|
|
@@ -132,45 +132,66 @@ namespace HKControl |
|
|
|
{ |
|
|
|
SiemensDicitonary[item.DeviceNum].ConnectOk = new Action(() => |
|
|
|
{ |
|
|
|
AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}号档口"); |
|
|
|
AlarmHelper<DataModel>.Init(); |
|
|
|
//AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}号档口"); |
|
|
|
HKLog.HKLogImport.WriteInfo($"{item.DeviceNum}:连接成功"); |
|
|
|
ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var md = AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}号档口"); |
|
|
|
var res = SiemensDicitonary[item.DeviceNum].Read<byte>("MB7"); |
|
|
|
var res1 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB10"); |
|
|
|
var res2 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB11"); |
|
|
|
md.LeftWindowData.L1 = Get8bitValue(res1, 2); |
|
|
|
md.LeftWindowData.L2 = Get8bitValue(res1, 3); |
|
|
|
md.LeftWindowData.L3 = Get8bitValue(res1, 4); |
|
|
|
md.LeftWindowData.L4 = Get8bitValue(res1, 5); |
|
|
|
md.LeftWindowData.L5 = Get8bitValue(res1, 6); |
|
|
|
md.LeftWindowData.L6 = Get8bitValue(res1, 7); |
|
|
|
md.LeftWindowData.L7 = Get8bitValue(res1, 8); |
|
|
|
md.LeftWindowData.L8 = Get8bitValue(res2, 1); |
|
|
|
md.LeftWindowData.L9 = Get8bitValue(res2, 2); |
|
|
|
var md = AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}"); |
|
|
|
|
|
|
|
var MB7 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB7"); |
|
|
|
DataModels[item.DeviceNum].LeftWindowData.IsSwipe = Get8bitValue(MB7, 1); |
|
|
|
DataModels[item.DeviceNum].LeftWindowData.Complete = Get8bitValue(MB7, 2); |
|
|
|
DataModels[item.DeviceNum].RightWindowData.IsSwipe = Get8bitValue(MB7, 3); |
|
|
|
DataModels[item.DeviceNum].RightWindowData.Complete = Get8bitValue(MB7, 4); |
|
|
|
|
|
|
|
var res3 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB12"); |
|
|
|
var res4 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB13"); |
|
|
|
md.RightWindowData.R1 = Get8bitValue(res3, 2); |
|
|
|
md.RightWindowData.R2 = Get8bitValue(res3, 3); |
|
|
|
md.RightWindowData.R3 = Get8bitValue(res3, 4); |
|
|
|
md.RightWindowData.R4 = Get8bitValue(res3, 5); |
|
|
|
md.RightWindowData.R5 = Get8bitValue(res3, 6); |
|
|
|
md.RightWindowData.R6 = Get8bitValue(res3, 7); |
|
|
|
md.RightWindowData.R7 = Get8bitValue(res3, 8); |
|
|
|
md.RightWindowData.R8 = Get8bitValue(res4, 1); |
|
|
|
md.RightWindowData.R9 = Get8bitValue(res4, 2); |
|
|
|
var MB10 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB10"); |
|
|
|
var MB11 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB11"); |
|
|
|
md.LeftWindowData.L2 = Get8bitValue(MB10, 2); |
|
|
|
md.LeftWindowData.L3 = Get8bitValue(MB10, 3); |
|
|
|
md.LeftWindowData.L4 = Get8bitValue(MB10, 4); |
|
|
|
md.LeftWindowData.L5 = Get8bitValue(MB10, 5); |
|
|
|
md.LeftWindowData.L6 = Get8bitValue(MB10, 6); |
|
|
|
md.LeftWindowData.L7 = Get8bitValue(MB10, 7); |
|
|
|
md.LeftWindowData.L8 = Get8bitValue(MB10, 8); |
|
|
|
md.LeftWindowData.L9 = Get8bitValue(MB11, 1); |
|
|
|
|
|
|
|
DataModels[item.DeviceNum].LeftWindowData.IsSwipe = Get8bitValue(res, 1); |
|
|
|
DataModels[item.DeviceNum].LeftWindowData.Complete = Get8bitValue(res, 2); |
|
|
|
var MB12 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB12"); |
|
|
|
var MB13 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB13"); |
|
|
|
md.RightWindowData.R2 = Get8bitValue(MB12, 2); |
|
|
|
md.RightWindowData.R3 = Get8bitValue(MB12, 3); |
|
|
|
md.RightWindowData.R4 = Get8bitValue(MB12, 4); |
|
|
|
md.RightWindowData.R5 = Get8bitValue(MB12, 5); |
|
|
|
md.RightWindowData.R6 = Get8bitValue(MB12, 6); |
|
|
|
md.RightWindowData.R7 = Get8bitValue(MB12, 7); |
|
|
|
md.RightWindowData.R8 = Get8bitValue(MB12, 8); |
|
|
|
md.RightWindowData.R9 = Get8bitValue(MB13, 1); |
|
|
|
|
|
|
|
var MB14 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB14"); |
|
|
|
md.WaterTemperatureLow = Get8bitValue(MB14, 5); |
|
|
|
md.FrequencyConverterFault = Get8bitValue(MB14, 6); |
|
|
|
|
|
|
|
var MB15 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB15"); |
|
|
|
md.RobotCommFault = Get8bitValue(MB15, 6); |
|
|
|
bool TempFault = Get8bitValue(MB15, 5); |
|
|
|
if (TempFault) |
|
|
|
{ |
|
|
|
md.RBStatus = RobotStatus.故障; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (Get8bitValue(MB15, 1)) |
|
|
|
md.RBStatus = RobotStatus.运行; |
|
|
|
else if (Get8bitValue(MB15, 2)) |
|
|
|
md.RBStatus = RobotStatus.停止; |
|
|
|
else if (Get8bitValue(MB15, 3)) |
|
|
|
md.RBStatus = RobotStatus.暂停; |
|
|
|
else if (Get8bitValue(MB15, 4)) |
|
|
|
md.RBStatus = RobotStatus.准备; |
|
|
|
} |
|
|
|
|
|
|
|
DataModels[item.DeviceNum].RightWindowData.IsSwipe = Get8bitValue(res, 3); |
|
|
|
DataModels[item.DeviceNum].RightWindowData.Complete = Get8bitValue(res, 4); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|