You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.6 KiB
C#
78 lines
2.6 KiB
C#
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<Control> McControls;
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
|
|
base.RunIni(runtime); //必须要调用
|
|
|
|
McControls = GetAllControls();
|
|
|
|
ControlImport();
|
|
|
|
ControlInitFromPLC();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 控件从Plc初始化
|
|
/// </summary>
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|