堆垛机读取修改

This commit is contained in:
liuhanqing
2025-11-21 10:29:06 +08:00
parent 341f21fa0e
commit a626f882f1
5 changed files with 22 additions and 20 deletions

View File

@@ -26,9 +26,10 @@ public class PlcDdjRead extends Thread {
private final String ip;
private final int port;
private boolean success = false;
private MsgDdj msgDdj;
public PlcDdjRead(ConcurrentHashMap<String, MsgDdj> deviceDdjMap, PlcConnectInfo plcConnectInfo) {
PlcDdjRead.deviceDdjMap = deviceDdjMap;
public PlcDdjRead(MsgDdj msgDdj, PlcConnectInfo plcConnectInfo) {
this.msgDdj = msgDdj;
this.ip = plcConnectInfo.getIp();
this.port = plcConnectInfo.getPort();
}
@@ -46,12 +47,7 @@ public class PlcDdjRead extends Thread {
while (isRun) {
try {
if (IsConnect()) {
for (String key : deviceDdjMap.keySet()) {
MsgDdj msgDdj = deviceDdjMap.get(key);
if (msgDdj != null) {
readPlcDdj(msgDdj);
}
}
readPlcDdj(msgDdj);
Thread.sleep(1000);
} else {
reConnect();