修改接口

This commit is contained in:
lsymicc
2026-07-17 15:41:48 +08:00
parent 415543a723
commit f944d7fef5
14 changed files with 254 additions and 116 deletions

View File

@@ -12,6 +12,7 @@ import com.ruoyi.api.service.IApiService;
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.core.domain.AjaxResult;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.device.ssj.domain.DeviceSsj;
@@ -128,7 +129,7 @@ public class PortConvThread implements Runnable {
updateMydoJob(deviceSsj);
//请求wms获取入库任务
//requestMydoJob(deviceSsj);
requestMydoJob(deviceSsj);
break;
//1#巷道出库口(单向)
@@ -172,13 +173,22 @@ public class PortConvThread implements Runnable {
boolean flag = false;
//---------------------------入口取输送机(叉车取放货位置)---------------------------
//输送机【条码】空
if (inSsjDevice.getTrayCode() == "" || inSsjDevice.getTrayCode() == null) return flag;
if (inSsjDevice.getTrayCode() == "" || inSsjDevice.getTrayCode() == null)
return flag;
//不存在扫描【条码】的作业
if (mydoJobService.selectMydoJobList(
new MydoJob().builder().trayCode(inSsjDevice.getTrayCode()).build()
).size() == 1)
return flag;
//【入库请求】,表示输送到位和空闲
if (inSsjDevice.getRkqq() != 1) return flag;
if (inSsjDevice.getRkqq() != 1)
return flag;
//【输送高度】
if (inSsjDevice.getHeight() == 0) return flag;
if (inSsjDevice.getHeight() == 0)
return flag;
return true;
}
@@ -190,7 +200,8 @@ public class PortConvThread implements Runnable {
*/
private void requestMydoJob(DeviceSsj inSsjDevice){
//请求成功已经生成该任务则不继续执行
//如果已经生成wcs任务则不继续执行后续请求操作
//包括请求成功生成作业和wms推送成功的情况
int count = mydoJobService.selectInOrOutMydoJobList(
new MydoJob().builder().trayCode(inSsjDevice.getTrayCode()).build()
).size();
@@ -199,20 +210,20 @@ public class PortConvThread implements Runnable {
return;
}
String errorMessage = "";
AjaxResult ajaxResult;
//初始化请求wms参数
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("taskTypeCode", WMS_TASK_TYPE_STOCKIN);//wms自定义的任务类型编号
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
paramMap.put("cntCode", inSsjDevice.getTrayCode().trim());//容器编号
paramMap.put("trayCode", inSsjDevice.getTrayCode().trim());//容器编号
// paramMap.put("entranceId", inSsjDevice.getDeviceCode());//入口输送机编号
paramMap.put("roadwayId", ConvType.CONV_ROAD.get(inSsjDevice.getDeviceCode()));//入口输送机编号对应巷道
int height = inSsjDevice.getHeight();
// String weight = inSsjDevice.getWeight();//不需要直读重量或从plc读值,wms不需要该参数
// paramMap.put("weight", getWeightByMoxa(MOXA_IP, MOXA_PORT, SO_TIMEOUT_MS));//重量
paramMap.put("altimetry", height);//高度
paramMap.put("adverseCauses", errorMessage);
// paramMap.put("trayType", height);//高度
// paramMap.put("remark", errorMessage);
//-----------------警告校验:条码已有库存-----------------
@@ -231,9 +242,9 @@ public class PortConvThread implements Runnable {
StockinReceive result = BeanUtil.toBean(ajaxResult.get("data"), StockinReceive.class);
//校验:wms分配的货位(排列层)是否合法
if (ObjUtil.isNull(basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(result.getSiteCode()))) {
if (ObjUtil.isNull(basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(result.getCargoSpaceId()))) {
errorMessage = "wms下发货位错误,任务生成失败!";
paramMap.put("adverseCauses", errorMessage);
paramMap.put("remark", errorMessage);
apiService.createInMydoJobException(paramMap);
log.info("【响应参数异常】分配货位:null,无法生成作业,托盘条码:{}",inSsjDevice.getTrayCode());
writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 2, 1);
@@ -242,17 +253,16 @@ public class PortConvThread implements Runnable {
//初始化要生成的任务
MydoJob mydoJob = new MydoJob().builder()
// mydoJob.setTaskNo(result.getTaskCode());//如果需要用wms下发的任务号作为wcs的任务号使用
.trayCode(result.getCntCode())
.cargoSpaceId(result.getSiteCode())
.wmsTaskNo(result.getTaskCode())
.jobId(mydoJobService.getJobId("RK"))
.taskNo(mydoJobService.getTaskNo("1"))
.jobId(result.getJobId())
.taskNo(mydoJobService.getTaskNo("2"))//如果需要用wms下发的任务号作为wcs的任务号使用
.status(TASK_STATUS_CREATED)
.trayCode(result.getTrayCode())
.cargoSpaceId(result.getCargoSpaceId())
// .wmsTaskNo(mydoJobService.getTaskNo("1"))
.traySize(String.valueOf(inSsjDevice.getHeight()))
.status(TASK_STATUS_CREATED)
.inOrOut("1")
.roadwayId(basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(result.getSiteCode()).getRoadwayId())//获取货位表货位对应的巷道号
.entranceId("G1004")
.roadwayId(basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(result.getCargoSpaceId()).getRoadwayId())//获取货位表货位对应的巷道号
.entranceId(inSsjDevice.getDeviceCode())
.executionPhase(TASK_EP_CREATED)
.faultFlag("0")
.priority(10L)
@@ -290,8 +300,6 @@ public class PortConvThread implements Runnable {
MydoJob mydoJobStockin = new MydoJob().builder()
.trayCode(inSsjDevice.getTrayCode())
.status(TASK_STATUS_CREATED)
.executionPhase(TASK_EP_CREATED)
.entranceId(inSsjDevice.getDeviceCode())
.build();
if(!mydoJobService.selectMydoJobList(mydoJobStockin).isEmpty()){
@@ -305,6 +313,7 @@ public class PortConvThread implements Runnable {
//写入成功则更新执行阶段
mydoJobStockin.setStatus(TASK_STATUS_RUNNING);
mydoJobStockin.setExecutionPhase(TASK_EP_SSJ);
mydoJobStockin.setEntranceId(inSsjDevice.getDeviceCode());
mydoJobStockin.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
mydoJobService.updateMydoJob(mydoJobStockin);
log.info("【更新状态】G1009入口输送机下发成功,任务号:{},入库执行中", mydoJobStockin.getTaskNo());