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.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs

888 lines
37 KiB
C#

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
{
/// <summary>
/// Plc操作辅助类
/// </summary>
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中读取原始数据的方法
/// <summary>
/// 从PLC中读取原始数据
/// </summary>
/// <param name="dataName">要读取的设备变量名称</param>
/// <param name="dataValue">从PLC读取的值</param>
/// <returns>成功返回true失败返回false</returns>
public bool PlcRead(string dataName, out int[] dataValue)
{
return Mesnac.Equips.Factory.Instance.Read(dataName, out dataValue);
}
/// <summary>
/// 根据设备名称读取指定数据块,指定起始字,指定长度的数据
/// </summary>
/// <param name="equipName">设备名称</param>
/// <param name="block">数据块</param>
/// <param name="start">起始字</param>
/// <param name="len">长度</param>
/// <param name="dataValue">输出数据</param>
/// <returns>成功返回true失败返回false</returns>
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);
}
/// <summary>
/// 从PLC中读取原始数据
/// </summary>
/// <param name="dataKey"></param>
/// <param name="dataValue"></param>
/// <returns></returns>
public bool PlcRead(DataKeyValue dataKey, out int[] dataValue)
{
return PlcRead(dataKey.EquipKey, out dataValue);
}
/// <summary>
/// 按设备变量别名从PLC读取数据
/// </summary>
/// <param name="runName">PLC设备变量别名</param>
/// <param name="dataValue">读取值</param>
/// <returns>读取成功返回true失败返回false</returns>
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);
}
/// <summary>
/// 读取设备数据
/// </summary>
/// <param name="dataName">设备变量名称</param>
/// <param name="dataValue">读取的设备值</param>
/// <returns>读取成功返回true失败返回false</returns>
public bool PlcLastValueRead(string dataName, out int[] dataValue)
{
return Mesnac.Equips.Factory.Instance.ReadLastValue(dataName, out dataValue);
}
#endregion
#region 向PLC变量中写入值并不真正下传至PLC
/// <summary>
/// 向PLC变量中写入值并不真正下传至PLC
/// </summary>
/// <param name="equipKey"></param>
/// <param name="runName"></param>
/// <param name="shifting"></param>
/// <param name="dataValue"></param>
/// <returns></returns>
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());
//}
}
}
/// <summary>
/// 向PLC变量中写入值并不真正下传至PLC
/// </summary>
/// <param name="equipKey"></param>
/// <param name="shifting"></param>
/// <param name="dataValue"></param>
/// <returns></returns>
public bool PlcVarWriteByDataKey(string equipKey, int shifting, object dataValue)
{
return PlcVarWrite(equipKey, string.Empty, shifting, dataValue);
}
/// <summary>
/// 向PLC变量中写入值并不真正下传至PLC
/// </summary>
/// <param name="dataKey"></param>
/// <param name="shifting"></param>
/// <param name="dataValue"></param>
/// <returns></returns>
public bool PlcVarWriteByDataKey(DataKeyValue dataKey, int shifting, object dataValue)
{
return PlcVarWriteByDataKey(dataKey.EquipKey, shifting, dataValue);
}
/// <summary>
/// 向PLC变量中写入值并不真正下传至PLC
/// </summary>
/// <param name="dataKey"></param>
/// <param name="dataValue"></param>
/// <returns></returns>
public bool PlcVarWriteByDataKey(DataKeyValue dataKey, object dataValue)
{
return PlcVarWriteByDataKey(dataKey, 0, dataValue);
}
#endregion
#region Plc写入方法真正写入PLC
/// <summary>
/// PlcWrite
/// </summary>
/// <param name="equipKey"></param>
/// <param name="runName"></param>
/// <param name="shifting"></param>
/// <param name="dataValue"></param>
/// <param name="isOutFlag"></param>
/// <returns></returns>
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];
}
else
{
ICSharpCode.Core.LoggingService<BasePlcHelper>.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<BasePlcHelper>.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]) };
}
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<BasePlcHelper>.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<BasePlcHelper>.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);
}
/// <summary>
/// 向Plc变量写入float浮点数下传Plc
/// </summary>
/// <param name="dataKey"></param>
/// <param name="dataValue"></param>
/// <returns></returns>
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));
}
}
/// <summary>
/// 向Plc变量写入float浮点数下传Plc
/// </summary>
/// <param name="dataKey"></param>
/// <param name="dataValue"></param>
/// <param name="isOutLog"></param>
/// <returns></returns>
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表写入操作
/// <summary>
/// 把设备变量的值写入PptPlcData表
/// </summary>
/// <param name="dataKey">设备变量</param>
/// <param name="equipKey">设备</param>
/// <param name="shifting">偏移</param>
/// <param name="dataValue">值数组</param>
/// <returns></returns>
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 自定义设备变量
/// <summary>
/// 最小计划数由PLC实时读取
/// </summary>
public int MinPlanNum = 3;
#region PC在线标志
/// <summary>
/// 开门料仓号
/// </summary>
public DataKeyValue ChemicalWeighing_PC_Online = new DataKeyValue("PC_Online");
#endregion
/// <summary>
/// 小料PLC在线标志
/// </summary>
public DataKeyValue ChemicalWeighing_PLC_Online_Flag = new DataKeyValue("PLC_Online_Flag");
/// <summary>
/// 等待计划数
/// </summary>
public DataKeyValue ChemicalWeighing_Scheduled_Num = new DataKeyValue("Scheduled_Num");
#region 自动下传计划相关变量
/// <summary>
/// 小料PLC请求计划交互信息
/// </summary>
public DataKeyValue ChemicalWeighing_PLC_LoadingStatus = new DataKeyValue("PLC_LoadingStatus");
/// <summary>
/// 小料PC计划反馈交互信息
/// </summary>
public DataKeyValue ChemicalWeighing_PC_LoadingStatus = new DataKeyValue("PC_LoadingStatus");
/// <summary>
/// 速度1
/// </summary>
public DataKeyValue DwSpeed = new DataKeyValue("DwSpeed");
#endregion
#region 自动更新计划状态相关变量
/// <summary>
/// 小料PLC计划状态变化交互PLC请求信息
/// </summary>
public DataKeyValue ChemicalWeighing_PLC_Plan_Status_ShakeHand = new DataKeyValue("PLC_Plan_Status_ShakeHand");
/// <summary>
/// PC计划状态根据PLC状态更新交互信息
/// </summary>
public DataKeyValue ChemicalWeighing_PLC_Plan_Status_FeedBack = new DataKeyValue("PLC_Plan_Status_FeedBack");
/// <summary>
/// 小料计划序号
/// </summary>
public DataKeyValue ChemicalWeighing_Plan_Serial = new DataKeyValue("Plan_Serial");
/// <summary>
/// 小料计划状态
/// </summary>
public DataKeyValue ChemicalWeighing_Plan_Status = new DataKeyValue("Plan_Status");
/// <summary>
/// 小料计划完成数
/// </summary>
public DataKeyValue ChemicalWeighing_Plan_Number = new DataKeyValue("Plan_Number");
/// <summary>
/// 小料计划剩余数量
/// </summary>
public DataKeyValue ChemicalWeighing_Remain_Number = new DataKeyValue("Remain_Number");
#endregion
#region HMI配方列表请求相关变量
/// <summary>
/// 小料HMI配方查询请求信息
/// </summary>
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Name_ShakeHand = new DataKeyValue("HMI_Request_Recipe_Name_ShakeHand");
/// <summary>
/// PCHMI配方查询请求信息响应
/// </summary>
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Name_FeedBack = new DataKeyValue("HMI_Request_Recipe_Name_FeedBack");
/// <summary>
/// 读取到的机台号
/// </summary>
public DataKeyValue ChemicalWeighing_Sys_Machine = new DataKeyValue("Sys_Machine");
/// <summary>
/// 读取到的配方名称
/// </summary>
public DataKeyValue ChemicalWeighing_Plan_Code = new DataKeyValue("Plan_Code");
#endregion
#region HMI根据配方请求添加计划相关变量
/// <summary>
/// 小料HMI配方添加计划请求信息
/// </summary>
public DataKeyValue ChemicalWeighing_HMI_Confirm_Recipe_ShakeHand = new DataKeyValue("HMI_Confirm_Recipe_ShakeHand");
/// <summary>
/// PCHMI配方添加计划请求信息响应
/// </summary>
public DataKeyValue ChemicalWeighing_HMI_Confirm_Recipe_FeedBack = new DataKeyValue("HMI_Confirm_Recipe_FeedBack");
/// <summary>
/// 读取到的机台号
/// </summary>
public DataKeyValue ChemicalWeighing_Sys_Machine1 = new DataKeyValue("Sys_Machine1");
/// <summary>
/// 读取到的配方名称
/// </summary>
public DataKeyValue ChemicalWeighing_Plan_Code1 = new DataKeyValue("Plan_Code1");
/// <summary>
/// 设定数量
/// </summary>
public DataKeyValue ChemicalWeighing_HMI_Plan_Num = new DataKeyValue("HMI_Plan_Num");
#endregion
#region HMI请求修改计划相关变量
/// <summary>
/// PLCHMI修改计划请求信息
/// </summary>
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Change_ShakeHand = new DataKeyValue("HMI_Request_Recipe_Change_ShakeHand");
/// <summary>
/// PCHMI修改计划请求信息响应
/// </summary>
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Change_FeedBack = new DataKeyValue("HMI_Request_Recipe_Change_FeedBack");
/// <summary>
/// 命令0默认 1刷新 2上移 3下移 4修改车数 5删除计划
/// </summary>
public DataKeyValue ChemicalWeighing_HMI_Request_Recipe_Change_Command = new DataKeyValue("HMI_Request_Recipe_Change_Command");
/// <summary>
/// 读取到的机台号
/// </summary>
public DataKeyValue ChemicalWeighing_Sys_Machine2 = new DataKeyValue("Sys_Machine2");
/// <summary>
/// 读取到的计划号
/// </summary>
public DataKeyValue ChemicalWeighing_HMIChange_PlanId = new DataKeyValue("HMIChange_PlanId");
/// <summary>
/// 设定数量
/// </summary>
public DataKeyValue ChemicalWeighing_HMIChange_PlanNum = new DataKeyValue("HMIChange_PlanNum");
#endregion
#region 自动存盘相关变量
/// <summary>
/// PLC存盘请求
/// </summary>
public DataKeyValue ChemicalWeighing_PLC_Request_Save_ShakeHand = new DataKeyValue("Plc_Request_Save_ShakeHand");
/// <summary>
/// PC存盘反馈信息
/// </summary>
public DataKeyValue ChemicalWeighing_PC_Request_Save_FeedBack = new DataKeyValue("PC_Request_Save_FeedBack");
/// <summary>
/// 报表基本信息
/// </summary>
public DataKeyValue ChemicalWeighing_Report_Update_Block_BaseInf = new DataKeyValue("Report_Update_Block_BaseInf");
/// <summary>
/// 物料报表信息
/// </summary>
public DataKeyValue ChemicalWeighing_Report_Update_Block_Material_Report = new DataKeyValue("Report_Update_Block_Material_Report");
#endregion
#region 上位机修改计划数、终止计划相关变量
/// <summary>
/// PC下传终止计划状态
/// </summary>
public DataKeyValue ChemicalWeighing_Plan_Status_Com_ShakeHand = new DataKeyValue("Plan_Status_Com_ShakeHand");
/// <summary>
/// PLC终止计划状态反馈
/// </summary>
public DataKeyValue ChemicalWeighing_Plan_Status_Com_FeedBack = new DataKeyValue("Plan_Status_Com_FeedBack");
#endregion
#region 条码扫描后下传到PLC的命令相关变量
/// <summary>
/// 开门料仓号
/// </summary>
public DataKeyValue ChemicalWeighing_Hopper_No_103 = new DataKeyValue("Hopper_No_103");
/// <summary>
/// 条码开门命令
/// </summary>
public DataKeyValue ChemicalWeighing_ScanCommand = new DataKeyValue("Command");
/// <summary>
/// 条码开门握手信号
/// </summary>
public DataKeyValue ChemicalWeighing_Open_door_Command_ShakeHand = new DataKeyValue("Open_door_Command_ShakeHand");
#endregion
#endregion
#region 自动写入物料名称相关变量
/// <summary>
/// PLC物料名称下传请求
/// </summary>
public DataKeyValue ChemicalWeighing_PLC_LoadingConfig = new DataKeyValue("PLC_LoadingConfig");
/// <summary>
/// PC物料名称下传反馈
/// </summary>
public DataKeyValue ChemicalWeighing_PC_LoadingConfig = new DataKeyValue("PC_LoadingConfig");
#endregion
#endregion
#region 冠合上位机计划下传
//下位机准备信号(上位机下传时读取)
public DataKeyValue ChemicalWeighing_PC_ConfirmRemote = new DataKeyValue("ConfirmRemote");
public DataKeyValue ChemicalWeighing_PC_ConfirmReady = new DataKeyValue("ConfirmReady");
public DataKeyValue ChemicalWeighing_PC_ConfirmRun = new DataKeyValue("ConfirmRun");
//配方编号、名称
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_RpFinished = new DataKeyValue("PC_RpFinished");
//计划完成车数
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");
#endregion
}
}