修改 ssj tsj srgv cdz的读取调度,监控调度

This commit is contained in:
liuhanqing
2026-01-05 14:10:56 +08:00
parent f209620cd7
commit 5fe90b8bb4
12 changed files with 124 additions and 136 deletions

View File

@@ -2,15 +2,21 @@ package com.ruoyi.schedule;
import com.ruoyi.common.domain.CustomThread;
import com.ruoyi.common.domain.PlcConnectInfo;
import com.ruoyi.device.cdz.domain.DeviceCdz;
import com.ruoyi.device.cdz.service.IDeviceCdzService;
import com.ruoyi.device.ddj.domain.MsgDdj;
import com.ruoyi.device.ddj.service.IMsgDdjService;
import com.ruoyi.device.srgv.domain.DeviceSrgv;
import com.ruoyi.device.srgv.service.IDeviceSrgvService;
import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.device.ssj.service.IDeviceSsjService;
import com.ruoyi.device.tsj.domain.DeviceTsj;
import com.ruoyi.device.tsj.service.IDeviceTsjService;
import com.ruoyi.schedule.plcRead.cdz.PlcCdzRead;
import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
import com.ruoyi.schedule.plcRead.srgv.PlcSrgvRead;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
import com.ruoyi.schedule.plcRead.tsj.PlcTsjRead;
import com.ruoyi.schedule.scheduleTask.cdz.CdzThread;
import com.ruoyi.schedule.scheduleTask.ddj.impl.Ddj1Thread;
import com.ruoyi.schedule.scheduleTask.monit.MonitoringThread;
@@ -31,25 +37,27 @@ import java.util.concurrent.ConcurrentHashMap;
public class ScheduleThread {
public CustomThread<PlcSsjRead> plcSsjReadCustomThread;
public CustomThread<PlcTsjRead> plcTsjReadCustomThread;
public CustomThread<PlcCdzRead> plcCdzReadCustomThread;
public CustomThread<PlcSrgvRead> plcSrgvReadCustomThread1;
public CustomThread<PlcSrgvRead> plcSrgvReadCustomThread2;
public CustomThread<PlcSrgvRead> plcSrgvReadCustomThread3;
public CustomThread<MonitoringThread> monitoringCustomThread;
public CustomThread<SsjThread> ssjThreadCustomThread;
public CustomThread<SRgv1Thread> sRgvThreadCustomThread;
public CustomThread<TsjThread> tsjThreadCustomThread;
public CustomThread<CdzThread> cdzThreadCustomThread;
// public CustomThread<Ddj1Thread> ddj1CustomThread;
/*public CustomThread<Ddj2Thread> ddj2CustomThread;
public CustomThread<Ddj3Thread> ddj3CustomThread;
public CustomThread<Ddj4Thread> ddj4CustomThread;
public CustomThread<Ddj5Thread> ddj5CustomThread;
public CustomThread<Ddj6Thread> ddj6CustomThread;*/
@Autowired
private IDeviceSsjService deviceSsjService;
@Autowired
private IDeviceSrgvService deviceSrgvService;
@Autowired
private IDeviceTsjService deviceTsjService;
@Autowired
private IDeviceCdzService deviceCdzService;
private boolean isRun = false;
private boolean isRun2 = false;
@@ -111,6 +119,7 @@ public class ScheduleThread {
Thread plcSsjReadThread = new Thread(plcSsjRead);
plcSsjReadCustomThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
//四向车读取线程
ConcurrentHashMap<String, DeviceSrgv> srgvList = new ConcurrentHashMap<>();
List<DeviceSrgv> srgvs=deviceSrgvService.selectDeviceSrgvList(new DeviceSrgv());
for(DeviceSrgv srgv:srgvs){
@@ -136,6 +145,25 @@ public class ScheduleThread {
}
PlcSrgvRead.deviceSrgvMap=srgvList;
//提升机读取线程
ConcurrentHashMap<String, DeviceTsj> tsjList = new ConcurrentHashMap<>();
List<DeviceTsj> deviceTsjs = deviceTsjService.selectDeviceTsjList(new DeviceTsj());
for (DeviceTsj deviceTsj : deviceTsjs) {
tsjList.put(deviceTsj.getId().toString(), deviceTsj);
}
PlcTsjRead plcTsjRead = new PlcTsjRead(tsjList,new PlcConnectInfo("127.0.0.1", 102));
Thread plcTsjReadThread = new Thread(plcTsjRead);
plcTsjReadCustomThread = new CustomThread<>(plcTsjReadThread, plcTsjRead);
//充电桩读取线程
ConcurrentHashMap<String, DeviceCdz> cdzList = new ConcurrentHashMap<>();
List<DeviceCdz> deviceCdzs = deviceCdzService.selectDeviceCdzList(new DeviceCdz());
for (DeviceCdz deviceCdz : deviceCdzs) {
cdzList.put(deviceCdz.getId().toString(), deviceCdz);
}
PlcCdzRead plcCdzRead = new PlcCdzRead(cdzList,new PlcConnectInfo("127.0.0.1", 102));
Thread plcCdzReadThread = new Thread(plcCdzRead);
plcCdzReadCustomThread = new CustomThread<>(plcCdzReadThread, plcCdzRead);
}
@@ -145,8 +173,10 @@ public class ScheduleThread {
public void startAllThread() {
plcSsjReadCustomThread.getThread().start();
plcSrgvReadCustomThread1.getThread().start();
//plcSrgvReadCustomThread2.getThread().start();
//plcSrgvReadCustomThread3.getThread().start();
plcSrgvReadCustomThread2.getThread().start();
plcSrgvReadCustomThread3.getThread().start();
plcTsjReadCustomThread.getThread().start();
plcCdzReadCustomThread.getThread().start();
isRun = true;
@@ -157,16 +187,11 @@ public class ScheduleThread {
*/
public void startAllThread2() {
monitoringCustomThread.thread.start();
ssjThreadCustomThread.thread.start();
//ssjThreadCustomThread.thread.start();
//tsjThreadCustomThread.thread.start();
sRgvThreadCustomThread.thread.start();
//sRgvThreadCustomThread.thread.start();
//cdzThreadCustomThread.thread.start();
// ddj1CustomThread.thread.start();
/*ddj2CustomThread.thread.start();
ddj3CustomThread.thread.start();
ddj4CustomThread.thread.start();
ddj5CustomThread.thread.start();
ddj6CustomThread.thread.start();*/
isRun2 = true;
}