运行调整
This commit is contained in:
@@ -330,13 +330,13 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
|
||||
// 2.wms推送的目标货位是否已经有任务
|
||||
List<MydoJob> jobs = mydoJobService.selectMydoJobList(
|
||||
new MydoJob().builder().cargoSpaceId(receiveInJob.getCargoSpaceId()).build()
|
||||
);
|
||||
if (jobs.isEmpty()) {
|
||||
log.info("【请求错误】wms下发移库任务失败,已经存在该货位任务,推送作业号:{},源货位:{},目标货位:{}", receiveInJob.getJobId(), receiveInJob.getCargoSpaceId(), receiveInJob.getTargetCargoSpaceId());
|
||||
return AjaxResult.error("【请求错误】wms下发移库任务失败,已经存在目标货位任务,目标货位:{}" + receiveInJob.getJobId() + ",目标货位:" + receiveInJob.getCargoSpaceId());
|
||||
}
|
||||
// List<MydoJob> jobs = mydoJobService.selectMydoJobList(
|
||||
// new MydoJob().builder().cargoSpaceId(receiveInJob.getCargoSpaceId()).build()
|
||||
// );
|
||||
// if (jobs.isEmpty()) {
|
||||
// log.info("【请求错误】wms下发移库任务失败,已经存在该货位任务,推送作业号:{},源货位:{},目标货位:{}", receiveInJob.getJobId(), receiveInJob.getCargoSpaceId(), receiveInJob.getTargetCargoSpaceId());
|
||||
// return AjaxResult.error("【请求错误】wms下发移库任务失败,已经存在目标货位任务,目标货位:{}" + receiveInJob.getJobId() + ",目标货位:" + receiveInJob.getCargoSpaceId());
|
||||
// }
|
||||
|
||||
//生成入库作业
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
|
||||
@@ -20,8 +20,8 @@ public class TaskType {
|
||||
/**
|
||||
* 常规入库
|
||||
*/
|
||||
public static final int TASKTYPE_MOVE = 4;
|
||||
public static final String TASKTYPE_MOVE_STR = "4";
|
||||
public static final int TASKTYPE_MOVE = 5;
|
||||
public static final String TASKTYPE_MOVE_STR = "5";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -105,7 +105,7 @@ public class TaskHandler {
|
||||
);
|
||||
if (!jobs.isEmpty()) {
|
||||
for (MydoJob job : jobs) {
|
||||
mydoJobService.manualCompeleteTaskByTaskNo(job.getTaskNo());
|
||||
mydoJobService.manualCompeleteTaskByJobId(job.getJobId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class TaskHandler {
|
||||
|
||||
if (!jobs.isEmpty()) {
|
||||
for (MydoJob job : jobs) {
|
||||
mydoJobService.cancelTask(job.getTaskNo());
|
||||
mydoJobService.cancelTask(job.getJobId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.ruoyi.api.service.IRequestLogService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.common.ConvType;
|
||||
import com.ruoyi.common.TaskStatusCode;
|
||||
import com.ruoyi.common.TaskType;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
@@ -32,6 +33,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.ConvType.CONV_ROAD_ROADWAY;
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
||||
|
||||
@@ -115,6 +117,8 @@ public class RoadConvThread implements Runnable {
|
||||
|
||||
public void schedule(DeviceSsj roadSsjDevice) {
|
||||
|
||||
sendStackerMove();
|
||||
|
||||
switch (roadSsjDevice.getDeviceCode()){
|
||||
//1#巷道入库(双向)
|
||||
case "L1003":
|
||||
@@ -251,15 +255,15 @@ public class RoadConvThread implements Runnable {
|
||||
*/
|
||||
private boolean roadConvCheckedForStockout(DeviceSsj outSsjDevice){
|
||||
|
||||
boolean flag = true;
|
||||
//---------------------------巷道口取放货输送机---------------------------
|
||||
//输送机【任务号】和【到位】校验
|
||||
if (outSsjDevice.getTaskNo() != 0 || outSsjDevice.getDw() != 0) flag = false;
|
||||
if (outSsjDevice.getTaskNo() != 0 || outSsjDevice.getDw() != 0) return false;
|
||||
|
||||
//无入库作业
|
||||
List<MydoJob> jobs = mydoJobService.selectMydoJobList(new MydoJob());
|
||||
String roadwayId = CONV_ROAD_ROADWAY.get(outSsjDevice.getDeviceCode()).toString();
|
||||
//当前巷道无入库作业
|
||||
List<MydoJob> jobs = mydoJobService.selectMydoJobList(new MydoJob().builder().roadwayId(roadwayId).build());
|
||||
if (jobs.isEmpty() || jobs.stream().anyMatch(s -> Convert.toInt(s.getInOrOut()) < 20)){
|
||||
flag = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
//入口输送机无空闲和任务号
|
||||
@@ -269,7 +273,7 @@ public class RoadConvThread implements Runnable {
|
||||
if (ObjUtil.isNotNull(ssj)){
|
||||
if (ssj.getKx() != 1 || ssj.getTaskNo() != 0) {
|
||||
// log.info("L1002");
|
||||
flag = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,7 +283,7 @@ public class RoadConvThread implements Runnable {
|
||||
if (ObjUtil.isNotNull(ssj)){
|
||||
if (ssj.getKx() != 1 || ssj.getTaskNo() != 0){
|
||||
// log.info("L1004");
|
||||
flag = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,7 +293,7 @@ public class RoadConvThread implements Runnable {
|
||||
if (ObjUtil.isNotNull(ssj)){
|
||||
if (ssj.getKx() != 1 || ssj.getTaskNo() != 0) {
|
||||
// log.info("L1006");
|
||||
flag = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,12 +303,12 @@ public class RoadConvThread implements Runnable {
|
||||
if (ObjUtil.isNotNull(ssj)){
|
||||
if (ssj.getKx() != 1 || ssj.getTaskNo() != 0) {
|
||||
// log.info("L1009");
|
||||
flag = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +345,7 @@ public class RoadConvThread implements Runnable {
|
||||
// .wmsTaskNo(mydoJobService.getTaskNo("1"))
|
||||
.traySize(inSsjDevice.getHeight())
|
||||
.inOrOut("1")
|
||||
.roadwayId(String.valueOf(ConvType.CONV_ROAD_ROADWAY.get(inSsjDevice.getDeviceCode())))//获取货位表货位对应的巷道号
|
||||
.roadwayId(String.valueOf(CONV_ROAD_ROADWAY.get(inSsjDevice.getDeviceCode())))//获取货位表货位对应的巷道号
|
||||
.entranceId(inSsjDevice.getDeviceCode())
|
||||
.executionPhase(TASK_EP_CREATED)
|
||||
.faultFlag("0")
|
||||
@@ -445,7 +449,7 @@ public class RoadConvThread implements Runnable {
|
||||
//如果还没有wcs任务 - 生成一条任务
|
||||
if (mydoJobService.selectInOrOutMydoJobList(mydoJob).isEmpty()) {
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
log.info("【入库请求】请求生成wcs作业成功,wms任务号:{}, wcs任务号:{},托盘条码:{},分配货位:{}", mydoJob.getWmsTaskNo(), mydoJob.getTaskNo(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
log.info("【入库请求】请求生成wcs作业成功,wms任务号:{}, wcs任务号:{},托盘条码:{},分配货位:{}", mydoJob.getJobId(), mydoJob.getTaskNo(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
}
|
||||
|
||||
}else{
|
||||
@@ -630,5 +634,73 @@ public class RoadConvThread implements Runnable {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 向堆垛机发送【移库】任务
|
||||
*/
|
||||
private void sendStackerMove(){
|
||||
//---------------------------移库任务---------------------------
|
||||
|
||||
//检查是否有入库任务
|
||||
// MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(roadSsjDevice.getTaskNo()));
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(
|
||||
new MydoJob().builder().inOrOut(TaskType.TASKTYPE_MOVE_STR).build()
|
||||
);
|
||||
|
||||
if (mydoJobs.isEmpty()) return;
|
||||
|
||||
for (MydoJob moveJob : mydoJobs) {
|
||||
//检查执行阶段
|
||||
if (!moveJob.getExecutionPhase().equals(TASK_EP_CREATED) || !moveJob.getStatus().equals(TASK_EP_CREATED)) return;
|
||||
|
||||
//如果有入库任务 - 检查货位编码是否合法
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(moveJob.getCargoSpaceId());
|
||||
|
||||
int devId = 1;
|
||||
if (!basCargoSpace.getRoadwayId().equals("1")){
|
||||
devId = 2;
|
||||
}
|
||||
|
||||
if (ObjUtil.isNull(basCargoSpace)) {
|
||||
log.error("【任务异常】货位不存在 cargoSpaceId{}", moveJob.getCargoSpaceId());
|
||||
} else {
|
||||
//生成队列
|
||||
List<DdjDeviceExecutionQueue> list = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(
|
||||
new DdjDeviceExecutionQueue().builder().devId(Convert.toInt(moveJob.getRoadwayId())).build()
|
||||
);
|
||||
// List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
|
||||
BasCargoSpace cargo = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(moveJob.getCargoSpaceId());
|
||||
BasCargoSpace cargoTarget = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(moveJob.getTargetCargoSpaceId());
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(moveJob.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName("ddj" + devId);
|
||||
ddjDeviceExecutionQueue.setDevId(devId);
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(Convert.toInt(cargo.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setYlh(Convert.toInt(cargo.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setYch(Convert.toInt(cargo.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setMbph(Convert.toInt(cargoTarget.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setMblh(Convert.toInt(cargoTarget.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setMbch(Convert.toInt(cargoTarget.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(5);
|
||||
// ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize().toString());//货物高度
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
// ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_2);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
//修改作业状态
|
||||
moveJob.setStatus(TASK_STATUS_RUNNING);
|
||||
moveJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
moveJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(moveJob);
|
||||
|
||||
log.info("【堆垛机移库】生成移库队列,更新任务状态,等待堆垛机执行,任务号:{},源位置:{},目标位置:{}", moveJob.getTaskNo(), moveJob.getCargoSpaceId(), moveJob.getTargetCargoSpaceId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user