|
|
@@ -62,115 +62,89 @@ public class DeviceData { |
|
|
|
@Override |
|
|
|
public void Run() throws InterruptedException { |
|
|
|
|
|
|
|
//获取校准值-增加两个果糖通道 |
|
|
|
ModbusTcpServer.get().ReadShort("VW100", 12, (shorts) -> { |
|
|
|
for (int i = 0; i < shorts.length; i++) { |
|
|
|
CalibrationValue.put(i + 1, shorts[i]); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//获取称当前重量 |
|
|
|
ModbusTcpServer.get().ReadInt("VD260", 9, ints -> { |
|
|
|
for (int i = 0; i < ints.length; i++) { |
|
|
|
CallCurrentWeight.put(i + 1, ints[i]); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//获取校准基准时间 |
|
|
|
ModbusTcpServer.get().ReadInt("VD124", 1, ints -> { |
|
|
|
CalibrationReferenceTime = ints[0]; |
|
|
|
}); |
|
|
|
|
|
|
|
//获取温度参数 |
|
|
|
ModbusTcpServer.get().ReadInt("VD310", 3, ints -> { |
|
|
|
FructoseTemperature1=ints[0]; |
|
|
|
FructoseTemperature2=ints[1]; |
|
|
|
WashTheTankTemperature=ints[2]; |
|
|
|
}); |
|
|
|
|
|
|
|
//获取温度上下限 |
|
|
|
ModbusTcpServer.get().ReadInt("VD388", 6, ints -> { |
|
|
|
FructoseTemperature1_up=ints[0]; |
|
|
|
FructoseTemperature1_down=ints[1]; |
|
|
|
FructoseTemperature2_up=ints[2]; |
|
|
|
FructoseTemperature2_down=ints[3]; |
|
|
|
WashTheTankTemperature_up=ints[4]; |
|
|
|
WashTheTankTemperature_down=ints[5]; |
|
|
|
}); |
|
|
|
|
|
|
|
//获取清洗参数 |
|
|
|
ModbusTcpServer.get().ReadShort("VW140", 5, shorts -> { |
|
|
|
DrainageTime = shorts[0]; |
|
|
|
AddCleaningAgentTime = shorts[1]; |
|
|
|
InletTime = shorts[2]; |
|
|
|
CyclicCleaningTime = shorts[3]; |
|
|
|
CleaningAndHeatingTime = shorts[4]; |
|
|
|
}); |
|
|
|
|
|
|
|
//获取清洗参数 |
|
|
|
ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { |
|
|
|
WeightCalibrationMode = booleans[0]; |
|
|
|
}); |
|
|
|
|
|
|
|
ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { |
|
|
|
WeightCalibrationMode = booleans[0]; |
|
|
|
}); |
|
|
|
//IoStatus |
|
|
|
|
|
|
|
//读取1号果糖机按钮状态 |
|
|
|
ModbusTcpServer.get().ReadBool("M51.7", 1, booleans -> { |
|
|
|
ReheatSwitch1 = booleans[0]; |
|
|
|
}); |
|
|
|
|
|
|
|
//读取2号果糖机按钮状态 |
|
|
|
ModbusTcpServer.get().ReadBool("M52.0", 1, booleans -> { |
|
|
|
ReheatSwitch2 = booleans[0]; |
|
|
|
}); |
|
|
|
|
|
|
|
//读取当前扫码信息 |
|
|
|
ModbusTcpServer.get().ReadString("VW342", 20, (data) -> { |
|
|
|
|
|
|
|
if(!Code.equals(data)) |
|
|
|
{ |
|
|
|
if(!data.isEmpty() && OnScanTheCodeInformationT!=null) |
|
|
|
{ |
|
|
|
MessageLog.ShowInfo("当前扫码信息:"+data); |
|
|
|
OnScanTheCodeInformationT.Run(data); |
|
|
|
} |
|
|
|
Code=data; |
|
|
|
} |
|
|
|
//1.查询订单信息 |
|
|
|
//2.展示订单界面 |
|
|
|
//3.制作订单信息 |
|
|
|
//4.回馈订单信息 |
|
|
|
}); |
|
|
|
|
|
|
|
//读取实时状态 |
|
|
|
ModbusTcpServer.get().ReadStatus("VW382", 3, data -> { |
|
|
|
for (int i = 0; i < data.length; i++) { |
|
|
|
byte status=data[i];//0x92 |
|
|
|
IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1); |
|
|
|
IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1); |
|
|
|
IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1); |
|
|
|
IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1); |
|
|
|
IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1); |
|
|
|
IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1); |
|
|
|
IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1); |
|
|
|
IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//配料完成 M0.3 |
|
|
|
CompleteListen("M0.3", "配料完成", OnChargeMixtureCompleteNotify); |
|
|
|
|
|
|
|
//清洗完成 M0.6 |
|
|
|
CompleteListen("M0.6", "清洗完成", OnCleaningCompleteNotify); |
|
|
|
|
|
|
|
//去皮完成 M1.3 |
|
|
|
CompleteListen("M1.3", "去皮完成", OnPeelingCompleteNotify); |
|
|
|
|
|
|
|
//扫码信号 M1.5 |
|
|
|
//CompleteListen("M1.5", "扫码信号", OnScanTheCodeInformation); |
|
|
|
// //获取校准值-增加两个果糖通道 |
|
|
|
// ModbusTcpServer.get().ReadShort("VW100", 12, (shorts) -> { |
|
|
|
// for (int i = 0; i < shorts.length; i++) { |
|
|
|
// CalibrationValue.put(i + 1, shorts[i]); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// |
|
|
|
// //获取称当前重量 |
|
|
|
// ModbusTcpServer.get().ReadInt("VD260", 9, ints -> { |
|
|
|
// for (int i = 0; i < ints.length; i++) { |
|
|
|
// CallCurrentWeight.put(i + 1, ints[i]); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// |
|
|
|
// //获取温度参数 |
|
|
|
// ModbusTcpServer.get().ReadInt("VD310", 3, ints -> { |
|
|
|
// FructoseTemperature1=ints[0]; |
|
|
|
// FructoseTemperature2=ints[1]; |
|
|
|
// WashTheTankTemperature=ints[2]; |
|
|
|
// }); |
|
|
|
// |
|
|
|
// |
|
|
|
// //获取清洗参数 |
|
|
|
// ModbusTcpServer.get().ReadShort("VW140", 5, shorts -> { |
|
|
|
// DrainageTime = shorts[0]; |
|
|
|
// AddCleaningAgentTime = shorts[1]; |
|
|
|
// InletTime = shorts[2]; |
|
|
|
// CyclicCleaningTime = shorts[3]; |
|
|
|
// CleaningAndHeatingTime = shorts[4]; |
|
|
|
// }); |
|
|
|
// |
|
|
|
// //获取清洗参数 |
|
|
|
// ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { |
|
|
|
// WeightCalibrationMode = booleans[0]; |
|
|
|
// }); |
|
|
|
// |
|
|
|
// ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { |
|
|
|
// WeightCalibrationMode = booleans[0]; |
|
|
|
// }); |
|
|
|
// //IoStatus |
|
|
|
// |
|
|
|
// |
|
|
|
// //读取当前扫码信息 |
|
|
|
// ModbusTcpServer.get().ReadString("VW342", 20, (data) -> { |
|
|
|
// |
|
|
|
// if(!Code.equals(data)) |
|
|
|
// { |
|
|
|
// if(!data.isEmpty() && OnScanTheCodeInformationT!=null) |
|
|
|
// { |
|
|
|
// MessageLog.ShowInfo("当前扫码信息:"+data); |
|
|
|
// OnScanTheCodeInformationT.Run(data); |
|
|
|
// } |
|
|
|
// Code=data; |
|
|
|
// } |
|
|
|
// //1.查询订单信息 |
|
|
|
// //2.展示订单界面 |
|
|
|
// //3.制作订单信息 |
|
|
|
// //4.回馈订单信息 |
|
|
|
// }); |
|
|
|
// |
|
|
|
// //读取实时状态 |
|
|
|
// ModbusTcpServer.get().ReadStatus("VW382", 3, data -> { |
|
|
|
// for (int i = 0; i < data.length; i++) { |
|
|
|
// byte status=data[i];//0x92 |
|
|
|
// IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1); |
|
|
|
// IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1); |
|
|
|
// IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1); |
|
|
|
// IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1); |
|
|
|
// IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1); |
|
|
|
// IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1); |
|
|
|
// IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1); |
|
|
|
// IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// |
|
|
|
// //配料完成 M0.3 |
|
|
|
// CompleteListen("M0.3", "配料完成", OnChargeMixtureCompleteNotify); |
|
|
|
// |
|
|
|
// //清洗完成 M0.6 |
|
|
|
// CompleteListen("M0.6", "清洗完成", OnCleaningCompleteNotify); |
|
|
|
// |
|
|
|
// //去皮完成 M1.3 |
|
|
|
// CompleteListen("M1.3", "去皮完成", OnPeelingCompleteNotify); |
|
|
|
|
|
|
|
Thread.sleep(10); |
|
|
|
} |
|
|
|