From bf62b0ec69cf22757b85bbfe4157be2ddbd84be1 Mon Sep 17 00:00:00 2001 From: nodyang Date: Thu, 26 Oct 2023 17:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=8E=A7=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoControl/InitAction.cs | 54 +++++++++---------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs index 5c49fa0..6c65582 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.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().Where(x => x.DeviceId == SingleSelect()).ToList(); + var selected = FreeSqlUnit.Instance.Select(). + Where(x => x.DeviceId == SingleSelect()).ToList(); if(selected.Count != 0) { @@ -85,42 +85,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) + else if (Convert.ToBoolean(ControlsEntity.Line8.MCValue)) { - return 8; - } - else - { - return 0; + no= 8; } + + return no; } /// @@ -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; - } + } }