|
|
|
|
using System;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
using Mesnac.Equips;
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.Intake.Qingquan.BasicInfo
|
|
|
|
|
{
|
|
|
|
|
public class PlcData
|
|
|
|
|
{
|
|
|
|
|
#region 基本设置
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// PLC数据键值类
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DataKeyValue
|
|
|
|
|
{
|
|
|
|
|
public class Value
|
|
|
|
|
{
|
|
|
|
|
private object value = null;
|
|
|
|
|
public Value(object obj)
|
|
|
|
|
{
|
|
|
|
|
this.value = obj;
|
|
|
|
|
}
|
|
|
|
|
public object ToObject()
|
|
|
|
|
{
|
|
|
|
|
return this.value;
|
|
|
|
|
}
|
|
|
|
|
public int ToInt(int defaultValue)
|
|
|
|
|
{
|
|
|
|
|
int iResult = defaultValue;
|
|
|
|
|
if (this.value != null
|
|
|
|
|
&& this.value != DBNull.Value
|
|
|
|
|
&& int.TryParse(this.value.ToString(), out iResult)
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
return defaultValue;
|
|
|
|
|
}
|
|
|
|
|
public int ToInt()
|
|
|
|
|
{
|
|
|
|
|
return ToInt(0);
|
|
|
|
|
}
|
|
|
|
|
public DateTime ToDateTime(DateTime defaultValue)
|
|
|
|
|
{
|
|
|
|
|
DateTime iResult = defaultValue;
|
|
|
|
|
if (this.value != null
|
|
|
|
|
&& this.value != DBNull.Value
|
|
|
|
|
&& DateTime.TryParse(this.value.ToString(), out iResult)
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
return defaultValue;
|
|
|
|
|
}
|
|
|
|
|
public DateTime ToDateTime()
|
|
|
|
|
{
|
|
|
|
|
return ToDateTime(DateTime.Now);
|
|
|
|
|
}
|
|
|
|
|
public double ToDouble(double defaultValue)
|
|
|
|
|
{
|
|
|
|
|
double iResult = defaultValue;
|
|
|
|
|
if (this.value != null
|
|
|
|
|
&& this.value != DBNull.Value
|
|
|
|
|
&& double.TryParse(this.value.ToString(), out iResult)
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
return defaultValue;
|
|
|
|
|
}
|
|
|
|
|
public double ToDouble()
|
|
|
|
|
{
|
|
|
|
|
return ToDouble(0.0);
|
|
|
|
|
}
|
|
|
|
|
public string ToString(string defaultValue)
|
|
|
|
|
{
|
|
|
|
|
string iResult = defaultValue;
|
|
|
|
|
if (this.value != null
|
|
|
|
|
&& this.value != DBNull.Value
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
return this.value.ToString();
|
|
|
|
|
}
|
|
|
|
|
return defaultValue;
|
|
|
|
|
}
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return ToString(string.Empty);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void Ini()
|
|
|
|
|
{
|
|
|
|
|
foreach (Mesnac.Equips.BaseEquip equip in Factory.Instance.AllEquips.Values)
|
|
|
|
|
{
|
|
|
|
|
foreach (Mesnac.Equips.BaseInfo.Group group in equip.Group.Values)
|
|
|
|
|
{
|
|
|
|
|
foreach (Mesnac.Equips.BaseInfo.Data data in group.Data.Values)
|
|
|
|
|
{
|
|
|
|
|
if (data.RunName.Equals(this.FieldKey, StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.EquipKey = data.KeyName;
|
|
|
|
|
this.EquipRunName = data.RunName;
|
|
|
|
|
this.EquipData = data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private Value getLastValue()
|
|
|
|
|
{
|
|
|
|
|
Value Result = null;
|
|
|
|
|
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.Read ||
|
|
|
|
|
group.Access == System.IO.FileAccess.ReadWrite)
|
|
|
|
|
{
|
|
|
|
|
foreach (Mesnac.Equips.BaseInfo.Data data in group.Data.Values)
|
|
|
|
|
{
|
|
|
|
|
if (data.KeyName == this.EquipKey)
|
|
|
|
|
{
|
|
|
|
|
return new Value(data.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
private Value getNowValue()
|
|
|
|
|
{
|
|
|
|
|
Value Result = null;
|
|
|
|
|
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.Read ||
|
|
|
|
|
group.Access == System.IO.FileAccess.ReadWrite)
|
|
|
|
|
{
|
|
|
|
|
foreach (Mesnac.Equips.BaseInfo.Data data in group.Data.Values)
|
|
|
|
|
{
|
|
|
|
|
if (data.KeyName == this.EquipKey)
|
|
|
|
|
{
|
|
|
|
|
return new Value(equip.ReadData(data));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataKeyValue(string name)
|
|
|
|
|
{
|
|
|
|
|
this.Name = name;
|
|
|
|
|
this.FieldKey = name;
|
|
|
|
|
this.Ini();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配置名称 = 配置key值
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配置key值
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string FieldKey { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设备设置值
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string EquipKey { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设备设置值
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string EquipRunName { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设备设置值
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Mesnac.Equips.BaseInfo.Data EquipData { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 说明
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Remark { get; private set; }
|
|
|
|
|
private Value setLastValue = null;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上一次读取的值
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Value LastValue
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
Value value = this.getLastValue();
|
|
|
|
|
if (value == null)
|
|
|
|
|
{
|
|
|
|
|
value = this.getNowValue();
|
|
|
|
|
}
|
|
|
|
|
if (value == null)
|
|
|
|
|
{
|
|
|
|
|
value = setLastValue;
|
|
|
|
|
}
|
|
|
|
|
if (value == null)
|
|
|
|
|
{
|
|
|
|
|
value = new Value(null);
|
|
|
|
|
}
|
|
|
|
|
setLastValue = value;
|
|
|
|
|
return setLastValue;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.setLastValue = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private Value setNowValue = null;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 读取当前值
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Value NowValue
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
Value value = this.getNowValue();
|
|
|
|
|
if (value == null)
|
|
|
|
|
{
|
|
|
|
|
value = setNowValue;
|
|
|
|
|
}
|
|
|
|
|
if (value == null)
|
|
|
|
|
{
|
|
|
|
|
value = setLastValue;
|
|
|
|
|
}
|
|
|
|
|
if (value == null)
|
|
|
|
|
{
|
|
|
|
|
value = new Value(null);
|
|
|
|
|
}
|
|
|
|
|
setNowValue = value;
|
|
|
|
|
return setNowValue;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.setNowValue = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 单例模式
|
|
|
|
|
private static PlcData _this;
|
|
|
|
|
public static PlcData Instance
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (null == _this)
|
|
|
|
|
_this = new PlcData();
|
|
|
|
|
return _this;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private PlcData()
|
|
|
|
|
{
|
|
|
|
|
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 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 PlcWrite
|
|
|
|
|
private bool PlcWrite(string equipKey, string runName, int shifting, object[] dataValue)
|
|
|
|
|
{
|
|
|
|
|
BaseAction action = new BaseAction();
|
|
|
|
|
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 + ",");
|
|
|
|
|
}
|
|
|
|
|
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 (log.Length > "equipKey=[]runName=[]No Find".Length)
|
|
|
|
|
{
|
|
|
|
|
action.LogDebug(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);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 从PLC中读取原始数据的方法
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从PLC中读取原始数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="equipKey">要读取的设备名称</param>
|
|
|
|
|
/// <param name="dataValue">从PLC读取的值</param>
|
|
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
|
|
public bool PlcRead(string equipKey, out int[] dataValue)
|
|
|
|
|
{
|
|
|
|
|
dataValue = new int[0];
|
|
|
|
|
int onelen = 100;
|
|
|
|
|
int shifting = 0;
|
|
|
|
|
bool result = false;
|
|
|
|
|
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.Read ||
|
|
|
|
|
group.Access == System.IO.FileAccess.ReadWrite)
|
|
|
|
|
{
|
|
|
|
|
foreach (Mesnac.Equips.BaseInfo.Data data in group.Data.Values)
|
|
|
|
|
{
|
|
|
|
|
if (data.KeyName == equipKey)
|
|
|
|
|
{
|
|
|
|
|
dataValue = new int[data.Len];
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
#region 本次读取长度 readlen
|
|
|
|
|
int readlen = 0;
|
|
|
|
|
if (data.Len - shifting > onelen)
|
|
|
|
|
{
|
|
|
|
|
readlen = onelen;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
readlen = data.Len - shifting;
|
|
|
|
|
}
|
|
|
|
|
if (readlen <= 0)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 读取数据
|
|
|
|
|
object[] buff;
|
|
|
|
|
if (equip.Read(group.Block, group.Start + data.Start + shifting, readlen, out buff))
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < buff.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
int ivalue = 0;
|
|
|
|
|
if (buff[i] != null && buff[i] != DBNull.Value
|
|
|
|
|
&& int.TryParse(buff[i].ToString(), out ivalue))
|
|
|
|
|
{
|
|
|
|
|
dataValue[shifting + i] = ivalue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dataValue[shifting + i] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
shifting += readlen;
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (buff.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
/// <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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public object PlcLastValueRead(string equipKey)
|
|
|
|
|
{
|
|
|
|
|
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.Read ||
|
|
|
|
|
group.Access == System.IO.FileAccess.ReadWrite)
|
|
|
|
|
{
|
|
|
|
|
foreach (Mesnac.Equips.BaseInfo.Data data in group.Data.Values)
|
|
|
|
|
{
|
|
|
|
|
if (data.Name == equipKey)
|
|
|
|
|
{
|
|
|
|
|
return data.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 读取设备数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="equipKey">设备名称</param>
|
|
|
|
|
/// <param name="dataValue">读取的设备值</param>
|
|
|
|
|
/// <returns>读取成功返回true,失败返回false</returns>
|
|
|
|
|
public bool PlcLastValueRead(string equipKey, out int[] dataValue)
|
|
|
|
|
{
|
|
|
|
|
dataValue = new int[0];
|
|
|
|
|
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.Read ||
|
|
|
|
|
group.Access == System.IO.FileAccess.ReadWrite)
|
|
|
|
|
{
|
|
|
|
|
foreach (Mesnac.Equips.BaseInfo.Data data in group.Data.Values)
|
|
|
|
|
{
|
|
|
|
|
if (data.Name == equipKey)
|
|
|
|
|
{
|
|
|
|
|
object ovalue = data.Value;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (ovalue is object[])
|
|
|
|
|
{
|
|
|
|
|
object[] ovalues = ovalue as object[];
|
|
|
|
|
dataValue = new int[ovalues.Length];
|
|
|
|
|
for (int i = 0; i < ovalues.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
object obj = ovalues[i];
|
|
|
|
|
int ivalue = 0;
|
|
|
|
|
|
|
|
|
|
if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out ivalue))
|
|
|
|
|
{
|
|
|
|
|
dataValue[i] = ivalue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (ovalue != null && ovalue != DBNull.Value)
|
|
|
|
|
{
|
|
|
|
|
dataValue = new int[1];
|
|
|
|
|
int ivalue = 0;
|
|
|
|
|
if (int.TryParse(ovalue.ToString(), out ivalue))
|
|
|
|
|
{
|
|
|
|
|
dataValue[0] = ivalue;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService.Error("获取PLC设备[" + equipKey + "]数据失败:" + ex.Message, ex);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region DataWrite
|
|
|
|
|
|
|
|
|
|
#region 基本函数
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取本地连接
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private DbHelper getLocalHelper()
|
|
|
|
|
{
|
|
|
|
|
return new DatabaseAction().NewDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 基本类型
|
|
|
|
|
public class DataInfo
|
|
|
|
|
{
|
|
|
|
|
public string PlcSchemaField { get; set; }
|
|
|
|
|
public string EquipRunName { get; set; }
|
|
|
|
|
public object PlcDataValue { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region PLCData表写入操作
|
|
|
|
|
|
|
|
|
|
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 = getLocalHelper();
|
|
|
|
|
dbHelper.CommandType = System.Data.CommandType.Text;
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
#region 基于SQL2008语法,不适合SQL2000
|
|
|
|
|
//StringBuilder sqlstr = new StringBuilder("INSERT INTO dbo.PlcData (PlcSchemaField ,EquipRunName ,PlcDataValue ,PlcDataIndex,PlcDownState) VALUES ");
|
|
|
|
|
//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(" (").Append(key1).Append(",").Append(key2).Append(",").Append(key3).Append(",").Append(key4).Append(",0)");
|
|
|
|
|
// if (i < dataValue.Length - 1)
|
|
|
|
|
// {
|
|
|
|
|
// sqlstr.AppendLine(",");
|
|
|
|
|
// }
|
|
|
|
|
// if (obj is DataInfo)
|
|
|
|
|
// {
|
|
|
|
|
// DataInfo data = obj as DataInfo;
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
#region 支持SQL2000
|
|
|
|
|
|
|
|
|
|
StringBuilder sqlstr = new StringBuilder("INSERT INTO dbo.PlcData (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 DataInfo)
|
|
|
|
|
{
|
|
|
|
|
DataInfo data = obj as DataInfo;
|
|
|
|
|
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 1#罐组实时属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Automatic { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Manual { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 输送
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Conveying { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 清扫
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Purging { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 故障
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Fault { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 等待确认
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Acknoledge { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 罐开始标志
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_StartFlag { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 存盘准备好
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_SaveFlag { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 压送罐压力
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_TopAir { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 压送罐出口压力
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_ConveyAir { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass1 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass2 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力3
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass3 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力4
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass4 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力5
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass5 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力6
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass6 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力7
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass7 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力8
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass8 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力9
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass9 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力10
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Bypass10 { get; private set; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 2#罐组实时属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Automatic { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Manual { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 输送
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Conveying { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 清扫
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Purging { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 故障
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Fault { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 等待确认
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Acknoledge { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 罐开始标志
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_StartFlag { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 存盘准备好
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_SaveFlag { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 压送罐压力
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_TopAir { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 压送罐出口压力
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_ConveyAir { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass1 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass2 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力3
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass3 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力4
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass4 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力5
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass5 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力6
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass6 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力7
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass7 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力8
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass8 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力9
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass9 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力10
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Bypass10 { get; private set; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 3#罐组实时属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Automatic { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Manual { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 输送
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Conveying { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 清扫
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Purging { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 故障
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Fault { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 等待确认
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Acknoledge { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 罐开始标志
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_StartFlag { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 存盘准备好
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_SaveFlag { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 压送罐压力
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_TopAir { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 压送罐出口压力
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_ConveyAir { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass1 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass2 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力3
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass3 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力4
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass4 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力5
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass5 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力6
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass6 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力7
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass7 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力8
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass8 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力9
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass9 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力10
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Bypass10 { get; private set; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 4#罐组实时属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Automatic { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Manual { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 输送
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Conveying { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 清扫
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Purging { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 故障
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Fault { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 等待确认
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Acknoledge { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 罐开始标志
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_StartFlag { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 存盘准备好
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_SaveFlag { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 压送罐压力
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_TopAir { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 压送罐出口压力
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_ConveyAir { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass1 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass2 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力3
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass3 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力4
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass4 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力5
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass5 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力6
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass6 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力7
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass7 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力8
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass8 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力9
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass9 { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 管路压力10
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Bypass10 { get; private set; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 1#罐组存盘报表属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_总时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_TotalTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_加料时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_ChargeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_憋压时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_AirationTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_压送时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_DischargeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_清扫时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_PurgeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_目标罐号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_DestNo { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_目标罐类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_DestBinType { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_源罐号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_SourceBinNo { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_源罐类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_SourceBinType { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_目标机台
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_DestMixer { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_预留1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Spare1 { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G1_预留2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G1_Spare2 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 2#罐组存盘报表属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_总时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_TotalTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_加料时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_ChargeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_憋压时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_AirationTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_压送时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_DischargeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_清扫时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_PurgeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_目标罐号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_DestNo { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_目标罐类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_DestBinType { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_源罐号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_SourceBinNo { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_源罐类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_SourceBinType { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_目标机台
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_DestMixer { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_预留1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Spare1 { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G2_预留2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G2_Spare2 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 3#罐组存盘报表属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_总时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_TotalTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_加料时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_ChargeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_憋压时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_AirationTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_压送时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_DischargeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_清扫时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_PurgeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_目标罐号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_DestNo { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_目标罐类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_DestBinType { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_源罐号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_SourceBinNo { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_源罐类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_SourceBinType { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_目标机台
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_DestMixer { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_预留1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Spare1 { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G3_预留2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G3_Spare2 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 4#罐组存盘报表属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_总时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_TotalTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_加料时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_ChargeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_憋压时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_AirationTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_压送时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_DischargeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_清扫时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_PurgeTime { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_目标罐号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_DestNo { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_目标罐类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_DestBinType { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_源罐号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_SourceBinNo { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_源罐类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_SourceBinType { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_目标机台
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_DestMixer { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_预留1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Spare1 { get; private set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// G4_预留2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataKeyValue G4_Spare2 { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|