fix: 交互
This commit is contained in:
@@ -45,7 +45,10 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.extInterface.suray.SurayApi;
|
||||
import org.nl.extInterface.suray.data.req.TaskReceiveRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -68,7 +71,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
private List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
|
||||
|
||||
@Autowired
|
||||
private DeviceAppService appService;
|
||||
@Autowired
|
||||
private InstructionMapper instructionMapper;
|
||||
@Autowired
|
||||
@@ -77,6 +81,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
private RouteLineService routeLineService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private SurayApi surayApi;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -167,62 +173,76 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Instruction dto) throws Exception {
|
||||
format(dto);
|
||||
TaskDto task = taskService.findByCodeFromCache(dto.getTask_code());
|
||||
public void create(Instruction instruction) throws Exception {
|
||||
format(instruction);
|
||||
TaskDto task = taskService.findByCodeFromCache(instruction.getTask_code());
|
||||
if (task == null) {
|
||||
throw new BadRequestException("任务号为:" + dto.getTask_code() + "的任务不存在!");
|
||||
throw new BadRequestException("任务号为:" + instruction.getTask_code() + "的任务不存在!");
|
||||
}
|
||||
String now = DateUtil.now();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||
dto.setRoute_plan_code(task.getRoute_plan_code());
|
||||
if (StrUtil.isEmpty(instruction.getRoute_plan_code())) {
|
||||
instruction.setRoute_plan_code(task.getRoute_plan_code());
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.getPriority())) {
|
||||
dto.setPriority(task.getPriority());
|
||||
if (StrUtil.isEmpty(instruction.getPriority())) {
|
||||
instruction.setPriority(task.getPriority());
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.getInstruction_code())) {
|
||||
dto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
|
||||
if (StrUtil.isEmpty(instruction.getInstruction_code())) {
|
||||
instruction.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.getInstruction_id())) {
|
||||
dto.setInstruction_id(IdUtil.simpleUUID());
|
||||
if (StrUtil.isEmpty(instruction.getInstruction_id())) {
|
||||
instruction.setInstruction_id(IdUtil.simpleUUID());
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.instruction_status)) {
|
||||
dto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
if (StrUtil.isEmpty(instruction.instruction_status)) {
|
||||
instruction.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
}
|
||||
dto.setVehicle_code2(StrUtil.isEmpty(dto.getVehicle_code2()) ? task.getVehicle_code2() : dto.getVehicle_code2());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(currentNickName);
|
||||
dto.setCreate_time(now);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_name(currentNickName);
|
||||
dto.setUpdate_time(now);
|
||||
instruction.setVehicle_code2(StrUtil.isEmpty(instruction.getVehicle_code2()) ? task.getVehicle_code2() : instruction.getVehicle_code2());
|
||||
instruction.setCreate_id(currentUserId);
|
||||
instruction.setCreate_name(currentNickName);
|
||||
instruction.setCreate_time(now);
|
||||
instruction.setUpdate_id(currentUserId);
|
||||
instruction.setUpdate_name(currentNickName);
|
||||
instruction.setUpdate_time(now);
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(
|
||||
dto.getStart_device_code(), dto.getNext_device_code(), task.getRoute_plan_code());
|
||||
if (ObjectUtils.isEmpty(shortPathsList) && !StrUtil.equals(dto.getStart_device_code(), dto.getNext_device_code())) {
|
||||
throw new BadRequestException(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通");
|
||||
instruction.getStart_device_code(), instruction.getNext_device_code(), task.getRoute_plan_code());
|
||||
if (ObjectUtils.isEmpty(shortPathsList) && !StrUtil.equals(instruction.getStart_device_code(), instruction.getNext_device_code())) {
|
||||
throw new BadRequestException(instruction.getStart_device_code() + "->" + instruction.getNext_device_code() + "路由不通");
|
||||
}
|
||||
try {
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), RouteTypeEnum.NDC.getCode())) {
|
||||
//下发成功,否则失败
|
||||
dto.setSend_status(SendStatusEnum.SUCCESS.getCode());
|
||||
instruction.setSend_status(SendStatusEnum.SUCCESS.getCode());
|
||||
} else if (StrUtil.equals(shortPathsList.get(0).getType(), RouteTypeEnum.KUKA.getCode())) {
|
||||
//下发成功,否则失败
|
||||
dto.setSend_status(SendStatusEnum.SUCCESS.getCode());
|
||||
instruction.setSend_status(SendStatusEnum.SUCCESS.getCode());
|
||||
} else if (StrUtil.equals(shortPathsList.get(0).getType(), RouteTypeEnum.SURAY.getCode())) {
|
||||
//下发成功,否则失败
|
||||
dto.setSend_status(SendStatusEnum.SUCCESS.getCode());
|
||||
JSONObject paramObj = JSONObject.parseObject(task.getParam());
|
||||
TaskReceiveRequest request = new TaskReceiveRequest();
|
||||
request.setGroupId(IdUtil.getSnowflakeNextIdStr());
|
||||
request.setWarehouse(paramObj.getString("warehouse"));
|
||||
request.setPriorityCode(Integer.valueOf(instruction.getPriority()));
|
||||
TaskReceiveRequest.TaskItem taskItem = new TaskReceiveRequest.TaskItem();
|
||||
taskItem.setTaskId(instruction.getInstruction_code());
|
||||
taskItem.setTaskType(paramObj.getInteger("ioType"));
|
||||
taskItem.setStartNode(instruction.getStart_device_code());
|
||||
taskItem.setEndNode(instruction.getNext_device_code());
|
||||
taskItem.setBarCode(instruction.getVehicle_code());
|
||||
taskItem.setOrder(1);
|
||||
// todo: 下发失败的时候未处理
|
||||
surayApi.taskReceive(request);
|
||||
instruction.setSend_status(SendStatusEnum.SUCCESS.getCode());
|
||||
} else {
|
||||
//常规路由则未下发,等下发给电气后,电气上报任务号后,再更新成功
|
||||
dto.setSend_status(SendStatusEnum.NOT_SENT.getCode());
|
||||
instruction.setSend_status(SendStatusEnum.NOT_SENT.getCode());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status(SendStatusEnum.FAILED.getCode());
|
||||
dto.setRemark(e.getMessage());
|
||||
instruction.setSend_status(SendStatusEnum.FAILED.getCode());
|
||||
instruction.setRemark(e.getMessage());
|
||||
}
|
||||
instructionMapper.insert(ConvertUtil.convert(dto, InstructionMybatis.class));
|
||||
refreshInstructionCache(dto);
|
||||
instructionMapper.insert(ConvertUtil.convert(instruction, InstructionMybatis.class));
|
||||
refreshInstructionCache(instruction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,48 +12,47 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.task.TaskConfig;
|
||||
import org.nl.ApplicationAutoInitial;
|
||||
import org.nl.acs.task.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.task.service.mapper.TaskMapper;
|
||||
import org.nl.common.db.CommonFinalParam;
|
||||
import org.nl.acs.device.device.service.DeviceAppService;
|
||||
import org.nl.acs.device.device.service.entity.Device;
|
||||
import org.nl.acs.device.device.service.enums.DeviceType;
|
||||
import org.nl.acs.device.device.service.impl.DeviceAppServiceImpl;
|
||||
import org.nl.acs.task.TaskConfig;
|
||||
import org.nl.acs.task.instruction.domain.Instruction;
|
||||
import org.nl.acs.task.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.task.instruction.service.InstructionService;
|
||||
import org.nl.acs.task.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.device.device.service.DeviceAppService;
|
||||
import org.nl.acs.device.device.service.impl.DeviceAppServiceImpl;
|
||||
import org.nl.acs.task.route.domain.RoutePlan;
|
||||
import org.nl.acs.task.route.service.RouteLineService;
|
||||
import org.nl.acs.task.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.route.service.mapper.RoutePlanMapper;
|
||||
import org.nl.acs.task.task.domain.Task;
|
||||
import org.nl.acs.task.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.task.enums.TaskTypeEnum;
|
||||
import org.nl.acs.task.task.service.TaskService;
|
||||
import org.nl.acs.task.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.acs.task.task.service.dto.TaskQueryParam;
|
||||
import org.nl.acs.task.task.service.mapper.TaskMapper;
|
||||
import org.nl.common.db.CommonFinalParam;
|
||||
import org.nl.common.db.PageInfo;
|
||||
import org.nl.common.db.QueryHelpMybatisPlus;
|
||||
import org.nl.common.db.impl.CommonServiceImpl;
|
||||
import org.nl.acs.task.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.ConvertUtil;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
import org.nl.common.utils.PageUtil;
|
||||
import org.nl.acs.task.task.domain.Task;
|
||||
import org.nl.acs.task.task.service.TaskService;
|
||||
import org.nl.acs.task.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.task.service.dto.TaskQueryParam;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
|
||||
import org.nl.common.utils.*;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.extInterface.wms.WmsApi;
|
||||
import org.nl.extInterface.wms.constand.TaskFeedbackEnum;
|
||||
import org.nl.extInterface.wms.data.req.FeedbackStatusRequest;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@@ -82,6 +81,9 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
|
||||
@Resource
|
||||
private WmsApi wmsApi;
|
||||
|
||||
/**
|
||||
* 缓存
|
||||
* 存储未完成的任务信息
|
||||
@@ -460,7 +462,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
this.addTaskToCache(dto);
|
||||
//反馈上位系统任务状态
|
||||
|
||||
this.feedWmsTaskStatus(entity);
|
||||
this.feedWmsTaskStatus(entity, new HashMap<>());
|
||||
|
||||
}
|
||||
|
||||
@@ -498,7 +500,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
this.removeByCodeFromCache(entity.getTask_code());
|
||||
if (!TaskStatusEnum.FINISHED.getIndex().equals(updateTask.getTask_status())) {
|
||||
//反馈上位系统任务状态
|
||||
this.feedWmsTaskStatus(entity);
|
||||
this.feedWmsTaskStatus(entity, new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +529,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
//移除任务缓存信息
|
||||
this.removeByCodeFromCache(entity.getTask_code());
|
||||
//反馈上位系统任务状态
|
||||
this.feedWmsTaskStatus(entity);
|
||||
this.feedWmsTaskStatus(entity, new HashMap<>());
|
||||
}
|
||||
|
||||
|
||||
@@ -557,7 +559,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
//移除任务缓存信息
|
||||
this.removeByCodeFromCache(entity.getTask_code());
|
||||
//反馈上位系统任务状态
|
||||
this.feedWmsTaskStatus(entity);
|
||||
this.feedWmsTaskStatus(entity, new HashMap<>());
|
||||
}
|
||||
|
||||
|
||||
@@ -800,29 +802,21 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
*
|
||||
* @param taskDto
|
||||
*/
|
||||
private void feedWmsTaskStatus(TaskDto taskDto) {
|
||||
private void feedWmsTaskStatus(TaskDto taskDto, Map<String, Object> payload) {
|
||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||
TaskDto entity = this.findById(taskDto.getTask_id());
|
||||
String hasWms = paramService.findByCode(TaskConfig.HASWMS).getValue();
|
||||
if (!StrUtil.startWith(taskDto.getTask_code(), CommonFinalParam.HYPHEN_) && StrUtil.equals(hasWms, CommonFinalParam.ONE)) {
|
||||
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
// request.setTask_id(taskDto.getExt_task_id());
|
||||
// request.setTask_code(taskDto.getTask_code());
|
||||
// request.setTask_status(taskDto.getTask_status());
|
||||
// request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
||||
// request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
||||
JSONObject feed_jo = new JSONObject();
|
||||
feed_jo.put("task_id", entity.getExt_task_id());
|
||||
feed_jo.put("task_code", entity.getTask_code());
|
||||
feed_jo.put("task_status", entity.getTask_status());
|
||||
if (ObjectUtil.isNotEmpty(entity.getWeight())) {
|
||||
feed_jo.put("weight", entity.getWeight());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(entity.getCarno())) {
|
||||
feed_jo.put("car_no", entity.getCarno());
|
||||
}
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.add(feed_jo);
|
||||
|
||||
FeedbackStatusRequest request = new FeedbackStatusRequest();
|
||||
request.setTaskId(Long.parseLong(entity.getExt_task_id()));
|
||||
request.setTaskCode(entity.getTask_code());
|
||||
request.setCarNo(entity.getCarno());
|
||||
request.setEventId(IdUtil.simpleUUID());
|
||||
request.setPayload(payload);
|
||||
request.setStatus(TaskFeedbackEnum.getByCode(taskDto.getTask_status()).getName());
|
||||
wmsApi.feedbackTaskStatus(request);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ public class SubmitMissionRequest {
|
||||
private String orgId;
|
||||
private String requestId;
|
||||
private String missionCode;
|
||||
/**
|
||||
* 货 架(托 盘)移动:RACK_MOVE
|
||||
*/
|
||||
private String missionType;
|
||||
private String viewBoardType;
|
||||
private String robotType;
|
||||
|
||||
@@ -6,18 +6,25 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TaskReceiveRequest {
|
||||
/** 任务组号 */
|
||||
private String groupId;
|
||||
/** 下发时间 */
|
||||
private String msgTime;
|
||||
/** 优先级(任务中提供,默认值 = 1) */
|
||||
private Integer priorityCode;
|
||||
/** 仓库编码(任务扩展参数中获取) */
|
||||
private String warehouse;
|
||||
/** 任务 */
|
||||
private List<TaskItem> tasks;
|
||||
|
||||
@Data
|
||||
public static class TaskItem {
|
||||
private String taskId;
|
||||
/** 任务类型:0-入库;1-出库;2-移库 (任务扩展参数中获取) */
|
||||
private Integer taskType;
|
||||
private String startNode;
|
||||
private String endNode;
|
||||
/** 托盘号 */
|
||||
private String barCode;
|
||||
private Integer cargoSize;
|
||||
private Integer order;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.extInterface.suray.data.resp;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -7,4 +8,20 @@ public class TaskStatusReportResponse {
|
||||
private Integer returnStatus;
|
||||
private String returnInfo;
|
||||
private String msgTime;
|
||||
|
||||
|
||||
public static TaskStatusReportResponse success() {
|
||||
TaskStatusReportResponse taskStatusReportResponse = new TaskStatusReportResponse();
|
||||
taskStatusReportResponse.setReturnStatus(1);
|
||||
taskStatusReportResponse.setMsgTime(DateUtil.now());
|
||||
return taskStatusReportResponse;
|
||||
}
|
||||
|
||||
public static TaskStatusReportResponse failed(String message) {
|
||||
TaskStatusReportResponse taskStatusReportResponse = new TaskStatusReportResponse();
|
||||
taskStatusReportResponse.setReturnStatus(0);
|
||||
taskStatusReportResponse.setReturnInfo(message);
|
||||
taskStatusReportResponse.setMsgTime(DateUtil.now());
|
||||
return taskStatusReportResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package org.nl.extInterface.suray.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.task.instruction.domain.Instruction;
|
||||
import org.nl.acs.task.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.task.instruction.service.InstructionService;
|
||||
import org.nl.extInterface.suray.data.req.ApplyChangeEndRequest;
|
||||
import org.nl.extInterface.suray.data.req.EmptyPalletTaskApplyRequest;
|
||||
import org.nl.extInterface.suray.data.req.ErrorReportRequest;
|
||||
@@ -13,13 +16,19 @@ import org.nl.extInterface.suray.data.resp.ErrorReportResponse;
|
||||
import org.nl.extInterface.suray.data.resp.InwareTaskApplyResponse;
|
||||
import org.nl.extInterface.suray.data.resp.TaskStatusReportResponse;
|
||||
import org.nl.extInterface.suray.service.SurayToAcsService;
|
||||
import org.nl.extInterface.wms.WmsApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SurayToAcsServiceImpl implements SurayToAcsService {
|
||||
|
||||
@Resource
|
||||
private InstructionService instructionService;
|
||||
|
||||
@Override
|
||||
public InwareTaskApplyResponse applyInwareTask(InwareTaskApplyRequest request) {
|
||||
return null;
|
||||
@@ -32,7 +41,26 @@ public class SurayToAcsServiceImpl implements SurayToAcsService {
|
||||
|
||||
@Override
|
||||
public TaskStatusReportResponse reportTaskStatus(TaskStatusReportRequest request) {
|
||||
return null;
|
||||
Instruction instruction = instructionService.findByCodeFromCache(request.getTaskId());
|
||||
// 判断任务状态,0- 已接收 , 1- 任务开始,2-取货完成,3-任务中断,4-放货完成,8-任务结束
|
||||
if (1 == request.getTaskStatus()) {
|
||||
// 执行中
|
||||
if (instruction != null) {
|
||||
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instructionService.update(instruction);
|
||||
}
|
||||
}
|
||||
if (8 == request.getTaskStatus()) {
|
||||
// 任务完成
|
||||
if (instruction != null) {
|
||||
try {
|
||||
instructionService.finish(request.getTaskId());
|
||||
} catch (Exception e) {
|
||||
return TaskStatusReportResponse.failed(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return TaskStatusReportResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,11 +7,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.task.TaskConfig;
|
||||
import org.nl.common.base.ResponseData;
|
||||
import org.nl.extInterface.log.InterfaceLog;
|
||||
import org.nl.extInterface.wms.constand.WmsMethodConstand;
|
||||
import org.nl.extInterface.wms.constand.WmsMethodConstant;
|
||||
import org.nl.extInterface.wms.data.req.ApplyInboundReqVO;
|
||||
import org.nl.extInterface.wms.data.req.BundleInfoReqVO;
|
||||
import org.nl.extInterface.wms.data.req.CallTaskReqVO;
|
||||
import org.nl.extInterface.wms.data.req.FeedbackTaskStatusRequest;
|
||||
import org.nl.extInterface.wms.data.req.FeedbackStatusRequest;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -30,33 +30,40 @@ public class WmsApi {
|
||||
/**
|
||||
* 反馈任务状态
|
||||
*/
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstand.FEEDBACK_TASK_STATUS, description = "反馈任务状态")
|
||||
public ResponseEntity feedbackTaskStatus(FeedbackTaskStatusRequest request) {
|
||||
return post(WmsMethodConstand.FEEDBACK_TASK_STATUS, request);
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstant.FEEDBACK_TASK_STATUS, description = "反馈任务状态")
|
||||
public ResponseEntity feedbackTaskStatus(FeedbackStatusRequest request) {
|
||||
return post(WmsMethodConstant.FEEDBACK_TASK_STATUS, request);
|
||||
}
|
||||
/**
|
||||
* 反馈业务状态
|
||||
*/
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstant.FEEDBACK_BUSINESS_STATUS, description = "反馈业务状态")
|
||||
public ResponseEntity feedbackBusinessStatus(FeedbackStatusRequest request) {
|
||||
return post(WmsMethodConstant.FEEDBACK_BUSINESS_STATUS, request);
|
||||
}
|
||||
/**
|
||||
* 请求入库:WMS根据不同的类型自行区分;6-申请空拖盘入库;7-申请空木箱入库;8-申请退货入库;9-申请成品入库
|
||||
*/
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstand.APPLY_INBOUND_TASK, description = "输送线请求入库")
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstant.APPLY_INBOUND_TASK, description = "输送线请求入库")
|
||||
public ResponseEntity applyInboundTask(ApplyInboundReqVO request) {
|
||||
return post(WmsMethodConstand.APPLY_INBOUND_TASK, request);
|
||||
return post(WmsMethodConstant.APPLY_INBOUND_TASK, request);
|
||||
}
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstand.CALL_EMPTY_PALLET_STACK, description = "呼叫空托盘垛")
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstant.CALL_EMPTY_PALLET_STACK, description = "呼叫空托盘垛")
|
||||
public ResponseEntity emptyPalletStack(CallTaskReqVO request) {
|
||||
return post(WmsMethodConstand.CALL_EMPTY_PALLET_STACK, request);
|
||||
return post(WmsMethodConstant.CALL_EMPTY_PALLET_STACK, request);
|
||||
}
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstand.REQUEST_BUNDLE_INFO, description = "获取困扎信息")
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstant.REQUEST_BUNDLE_INFO, description = "获取困扎信息")
|
||||
public ResponseEntity requestBundleInfo(BundleInfoReqVO request) {
|
||||
return post(WmsMethodConstand.REQUEST_BUNDLE_INFO, request);
|
||||
return post(WmsMethodConstant.REQUEST_BUNDLE_INFO, request);
|
||||
}
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstand.APPLY_OUTBOUND_AGV_TASK, description = "申请AGV出库任务")
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstant.APPLY_OUTBOUND_AGV_TASK, description = "申请AGV出库任务")
|
||||
public ResponseEntity requestOutboundAgvTask(CallTaskReqVO request) {
|
||||
return post(WmsMethodConstand.APPLY_OUTBOUND_AGV_TASK, request);
|
||||
return post(WmsMethodConstant.APPLY_OUTBOUND_AGV_TASK, request);
|
||||
}
|
||||
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstand.REQUEST_OPEN_COVER_INFO, description = "获取开盖信息")
|
||||
@InterfaceLog(direction = "ACS->WMS", path = WmsMethodConstant.REQUEST_OPEN_COVER_INFO, description = "获取开盖信息")
|
||||
public ResponseEntity requestOpenCoverInfo(BundleInfoReqVO request) {
|
||||
return post(WmsMethodConstand.REQUEST_OPEN_COVER_INFO, request);
|
||||
return post(WmsMethodConstant.REQUEST_OPEN_COVER_INFO, request);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,6 +79,7 @@ public class WmsApi {
|
||||
try {
|
||||
String responseBody = HttpRequest.post(baseUrl.replaceAll("/+$", "") + apiPath)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("Authorization", "Bearer test3")
|
||||
.body(JSON.toJSONString(request))
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.extInterface.wms.constand;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* ACS 业务操作类型枚举
|
||||
*
|
||||
* @Author: liyongde
|
||||
* @Date: 2026/7/16
|
||||
*/
|
||||
@Getter
|
||||
public enum BusinessOperationTypeEnum {
|
||||
|
||||
PICKED("PICKED", "取货完成"),
|
||||
|
||||
APPLY_AGAIN("APPLY-AGAIN", "二次请求"),
|
||||
|
||||
REQUEST_RELEASE("REQUEST-RELEASE", "请求放货"),
|
||||
|
||||
REQUEST_PICK("REQUEST-PICK", "请求取货"),
|
||||
|
||||
REQUEST_LEAVE("REQUEST-LEAVE", "请求离开"),
|
||||
|
||||
REQUEST_ENTER("REQUEST-ENTER", "请求进入");
|
||||
|
||||
/** 操作编码 */
|
||||
private final String code;
|
||||
/** 操作名称 */
|
||||
private final String name;
|
||||
|
||||
BusinessOperationTypeEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据编码解析枚举,找不到返回 null
|
||||
*/
|
||||
public static BusinessOperationTypeEnum getByCode(String code) {
|
||||
for (BusinessOperationTypeEnum type : values()) {
|
||||
if (type.getCode().equalsIgnoreCase(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.extInterface.wms.constand;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author: liyongde
|
||||
* @Date: 2026/8/27 15:22
|
||||
*/
|
||||
@Getter
|
||||
public enum TaskFeedbackEnum {
|
||||
EXECUTING("1", "EXECUTING"),
|
||||
FINISHED("2", "FINISHED"),
|
||||
CANCELLED("3", "CANCELLED");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
TaskFeedbackEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static TaskFeedbackEnum getByCode(String code) {
|
||||
for (TaskFeedbackEnum e : TaskFeedbackEnum.values()) {
|
||||
if (e.getCode().equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package org.nl.extInterface.wms.constand;
|
||||
|
||||
public class WmsMethodConstand {
|
||||
public static final String FEEDBACK_TASK_STATUS = "/feedbackTaskStatus";
|
||||
public class WmsMethodConstant {
|
||||
public static final String FEEDBACK_TASK_STATUS = "/admin-api/task/transport/acs-feedback";
|
||||
public static final String FEEDBACK_BUSINESS_STATUS = "/admin-api/task/transport/acs-business-feedback";
|
||||
public static final String APPLY_INBOUND_TASK = "/acs/call/inbound/apply";
|
||||
public static final String APPLY_OUTBOUND_AGV_TASK = "/acs/call/outbound/agv/apply";
|
||||
public static final String CALL_EMPTY_PALLET_STACK = "/acs/call/empty-pallet-stack";
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.extInterface.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author: liyongde
|
||||
* @Date: 2026/8/27 15:42
|
||||
*/
|
||||
@Deprecated
|
||||
@Data
|
||||
public class WmsRespVO {
|
||||
private Integer code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private Object data;
|
||||
|
||||
public static WmsRespVO error(String message) {
|
||||
WmsRespVO wmsRespVO = new WmsRespVO();
|
||||
wmsRespVO.setCode(400);
|
||||
wmsRespVO.setMsg(message);
|
||||
return wmsRespVO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.extInterface.wms.data.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class FeedbackStatusRequest {
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String carNo;
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
private String deviceCode;
|
||||
/**
|
||||
* 幂等唯一id
|
||||
*/
|
||||
private String eventId;
|
||||
/**
|
||||
* 拓展参数
|
||||
*/
|
||||
private Map<String, Object> payload;
|
||||
/**
|
||||
* 反馈任务状态:EXECUTING/FINISHED/CANCELLED
|
||||
* 反馈业务操作:PICKED/APPLY-AGAIN/REQUEST-RELEASE/REQUEST-PICK/REQUEST-LEAVE/REQUEST-ENTER
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 任务编码
|
||||
*/
|
||||
private String taskCode;
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
private long taskId;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package org.nl.extInterface.wms.data.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FeedbackTaskStatusRequest {
|
||||
private String task_id;
|
||||
private String task_code;
|
||||
private String task_status;
|
||||
private String weight;
|
||||
private String car_no;
|
||||
}
|
||||
@@ -1,8 +1,14 @@
|
||||
package org.nl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nl.acs.task.task.service.dto.TaskDto;
|
||||
import org.nl.common.base.ResponseData;
|
||||
import org.nl.extInterface.wms.WmsApi;
|
||||
import org.nl.extInterface.wms.constand.TaskFeedbackEnum;
|
||||
import org.nl.extInterface.wms.data.req.FeedbackStatusRequest;
|
||||
import org.nl.system.service.user.ISysUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -10,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
@@ -25,7 +32,23 @@ public class ApplicationTest {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ApplicationTest.class);
|
||||
|
||||
@Resource
|
||||
private WmsApi wmsApi;
|
||||
|
||||
@Test
|
||||
void wmsApiTest() {
|
||||
FeedbackStatusRequest request = new FeedbackStatusRequest();
|
||||
request.setTaskId(2091795922294444034L);
|
||||
request.setTaskCode("202608240302");
|
||||
request.setCarNo("C1");
|
||||
request.setEventId(IdUtil.simpleUUID());
|
||||
request.setDeviceCode("ZJXX_05");
|
||||
request.setStatus(TaskFeedbackEnum.getByCode("1").getName());
|
||||
JSONObject response = ResponseData.getCheckData(
|
||||
wmsApi.feedbackTaskStatus(request)
|
||||
);
|
||||
System.out.println(JSON.toJSONString(response));
|
||||
}
|
||||
|
||||
@Test
|
||||
void contextLoads2() {
|
||||
|
||||
Reference in New Issue
Block a user