using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Reflection;
using ICSharpCode.Core;
using Mesnac.Basic;
using Mesnac.Equips;
using Mesnac.Codd.Session;
using Mesnac.Action.ChemicalWeighing.Entity;
namespace Mesnac.Action.ChemicalWeighing
{
///
/// Plc操作辅助类
///
public class BasePlcHelper
{
#region 单例模式
private static BasePlcHelper _this = null;
public static BasePlcHelper Instance
{
get
{
if (null == _this)
_this = new BasePlcHelper();
return _this;
}
}
private BasePlcHelper()
{
foreach (PropertyInfo pi in this.GetType().GetProperties())
{
if (pi.PropertyType == typeof(DataKeyValue))
{
DataKeyValue data = new DataKeyValue(pi.Name);
pi.SetValue(this, data, null);
}
}
}
#endregion
#region 方法定义
#region GetDataKeyValue
public DataKeyValue GetDataKeyValue(string key)
{
foreach (PropertyInfo pi in this.GetType().GetProperties())
{
if (pi.PropertyType == typeof(DataKeyValue))
{
DataKeyValue data = (DataKeyValue)pi.GetValue(this, null);
if (data.FieldKey.ToLower() == key.ToLower())
{
return data;
}
}
}
return null;
}
#endregion
#region 从PLC中读取原始数据的方法
///
/// 从PLC中读取原始数据
///
/// 要读取的设备变量名称
/// 从PLC读取的值
/// 成功返回true,失败返回false
public bool PlcRead(string dataName, out int[] dataValue)
{
return Mesnac.Equips.Factory.Instance.Read(dataName, out dataValue);
}
///
/// 根据设备名称读取指定数据块,指定起始字,指定长度的数据
///
/// 设备名称
/// 数据块
/// 起始字
/// 长度
/// 输出数据
/// 成功返回true,失败返回false
public bool PlcRead(string equipName, string block, int start, int len, out Int16[] dataValue)
{
return Mesnac.Equips.Factory.Instance.Read(equipName, block, start, len, out dataValue);
}
///
/// 从PLC中读取原始数据
///
///
///
///
public bool PlcRead(DataKeyValue dataKey, out int[] dataValue)
{
return PlcRead(dataKey.EquipKey, out dataValue);
}
///
/// 按设备变量别名从PLC读取数据
///
/// PLC设备变量别名
/// 读取值
/// 读取成功返回true,失败返回false
public bool PlcReadByRunName(string runName, out int[] dataValue)
{
return Mesnac.Equips.Factory.Instance.ReadByRunName(runName, out dataValue);
}
public object PlcLastValueRead(string dataName)
{
return Mesnac.Equips.Factory.Instance.ReadLastValue(dataName);
}
///
/// 读取设备数据
///
/// 设备变量名称
/// 读取的设备值
/// 读取成功返回true,失败返回false
public bool PlcLastValueRead(string dataName, out int[] dataValue)
{
return Mesnac.Equips.Factory.Instance.ReadLastValue(dataName, out dataValue);
}
#endregion
#region 向PLC变量中写入值,并不真正下传至PLC
///
/// 向PLC变量中写入值,并不真正下传至PLC
///
///
///
///
///
///
public bool PlcVarWrite(string equipKey, string runName, int shifting, object dataValue)
{
StringBuilder log = new StringBuilder();
try
{
//log.Append("equipKey=[").Append(equipKey).Append("]runName=[").Append(runName);
foreach (Mesnac.Equips.BaseEquip equip in Factory.Instance.AllEquips.Values)
{
foreach (Mesnac.Equips.BaseInfo.Group group in equip.Group.Values)
{
if (group.Access == System.IO.FileAccess.Write ||
group.Access == System.IO.FileAccess.ReadWrite)
{
foreach (Mesnac.Equips.BaseInfo.Data data in group.Data.Values)
{
if (data.KeyName == equipKey || (!String.IsNullOrEmpty(data.RunName) && data.RunName == runName))
{
try
{
data.Value = dataValue;
return true;
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService.Error(ex.Message);
return false;
}
}
}
}
}
}
//log.Append("]No Find");
return false;
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService.Error("写入PLC变量值失败:" + ex.Message, ex);
return false;
}
finally
{
//if (log.Length > "equipKey=[]runName=[]No Find".Length)
//{
// action.LogDebug(log.AppendLine("...").ToString());
//}
}
}
///
/// 向PLC变量中写入值,并不真正下传至PLC
///
///
///
///
///
public bool PlcVarWriteByDataKey(string equipKey, int shifting, object dataValue)
{
return PlcVarWrite(equipKey, string.Empty, shifting, dataValue);
}
///
/// 向PLC变量中写入值,并不真正下传至PLC
///
///
///
///
///
public bool PlcVarWriteByDataKey(DataKeyValue dataKey, int shifting, object dataValue)
{
return PlcVarWriteByDataKey(dataKey.EquipKey, shifting, dataValue);
}
///
/// 向PLC变量中写入值,并不真正下传至PLC
///
///
///
///
public bool PlcVarWriteByDataKey(DataKeyValue dataKey, object dataValue)
{
return PlcVarWriteByDataKey(dataKey, 0, dataValue);
}
#endregion
#region Plc写入方法,真正写入PLC
///
/// PlcWrite
///
///
///
///
///
///
///
private bool PlcWrite(string equipKey, string runName, int shifting, object[] dataValue, params bool[] isOutFlag)
{
StringBuilder log = new StringBuilder();
try
{
log.Append("equipKey=[").Append(equipKey).Append("]runName=[").Append(runName);
foreach (Mesnac.Equips.BaseEquip equip in Factory.Instance.AllEquips.Values)
{
foreach (Mesnac.Equips.BaseInfo.Group group in equip.Group.Values)
{
if (group.Access == System.IO.FileAccess.Write ||
group.Access == System.IO.FileAccess.ReadWrite)
{
foreach (Mesnac.Equips.BaseInfo.Data data in group.Data.Values)
{
//if (data.KeyName == equipKey || data.RunName == runName)
//if (data.KeyName == equipKey)
if (data.KeyName == equipKey || (!String.IsNullOrEmpty(data.RunName) && data.RunName == runName))
{
int block = 0;
if (int.TryParse(group.Block.ToString(), out block))
{
log.Append("]shifting=[").Append((group.Start + data.Start + shifting).ToString());
log.Append("]dataLen=[").Append(dataValue.Length);
log.Append("]Find Result=");
foreach (object v in dataValue)
{
log.Append(v + ",");
}
#region 二进制位写入
if (data.Method.StartsWith("Default_Bit"))
{
string parameters = data.Method.Replace("Default_Bit(", String.Empty).Replace(")", String.Empty);
string[] ps = parameters.Split(new char[] { ',' });
int startIndex = 0;
int length = 1;
if (ps.Length == 1) //单参数判断
{
if (!int.TryParse(ps[0], out startIndex))
{
log.Append("[false](Convert The Bit method first parameter to int failure!)");
return false;
}
}
else if (ps.Length == 2) //多参数判断
{
if (!int.TryParse(ps[0], out startIndex))
{
log.Append("[false](Convert The Bit method first parameter to int failure!)");
return false;
}
if (!int.TryParse(ps[1], out length))
{
log.Append("[false](Convert The Bit method second parameter to int failure!)");
return false;
}
}
object originalValue = 0; //保存原始值
if (data.Len == 1) //如果len=1则为Int16类型
{
int[] buff = null;
if (PlcRead(data.KeyName, out buff))
{
originalValue = buff[0];
originalValue = Mesnac.Basic.DataProcessor.Swap(short.Parse(originalValue.ToString()));
}
else
{
ICSharpCode.Core.LoggingService.Warn(String.Format("在进行二进制写入时读取设备变量[{0}]失败!", data.KeyName));
}
}
else if (data.Len == 2) //如果len=2则为Int32类型
{
int[] buff = null;
if (PlcRead(data.KeyName, out buff))
{
if (equip.Main.Brand == Mesnac.Basic.PlcBrand.Siemens)
{
originalValue = Mesnac.Basic.DataProcessor.ToSiemensInt32(buff);
}
else
{
originalValue = Mesnac.Basic.DataProcessor.ToInt32(buff);
}
}
else
{
ICSharpCode.Core.LoggingService.Warn(String.Format("在进行二进制写入时读取设备变量[{0}]失败!", data.KeyName));
}
}
object[] newValue = null;
if (data.Len == 1)
{
newValue = new object[] { Mesnac.Basic.DataProcessor.SetBitValue(originalValue, startIndex, length, dataValue[0]) };
//从PLC中读取到的值进行高低位转换
int int16 = Mesnac.Basic.DataProcessor.Swap(short.Parse(newValue[0].ToString()));
newValue = new object[] { int16 };
////解析为二进制数组
//int[] binaryAlarmData = Mesnac.Basic.DataProcessor.ParseBinaryValue(int16, int16*2);
//String str = "";
//for (int i = 0; i < (int16 * 2); i++)
//{
// //按照偏移量对数组进行赋值
// if (i == group.Start + data.Start + shifting)
// {
// if (int.Parse(dataValue[0].ToString()) == 0)
// {
// binaryAlarmData[i] = 0;
// }
// else
// {
// binaryAlarmData[i] = 1;
// }
// }
// str += binaryAlarmData[i].ToString();
//}
//Int16 iwrite = Convert.ToInt16(str,2);
//int swpint16 = Mesnac.Basic.DataProcessor.Swap(iwrite);
////获取二进制数组字符串
//newValue = new object[] { swpint16 };
//if (equip.Write(block, group.Start + data.Start + shifting, newValue))
//{
// log.Append("[true]");
// return true;
//}
//else
//{
// log.Append("[false]");
// return false;
//}
//int writedata = Mesnac.Basic.DataProcessor.ToInt32(binaryAlarmData);
}
else if (data.Len == 2)
{
object objNewValue = Mesnac.Basic.DataProcessor.SetBitValue32(originalValue, startIndex, length, dataValue[0]);
int intNewValue = Convert.ToInt32(objNewValue);
if (equip.Main.Brand == Mesnac.Basic.PlcBrand.Siemens)
{
newValue = Mesnac.Basic.DataProcessor.ToSiemensPLCDataArray(intNewValue);
}
else
{
newValue = Mesnac.Basic.DataProcessor.ToPLCDataArray(intNewValue);
}
}
if (equip.Write(block, group.Start + data.Start + shifting, newValue))
{
log.Append("[true]");
return true;
}
else
{
log.Append("[false]");
return false;
}
}
#endregion
if (equip.Write(block, group.Start + data.Start + shifting, dataValue))
{
log.Append("[true]");
return true;
}
else
{
log.Append("[false]");
return false;
}
}
}
}
}
}
}
log.Append("]No Find");
return false;
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService.Error("下传PLC失败:" + ex.Message, ex);
return false;
}
finally
{
if (isOutFlag.Length == 0 || isOutFlag[0] == true)
{
if (log.Length > "equipKey=[]runName=[]No Find".Length)
{
ICSharpCode.Core.LoggingService.Debug(log.AppendLine("...").ToString());
}
}
}
}
public bool PlcWriteByRunName(string runName, int shifting, object[] dataValue)
{
return PlcWrite(string.Empty, runName, shifting, dataValue);
}
public bool PlcWriteByRunName(string runName, object[] dataValue)
{
return PlcWriteByRunName(runName, 0, dataValue);
}
public bool PlcWriteByEquipKey(string equipKey, int shifting, object[] dataValue)
{
return PlcWrite(equipKey, string.Empty, shifting, dataValue);
}
public bool PlcWriteByEquipKey(string equipKey, object[] dataValue)
{
return PlcWriteByEquipKey(equipKey, 0, dataValue);
}
public bool PlcWriteByDataKey(DataKeyValue dataKey, int shifting, object[] dataValue)
{
return PlcWriteByEquipKey(dataKey.EquipKey, shifting, dataValue);
}
public bool PlcWriteByDataKey(DataKeyValue dataKey, object[] dataValue)
{
return PlcWriteByDataKey(dataKey, 0, dataValue);
}
public bool PlcWriteByDataKey(DataKeyValue dataKey, string dataValue)
{
object[] buff = null;
buff = new object[dataKey.EquipData.Len];
for (int i = 0; i < buff.Length; i++)
{
buff[i] = 0;
}
object[] planIDData = Mesnac.Basic.DataProcessor.ToPLCDataArray(dataValue);
if (planIDData.Length <= buff.Length)
{
Array.Copy(planIDData, buff, planIDData.Length);
}
else
{
Array.Copy(planIDData, buff, buff.Length);
}
return PlcWriteByDataKey(dataKey, buff);
}
//增加是否输出日志
public bool PlcWriteByEquipKey(string equipKey, int shifting, object[] dataValue, bool isOutLog)
{
return PlcWrite(equipKey, string.Empty, shifting, dataValue, isOutLog);
}
//增加是否输出日志
public bool PlcWriteByDataKey(DataKeyValue dataKey, int shifting, object[] dataValue, bool isOutLog)
{
return PlcWriteByEquipKey(dataKey.EquipKey, shifting, dataValue, isOutLog);
}
//增加是否输出日志
public bool PlcWriteByDataKey(DataKeyValue dataKey, object[] dataValue, bool isOutLog)
{
return PlcWriteByDataKey(dataKey, 0, dataValue, isOutLog);
}
///
/// 向Plc变量写入float浮点数,下传Plc
///
///
///
///
public bool PlcWriteFloatByDataKey(DataKeyValue dataKey, float dataValue)
{
string equipName = dataKey.EquipKey;
if (dataKey.EquipKey.Contains("."))
{
equipName = dataKey.EquipKey.Split(new char[] { '.' })[0];
}
if (Factory.Instance.AllEquips[equipName].Main.Brand.Equals("Siemens", StringComparison.CurrentCultureIgnoreCase))
{
return PlcWriteByDataKey(dataKey, 0, Mesnac.Basic.DataProcessor.ToSiemensPLCDataArray(dataValue));
}
else
{
return PlcWriteByDataKey(dataKey, 0, Mesnac.Basic.DataProcessor.ToPLCDataArray(dataValue));
}
}
///
/// 向Plc变量写入float浮点数,下传Plc
///
///
///
///
///
public bool PlcWriteFloatByDataKey(DataKeyValue dataKey, float dataValue, bool isOutLog)
{
string equipName = dataKey.EquipKey;
if (dataKey.EquipKey.Contains("."))
{
equipName = dataKey.EquipKey.Split(new char[] { '.' })[0];
}
if (Factory.Instance.AllEquips[equipName].Main.Brand.Equals("Siemens", StringComparison.CurrentCultureIgnoreCase))
{
return PlcWriteByDataKey(dataKey, 0, Mesnac.Basic.DataProcessor.ToSiemensPLCDataArray(dataValue), isOutLog);
}
else
{
return PlcWriteByDataKey(dataKey, 0, Mesnac.Basic.DataProcessor.ToPLCDataArray(dataValue), isOutLog);
}
}
#endregion
#region PptPlcData表写入操作
///
/// 把设备变量的值写入PptPlcData表
///
/// 设备变量
/// 设备
/// 偏移
/// 值数组
///
public bool DataWrite(string dataKey, string equipKey, int shifting, object[] dataValue)
{
if (string.IsNullOrWhiteSpace(dataKey))
{
dataKey = equipKey;
}
if (string.IsNullOrWhiteSpace(equipKey))
{
equipKey = dataKey;
}
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
if (dbHelper == null)
{
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
}
dbHelper.CommandType = System.Data.CommandType.Text;
dbHelper.ClearParameter();
#region 支持SQL2000
StringBuilder sqlstr = new StringBuilder("INSERT INTO PptPlcData (PlcSchemaField, EquipRunName, PlcDataValue, PlcDataIndex, PlcDownState) ");
for (int i = 0; i < dataValue.Length; i++)
{
object obj = dataValue[i];
if (obj == null || obj == DBNull.Value)
{
obj = string.Empty;
}
string key1 = "@PlcSchemaField" + i.ToString();
string key2 = "@EquipRunName" + i.ToString();
string key3 = "@PlcDataValue" + i.ToString();
string key4 = "@PlcDataIndex" + i.ToString();
sqlstr.Append(" (select ").Append(key1).Append(" as PlcSchemaField").Append(",").Append(key2).Append(" as EquipRunName").Append(",").Append(key3).Append(" as PlcDataValue").Append(",").Append(key4).Append(" as PlcDataIndex").Append(",0 as PlcDownState)");
if (i < dataValue.Length - 1)
{
sqlstr.AppendLine("union all");
}
if (obj is PlcDataInfo)
{
PlcDataInfo data = obj as PlcDataInfo;
dbHelper.AddParameter(key1, string.IsNullOrWhiteSpace(data.PlcSchemaField) ? dataKey : data.PlcSchemaField);
dbHelper.AddParameter(key2, string.IsNullOrWhiteSpace(data.EquipRunName) ? equipKey : data.EquipRunName);
dbHelper.AddParameter(key3, data.PlcDataValue == null ? 0 : data.PlcDataValue);
dbHelper.AddParameter(key4, (shifting + i).ToString());
}
else
{
dbHelper.AddParameter(key1, dataKey);
dbHelper.AddParameter(key2, equipKey);
dbHelper.AddParameter(key3, obj);
dbHelper.AddParameter(key4, (shifting + i).ToString());
}
} //插入语句
#endregion
dbHelper.CommandText = sqlstr.ToString();
dbHelper.ExecuteNonQuery();
return true;
}
public bool DataWrite(string dataKey, string equipKey, object[] dataValue)
{
return DataWrite(dataKey, equipKey, 0, dataValue);
}
public bool DataWrite(string equipKey, object[] dataValue)
{
return DataWrite(equipKey, equipKey, 0, dataValue);
}
public bool DataWrite(DataKeyValue dataKey, int shifting, object[] dataValue)
{
return DataWrite(dataKey.Name, dataKey.EquipRunName, shifting, dataValue);
}
public bool DataWrite(DataKeyValue dataKey, object[] dataValue)
{
return DataWrite(dataKey, 0, dataValue);
}
#endregion
#endregion
#region 属性定义
#region 自定义设备变量
///
/// 最小计划数(由PLC实时读取)
///
public int MinPlanNum = 3;
#region PC在线标志
///
/// 开门料仓号
///
public DataKeyValue ChemicalWeighing_PC_Online = new DataKeyValue("PC_Online");
#endregion
///
/// 小料PLC在线标志
///
public DataKeyValue ChemicalWeighing_PLC_Online_Flag = new DataKeyValue("PLC_Online_Flag");
///
/// 等待计划数
///
public DataKeyValue ChemicalWeighing_Scheduled_Num = new DataKeyValue("Scheduled_Num");
#region 自动下传计划相关变量
///
/// 小料PLC请求计划交互信息
///
public DataKeyValue ChemicalWeighing_PLC_LoadingStatus = new DataKeyValue("PLC_LoadingStatus");
///
/// 小料PC计划反馈交互信息
///
public DataKeyValue ChemicalWeighing_PC_LoadingStatus = new DataKeyValue("PC_LoadingStatus");
///
/// 速度1
///
public DataKeyValue DwSpeed = new DataKeyValue("DwSpeed");
#endregion
#region 自动更新计划状态相关变量
///
/// 小料PLC计划状态变化交互PLC请求信息
///
public DataKeyValue ChemicalWeighing_PLC_Plan_Status_ShakeHand = new DataKeyValue("PLC_Plan_Status_ShakeHand");
///
/// PC计划状态根据PLC状态更新交互信息
///
public DataKeyValue ChemicalWeighing_PLC_Plan_Status_FeedBack = new DataKeyValue("PLC_Plan_Status_FeedBack");
///
/// 小料计划序号
///
public DataKeyValue ChemicalWeighing_Plan_Serial = new DataKeyValue("Plan_Serial");
///
/// 小料计划状态
///
public DataKeyValue ChemicalWeighing_Plan_Status = new DataKeyValue("Plan_Status");
///
/// 小料计划完成数
///
public DataKeyValue ChemicalWeighing_Plan_Number = new DataKeyValue("Plan_Number");
///
/// 小料计划剩余数量
///
public DataKeyValue ChemicalWeighing_Remain_Number = new DataKeyValue("Remain_Number");
#endregion
#region HMI配方列表请求相关变量
///
/// 小料HMI配方查询请求信息
///
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Name_ShakeHand = new DataKeyValue("HMI_Request_Recipe_Name_ShakeHand");
///
/// PCHMI配方查询请求信息响应
///
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Name_FeedBack = new DataKeyValue("HMI_Request_Recipe_Name_FeedBack");
///
/// 读取到的机台号
///
public DataKeyValue ChemicalWeighing_Sys_Machine = new DataKeyValue("Sys_Machine");
///
/// 读取到的配方名称
///
public DataKeyValue ChemicalWeighing_Plan_Code = new DataKeyValue("Plan_Code");
#endregion
#region HMI根据配方请求添加计划相关变量
///
/// 小料HMI配方添加计划请求信息
///
public DataKeyValue ChemicalWeighing_HMI_Confirm_Recipe_ShakeHand = new DataKeyValue("HMI_Confirm_Recipe_ShakeHand");
///
/// PCHMI配方添加计划请求信息响应
///
public DataKeyValue ChemicalWeighing_HMI_Confirm_Recipe_FeedBack = new DataKeyValue("HMI_Confirm_Recipe_FeedBack");
///
/// 读取到的机台号
///
public DataKeyValue ChemicalWeighing_Sys_Machine1 = new DataKeyValue("Sys_Machine1");
///
/// 读取到的配方名称
///
public DataKeyValue ChemicalWeighing_Plan_Code1 = new DataKeyValue("Plan_Code1");
///
/// 设定数量
///
public DataKeyValue ChemicalWeighing_HMI_Plan_Num = new DataKeyValue("HMI_Plan_Num");
#endregion
#region HMI请求修改计划相关变量
///
/// PLCHMI修改计划请求信息
///
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Change_ShakeHand = new DataKeyValue("HMI_Request_Recipe_Change_ShakeHand");
///
/// PCHMI修改计划请求信息响应
///
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Change_FeedBack = new DataKeyValue("HMI_Request_Recipe_Change_FeedBack");
///
/// 命令:0默认 1刷新 2上移 3下移 4修改车数 5删除计划
///
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Change_Command = new DataKeyValue("HMI_Request_Recipe_Change_Command");
///
/// 读取到的机台号
///
public DataKeyValue ChemicalWeighing_Sys_Machine2 = new DataKeyValue("Sys_Machine2");
///
/// 读取到的计划号
///
public DataKeyValue ChemicalWeighing_HMIChange_PlanId = new DataKeyValue("HMIChange_PlanId");
///
/// 设定数量
///
public DataKeyValue ChemicalWeighing_HMIChange_PlanNum = new DataKeyValue("HMIChange_PlanNum");
#endregion
#region 自动存盘相关变量
///
/// PLC存盘请求
///
public DataKeyValue ChemicalWeighing_PLC_Request_Save_ShakeHand = new DataKeyValue("Plc_Request_Save_ShakeHand");
///
/// PC存盘反馈信息
///
public DataKeyValue ChemicalWeighing_PC_Request_Save_FeedBack = new DataKeyValue("PC_Request_Save_FeedBack");
///
/// 报表基本信息
///
public DataKeyValue ChemicalWeighing_Report_Update_Block_BaseInf = new DataKeyValue("Report_Update_Block_BaseInf");
///
/// 物料报表信息
///
public DataKeyValue ChemicalWeighing_Report_Update_Block_Material_Report = new DataKeyValue("Report_Update_Block_Material_Report");
#endregion
#region 上位机修改计划数、终止计划相关变量
///
/// PC下传终止计划状态
///
public DataKeyValue ChemicalWeighing_Plan_Status_Com_ShakeHand = new DataKeyValue("Plan_Status_Com_ShakeHand");
///
/// PLC终止计划状态反馈
///
public DataKeyValue ChemicalWeighing_Plan_Status_Com_FeedBack = new DataKeyValue("Plan_Status_Com_FeedBack");
#endregion
#region 条码扫描后,下传到PLC的命令相关变量
///
/// 开门料仓号
///
public DataKeyValue ChemicalWeighing_Hopper_No_103 = new DataKeyValue("Hopper_No_103");
///
/// 条码开门命令
///
public DataKeyValue ChemicalWeighing_ScanCommand = new DataKeyValue("Command");
///
/// 条码开门握手信号
///
public DataKeyValue ChemicalWeighing_Open_door_Command_ShakeHand = new DataKeyValue("Open_door_Command_ShakeHand");
#endregion
#endregion
#region 自动写入物料名称相关变量
///
/// PLC物料名称下传请求
///
public DataKeyValue ChemicalWeighing_PLC_LoadingConfig = new DataKeyValue("PLC_LoadingConfig");
///
/// PC物料名称下传反馈
///
public DataKeyValue ChemicalWeighing_PC_LoadingConfig = new DataKeyValue("PC_LoadingConfig");
#endregion
#endregion
#region 冠合上位机计划下传
public List dataKeyValues = new List();
//下位机准备信号(上位机下传时读取)
///
/// 下位机在线
///
public DataKeyValue GH_PC_ConfirmOnline = new DataKeyValue("Sign_Confirm_ConfirmOnline"); //下位机在线
///
/// 下位机遥控
///
public DataKeyValue GH_PC_ConfirmRemote = new DataKeyValue("Sign_Confirm_ConfirmRemote"); //下位机遥控
///
/// 下位机准备好
///
public DataKeyValue GH_PC_ConfirmReady = new DataKeyValue("Sign_Confirm_ConfirmReady"); //下位机准备好
///
/// 下位机配方运行
///
public DataKeyValue GH_PC_ConfirmRun = new DataKeyValue("Sign_Confirm_ConfirmRun"); //下位机配方运行
///
/// 调试模式允许
///
public DataKeyValue GH_PC_ConfirmForc = new DataKeyValue("Sign_Confirm_ConfirmForc"); // 调试模式允许
//配方编号、名称
public DataKeyValue ChemicalWeighing_PC_RecipeCode = new DataKeyValue("Recipe_Code");
public DataKeyValue ChemicalWeighing_PC_RecipeName = new DataKeyValue("recipe_name");
//设定车数、格数、层数
public DataKeyValue ChemicalWeighing_PC_SetCarNumber = new DataKeyValue("set_carnumber");
public DataKeyValue ChemicalWeighing_PC_SetGeNumber = new DataKeyValue("set_genumber");
public DataKeyValue ChemicalWeighing_PC_SetLineNumber = new DataKeyValue("set_linenumber");
//混料速度
public DataKeyValue ChemicalWeighing_PC_Hlsd1 = new DataKeyValue("hlsd1");
public DataKeyValue ChemicalWeighing_PC_Hlsd2 = new DataKeyValue("hlsd2");
public DataKeyValue ChemicalWeighing_PC_Hlsd3 = new DataKeyValue("hlsd3");
//进料时间、混料时间
public DataKeyValue ChemicalWeighing_PC_Jlsj = new DataKeyValue("jl_sj");
public DataKeyValue ChemicalWeighing_PC_Hlsj = new DataKeyValue("hl_sj");
//VCC、GFA、树脂进料、进料误差
public DataKeyValue ChemicalWeighing_PC_VCCJl = new DataKeyValue("vcc_jl");
public DataKeyValue ChemicalWeighing_PC_VCCJlWc = new DataKeyValue("vcc_jlwc");
public DataKeyValue ChemicalWeighing_PC_GFAJl = new DataKeyValue("gfa_jl");
public DataKeyValue ChemicalWeighing_PC_GFAJlWc = new DataKeyValue("gfa_jlwc");
public DataKeyValue ChemicalWeighing_PC_SZJl = new DataKeyValue("sz_jl");
public DataKeyValue ChemicalWeighing_PC_SZJlWc = new DataKeyValue("sz_jlwc");
public DataKeyValue ChemicalWeighing_PC_VCC_2th= new DataKeyValue("vcc2th_jl");
public DataKeyValue ChemicalWeighing_PC_GFA_2th = new DataKeyValue("GFA2th_jl");
//配方下传完成信号
public DataKeyValue ChemicalWeighing_PC_RpFinished = new DataKeyValue("PlanDownLoad");
//计划完成车数
public DataKeyValue ChemicalWeighing_PC_RecipeNum = new DataKeyValue("RecipeNum");
//计划编号PlanNo
public DataKeyValue ChemicalWeighing_PC_PlanNo = new DataKeyValue("PlanNo");
//计划终止
public DataKeyValue ChemicalWeighing_PC_RpCancel = new DataKeyValue("RpCancel");
public DataKeyValue TestWriteBool1 = new DataKeyValue("TestWriteBool1");
public DataKeyValue TestWriteBool2 = new DataKeyValue("TestWriteBool2");
#region 冠合存盘数据
///
/// 存盘数据准备好
///
public DataKeyValue GH_PC_ConfirmSDReady = new DataKeyValue("Sign_Confirm_ConfirmSDReady");
///
/// 配方编号
///
public DataKeyValue GH_PC_SaveCode = new DataKeyValue("SaveCode");
public DataKeyValue GH_PC_SaveFinishedNum = new DataKeyValue("SaveFinishedNum");
public DataKeyValue GH_PC_SaveRow = new DataKeyValue("SaveRow");
public DataKeyValue GH_PC_SaveCol = new DataKeyValue("SaveCol");
public DataKeyValue GH_PC_SaveVCCSet = new DataKeyValue("SaveVCCSet");
public DataKeyValue GH_PC_SaveVCCAct = new DataKeyValue("SaveVCCAct");
public DataKeyValue GH_PC_SaveGFASet = new DataKeyValue("SaveGFASet");
public DataKeyValue GH_PC_SaveGFAAct = new DataKeyValue("SaveGFAAct");
public DataKeyValue GH_PC_Save3thSet = new DataKeyValue("Save3thSet");
public DataKeyValue GH_PC_Save3thAct = new DataKeyValue("Save3thAct");
public DataKeyValue GH_PC_SaveLevel = new DataKeyValue("SaveLevel");
public DataKeyValue GH_PC_SaveFillTime = new DataKeyValue("SaveFillTime");
public DataKeyValue GH_PC_SaveSpeed1 = new DataKeyValue("SaveSpeed1");
public DataKeyValue GH_PC_SaveSpeed2 = new DataKeyValue("SaveSpeed2");
public DataKeyValue GH_PC_SaveTime = new DataKeyValue("SaveTime");
public DataKeyValue GH_PC_SavePlanId = new DataKeyValue("SavePlanId");
public DataKeyValue GH_PC_SaveVCC2thSet = new DataKeyValue("SaveVCC2thSet");
public DataKeyValue GH_PC_SaveVCC2thAct = new DataKeyValue("SaveVCC2thAct");
public DataKeyValue GH_PC_SaveGFA2thSet = new DataKeyValue("SaveGFA2thSet");
public DataKeyValue GH_PC_SaveGFA2thAct = new DataKeyValue("SaveGFA2thAct");
public DataKeyValue WatchDog = new DataKeyValue("WatchDog");
///
/// 存盘数据保存完成
///
public DataKeyValue ChemicalWeighing_PC_RpSaved = new DataKeyValue("RpSaved");
#endregion
#endregion
public DataKeyValue FirstWord { get; set; }
public DataKeyValue Spare4 { get; set; }
public DataKeyValue RecipePause { get; set; }
public DataKeyValue recipeName0 { get; set; }
public DataKeyValue Dryer0_speed { get; set; }
}
}