测试过程问题修改

This commit is contained in:
zgw
2025-12-25 13:56:28 +08:00
parent 389ea2bb6c
commit 696e73b0a9
12 changed files with 226 additions and 101 deletions

View File

@@ -3,6 +3,8 @@ package com.ruoyi.schedule;
import HslCommunication.Core.Types.OperateResultExOne;
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;
@@ -11,6 +13,7 @@ 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.impl.DeviceTsjServiceImpl;
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;
@@ -35,6 +38,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class ScheduleThread {
public CustomThread<PlcSsjRead> plcSsjReadCustomThread;
public CustomThread<PlcCdzRead> plcCdzjReadCustomThread;
public CustomThread<PlcTsjRead> plcTsjReadCustomThread;
public CustomThread<PlcSrgvRead> plcSrgvReadCustomThread1;
public CustomThread<PlcSrgvRead> plcSrgvReadCustomThread2;
@@ -56,6 +60,9 @@ public class ScheduleThread {
@Autowired
private IDeviceSrgvService deviceSrgvService;
@Autowired
private IDeviceCdzService deviceCdzService;
private boolean isRun = false;
private boolean isRun2 = false;
@Autowired
@@ -91,26 +98,36 @@ public class ScheduleThread {
//提升机线程
TsjThread tsjThread=new TsjThread();
tsjThreadCustomThread=new CustomThread<>(new Thread(tsjThread),tsjThread);
// //充电线程
// CdzThread cdzThread = new CdzThread();
// cdzThreadCustomThread=new CustomThread<>(new Thread(cdzThread),cdzThread);
//充电线程
CdzThread cdzThread = new CdzThread();
cdzThreadCustomThread=new CustomThread<>(new Thread(cdzThread),cdzThread);
}
/**
* plc读取初始化
*/
private void plcReadInit() {
//plc输送机读取线程
ConcurrentHashMap<String, DeviceSsj> ssjList = new ConcurrentHashMap<>();
//获取要取的输送机
List<DeviceSsj> deviceSsjs = deviceSsjService.selectDeviceSsjList(new DeviceSsj());
for (DeviceSsj deviceSsj : deviceSsjs) {
ssjList.put(deviceSsj.getDeviceCode(), deviceSsj);
}
//plc输送机读取线程
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo("172.16.100.9", 1502));
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo("127.0.0.1", 1502));
Thread plcSsjReadThread = new Thread(plcSsjRead);
plcSsjReadCustomThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
//plc充电桩读取线程
ConcurrentHashMap<String, DeviceCdz> cdzList = new ConcurrentHashMap<>();
List<DeviceCdz> deviceCdzList =deviceCdzService.selectDeviceCdzList(new DeviceCdz());
for (DeviceCdz deviceCdz : deviceCdzList) {
cdzList.put(String.valueOf(deviceCdz.getId()),deviceCdz);
}
PlcCdzRead plcCdzRead = new PlcCdzRead(cdzList, new PlcConnectInfo("127.0.0.1", 1502));
Thread plcCdzReadThread = new Thread(plcCdzRead);
plcCdzjReadCustomThread = new CustomThread<PlcCdzRead>(plcCdzReadThread, plcCdzRead);
ConcurrentHashMap<String, DeviceTsj> tsjList = new ConcurrentHashMap<>();
//获取要取的提升机
List<DeviceTsj> tsjLists = deviceTsjServiceImpl.selectDeviceTsjList(new DeviceTsj());
@@ -118,7 +135,7 @@ public class ScheduleThread {
tsjList.put(t.getName(), t);
}
//plc提升机读取线程
PlcTsjRead plcTsjRead = new PlcTsjRead(tsjList, new PlcConnectInfo("172.16.100.9", 1502));
PlcTsjRead plcTsjRead = new PlcTsjRead(tsjList, new PlcConnectInfo("127.0.0.1", 1502));
Thread plcTsjReadThread = new Thread(plcTsjRead);
plcTsjReadCustomThread = new CustomThread<PlcTsjRead>(plcTsjReadThread, plcTsjRead);
@@ -154,6 +171,8 @@ public class ScheduleThread {
// plcSrgvReadCustomThread2.getThread().start();
plcTsjReadCustomThread.getThread().start();
monitoringCustomThread.getThread().start();
//充电桩读取线程
// plcCdzjReadCustomThread.getThread().start();
isRun = true;
}
@@ -164,7 +183,7 @@ public class ScheduleThread {
ssjThreadCustomThread.thread.start();
tsjThreadCustomThread.thread.start();
sRgvThreadCustomThread.thread.start();
//cdzThreadCustomThread.thread.start();
// cdzThreadCustomThread.thread.start();
isRun2 = true;
}