fix: ACS、PC对任务状态的变化
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
package cn.code.nl.module.task.api;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.CommonResult;
|
||||
import cn.code.nl.module.task.dto.TaskInfoDTO;
|
||||
import cn.code.nl.module.task.dto.TransportTaskCreateReqDTO;
|
||||
import cn.code.nl.module.task.dto.TaskCallbackResultReqDTO;
|
||||
import cn.code.nl.module.task.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@@ -30,4 +33,12 @@ public interface TransportTaskApi {
|
||||
@PostMapping(PREFIX + "/callback-result")
|
||||
@Operation(summary = "接收 LMS/WMS 业务处理结果")
|
||||
CommonResult<Boolean> receiveCallbackResult(@Valid @RequestBody TaskCallbackResultReqDTO reqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/getTaskById")
|
||||
@Operation(summary = "根据 taskId 查询任务")
|
||||
CommonResult<TaskInfoDTO> getTaskById(@RequestParam("taskId") Long taskId);
|
||||
|
||||
@GetMapping(PREFIX + "/getTaskByCode")
|
||||
@Operation(summary = "根据 taskCode 查询任务")
|
||||
CommonResult<TaskInfoDTO> getTaskByCode(@RequestParam("taskCode") String taskCode);
|
||||
}
|
||||
|
||||
@@ -18,13 +18,19 @@ public class AcsFeedbackReqDTO {
|
||||
@NotNull(message = "任务ID不能为空")
|
||||
private Long taskId;
|
||||
|
||||
@Schema(description = "ACS反馈状态:EXECUTING/PICKED/FINISHED/CANCELLED", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "任务编码")
|
||||
private String taskCode;
|
||||
|
||||
@Schema(description = "ACS反馈状态:EXECUTING/PICKED/FINISHED/CANCELLED/APPLYAGAIN", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "反馈状态不能为空")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "事件ID(幂等键)")
|
||||
private String eventId;
|
||||
|
||||
@Schema(description = "车号")
|
||||
private String carNo;
|
||||
|
||||
@Schema(description = "ACS反馈扩展数据")
|
||||
private Map<String, Object> payload;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package cn.code.nl.module.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 任务表的全量字段
|
||||
* @Author: liyongde
|
||||
* @Date: 2026/7/16 9:38
|
||||
*/
|
||||
@Data
|
||||
public class TaskInfoDTO implements Serializable {
|
||||
/**
|
||||
* 任务标识
|
||||
*/
|
||||
private Long taskId;
|
||||
/**
|
||||
* 任务编码
|
||||
*/
|
||||
private String taskCode;
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String taskName;
|
||||
/**
|
||||
* 业务归属服务:LMS/WMS,用于完成取消事件一级路由
|
||||
*/
|
||||
private String ownerService;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String bizType;
|
||||
/**
|
||||
* 业务侧标识
|
||||
*/
|
||||
private String bizId;
|
||||
/**
|
||||
* 业务回调处理器编码
|
||||
*/
|
||||
private String handleCode;
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private String taskType;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private String taskStatus;
|
||||
/**
|
||||
* ACS任务类型
|
||||
*/
|
||||
private String acsTaskType;
|
||||
/**
|
||||
* AGV系统类型
|
||||
*/
|
||||
private String agvSystemType;
|
||||
/**
|
||||
* ACS外部任务号
|
||||
*/
|
||||
private String externalTaskNo;
|
||||
/**
|
||||
* 取货点1
|
||||
*/
|
||||
private String pointCode1;
|
||||
/**
|
||||
* 放货点1
|
||||
*/
|
||||
private String pointCode2;
|
||||
/**
|
||||
* 取货点2
|
||||
*/
|
||||
private String pointCode3;
|
||||
/**
|
||||
* 放货点2
|
||||
*/
|
||||
private String pointCode4;
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private String vehicleType;
|
||||
/**
|
||||
* 载具数量
|
||||
*/
|
||||
private Long vehicleQty;
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
private String vehicleCode;
|
||||
/**
|
||||
* 载具编码2
|
||||
*/
|
||||
private String vehicleCode2;
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String carNo;
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
private String priority;
|
||||
/**
|
||||
* 生产区域
|
||||
*/
|
||||
private String productArea;
|
||||
/**
|
||||
* 是否自动下发
|
||||
*/
|
||||
private String isAutoIssue;
|
||||
/**
|
||||
* 任务组标识
|
||||
*/
|
||||
private Long taskGroupId;
|
||||
/**
|
||||
* 任务组顺序号
|
||||
*/
|
||||
private Long sortSeq;
|
||||
/**
|
||||
* 任务完成类型
|
||||
*/
|
||||
private String finishedType;
|
||||
/**
|
||||
* 业务回调状态:PENDING/SUCCESS/FAILED
|
||||
*/
|
||||
private String callbackStatus;
|
||||
/**
|
||||
* 业务回调重试次数
|
||||
*/
|
||||
private Integer callbackRetryCount;
|
||||
/**
|
||||
* 业务回调失败原因
|
||||
*/
|
||||
private String callbackErrorMsg;
|
||||
/**
|
||||
* 生成方式
|
||||
*/
|
||||
private String createMode;
|
||||
/**
|
||||
* 创建任务请求参数
|
||||
*/
|
||||
private String requestParam;
|
||||
/**
|
||||
* 下发ACS的AcsTaskDto扩展报文
|
||||
*/
|
||||
private String dispatchParam;
|
||||
/**
|
||||
* ACS反馈参数
|
||||
*/
|
||||
private String resultParam;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -13,5 +13,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode TRANSPORT_TASK_STATUS_NOT_ALLOW = new ErrorCode(5003, "当前任务状态不允许此操作");
|
||||
ErrorCode TRANSPORT_TASK_CALLBACK_SEND_FAILED = new ErrorCode(5004, "业务回调发送失败");
|
||||
ErrorCode TRANSPORT_TASK_RUNNING_ALREADY_EXIST = new ErrorCode(5005, "已存在运行中的任务");
|
||||
ErrorCode TRANSPORT_TASK_OPERATION_NOT_SUPPORTED = new ErrorCode(5006, "不支持的任务操作类型");
|
||||
ErrorCode TRANSPORT_TASK_ALREADY_FINAL = new ErrorCode(5007, "任务已处于终态,不允许操作");
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.code.nl.module.task.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author: liyongde
|
||||
* @Date: 2026/7/16 11:03
|
||||
*/
|
||||
@Getter
|
||||
public enum FinishedTypeEnum {
|
||||
MANUAL("MANUAL", "人工完成"),
|
||||
AUTO("AUTO", "自动完成"),
|
||||
MANUAL_FORCE("MANUAL_FORCE", "人工强制完成");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
FinishedTypeEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.code.nl.module.task.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 任务操作类型枚举
|
||||
* <p>
|
||||
* acsAllowed:是否允许 ACS 反馈触发;pcAllowed:是否允许 PC 端触发
|
||||
*
|
||||
* @Author: liyongde
|
||||
* @Date: 2026/7/15 19:11
|
||||
*/
|
||||
@Getter
|
||||
public enum TaskOperationTypeEnum {
|
||||
|
||||
EXECUTING("EXECUTING", "执行中", true, false),
|
||||
|
||||
PICKED("PICKED", "取货完成", true, false),
|
||||
|
||||
FINISHED("FINISHED", "完成任务", true, true),
|
||||
|
||||
CANCELLED("CANCELLED", "取消任务", true, true),
|
||||
|
||||
APPLY_AGAIN("APPLY-AGAIN", "二次请求", true, false),
|
||||
|
||||
FORCE_FINISH("FORCE-FINISH", "强制完成", false, true);
|
||||
|
||||
/** 操作编码 */
|
||||
private final String code;
|
||||
/** 操作名称 */
|
||||
private final String name;
|
||||
/** 是否允许 ACS 反馈触发 */
|
||||
private final boolean acsAllowed;
|
||||
/** 是否允许 PC 端触发 */
|
||||
private final boolean pcAllowed;
|
||||
|
||||
TaskOperationTypeEnum(String code, String name, boolean acsAllowed, boolean pcAllowed) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.acsAllowed = acsAllowed;
|
||||
this.pcAllowed = pcAllowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据编码解析枚举(忽略大小写),找不到返回 null
|
||||
*/
|
||||
public static TaskOperationTypeEnum getByCode(String code) {
|
||||
for (TaskOperationTypeEnum type : values()) {
|
||||
if (type.getCode().equalsIgnoreCase(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user