diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/WaterInitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/WaterInitAction.cs new file mode 100644 index 0000000..c3305a3 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/WaterInitAction.cs @@ -0,0 +1,77 @@ +using DataBlockHelper.DBHelpers; +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 +{ + public class WaterInitAction : ChemicalWeighingAction, IAction + { + DryerWaterControlsEntity ControlsEntity = new DryerWaterControlsEntity(); + private List McControls; + + public void Run(RuntimeParameter runtime) + { + + base.RunIni(runtime); //必须要调用 + + McControls = GetAllControls(); + + ControlImport(); + + ControlInitFromPLC(); + + } + + /// + /// 控件从Plc初始化 + /// + private void ControlInitFromPLC() + { + + DB2104Helper dB2104Helper = new DB2104Helper(); + + ControlsEntity.ColdValueA.MCValue = dB2104Helper.GetAColWater.Set; + ControlsEntity.ColdValueB.MCValue = dB2104Helper.GetBColWater.Set; + ControlsEntity.HotValueA.MCValue = dB2104Helper.GetAHotWater.Set; + ControlsEntity.HotValueB.MCValue = dB2104Helper.GetBHotWater.Set; + ControlsEntity.ColdToleranceA.MCValue = dB2104Helper.GetAColWater.Tolerance; + ControlsEntity.ColdToleranceB.MCValue = dB2104Helper.GetBColWater.Tolerance; + ControlsEntity.HotToleranceA.MCValue = dB2104Helper.GetAHotWater.Tolerance; + ControlsEntity.HotToleranceB.MCValue = dB2104Helper.GetBHotWater.Tolerance; + + } + + private void ControlImport() + { + ControlsEntity.WaterConfrim = GetButtonControl("WaterConfrim"); + + ControlsEntity.ColdValueA = GetBaseControl("ColdValueA"); + ControlsEntity.ColdValueB = GetBaseControl("ColdValueB"); + ControlsEntity.HotValueA = GetBaseControl("HotValueA"); + ControlsEntity.HotValueB = GetBaseControl("HotValueB"); + ControlsEntity.ColdToleranceA = GetBaseControl("ColdToleranceA"); + ControlsEntity.ColdToleranceB = GetBaseControl("ColdToleranceB"); + ControlsEntity.HotToleranceA = GetBaseControl("HotToleranceA"); + ControlsEntity.HotToleranceB = GetBaseControl("HotToleranceB"); + } + + 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; + } + + } + +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index d827e38..90e8a77 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -228,6 +228,7 @@ + diff --git a/Main/MCEdit/Data/EventConfig/小料称量/自动控制.xml b/Main/MCEdit/Data/EventConfig/小料称量/自动控制.xml index 95ce032..6cd5d36 100644 --- a/Main/MCEdit/Data/EventConfig/小料称量/自动控制.xml +++ b/Main/MCEdit/Data/EventConfig/小料称量/自动控制.xml @@ -11,13 +11,17 @@ 湿混糊化机控制 - 界面初始化 - 界面初始化 + 湿混糊化界面初始化 + 湿混糊化界面初始化 刷新事件 刷新事件 + + 干混水称界面初始化 + 干混水称界面初始化 + @@ -35,6 +39,9 @@ + + + @@ -43,6 +50,7 @@ + \ No newline at end of file diff --git a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlA.xml b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlA.xml index 81e4016..5e7e08f 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlA.xml +++ b/Main/MCEdit/Data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