|
|
|
|
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];
|
|
|
|
|
originalValue =
|
|
|
|
|
Mesnac.Basic.DataProcessor.Swap(
|
|
|
|
|
short.Parse(originalValue.ToString()));
|
|
|
|
|
}
|
|
|
|
|
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])
|
|
|
|
|
};
|
|
|
|
|
//从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<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 2107
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Hopper_1_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Hopper_1_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Hopper_1_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Hopper_1_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Hopper_1_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Hopper_2_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Hopper_2_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Hopper_2_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Hopper_2_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Hopper_2_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Hopper_3_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Hopper_3_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Hopper_3_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Hopper_3_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Hopper_3_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Hopper_4_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Hopper_4_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Hopper_4_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Hopper_4_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Hopper_4_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Vessel_1_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_1_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_1_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_1_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_1_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Vessel_2_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_2_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_2_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_2_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_2_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Vessel_3_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_3_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_3_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_3_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_3_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Vessel_4_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_4_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_4_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_4_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_4_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue Vessel_5_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_5_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue Vessel_5_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_5_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue Vessel_5_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue WScale_1_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue WScale_1_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue WScale_1_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue WScale_1_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue WScale_1_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue WScale_2_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue WScale_2_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue WScale_2_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue WScale_2_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue WScale_2_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue WScale_3_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue WScale_3_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue WScale_3_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue WScale_3_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue WScale_3_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
////public DataKeyValue WScale_4_ActWeight { get; set; }
|
|
|
|
|
//public DataKeyValue WScale_4_HighWeight { get; set; }
|
|
|
|
|
//public DataKeyValue WScale_4_LowWeight { get; set; }
|
|
|
|
|
////public DataKeyValue WScale_4_HighLevel { get; set; }
|
|
|
|
|
////public DataKeyValue WScale_4_LowLevel { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue conveyV1_PV { get; set; }
|
|
|
|
|
//public DataKeyValue conveyV1_SV { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue purgeV1_PV { get; set; }
|
|
|
|
|
//public DataKeyValue purgeV1_SV { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue conveyV2_PV { get; set; }
|
|
|
|
|
//public DataKeyValue conveyV2_SV { get; set; }
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue purgeV2_PV { get; set; }
|
|
|
|
|
//public DataKeyValue purgeV2_SV { get; set; }
|
|
|
|
|
//public DataKeyValue conveyV3_PV { get; set; }
|
|
|
|
|
//public DataKeyValue conveyV3_SV { get; set; }
|
|
|
|
|
//public DataKeyValue purgeV3_PV { get; set; }
|
|
|
|
|
//public DataKeyValue purgeV3_SV { get; set; }
|
|
|
|
|
//public DataKeyValue conveyV4_PV { get; set; }
|
|
|
|
|
//public DataKeyValue conveyV4_SV { get; set; }
|
|
|
|
|
//public DataKeyValue purgeV4_PV { get; set; }
|
|
|
|
|
//public DataKeyValue purgeV4_SV { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue conveyV5_SV { get; set; }
|
|
|
|
|
//public DataKeyValue conveyV5_PV { get; set; }
|
|
|
|
|
//public DataKeyValue purgeV5_SV { get; set; }
|
|
|
|
|
//public DataKeyValue purgeV5_PV { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue Hoper3_HighSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Hoper3_LowSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Hoper3_WeightSlow { get; set; }
|
|
|
|
|
//public DataKeyValue Hoper3_Precut { get; set; }
|
|
|
|
|
//public DataKeyValue Hoper3_JogTime { get; set; }
|
|
|
|
|
//public DataKeyValue Water0_HighSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Water0_LowSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Water0_WeightSlow { get; set; }
|
|
|
|
|
//public DataKeyValue Water0_Precut { get; set; }
|
|
|
|
|
//public DataKeyValue Water0_JogTime { get; set; }
|
|
|
|
|
//public DataKeyValue Water1_HighSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Water1_LowSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Water1_WeightSlow { get; set; }
|
|
|
|
|
//public DataKeyValue Water1_Precut { get; set; }
|
|
|
|
|
//public DataKeyValue Water1_JogTime { get; set; }
|
|
|
|
|
//public DataKeyValue Water2_HighSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Water2_LowSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Water2_WeightSlow { get; set; }
|
|
|
|
|
//public DataKeyValue Water2_Precut { get; set; }
|
|
|
|
|
//public DataKeyValue Water2_JogTime { get; set; }
|
|
|
|
|
//public DataKeyValue Water3_HighSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Water3_LowSpeed { get; set; }
|
|
|
|
|
//public DataKeyValue Water3_WeightSlow { get; set; }
|
|
|
|
|
//public DataKeyValue Water3_Precut { get; set; }
|
|
|
|
|
//public DataKeyValue Water3_JogTime { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue SpeedD1 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedD2 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedD3 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedD4 { get; set; }
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue SpeedG1 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedG2 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedG3 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedG4 { get; set; }
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue SpeedG5 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedG6 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedG7 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedG8 { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue SpeedH1 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedH2 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedH3 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedH4 { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue SpeedS1 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedS5 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedS7 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedS11 { get; set; }
|
|
|
|
|
//public DataKeyValue SpeedS15 { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue Dryer0_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_status { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_step { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer0_pressure { get; set; }
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue Dryer1_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_status { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_step { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer1_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_status { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_step { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer2_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_status { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_step { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Dryer3_pressure { get; set; }
|
|
|
|
|
|
|
|
|
|
//public DataKeyValue Gelater0_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_status { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_step { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater0_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_status { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_step { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater1_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_status { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_step { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater2_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_status { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_step { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater3_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_status { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_step { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater4_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_status { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_step { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater5_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_status { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_step { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater6_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_status { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_step { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Gelater7_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_status { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_step { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Weter0_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_status { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_step { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Weter1_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_status { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_step { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Weter2_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_status { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_step { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Weter3_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_status { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_step { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Weter4_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_status { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_step { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Weter5_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_status { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_step { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Weter6_pressure { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_mode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_status { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_batch { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_step { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_stepCode { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_totalTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_stepTime { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_temperature { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_speed { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_currnet { get; set; }
|
|
|
|
|
//public DataKeyValue Weter7_pressure { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 2107
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// PLC通讯指示,大于0:正常,0:断线
|
|
|
|
|
///// </summary>
|
|
|
|
|
//public DataKeyValue WatchDog { get; set; }
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 系统运行状态
|
|
|
|
|
///// </summary>
|
|
|
|
|
//public DataKeyValue RecipeRun { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 系统暂停状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue RecipePause { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|