This commit is contained in:
zj
2025-12-25 14:46:44 +08:00
parent 885fab377d
commit 88d01609d8
18 changed files with 363 additions and 120 deletions

View File

@@ -6,7 +6,8 @@ import com.ruoyi.device.ddj.service.IMsgDdjService;
import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.device.ssj.service.IDeviceSsjService;
import com.ruoyi.common.domain.PlcConnectInfo;
import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
import com.ruoyi.schedule.plcRead.ddj.PlcDdj1Read;
import com.ruoyi.schedule.plcRead.ddj.PlcDdj2Read;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
import com.ruoyi.common.domain.CustomThread;
import com.ruoyi.schedule.scheduleTask.ddj.Ddj1Thread;
@@ -31,8 +32,8 @@ import java.util.concurrent.ConcurrentHashMap;
public class ScheduleThread {
public CustomThread<PlcSsjRead> plcSsjReadCustomThread;
public CustomThread<PlcDdjRead> plcDdj1ReadCustomThread;
public CustomThread<PlcDdjRead> plcDdj2ReadCustomThread;
public CustomThread<PlcDdj1Read> plcDdj1ReadCustomThread;
public CustomThread<PlcDdj2Read> plcDdj2ReadCustomThread;
public CustomThread<Floor1BothWayInSsjThread> floor1BothWayInSsjCustomThread;
public CustomThread<Floor1BothWayOutSsjThread> floor1BothWayOutSsjCustomThread;
@@ -108,24 +109,28 @@ public class ScheduleThread {
PlcSsjRead.deviceSsjMap = ssjList;
//获取堆垛机
ConcurrentHashMap<String, MsgDdj> ddjList = new ConcurrentHashMap<>();
ConcurrentHashMap<String, MsgDdj> ddj1List = new ConcurrentHashMap<>();
ConcurrentHashMap<String, MsgDdj> ddj2List = 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:
plcDdj1ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread, plcDdjRead);
PlcDdj1Read plcDdj1Read = new PlcDdj1Read(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
Thread plcDdj1ReadThread = new Thread(plcDdj1Read);
plcDdj1ReadCustomThread = new CustomThread<PlcDdj1Read>(plcDdj1ReadThread, plcDdj1Read);
ddj1List.put("ddj1", msgDdj);
PlcDdj1Read.deviceDdjMap = ddj1List;
break;
case 2:
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread, plcDdjRead);
PlcDdj2Read plcDdj2Read = new PlcDdj2Read(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
Thread plcDdj2ReadThread = new Thread(plcDdj2Read);
plcDdj2ReadCustomThread = new CustomThread<PlcDdj2Read>(plcDdj2ReadThread, plcDdj2Read);
ddj2List.put("ddj2", msgDdj);
PlcDdj2Read.deviceDdjMap = ddj2List;
break;
}
ddjList.put("ddj" + msgDdj.getId(), msgDdj);
}
PlcDdjRead.deviceDdjMap = ddjList;
}
/**
@@ -143,9 +148,9 @@ public class ScheduleThread {
*/
public void startAllThread2() {
monitoringCustomThread.thread.start();
floor1BothWayInSsjCustomThread.thread.start();
floor1BothWayOutSsjCustomThread.thread.start();
floor1SingleSsjCustomThread.thread.start();
// floor1BothWayInSsjCustomThread.thread.start();
// floor1BothWayOutSsjCustomThread.thread.start();
// floor1SingleSsjCustomThread.thread.start();
floor2InSsjCustomThread.thread.start();
lineSsjCustomThread.thread.start();
floor2OutSsjCustomThread.thread.start();