diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs index d97e94a..06f69bf 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs @@ -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.Drawing; @@ -28,7 +28,6 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl { base.RunIni(runtime); //必须要调用 - McControls = GetAllControls(); ControlImport(); @@ -72,7 +71,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl ControlsEntity.ChooseMaterial1.DataSource = StockMaterrialDbHelp.GetSiloMaterrial(); ControlsEntity.ChooseMaterial2.DataSource = StockMaterrialDbHelp.GetSiloMaterrial(); - var selected = FreeSqlUnit.Instance.Select().Where(x => x.DeviceId == SingleSelect()).ToList(); + var selected = FreeSqlUnit.Instance.Select(). + Where(x => x.DeviceId == SingleSelect()).ToList(); if(selected.Count != 0) { @@ -111,42 +111,41 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl /// 返回单选的产线号 如果未选择返回0 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) - { - return 8; - } - else + else if (Convert.ToBoolean(ControlsEntity.Line8.MCValue)) { - return 0; + no= 8; } + + return no; } /// @@ -163,8 +162,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl ControlsEntity.Line7 = GetMCRadioButtonControl("Line7"); ControlsEntity.Line8 = GetMCRadioButtonControl("Line8"); - 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");