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.

115 lines
3.2 KiB
C#

1 year ago
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();
1 year ago
1 year ago
}
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;
1 year ago
1 year ago
List<RecipePlcView> recipePlcViews = new List<RecipePlcView>();
List<Step> recipeSteps = new List<Step>();
1 year ago
1 year ago
recipePlcViews = LjMixManagerDb.GetRecip(view.MetageAId);
recipeSteps=LjMixManagerDb.GetStep(view.MetageAId);
1 year ago
// 第一台干混机
// switch (_id)
// {
// case 1 :
// LjMixManagerPlc.DownD1Recipe(recipePlcViews, recipeSteps);
// break;
// case 2 :
// LjMixManagerPlc.DownD2Recipe(recipePlcViews, recipeSteps);
// break;
// case 3 :
// LjMixManagerPlc.DownD3Recipe(recipePlcViews, recipeSteps);
// break;
// case 4 :
// LjMixManagerPlc.DownD4Recipe(recipePlcViews, recipeSteps);
// break;
// }
1 year ago
1 year ago
this.DialogResult = DialogResult.OK;
}
}
}