货位信息初始化

This commit is contained in:
liuhanqing
2025-09-23 14:10:14 +08:00
parent 543c7a6feb
commit 00e807f71c
11 changed files with 845 additions and 29 deletions

View File

@@ -1,7 +1,10 @@
package com.ruoyi.schedule.scheduleTask.ssj.floor1;
import cn.hutool.core.util.ObjUtil;
import com.ruoyi.api.service.IApiService;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.job.domain.MydoJob;
import com.ruoyi.job.service.IMydoJobService;
import com.ruoyi.queue.agv.service.IAgvQueueService;
import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
@@ -10,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 一楼单向出库线程 循环出库作业+巷道口空闲 生成堆垛机出库队列
@@ -20,20 +24,26 @@ public class Floor1SingleSsjThread implements Runnable {
public HashMap<String, List<String>> ssjCodeList;
private IApiService apiService;
private IAgvQueueService agvQueueService;
private IMydoJobService mydoJobService;
public boolean isRun = true;
private Map<String,String> exitRoadwayMap = new HashMap<>();
public void init() {
ssjCodeList = new HashMap<>();
ArrayList<String> ssjCodes = new ArrayList<>();
ssjCodes.add("L1002");
ssjCodes.add("L1004");
ssjCodeList.put("in", ssjCodes);
ssjCodes.add("L2001");
ssjCodes.add("L2007");
ssjCodeList.put("outRoadwaySsj", ssjCodes);
apiService = SpringUtils.getBean(IApiService.class);
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
log.info("初始化服务 {},{}", apiService, agvQueueService);
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
exitRoadwayMap.put("L2001","L2011");
exitRoadwayMap.put("L2007","L2014");
log.info("初始化服务 {},{}", apiService, mydoJobService);
}
@Override
@@ -41,23 +51,20 @@ public class Floor1SingleSsjThread implements Runnable {
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);
//一楼单向出库口
if ("outRoadwaySsj".equals(type)) {
for (String ssjCode : ssjCodeList.get(type)) {
try {
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
dispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
} else {
log.error("设备不存在 ssjCode{}", ssjCode);
}
} catch (RuntimeException e) {
log.error(e.getMessage(), e);
}
break;
}
}
}
try {
@@ -70,15 +77,14 @@ public class Floor1SingleSsjThread implements Runnable {
}
public void inDispatch(DeviceSsj inSsjDevice) {
public void dispatch(DeviceSsj ssj) {
//如果入库请求1 并且 托盘码不为空
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0 && inSsjDevice.getRkqq() == 1) {
//查询货位 排列层
//查询入口 排列层
//生成堆垛机队列
if (ssj.getKx()==1){
String exitId = exitRoadwayMap.get(ssj.getDeviceCode());
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(List.of(exitId));
if (ObjUtil.isNotNull(mydoJob)){
//生成队列
}
}
}