获取控件和修改数数量

wangsr
nodyang 1 year ago
parent b3638888ea
commit bf62b0ec69

@ -6,7 +6,7 @@ using Mesnac.Action.ChemicalWeighing.FreeDb;
using Mesnac.Action.ChemicalWeighing.LjPlanning;
using Mesnac.Controls.Base;
using Mesnac.Controls.Default;
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
@ -26,7 +26,6 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
{
base.RunIni(runtime); //必须要调用
McControls = GetAllControls();
ControlImport();
@ -46,7 +45,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
ControlsEntity.ChooseMaterial1.DataSource = StockMaterrialDbHelp.GetSiloMaterrial();
ControlsEntity.ChooseMaterial2.DataSource = StockMaterrialDbHelp.GetSiloMaterrial();
var selected = FreeSqlUnit.Instance.Select<DeviceMaterrial>().Where(x => x.DeviceId == SingleSelect()).ToList();
var selected = FreeSqlUnit.Instance.Select<DeviceMaterrial>().
Where(x => x.DeviceId == SingleSelect()).ToList();
if(selected.Count != 0)
{
@ -85,42 +85,41 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
/// <returns>返回单选的产线号 如果未选择返回0</returns>
private int SingleSelect()
{
if (Convert.ToBoolean(ControlsEntity.Line1.MCValue) == true)
int no = 0;
if (Convert.ToBoolean(ControlsEntity.Line1.MCValue))
{
return 1;
no= 1;
}
else if (Convert.ToBoolean(ControlsEntity.Line2.MCValue) == true)
else if (Convert.ToBoolean(ControlsEntity.Line2.MCValue))
{
return 2;
no= 2;
}
else if (Convert.ToBoolean(ControlsEntity.Line3.MCValue) == true)
else if (Convert.ToBoolean(ControlsEntity.Line3.MCValue))
{
return 3;
no= 3;
}
else if (Convert.ToBoolean(ControlsEntity.Line4.MCValue) == true)
else if (Convert.ToBoolean(ControlsEntity.Line4.MCValue))
{
return 4;
no= 4;
}
else if (Convert.ToBoolean(ControlsEntity.Line5.MCValue) == true)
else if (Convert.ToBoolean(ControlsEntity.Line5.MCValue))
{
return 5;
no= 5;
}
else if (Convert.ToBoolean(ControlsEntity.Line6.MCValue) == true)
else if (Convert.ToBoolean(ControlsEntity.Line6.MCValue))
{
return 6;
no= 6;
}
else if (Convert.ToBoolean(ControlsEntity.Line7.MCValue) == true)
else if (Convert.ToBoolean(ControlsEntity.Line7.MCValue))
{
return 7;
no= 7;
}
else if (Convert.ToBoolean(ControlsEntity.Line8.MCValue) == true)
else if (Convert.ToBoolean(ControlsEntity.Line8.MCValue))
{
return 8;
}
else
{
return 0;
no= 8;
}
return no;
}
/// <summary>
@ -130,8 +129,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
{
ControlsEntity.Line1 = GetBaseControl("Line1");
ControlsEntity.ChooseMaterial1 = GetComboBoxControl("ChooseMaterial1");
ControlsEntity.ChooseMaterial2 = GetComboBoxControl("ChooseMaterial2");
ControlsEntity.ChooseMaterial1 = GetBaseControl("ChooseMaterial1") as MCCombobox;
ControlsEntity.ChooseMaterial2 = GetBaseControl("ChooseMaterial2") as MCCombobox;;
ControlsEntity.MaterialWeight1 = GetBaseControl("MaterialWeight1");
ControlsEntity.MaterialWeight2 = GetBaseControl("MaterialWeight2");
@ -157,9 +156,6 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
return McControls.First(x => x.Name == name) as IBaseControl;
}
private MCCombobox GetComboBoxControl(string name)
{
return McControls.First(x => x.Name == name) as MCCombobox;
}
}
}

Loading…
Cancel
Save