using DataBlockHelper.Entity.DB2104Entity; using DataBlockHelper.Entity.DB2106Entity; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; using Mesnac.Controls.Base; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Mesnac.Action.ChemicalWeighing.AutoControl { internal class GelerWeterControl : ChemicalWeighingAction, IAction { private List McControls; // 获取Query控件 GelerWeterControlsEntity ControlsEntity = new GelerWeterControlsEntity(); public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须要调用 McControls = GetAllControls(); ControlImport(); BottomSelect(runtime); } /// /// 单选选择 /// /// 返回单选的产线号 如果未选择返回0 private int SingleSelect() { if(Convert.ToBoolean(ControlsEntity.Line1.MCValue) == true) { return 1; } else if (Convert.ToBoolean(ControlsEntity.Line2.MCValue) == true) { return 2; } else if (Convert.ToBoolean(ControlsEntity.Line3.MCValue) == true) { return 3; } else if (Convert.ToBoolean(ControlsEntity.Line4.MCValue) == true) { return 4; } else if (Convert.ToBoolean(ControlsEntity.Line5.MCValue) == true) { return 5; } else if (Convert.ToBoolean(ControlsEntity.Line6.MCValue) == true) { return 6; } else if (Convert.ToBoolean(ControlsEntity.Line7.MCValue) == true) { return 7; } else if (Convert.ToBoolean(ControlsEntity.Line8.MCValue) == true) { return 8; } else { return 0; } } private void ControlImport() { ControlsEntity.Line1 = GetBaseControl("Line1"); ControlsEntity.Line2 = GetBaseControl("Line2"); ControlsEntity.Line3 = GetBaseControl("Line3"); ControlsEntity.Line4 = GetBaseControl("Line4"); ControlsEntity.Line5 = GetBaseControl("Line5"); ControlsEntity.Line6 = GetBaseControl("Line6"); ControlsEntity.Line7 = GetBaseControl("Line7"); ControlsEntity.Line8 = GetBaseControl("Line8"); ControlsEntity.ChooseMaterial1 = GetBaseControl("ChooseMaterial1"); ControlsEntity.ChooseMaterial2 = GetBaseControl("ChooseMaterial2"); ControlsEntity.MaterialWeight1 = GetBaseControl("MaterialWeight1"); ControlsEntity.MaterialWeight2 = GetBaseControl("MaterialWeight2"); ControlsEntity.MaterialTolerance1 = GetBaseControl("MaterialTolerance1"); ControlsEntity.MaterialTolerance2 = GetBaseControl("MaterialTolerance2"); ControlsEntity.GelSpeedSet = GetBaseControl("GelSpeedSet"); ControlsEntity.GelPosTimeA = GetBaseControl("GelPosTimeA"); ControlsEntity.GelNagTimeB = GetBaseControl("GelNagTimeB"); ControlsEntity.GelPosTimeC = GetBaseControl("GelPosTimeC"); ControlsEntity.GelWaterTime = GetBaseControl("GelWaterTime"); ControlsEntity.GelWaitTime = GetBaseControl("GelWaitTime"); ControlsEntity.GelCloseHeatTime = GetBaseControl("GelCloseHeatTime"); ControlsEntity.GelOutDelayTime = GetBaseControl("GelOutDelayTime"); ControlsEntity.WetDryWeight = GetBaseControl("WetDryWeight"); ControlsEntity.WetMixTime = GetBaseControl("WetMixTime"); ControlsEntity.WetOutDelayTime = GetBaseControl("WetOutDelayTime"); ControlsEntity.WetManualControl = GetButtonControl("WetManualControl"); ControlsEntity.Download = GetButtonControl("Download"); ControlsEntity.LineStart = GetButtonControl("LineStart"); ControlsEntity.LineStop = GetButtonControl("LineStop"); } private void BottomSelect(RuntimeParameter runtime) { if(ControlsEntity.WetManualControl == runtime.Sender) { } if (ControlsEntity.Download == runtime.Sender) { } if (ControlsEntity.LineStart == runtime.Sender) { } if (ControlsEntity.LineStop == runtime.Sender) { } } private IBaseControl GetBaseControl(string name) { return McControls.First(x => x.Name == name) as IBaseControl; } private Button GetButtonControl(string name) { return McControls.First(x => x.Name == name) as Button; } } }