You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.5 KiB
C#
100 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using DevExpress.Utils;
|
|
using Mesnac.Action.ChemicalWeighing.LjMaterial;
|
|
using Mesnac.Action.ChemicalWeighing.LjMetageFormula;
|
|
using Mesnac.Action.ChemicalWeighing.LjMixFormula;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjMixManager
|
|
{
|
|
public partial class FrmMixA : Form
|
|
{
|
|
public FrmMixA()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
private int _id = 0;
|
|
|
|
public FrmMixA(int id) : this()
|
|
{
|
|
this._id = id;
|
|
|
|
FillController();
|
|
}
|
|
|
|
private LjMixManagerView view;
|
|
private void FillController()
|
|
{
|
|
view = LjMixManagerDb.GetById(_id);
|
|
IEnumerable<MyNameValueStr> ien = MetageFormulaDb.GetMetageNmaValue();
|
|
|
|
var drpA = ien.ToList();
|
|
FillComboBox(DrpMetageA);
|
|
DrpMetageA.DataSource = drpA;
|
|
Checked(DrpMetageA, view.MetageAId);
|
|
|
|
var lsAMixList = MixDb.GetMyNameValueStrs(2);
|
|
FillComboBox(DrpMixA);
|
|
DrpMixA.DataSource = lsAMixList;
|
|
Checked(DrpMixA,view.MixAId);
|
|
}
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
|
|
}
|
|
|
|
private void FillComboBox(ComboBox combo)
|
|
{
|
|
combo.ValueMember = "Id";
|
|
combo.DisplayMember = "Name";
|
|
}
|
|
|
|
private void Checked(ComboBox alBox,string checkId)
|
|
{
|
|
foreach (MyNameValueStr combo in alBox.Items)
|
|
{
|
|
if (combo.Id == checkId)
|
|
{
|
|
alBox.SelectedItem = combo;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
view.MetageAId = DrpMetageA.SelectedValue.ToString();
|
|
view.MetageAName = DrpMetageA.Text;
|
|
|
|
view.MixAId = DrpMixA.SelectedValue.ToString();
|
|
view.MixAName = DrpMixA.Text;
|
|
view.UpdateTime=DateTime.Now;
|
|
|
|
LjMixManagerDb.UpdateMixA(view);
|
|
view.Id = _id;
|
|
|
|
|
|
//List<RecipePlcView> recipePlcViews=
|
|
|
|
// 第一台干混机
|
|
|
|
switch (_id)
|
|
{
|
|
case 1 :
|
|
// LjMixManagerPlc.DownD1Recipe()
|
|
break;
|
|
}
|
|
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
}
|
|
} |