堆垛机读取修改

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

@@ -1,5 +1,6 @@
package com.ruoyi.schedule;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.device.ddj.domain.MsgDdj;
import com.ruoyi.device.ddj.service.IMsgDdjService;
import com.ruoyi.device.ssj.domain.DeviceSsj;
@@ -101,29 +102,29 @@ public class ScheduleThread {
for (DeviceSsj deviceSsj : deviceSsjs) {
ssjList.put(deviceSsj.getDeviceCode(), deviceSsj);
}
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo(deviceSsjs.get(0).getIpAddress(), Convert.toInt(deviceSsjs.get(0).getPort())));
Thread plcSsjReadThread = new Thread(plcSsjRead);
plcSsjReadCustomThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
PlcSsjRead.deviceSsjMap = ssjList;
//获取堆垛机
ConcurrentHashMap<String, MsgDdj> ddjList = new ConcurrentHashMap<>();
List<MsgDdj> msgDdjs = msgDdjService.selectMsgDdjList(new MsgDdj());
for (MsgDdj msgDdj : msgDdjs) {
msgDdj.setPlcDbReadAddress(msgDdj.getPlcDbReadAddress());
PlcDdjRead plcDdjRead = new PlcDdjRead(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
Thread plcDdjReadThread = new Thread(plcDdjRead);
switch (msgDdj.getId()){
case 1:
msgDdj.setPlcDbReadAddress("DB41.0");
PlcDdjRead plcDdjRead1 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
Thread plcDdjReadThread1 = new Thread(plcDdjRead1);
plcDdj1ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread1, plcDdjRead1);
plcDdj1ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread, plcDdjRead);
break;
case 2:
msgDdj.setPlcDbReadAddress("DB42.0");
PlcDdjRead plcDdjRead2 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.2", 102));
Thread plcDdjReadThread2 = new Thread(plcDdjRead2);
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread2, plcDdjRead2);
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread, plcDdjRead);
break;
}
ddjList.put("ddj" + msgDdj.getId(), msgDdj);
}
PlcDdjRead.deviceDdjMap = ddjList;
}