修改请求入库、处理异常任务接口

This commit is contained in:
lsymicc
2026-04-01 15:49:06 +08:00
parent a438e20bb1
commit b0372a0fea
13 changed files with 239 additions and 51 deletions

View File

@@ -0,0 +1,36 @@
package com.ruoyi.api.domain.wcs2wms;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 请求响应信息
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult {
/**
* 状态码:200 成功,500 失败,400 参数错误
*/
private Integer code;
/**
* 请求是否成功
*/
private Integer success;
/**
* 提示信息
*/
private boolean message;
/**
* 成功时返回任务信息对象
*/
private Object result;
}

View File

@@ -0,0 +1,36 @@
package com.ruoyi.api.domain.wcs2wms.exception;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 出入库异常信息上报响应信息
*
* 【常见错误】
* 任务编号不可为空 未传 taskCode
* 未找到该任务信息xxxxx taskCode 对应的任务在系统中不存在
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaskExceptionReceive {
/**
* 系统生成的任务编号(唯一)
*/
private String taskCode;
/**
* 异请求时传入的 reqCode,原样回传
*/
private String reqCode;
/**
* 转存库位编号
*/
private String siteCode;
}

View File

@@ -4,19 +4,42 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 出入库异常信息上报
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaskExceptionRequest {
/**
* 任务号
* 异常任务类型
*/
private String taskNo;
private String taskTypeCode;
/**
* 异常类型
* 需要上报异常的任务编号(系统任务号)
*/
private int exceptionType;
private String taskCode;
/**
* 异常类别:1-入库,2-出库
*/
private String taskClass;
/**
* 请求唯一编号,原样回传
*/
private String reqCode;
/**
* 异常信息
*/
private String adverseCauses;
/**
* 异常任务的类型 - 1052-入库有货,2-出库无货
*/
private int type;
}

View File

@@ -1,29 +1,43 @@
package com.ruoyi.api.domain.wcs2wms.stockin;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 入库请求返回
*
* 【常见错误】
* 任务类型不可为空 未传 taskTypeCode
* 该任务类型未配置 taskTypeCode 在系统中不存在
* 该任务类型无点位配置信息 任务类型缺少点位模板
* 该任务类型未开启 任务类型状态为禁用
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StockinReceive {
/**
* wms下发任务号
* 系统生成的任务编号(唯一)
*/
private String taskNo;
private String taskCode;
/**
* WMS分配的目标库位编号
* 请求时传入的 reqCode,原样回传
*/
private String cargoSpaceId;
private String reqCode;
/**
* 巷道编号
* 容器编号(containerCode)
*/
private String roadwayId;
private String cntCode;
/**
* 作业单ID
* 终点库位编号
*/
private String jobId;
private String siteCode;
/**
* 入出库标识
*/
private String inOrOut;
}

View File

@@ -13,24 +13,34 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class StockinRequest {
/**
* 任务类型编号(必填),对应 WMS 任务配置中的类型 code
*/
private String taskTypeCode;
/**
* 请求码 - 请求唯一编号,原样回传到响应中,便于追踪
*/
private String reqCode;
/**
* 托盘号
*/
private String trayCode;
private String cntCode;
/**
* 重量
* 货物高度 - 0-第一档高度,1-第二档高度,2-超高
*/
private int weight;
private String altimetry;
/**
* 货物高度
* 重量 - 0-正常,1-超重。
*/
private int height;
private String weight;
/**
* 异常信息
*/
private String errorInfo;
private String adverseCauses;
}

View File

@@ -1,22 +1,32 @@
package com.ruoyi.api.domain.wcs2wms.taskFinish;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 任务完成回传请求
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaskFinishRequest {
/**
* 任务号
* 任务类型(必填)
*/
private String taskNo;
private String taskTypeCode;
/**
* 作业单ID
* 请求唯一编号,原样回传到响应中,便于追踪
*/
private String jobId;
private String reqCode;
/**
* 完成类型枚举值
* 1-入库完成 2-出库完成
* 任务编号
*/
private String type;
private String taskCode;

View File

@@ -1,4 +1,36 @@
package com.ruoyi.api.domain.wcs2wms.taskFinish;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 任务完成回传响应
*
* 【常见错误】
* 任务编号不可为空 未传 taskCode
* 未找到该任务信息xxxxx taskCode 对应的任务在系统中不存在
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class taskFinishReceive {
/**
* 任务类型(必填)
*/
private String taskTypeCode;
/**
* 请求唯一编号,原样回传到响应中,便于追踪
*/
private String reqCode;
/**
* 任务编号
*/
private String taskCode;
}

View File

@@ -75,7 +75,7 @@ Y锁、N开 */
/** 货位高度 */
@Excel(name = "货位高度")
private String cargoHight;
private String cargoHeight;
/** 是否双伸 Y N */
@Excel(name = "是否双伸 Y N ")

View File

@@ -3,7 +3,7 @@ package com.ruoyi.common;
public class Constant {
public static final String WMS_BASE_URL = "http://192.168.58.10:8082/api2wms/";
public static final String WMS_BASE_URL = "http://192.168.58.10:8082/api2wms";
public static final String RCS_BASE_URL = "http://192.168.58.101:8182/rcms/services/rest/hikRpcService/";
//#region AGV接口url
@@ -27,16 +27,16 @@ public class Constant {
/**
* 向wms请求入库url
*/
public static final String WMS_STOCKIN_MYDOJOB = WMS_BASE_URL + "wcs/inbound/info";
public static final String WMS_STOCKIN_MYDOJOB = WMS_BASE_URL + "/api/external/taskIssue";
/**
* 向wms请求任务回传url
*/
public static final String WMS_TASK_FINISH = WMS_BASE_URL + "wcs/task/complete";
public static final String WMS_TASK_FINISH = WMS_BASE_URL + "/api/external/taskIssue";
/**
* 异常信息回传url
*/
public static final String WMS_TASK_EXCEPTION = WMS_BASE_URL + "wcs/exception/report";
public static final String WMS_TASK_EXCEPTION = WMS_BASE_URL + "/api/external/taskIssue";
}

View File

@@ -8,7 +8,7 @@ public class TaskExceptionType {
/**
* 任务异常 - 入库放货有货
*/
public static final int TASK_EXCEPTION_STOCKIN_OCCUPIED = 1;
public static final int TASK_EXCEPTION_STOCKIN_OCCUPIED = 1052;
/**
* 任务异常 - 出库取货无货

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.ObjUtil;
import com.ruoyi.api.domain.wcs2wms.JobParam;
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest;
@@ -150,9 +151,16 @@ public class DdjThread implements Runnable {
mydoJob.setStatus("1");
mydoJobService.updateMydoJob(mydoJob);
//向wms请求重分接口
// todo-在此商定每种异常类型对应的值
AjaxResult ajaxResult = apiService.reAssign(new TaskExceptionRequest(mydoJob.getTaskNo(),TASK_EXCEPTION_STOCKIN_OCCUPIED));
//上报异常 - 向wms请求重分接口
TaskExceptionRequest taskExceptionRequest = new TaskExceptionRequest();
taskExceptionRequest.setTaskClass(mydoJob.getInOrOut());
taskExceptionRequest.setType(TASK_EXCEPTION_STOCKIN_OCCUPIED);
taskExceptionRequest.setTaskCode(String.valueOf(mydoJob));
taskExceptionRequest.setTaskTypeCode("");//todo 不知道填什么内容
taskExceptionRequest.setReqCode(UUID.randomUUID().toString());
taskExceptionRequest.setAdverseCauses("当前位置已有货物,盘点后重新分配货位");
AjaxResult ajaxResult = apiService.reAssign(taskExceptionRequest);
if (ajaxResult.isSuccess()){
//获取返回的新货位
MydoJob mydoJobReAssign = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
@@ -188,7 +196,15 @@ public class DdjThread implements Runnable {
//找到对应任务 调用api接口 取货无货,重新分配单据
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
//向wms返回异常信息
AjaxResult ajaxResult = apiService.reMaterial(new TaskExceptionRequest(mydoJob.getTaskNo(),TASK_EXCEPTION_STOCKOUT_EMPTY));
TaskExceptionRequest taskExceptionRequest = new TaskExceptionRequest();
taskExceptionRequest.setTaskClass(mydoJob.getInOrOut());
taskExceptionRequest.setType(TASK_EXCEPTION_STOCKOUT_EMPTY);
taskExceptionRequest.setTaskCode(String.valueOf(mydoJob));
taskExceptionRequest.setTaskTypeCode("");//todo 不知道填什么内容
taskExceptionRequest.setReqCode(UUID.randomUUID().toString());
taskExceptionRequest.setAdverseCauses("取货位置空,盘点后作废该任务");
AjaxResult ajaxResult = apiService.reMaterial(taskExceptionRequest);
if (ajaxResult.isSuccess()) {
//作废作业
InvalidMydoJob(rwh, ddj.getId());

View File

@@ -2,8 +2,11 @@ package com.ruoyi.schedule.scheduleTask.ssj;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.ruoyi.api.domain.wcs2wms.ResponseResult;
import com.ruoyi.api.domain.wcs2wms.stockin.StockinReceive;
import com.ruoyi.api.service.IApiService;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
@@ -98,11 +101,14 @@ public class PortConvThread implements Runnable {
//---------------------------入口取输送机(叉车取放货位置)---------------------------
//输送机【非空闲】、【输送到位】、【条码不为空】、有【入库请求】
if (inSsjDevice.getKx() != 1 && inSsjDevice.getDw() == 1) {
AjaxResult ajaxResult;
//请求参数
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("trayCode", inSsjDevice.getTrayCode());//托盘条码
paramMap.put("taskTypeCode", inSsjDevice.getTrayCode());//任务类型编号
paramMap.put("reqCode", UUID.randomUUID().toString());//任请求码
paramMap.put("cntCode", inSsjDevice.getTrayCode());//容器编号
int height = inSsjDevice.getHeight();
int weight = inSsjDevice.getWeight();
paramMap.put("weight", weight);//重量
@@ -113,7 +119,7 @@ public class PortConvThread implements Runnable {
//外形检测异常
case ConvException.CHECK_SIZE_EXCEPTION:
paramMap.put("errorInfo", "外形检测异常-货物超高");
paramMap.put("adverseCauses", "外形检测异常-货物超高");
ajaxResult = apiService.createInMydoJobException(paramMap);
if (ajaxResult.isSuccess()) {
//向输送机下发退回
@@ -123,7 +129,7 @@ public class PortConvThread implements Runnable {
//超重检测
case ConvException.CHECK_OVERWEIGHT_EXCEPTION:
paramMap.put("errorInfo", "外形检测异常-货物超重");
paramMap.put("adverseCauses", "外形检测异常-货物超重");
ajaxResult = apiService.createInMydoJobException(paramMap);
if (ajaxResult.isSuccess()) {
//向输送机下发退回
@@ -134,11 +140,11 @@ public class PortConvThread implements Runnable {
//扫码异常
case ConvException.CHECK_BARCODE_EXCEPTION:
if (inSsjDevice.getTrayCode() == "") {
paramMap.put("errorInfo", "条码扫描失败:扫描结果为空");
paramMap.put("adverseCauses", "条码扫描失败:扫描结果为空");
ajaxResult = apiService.createInMydoJobException(paramMap);
}else{
//条码格式校验
paramMap.put("errorInfo", "条码扫描异常:格式错误");
paramMap.put("adverseCauses", "条码扫描异常:格式错误");
ajaxResult = apiService.createInMydoJobException(paramMap);
}
if (ajaxResult.isSuccess()) {
@@ -172,8 +178,13 @@ public class PortConvThread implements Runnable {
//请求生成wcs任务
ajaxResult = apiService.createInMydoJob(paramMap);
if (ajaxResult.isSuccess()) {
//获取wms下发的任务号和分配货位
MydoJob mydoJob = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
StockinReceive result = BeanUtil.toBean(ajaxResult.get("result"), StockinReceive.class);
MydoJob mydoJob = new MydoJob();
mydoJob.setTrayCode(result.getCntCode());
mydoJob.setCargoSpaceId(result.getSiteCode());
// mydoJob.setTaskNo(result.getTaskCode());//todo 确定是否用获取的任务号作为wcs的任务号
//todo 校验wms分配的货位(排列层)是否合法
if (mydoJob.getCargoSpaceId() == null) {

View File

@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="status" column="status" />
<result property="locked" column="locked" />
<result property="trayCode" column="tray_code" />
<result property="cargoHight" column="cargo_hight" />
<result property="cargoHeight" column="cargo_height" />
<result property="issDouble" column="iss_double" />
<result property="groupCodingNo" column="group_coding_no" />
<result property="groupCoding" column="group_coding" />
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBasCargoSpaceVo">
select cargo_space_id, warehouse_id, roadway_id, cargo_area_id, the_type, the_type_name, cargo_space_name, the_platoon, the_column, the_floor, status, locked, tray_code, cargo_hight, iss_double, group_coding_no, group_coding, cargo_space_logo, this_cargo_area, wms_cargo_space_id from bas_cargo_space
select cargo_space_id, warehouse_id, roadway_id, cargo_area_id, the_type, the_type_name, cargo_space_name, the_platoon, the_column, the_floor, status, locked, tray_code, cargo_height, iss_double, group_coding_no, group_coding, cargo_space_logo, this_cargo_area, wms_cargo_space_id from bas_cargo_space
</sql>
<select id="selectBasCargoSpaceList" parameterType="BasCargoSpace" resultMap="BasCargoSpaceResult">
@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="locked != null and locked != ''"> and locked = #{locked}</if>
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
<if test="cargoHight != null and cargoHight != ''"> and cargo_hight = #{cargoHight}</if>
<if test="cargoHeight != null and cargoHeight != ''"> and cargo_height = #{cargoHeight}</if>
<if test="issDouble != null and issDouble != ''"> and iss_double = #{issDouble}</if>
<if test="groupCodingNo != null and groupCodingNo != ''"> and group_coding_no = #{groupCodingNo}</if>
<if test="groupCoding != null and groupCoding != ''"> and group_coding = #{groupCoding}</if>
@@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">status,</if>
<if test="locked != null and locked != ''">locked,</if>
<if test="trayCode != null">tray_code,</if>
<if test="cargoHight != null">cargo_hight,</if>
<if test="cargoHeight != null">cargo_height,</if>
<if test="issDouble != null">iss_double,</if>
<if test="groupCodingNo != null">group_coding_no,</if>
<if test="groupCoding != null">group_coding,</if>
@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">#{status},</if>
<if test="locked != null and locked != ''">#{locked},</if>
<if test="trayCode != null">#{trayCode},</if>
<if test="cargoHight != null">#{cargoHight},</if>
<if test="cargoHeight != null">#{cargoHeight},</if>
<if test="issDouble != null">#{issDouble},</if>
<if test="groupCodingNo != null">#{groupCodingNo},</if>
<if test="groupCoding != null">#{groupCoding},</if>
@@ -129,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">status = #{status},</if>
<if test="locked != null and locked != ''">locked = #{locked},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="cargoHight != null">cargo_hight = #{cargoHight},</if>
<if test="cargoHeight != null">cargo_height = #{cargoHeight},</if>
<if test="issDouble != null">iss_double = #{issDouble},</if>
<if test="groupCodingNo != null">group_coding_no = #{groupCodingNo},</if>
<if test="groupCoding != null">group_coding = #{groupCoding},</if>