|
@@ -29,6 +29,8 @@ namespace UAS_PLCDataReader
|
|
|
DataHelper dh = SystemInf.dh;
|
|
|
ModeBusTCPServer mbt = new ModeBusTCPServer();
|
|
|
List<string> SQL = new List<string>();
|
|
|
+ //存放所有的设备返回的数据,用于比较
|
|
|
+ Dictionary<string, Dictionary<string, string>> ReturnData = new Dictionary<string, Dictionary<string, string>>();
|
|
|
|
|
|
#region 初始化代码
|
|
|
public Main()
|
|
@@ -423,6 +425,25 @@ namespace UAS_PLCDataReader
|
|
|
if (mbt.Returnvalue.ContainsKey(IP))
|
|
|
{
|
|
|
int ReceiveCommandByteSize = Encoding.Default.GetBytes(mbt.Returnvalue[IP].ToCharArray()).Length;
|
|
|
+ Dictionary<string, string> ItemData = new Dictionary<string, string>();
|
|
|
+ int[] Arr = BaseUtil.GetDecimalData(BaseUtil.ASCIIToString(mbt.Returnvalue[IP]), 8);
|
|
|
+ for (int i = 0; i < Arr.Length; i++)
|
|
|
+ {
|
|
|
+ ItemData.Add("Item" + i, Arr[i].ToString());
|
|
|
+ }
|
|
|
+ //如果不包含该项数据则在键值对中添加
|
|
|
+ if (!ReturnData.ContainsKey(Decode))
|
|
|
+ {
|
|
|
+ ReturnData.Add(Decode, ItemData);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //检测键值对是否发生变化,发生变化时赋予新值
|
|
|
+ if ((BaseUtil.CheckDicDiff(ReturnData[Decode], ItemData)))
|
|
|
+ {
|
|
|
+ ReturnData[Decode] = ItemData;
|
|
|
+ }
|
|
|
+ }
|
|
|
mbt.Returnvalue.Remove(IP);
|
|
|
SQL.Clear();
|
|
|
//更新轮询状态
|