堆垛机线程调度 输送线线程调度 监控线程调度

This commit is contained in:
liuhanqing
2025-09-25 14:15:35 +08:00
parent 9640507cfd
commit 0322611d7b
7 changed files with 140 additions and 238 deletions

View File

@@ -247,9 +247,9 @@ public class Ddj1Thread implements Runnable {
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc);
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc, jym);
if (devId==1){
return PlcDdjRead.WritetoDDJ("DB61.0", sendData);
return PlcDdjRead.WriteToDDJ("DB61.0", sendData);
}else {
return PlcDdjRead.WritetoDDJ("DB61.0", sendData);
return PlcDdjRead.WriteToDDJ("DB61.0", sendData);
}
}

View File

@@ -0,0 +1,48 @@
package com.ruoyi.schedule.scheduleTask.monit;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.device.ddj.service.IMsgDdjService;
import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.device.ssj.service.IDeviceSsjService;
import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
import lombok.extern.slf4j.Slf4j;
/**
* 监控线程
*/
@Slf4j
public class MonitoringThread implements Runnable {
public boolean isRun = true;
private IDeviceSsjService deviceSsjService;
private IMsgDdjService msgDdjService;
public void init() {
deviceSsjService = SpringUtils.getBean(IDeviceSsjService.class);
msgDdjService = SpringUtils.getBean(IMsgDdjService.class);
}
@Override
public void run() {
init();
while (isRun){
for (String ssjCode : PlcSsjRead.deviceSsjMap.keySet()) {
DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ssjCode);
deviceSsjService.updateDeviceSsj(deviceSsj);
}
for (String ddjCode : PlcDdjRead.deviceDdjMap.keySet()) {
msgDdjService.updateMsgDdj(PlcDdjRead.deviceDdjMap.get(ddjCode));
}
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
}

View File

@@ -1,83 +0,0 @@
package com.ruoyi.schedule.scheduleTask.ssj.common;
import com.ruoyi.api.service.IApiService;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.queue.agv.service.IAgvQueueService;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* 监控线程
*/
@Slf4j
public class MonitoringThread implements Runnable {
public HashMap<String, List<String>> ssjCodeList;
private IApiService apiService;
private IAgvQueueService agvQueueService;
public boolean isRun = true;
public void init() {
ssjCodeList = new HashMap<>();
ArrayList<String> ssjCodes = new ArrayList<>();
ssjCodes.add("L1002");
ssjCodes.add("L1004");
ssjCodeList.put("in", ssjCodes);
apiService = SpringUtils.getBean(IApiService.class);
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
log.info("初始化服务 {},{}", apiService, agvQueueService);
}
@Override
public void run() {
init();
while (isRun){
for (String type : ssjCodeList.keySet()) {
switch ( type){
case "in":
//生产线入库
for (String ssjCode : ssjCodeList.get(type)) {
try {
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
} else {
log.error("设备不存在 ssjCode{}", ssjCode);
}
} catch (RuntimeException e) {
log.error(e.getMessage(),e);
}
}
break;
}
}
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
public void inDispatch(DeviceSsj inSsjDevice) {
//如果入库请求1 并且 托盘码不为空
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0 && inSsjDevice.getRkqq() == 1) {
//查询货位 排列层
//查询入口 排列层
//生成堆垛机队列
}
}
}

View File

@@ -1,84 +0,0 @@
package com.ruoyi.schedule.scheduleTask.ssj.common;
import com.ruoyi.api.service.IApiService;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.queue.agv.service.IAgvQueueService;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* 巷道口线程 到位+任务号+入库作业+货位未分配 请求wms生成货位 到位+任务号+入库作业+货位已分配 生成堆垛机入库队列
*/
@Slf4j
public class RoadwaySsjThread implements Runnable{
public HashMap<String, List<String>> ssjCodeList;
private IApiService apiService;
private IAgvQueueService agvQueueService;
public boolean isRun = true;
public void init() {
ssjCodeList = new HashMap<>();
ArrayList<String> ssjCodes = new ArrayList<>();
ssjCodes.add("L1002");
ssjCodes.add("L1004");
ssjCodeList.put("in", ssjCodes);
apiService = SpringUtils.getBean(IApiService.class);
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
log.info("初始化服务 {},{}", apiService, agvQueueService);
}
@Override
public void run() {
init();
while (isRun){
for (String type : ssjCodeList.keySet()) {
switch ( type){
case "in":
//生产线入库
for (String ssjCode : ssjCodeList.get(type)) {
try {
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
} else {
log.error("设备不存在 ssjCode{}", ssjCode);
}
} catch (RuntimeException e) {
log.error(e.getMessage(),e);
}
}
break;
}
}
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
public void inDispatch(DeviceSsj inSsjDevice) {
//如果入库请求1 并且 托盘码不为空
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0 && inSsjDevice.getRkqq() == 1) {
//查询货位 排列层
//查询入口 排列层
//生成堆垛机队列
}
}
}