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.
109 lines
2.9 KiB
C#
109 lines
2.9 KiB
C#
using Mesnac.Action.ChemicalWeighing.LjMaterial;
|
|
using Mesnac.Action.ChemicalWeighing.LjMixFormula;
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning;
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjMixManager
|
|
{
|
|
public partial class FrmMixC : Form
|
|
{
|
|
public FrmMixC()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private int _id = 0;
|
|
private LjMixManagerView _view;
|
|
public FrmMixC(int id) : this()
|
|
{
|
|
this._id = id;
|
|
var lsCMixList = MixDb.GetMyNameValueStrs(3);
|
|
DrpMixC.DataSource = lsCMixList;
|
|
FillComboBox(DrpMixC);
|
|
|
|
|
|
_view = LjMixManagerDb.GetById(_id);
|
|
if (_view != null)
|
|
{
|
|
Checked(DrpMixC, _view.MixCId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
_view.Id = _id;
|
|
_view.MixCId = DrpMixC.SelectedValue.ToString();
|
|
_view.MixCName = DrpMixC.Text;
|
|
|
|
LjMixManagerDb.UpdateMixC(_view);
|
|
|
|
List<MixStep> recipeSteps = new List<MixStep>();
|
|
recipeSteps=LjMixManagerDb.GetMixStep( _view.MixBId);
|
|
|
|
|
|
// 第一台干混机
|
|
|
|
switch (_id)
|
|
{
|
|
case 1 :
|
|
LjMixManagerPlc.DownM1Recipe(recipeSteps);
|
|
break;
|
|
case 2 :
|
|
LjMixManagerPlc.DownM2Recipe(recipeSteps);
|
|
break;
|
|
case 3 :
|
|
LjMixManagerPlc.DownM3Recipe(recipeSteps);
|
|
break;
|
|
case 4 :
|
|
LjMixManagerPlc.DownM4Recipe(recipeSteps);
|
|
break;
|
|
|
|
case 5 :
|
|
LjMixManagerPlc.DownM5Recipe(recipeSteps);
|
|
break;
|
|
case 6 :
|
|
LjMixManagerPlc.DownM6Recipe(recipeSteps);
|
|
break;
|
|
case 7 :
|
|
LjMixManagerPlc.DownM7Recipe(recipeSteps);
|
|
break;
|
|
case 8 :
|
|
LjMixManagerPlc.DownM8Recipe(recipeSteps);
|
|
break;
|
|
}
|
|
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
}
|
|
}
|