堆垛机信号读取

This commit is contained in:
liuhanqing
2025-09-22 17:12:50 +08:00
parent baed4a312e
commit 006bba47da
19 changed files with 245 additions and 325 deletions

View File

@@ -3,9 +3,10 @@ package com.ruoyi.schedule;
import com.ruoyi.device.ddj.domain.MsgDdj;
import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.device.ssj.service.IDeviceSsjService;
import com.ruoyi.schedule.plcRead.ssj.domain.PlcConnectInfo;
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
import com.ruoyi.schedule.plcRead.ssj.domain.CustomThread;
import com.ruoyi.common.domain.PlcConnectInfo;
import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
import com.ruoyi.common.domain.CustomThread;
import com.ruoyi.schedule.scheduleTask.ddj.Ddj1Thread;
import com.ruoyi.schedule.scheduleTask.ddj.Ddj2Thread;
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1SsjInOutThread;
@@ -25,7 +26,8 @@ import java.util.concurrent.ConcurrentHashMap;
@Slf4j
public class ScheduleThread {
public CustomThread<PlcRead> customThread;
public CustomThread<PlcSsjRead> customSsjThread;
public CustomThread<PlcDdjRead> customDdjThread;
@Autowired
private IDeviceSsjService deviceSsjService;
@@ -88,19 +90,25 @@ public class ScheduleThread {
list.put(deviceSsj.getDeviceCode(), deviceSsj);
}
ConcurrentHashMap<String, MsgDdj> list2 = new ConcurrentHashMap<>();
//plc读取线程
PlcRead plcRead = new PlcRead(list,list2, ssjPlcConnectInfo);
Thread plcReadThread = new Thread(plcRead);
customThread = new CustomThread<PlcRead>(plcReadThread, plcRead);
//plc输送机读取线程
PlcSsjRead plcSsjRead = new PlcSsjRead(list, ssjPlcConnectInfo);
Thread plcSsjReadThread = new Thread(plcSsjRead);
customSsjThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
//plc堆垛机读取现场
ConcurrentHashMap<String, MsgDdj> list2 = new ConcurrentHashMap<>();
PlcDdjRead plcDdjRead = new PlcDdjRead(list2, ssjPlcConnectInfo);
Thread plcDdjReadThread = new Thread(plcDdjRead);
customDdjThread = new CustomThread<PlcDdjRead>(plcDdjReadThread, plcDdjRead);
}
/**
* 开始线程
*/
public void startAllThread() {
customThread.getThread().start();
customSsjThread.getThread().start();
customDdjThread.getThread().start();
isRun = true;
}
@@ -131,7 +139,8 @@ public class ScheduleThread {
* 停止线程
*/
public void stopAllThread() {
customThread.runnable.isRun = false;
customDdjThread.runnable.isRun = false;
customSsjThread.runnable.isRun = false;
plcReadInit();
isRun = false;
}