|
|
|
|
using DataBlockHelper;
|
|
|
|
|
using HslCommunication;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Controls.Base;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
{
|
|
|
|
|
public class InitAction : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
List<DbMCControl> McControllist;
|
|
|
|
|
OperateResult<byte[]> Read;
|
|
|
|
|
byte[] content;
|
|
|
|
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
base.RunIni(runtime); //必须要调用的
|
|
|
|
|
|
|
|
|
|
McControllist = GetAllDbMCControlsByOption(DbOptionTypes.InitData);//获取所有待初始化控件
|
|
|
|
|
|
|
|
|
|
IBaseControl WaterActualValue1 = GetBaseControl("WaterActualValue1");
|
|
|
|
|
IBaseControl WaterActualValue2 = GetBaseControl("WaterActualValue2");
|
|
|
|
|
IBaseControl WaterActualValue3 = GetBaseControl("WaterActualValue3");
|
|
|
|
|
IBaseControl WaterActualValue4 = GetBaseControl("WaterActualValue4");
|
|
|
|
|
IBaseControl SpiralActValue1 = GetBaseControl("SpiralActValue1");
|
|
|
|
|
IBaseControl SpiralActValue2 = GetBaseControl("SpiralActValue2");
|
|
|
|
|
IBaseControl SpiralActValue3 = GetBaseControl("SpiralActValue3");
|
|
|
|
|
IBaseControl SpiralActValue4 = GetBaseControl("SpiralActValue4");
|
|
|
|
|
|
|
|
|
|
Read = PlcConnect.Instance.Read("DB2119.22.0", 2);
|
|
|
|
|
|
|
|
|
|
content = Read.Content;
|
|
|
|
|
|
|
|
|
|
WaterActualValue1.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
|
|
|
|
|
Read = PlcConnect.Instance.Read("DB2119.2.0", 2);
|
|
|
|
|
|
|
|
|
|
content = Read.Content;
|
|
|
|
|
|
|
|
|
|
WaterActualValue2.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
|
|
|
|
|
Read = PlcConnect.Instance.Read("DB2119.32.0", 2);
|
|
|
|
|
|
|
|
|
|
content = Read.Content;
|
|
|
|
|
|
|
|
|
|
WaterActualValue3.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
|
|
|
|
|
Read = PlcConnect.Instance.Read("DB2119.12.0", 2);
|
|
|
|
|
|
|
|
|
|
content = Read.Content;
|
|
|
|
|
|
|
|
|
|
WaterActualValue4.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
|
|
|
|
|
Read = PlcConnect.Instance.Read("DB2119.42.0", 2);
|
|
|
|
|
|
|
|
|
|
content = Read.Content;
|
|
|
|
|
|
|
|
|
|
SpiralActValue1.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
|
|
|
|
|
Read = PlcConnect.Instance.Read("DB2119.64.0", 2);
|
|
|
|
|
|
|
|
|
|
content = Read.Content;
|
|
|
|
|
|
|
|
|
|
SpiralActValue2.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
|
|
|
|
|
Read = PlcConnect.Instance.Read("DB2119.86.0", 2);
|
|
|
|
|
|
|
|
|
|
content = Read.Content;
|
|
|
|
|
|
|
|
|
|
SpiralActValue3.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IBaseControl GetBaseControl(string name)
|
|
|
|
|
{
|
|
|
|
|
return McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|