construction-data/.env.development
@@ -2,7 +2,7 @@ ENV = 'development' # base api VUE_APP_BASE_API = 'http://127.0.0.1:8081/' VUE_APP_BASE_API = 'http://192.168.8.14:8081/' # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, # to control whether the babel-plugin-dynamic-import-node plugin is enabled. zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/controller/OutStockController.java
@@ -1,20 +1,26 @@ package com.zy.asrs.wms.apis.wcs.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.apis.wcs.entity.request.ContainerArrivedParam; import com.zy.asrs.wms.apis.wcs.entity.request.RfidSingalRequest; import com.zy.asrs.wms.apis.wcs.entity.request.TasksStatusCallbackParam; import com.zy.asrs.wms.apis.wcs.services.WcsApiService; import com.zy.asrs.wms.asrs.entity.CacheSite; import com.zy.asrs.wms.asrs.entity.Task; import com.zy.asrs.wms.asrs.entity.param.BindPlatformParam; import com.zy.asrs.wms.asrs.service.CacheSiteService; import com.zy.asrs.wms.asrs.service.PlatformService; import com.zy.asrs.wms.asrs.service.TaskService; import com.zy.asrs.wms.system.controller.BaseController; import io.netty.util.internal.StringUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Map; import java.util.Objects; @@ -28,6 +34,12 @@ @Autowired private PlatformService platformService; @Resource private CacheSiteService cacheSiteService; @Resource private TaskService taskService; /** @@ -72,6 +84,35 @@ } /** * 播种墙拍灯,ESS调用 */ @PostMapping("/light/off") public R lightOff(@RequestBody Map<String, Object> request) { if (Objects.isNull(request)) { throw new CoolException("参数不能为空!!"); } if (Objects.isNull(request.get("tagCode"))) { throw new CoolException("电子标签编号不能为空!!"); } if (Objects.isNull(request.get("eventCode"))){ throw new CoolException("事件名称不能为空!!"); } // 根据站点编码查播种站点信息 CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getSiteNo, request.get("tagCode"))); // 根据播种站点信息条码,查任务 Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, cacheSite.getBarcode())); request.clear(); request.put("taskNo", task.getTaskNo()); request.put("orderNo",cacheSite.getOrderNo()); wcsApiService.slapLightLogic(request); return R.ok(); } /** * 容器流动通知(当前物料播种完成) * //fixme 此接口将不再单独调用 * 1. 更新当前任务物料信息 zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/entity/response/CommonReponse.java
@@ -28,5 +28,5 @@ /** *返回的响应数据结构。 * */ private Map<String, Object> data; private Object data; } zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/schedule/ScheduleJobs.java
@@ -64,11 +64,11 @@ tasks.forEach(task -> { try { ConveyorStarParam conveyorStarParam = new ConveyorStarParam(); conveyorStarParam.setSlotCode(task.getOriginLoc()) conveyorStarParam.setSlotCode(task.getOriginSite()) .setContainerCode(task.getBarcode()) .setDirection("100"); // 原始报文 log.info("请求地址:{},请求参数:{}", "http://192.168.2.200:9046/conveyor/moveContainer", JSONObject.toJSONString(conveyorStarParam)); log.info("通知ESS输送线流动请求地址:{},请求参数:{}", "http://192.168.2.200:9046/conveyor/moveContainer", JSONObject.toJSONString(conveyorStarParam)); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "application/json"); HttpEntity httpEntity = new HttpEntity<>(conveyorStarParam, headers); @@ -86,7 +86,6 @@ taskService.update(new LambdaUpdateWrapper<Task>() .eq(Task::getId, task.getId()) .set(Task::getTaskSts, TaskStsType.WCS_CONVEYOR_START.id)); log.info(task.getTaskNo() + "下发流动通知" + commonReponse.getMsg()); } else { throw new CoolException("下发流动通知失败!!"); } @@ -139,9 +138,6 @@ describe.setContainerCode(task.getBarcode()) .setToLocationCode(formatLocNo) .setToStationCode(task.getTargetSite()); // .setFromLocationCode("") // .setContainerFace("") // .setContainerType("").setStorageTag(""); param.setTaskDescribe(describe); params.add(param); @@ -150,11 +146,7 @@ tasksParam.setTaskType("putaway"); // TODO 多任务多订单,统一调度,是否会出现部分成功,部分失败的情况 //调用三方接口,将任务推送至ESS平台 // MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); // 设置请求参数 // params.add("params", tasksParam); log.info("请求地址:{},请求参数:{}", "http://192.168.2.200:9046/task/create", JSONObject.toJSONString(tasksParam)); log.info("下发入库任务请求地址:{},请求参数:{}", "http://192.168.2.200:9046/task/create", JSONObject.toJSONString(tasksParam)); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "application/json"); HttpEntity httpEntity = new HttpEntity<>(tasksParam, headers); @@ -166,7 +158,6 @@ } else { ObjectMapper objectMapper = new ObjectMapper(); CommonReponse reponse = objectMapper.readValue(exchange.getBody(), CommonReponse.class); // CommonReponse reponse = (CommonReponse) JSON.parse(exchange.getBody()); if (reponse.getCode() == 0) { // 请求成功后,统一修改所有任务档状态为入库执行中。 tasks.forEach(task -> { @@ -258,14 +249,14 @@ if (tasks.isEmpty()) { return; } tasks.stream().sorted(Comparator.comparing(Task::getTaskSts)) .collect(Collectors.toList()); // tasks.stream().sorted(Comparator.comparing(Task::getTaskSts)) // .collect(Collectors.toList()); // 数据组装 PublishTasksParam tasksParam = new PublishTasksParam(); List<TaskParam> params = new ArrayList<>(); //TODO 确认是否需要单任务多容器码的需求,目前系统都是单容器码生成单任务,多任务明细(物料混装) tasks.forEach(task -> { List<TaskParam> params = new ArrayList<>(); TaskParam param = new TaskParam(); //设置容器编码 param.setTaskCode(task.getTaskNo()); @@ -276,17 +267,16 @@ .setToStationCode(task.getTargetSite()); param.setTaskDescribe(describe); params.add(param); tasksParam.setTasks(params); }); tasksParam.setTasks(params); tasksParam.setTaskType("carry"); log.info("请求地址:{},请求参数:{}", properties.getBaseHost() + properties.getEssReceiveTask(), JSONObject.toJSONString(tasksParam)); log.info("出库任务下发请求地址:{},请求参数:{}", properties.getBaseHost() + properties.getEssReceiveTask(), JSONObject.toJSONString(tasksParam)); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "application/json"); HttpEntity httpEntity = new HttpEntity<>(tasksParam, headers); // 请求 ResponseEntity<String> exchange = restTemplate.exchange(properties.getBaseHost() + properties.getEssReceiveTask(), HttpMethod.POST, httpEntity, String.class); log.info("下发任务 返回结果:{}", exchange); log.info("出库任务下发 返回结果:{}", exchange); if (exchange.getBody() == null) { throw new CoolException("下发任务失败!!"); } else { zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java
@@ -3,6 +3,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.fasterxml.jackson.core.JsonProcessingException; import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.apis.wcs.entity.domain.SystemProperties; @@ -10,6 +11,7 @@ import com.zy.asrs.wms.apis.wcs.entity.request.*; import com.zy.asrs.wms.apis.wcs.entity.response.CommonReponse; import com.zy.asrs.wms.apis.wcs.services.WcsApiService; import com.zy.asrs.wms.apis.wcs.utils.HttpEssUtils; import com.zy.asrs.wms.asrs.entity.*; import com.zy.asrs.wms.asrs.entity.enums.CacheSiteStatusType; import com.zy.asrs.wms.asrs.entity.enums.OrderPickStatus; @@ -28,11 +30,9 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.*; import java.util.stream.Collectors; @Slf4j @@ -62,6 +62,9 @@ @Autowired private PlatformService platformService; @Resource private SystemProperties systemProperties; /** * 容器到达接收 @@ -78,34 +81,69 @@ @Override @Transactional(rollbackFor = Exception.class) public R containerArrivedNotify(ContainerArrivedParam arrivedParam, String taskType, Long hostId) { List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, arrivedParam.getContainerCode())); if (Collections.isEmpty(tasks)) { Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, arrivedParam.getContainerCode())); if (task == null) { return R.error("任务不存在!!"); } log.info("容器到达接收,任务号:{},当前状态:{},上报状态:{}",task.getTaskNo(),task.getTaskSts$(),TaskStsType.WCS_CONTAINER_RECEIVE.desc); taskType = task.getTaskType() > 100 ? "outStock":"inStock"; if (taskType.equals("inStock")) { if (task.getTaskSts() == 198) { return R.error("播种中!!"); } if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_IN.id ) { //DONE 根据ESS返回的容器编码修改任务档中的输送线起始位置节点,及任务档容器到达状态 taskService.update(new LambdaUpdateWrapper<Task>() .set(Task::getTaskSts, TaskStsType.WCS_CONTAINER_RECEIVE.id) //输送线节点编码,不是源库位 .set(Task::getOriginLoc, arrivedParam.getSlotCode()) .set(Task::getOriginSite, arrivedParam.getSlotCode()) .eq(Task::getBarcode, arrivedParam.getContainerCode())); } else { //容器到达时更新任务状态为:入库完成,定时任务根据状态码更新库存 //当状态为入库完成时,更新库存信息 // boolean update = taskService.update(new LambdaUpdateWrapper<Task>() // .set(Task::getTaskSts, TaskStsType.COMPLETE_OUT.id) // .set(Task::getOriginLoc, arrivedParam.getSlotCode()) // .eq(Task::getBarcode, arrivedParam.getContainerCode())); //fixme 容器到达状态更改为播种中... log.warn("{}没有下发任务",task.getTaskNo()); R.error(task.getTaskNo()+"没有下发任务"); } } else { if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_ARRIVED.id || task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id ) { // 到达拣选位,控制播种墙亮灯 List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getBarcode, task.getBarcode())); if(cacheSites.size() == 0) { log.error("条码:{},未找到播种墙亮灯",task.getBarcode()); throw new CoolException("未找到播种墙"); } for (CacheSite cacheSite:cacheSites) { SlapLightControlParam slapLightControlParam = new SlapLightControlParam(); slapLightControlParam.setControllerCode(cacheSite.getMemo()).setTagCode(cacheSite.getSiteNo()) .setColor("GREEN").setMode("LIGHT"); // 发起亮灯请求 CommonReponse response = HttpEssUtils.post("到达拣选位,播种墙亮灯", HttpEssUtils.PLT_SEND_COMMAND, slapLightControlParam); if (response.getCode().equals(0)) { log.info("任务{}到达拣选位,播种墙{}亮灯成功",task.getTaskNo(),cacheSite.getSiteNo()); } else { log.info("任务{}到达拣选位,播种墙{}亮灯失败",task.getTaskNo(),cacheSite.getSiteNo()); } } boolean update = taskService.update(new LambdaUpdateWrapper<Task>() .set(Task::getTaskSts, TaskStsType.WAVE_SEED.id) .set(Task::getOriginLoc, arrivedParam.getSlotCode()) .set(Task::getOriginSite, arrivedParam.getSlotCode()) .eq(Task::getBarcode, arrivedParam.getContainerCode())); if (!update) { throw new CoolException("容器到达任务更新失败!!"); } } else if(task.getTaskSts().equals(TaskStsType.UPDATED_OUT.id)) { ConveyorStarParam conveyorStarParam = new ConveyorStarParam(); conveyorStarParam.setSlotCode(task.getOriginSite()) .setContainerCode(task.getBarcode()) .setDirection("200"); // 出库完成,清除输送线条码,取下箱子 CommonReponse response = HttpEssUtils.post("清除输送线条码", HttpEssUtils.CONVEYOR_START, conveyorStarParam); if (response.getCode().equals(200)) { log.info("{}出库完成,清除{}输送线条码{}成功",task.getTaskNo(),task.getOriginSite(),task.getBarcode()); } } } return R.success("success"); @@ -126,39 +164,43 @@ .eq(Task::getTaskNo, callbackParam.getTaskCode())); if (!Collections.isEmpty(list)) { list.forEach(task -> { log.info("容器执行状态上报,任务号:{},当前状态:{},上报状态:{}",task.getTaskNo(),task.getTaskSts$(),callbackParam.getEventType()); if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_ALLOCATED.event)) { return; } // ESS只能配置一个状态上报接口,根据任务号判断是入库任务或出库任务 String taskType = task.getTaskType() > 100 ? "outStock":"inStock"; TaskStsType taskStsType = null; if (taskType.equals("inStock")) { //入库任务 if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_LOAD.event)) { //上报取箱状态 if (task.getTaskSts() == TaskStsType.WCS_CONVEYOR_START.id) { // if (task.getTaskSts() == TaskStsType.WCS_CONVEYOR_START.id) { taskStsType = TaskStsType.WCS_TOTE_LOAD; } else { String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_TOTE_LOAD.desc + "任务"; log.error(errMsg); throw new CoolException(errMsg); } // } else { // String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_TOTE_LOAD.desc + "任务"; // log.error(errMsg); // throw new CoolException(errMsg); // } } else if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_UNLOAD.event)) { //上报放箱状态 if (task.getTaskSts() == TaskStsType.WCS_TOTE_LOAD.id) { // if (task.getTaskSts() == TaskStsType.WCS_TOTE_LOAD.id) { taskStsType = TaskStsType.WCS_TOTE_UNLOAD; } else { String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_TOTE_UNLOAD.desc + "任务"; log.error(errMsg); throw new CoolException(errMsg); } // } else { // String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_TOTE_UNLOAD.desc + "任务"; // log.error(errMsg); // throw new CoolException(errMsg); // } } else if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_STATUS.event)) { //TODO 需确认上报任务中,任务完成是哪个事件,目前暂定task事件 if (task.getTaskSts() == TaskStsType.WCS_TOTE_UNLOAD.id) { // if (task.getTaskSts() == TaskStsType.WCS_TOTE_UNLOAD.id) { taskStsType = TaskStsType.WCS_PUTAWAY_SUCESS; } else { String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_PUTAWAY_SUCESS.desc + "任务"; log.error(errMsg); throw new CoolException(errMsg); } // } else { // String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_PUTAWAY_SUCESS.desc + "任务"; // log.error(errMsg); // throw new CoolException(errMsg); // } } boolean result = taskService.update(new LambdaUpdateWrapper<Task>() .set(Task::getRobotCode, callbackParam.getRobotCode()) .set(Task::getSysTaskCode, callbackParam.getSysTaskCode()) .set(Task::getTaskSts, taskStsType.id) // .set(Task::getSysTaskCode, callbackParam.getSysTaskCode()) .set(Task::getTaskSts, taskStsType != null ? taskStsType.id : task.getTaskType()) .set(Task::getExcudeStatus, callbackParam.getStatus()) .set(Task::getTaskDesc, callbackParam.getMessage()) .eq(Task::getBarcode, callbackParam.getContainerCode()) @@ -171,37 +213,36 @@ } } else { //出库任务 if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_LOAD.event)) { //上报取箱状态 if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT.id ) { // if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT.id ) { taskStsType = TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD; } else { String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.desc + "任务"; log.error(errMsg); throw new CoolException(errMsg); } // } else { // String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.desc + "任务"; // log.error(errMsg); // throw new CoolException(errMsg); // } } else if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_UNLOAD.event)) { //上报放箱状态 if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.id) { // if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.id) { taskStsType = TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD; } else { String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD.desc + "任务"; log.error(errMsg); throw new CoolException(errMsg); } // } else { // String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD.desc + "任务"; // log.error(errMsg); // throw new CoolException(errMsg); // } } else if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_STATUS.event)) { //上报完成状态 if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD.id || task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id) { // if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD.id || task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id) { //出库任务完成,修改状态为容器到达,定时任务生成播种波次 taskStsType = TaskStsType.WCS_EXECUTE_OUT_TASK_DONE; } else { String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.desc + "任务"; log.error(errMsg); throw new CoolException(errMsg); // } else { // String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.desc + "任务"; // log.error(errMsg); // throw new CoolException(errMsg); // } } } //更新出库状态及相关字段 boolean update = taskService.update(new LambdaUpdateWrapper<Task>() .set(Task::getRobotCode, callbackParam.getRobotCode()) .set(Task::getSysTaskCode, callbackParam.getSysTaskCode()) .set(Task::getTaskSts, taskStsType.id) .set(Task::getTaskSts, taskStsType != null ? taskStsType.id : task.getTaskType()) .set(Task::getExcudeStatus, callbackParam.getStatus()) .set(Task::getTaskDesc, callbackParam.getMessage()) .eq(Task::getBarcode, callbackParam.getContainerCode()) @@ -325,7 +366,7 @@ //调用三方接口,闪灯不做操作 // 设置请求参数 params.add("params", JSONObject.toJSONString(slapParam)); log.info("请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam)); log.info("未完成闪灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam)); } else { //调用三方接口,灭灯通知容器流动, 传灭灯参数 //todo 判断当前订单是否完成,完成灭灯,未完成保持拣货状态亮灯 @@ -360,7 +401,7 @@ } converyor = true; params.add("params", JSONObject.toJSONString(slapParam)); log.info("请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam)); log.info("完成灭灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam)); } if (converyor) { zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/utils/HttpEssUtils.java
New file @@ -0,0 +1,79 @@ package com.zy.asrs.wms.apis.wcs.utils; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.cfg.CoercionAction; import com.fasterxml.jackson.databind.cfg.CoercionInputShape; import com.zy.asrs.framework.common.SpringUtils; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.apis.wcs.entity.response.CommonReponse; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; /** * @author pang.jiabao * @description 调用ESS接口封装工具类 * @createDate 2025/3/12 11:26 */ @Slf4j public class HttpEssUtils { /** * 基础ip+port */ public static final String baseUrl = "http://192.168.2.200:9046"; /** * 请求头 */ private static final HttpHeaders headers = new HttpHeaders(); static { headers.add("Content-Type", "application/json"); } /** * 通知输送线流动 */ public static final String CONVEYOR_START = baseUrl + "/conveyor/moveContainer"; /** * 控制播种墙亮/灭/闪灯 */ public static final String PLT_SEND_COMMAND = baseUrl + "/expand/api/equipment/ptl/sendCommand"; /** * 发送post请求调用ESS接口 * * @param name 调用接口名 * @param url 接口地址 * @param param 参数 * @param <T> 参数类型范化 * @return 返回结果 */ public static <T> CommonReponse post(String name, String url, T param) { log.info("{},请求地址:{},请求参数:{}", name, url, param); HttpEntity httpEntity = new HttpEntity<>(param, headers); RestTemplate restTemplate = SpringUtils.getBean(RestTemplate.class); ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class); log.info("{},返回结果:{}", name, exchange); if (exchange.getBody() == null) { throw new CoolException(name + "返回结果异常!!"); } else { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.coercionConfigDefaults() .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty); try { return objectMapper.readValue(exchange.getBody(), CommonReponse.class); } catch (JsonProcessingException e) { log.error("{},返回结果解析异常{}", name, e.getMessage()); e.printStackTrace(); throw new CoolException(name + "返回结果解析异常!!"); } } } } zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
@@ -1158,7 +1158,8 @@ throw new CoolException("当前波次订单不存在!!"); } List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getSiteStatus, CacheSiteStatusType.O.id).orderByAsc(CacheSite::getChannel)); List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>() .eq(CacheSite::getSiteStatus, CacheSiteStatusType.O.id).eq(CacheSite::getChannel,task.getTargetSite())); if (cacheSites.isEmpty()) { throw new CoolException("缓存站空间不足,请稍后再试"); @@ -1173,6 +1174,7 @@ cacheSite.setOrderId(orders.get(i).getId()); cacheSite.setOrderNo(orders.get(i).getOrderNo()); cacheSite.setSiteStatus(CacheSiteStatusType.R.id); cacheSite.setBarcode(loc.getBarcode()); cacheSite.setUpdateTime(new Date()); if (!cacheSiteService.updateById(cacheSite)) { throw new CoolException("缓存站更新失败"); zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/WorkServiceImpl.java
@@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.zy.asrs.framework.common.Cools; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.asrs.entity.*; @@ -684,8 +685,12 @@ if (loc == null) { throw new CoolException("没有空库位"); } // 获取新任务号 String taskNo = generateTaskNo(53L); // 设置新任务号 task.setTaskNo(taskNo); //102拣料此处需修改为WCS_CONTAINER_RECEIVE,定时任务查询后,自动下发入库任务至ESS task.setTaskSts(TaskStsType.WCS_CONTAINER_RECEIVE.id);//1.生成入库任务 task.setTaskSts(TaskStsType.GENERATE_IN.id);//1.生成入库任务 task.setTaskType(taskType); //原库位变目标库位, 原站点变目标站点 //todo 需确认原站点为空,该怎么处理 @@ -694,6 +699,9 @@ if (!taskService.updateById(task)) { throw new CoolException("拣料失败"); } // 更新任务明细新任务号 UpdateWrapper<TaskDetl> updateWrapper = new UpdateWrapper<>(); updateWrapper.set("task_no",taskNo).eq("task_id",task.getId()); //库位状态改为预约入库 R => S loc.setLocStsId(LocStsType.S.val()); loc.setUpdateTime(new Date()); zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java
@@ -171,16 +171,16 @@ return; } Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "taskLogDiffDays").eq(Dict::getStatus, 1)); if (dict == null) { return; } // Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "taskLogDiffDays").eq(Dict::getStatus, 1)); // if (dict == null) { // return; // } for (Task task : list) { int diff = DateUtils.diff(task.getCreateTime(), new Date()); int taskLogDiffDays = Integer.parseInt(dict.getValue()); if (diff < taskLogDiffDays) { continue; } // int diff = DateUtils.diff(task.getCreateTime(), new Date()); // int taskLogDiffDays = Integer.parseInt(dict.getValue()); // if (diff < taskLogDiffDays) { // continue; // } Long hostId = task.getHostId(); zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskWaveTimer.java
@@ -21,6 +21,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.util.*; import java.util.stream.Collectors; @Component public class TaskWaveTimer { @@ -47,7 +48,7 @@ * original : fetch datasource of task type on WCS_EXECUTE_OUT_TASK_DONE * now: Fetch datasource of task type on WCS_EXECUTE_OUT_ARRIVED, After completing the task and for setting the task type equal to GENERATE_WAVE_SEED */ @Scheduled(cron = "0/15 * * * * ? ") @Scheduled(cron = "0/3 * * * * ? ") @Transactional(rollbackFor = Exception.class) public void taskWave() { InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); @@ -62,8 +63,7 @@ } //查询状态为RCS任务完成所有任务单据 // List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WAVE_SEED.id)); List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id)); HashSet<String> sycMatnrs = new HashSet<>(); List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WCS_EXECUTE_OUT.id)); HashSet<String> sycMatnrs = new HashSet<>(); if (taskList.isEmpty()) { // throw new CoolException("没有可播种任务!!"); } else { @@ -72,6 +72,11 @@ List<TaskDetl> taskDetls = taskDetlService.list(new LambdaQueryWrapper<TaskDetl>().eq(TaskDetl::getTaskId, task.getId()).eq(TaskDetl::getHostId, hostId)); if (taskDetls.isEmpty()) { continue; } // 过滤已经生成波次播种数据的任务 该任务的任务明细号不能在播种数据表里面 long count = waveSeedService.count(new LambdaQueryWrapper<WaveSeed>().in(WaveSeed::getTaskDetlId, taskDetls.stream().map(TaskDetl::getId).collect(Collectors.toList())).eq(WaveSeed::getHostId, hostId)); if (count > 0) { continue; } @@ -153,11 +158,11 @@ } } task.setTaskSts(TaskStsType.GENERATE_WAVE_SEED.id); task.setUpdateTime(new Date()); if (!taskService.updateById(task)) { throw new CoolException("任务更新失败"); } // task.setTaskSts(TaskStsType.GENERATE_WAVE_SEED.id); // task.setUpdateTime(new Date()); // if (!taskService.updateById(task)) { // throw new CoolException("任务更新失败"); // } } } } catch (Exception e) { zy-asrs-wms/src/main/resources/mapper/asrs/TaskMapper.xml
@@ -34,10 +34,11 @@ mws.wave_no, SUM( mws.work_qty ) work_qty, mws.batch, mws.task_detl_id , mcs.site_no mws.task_detl_id -- ,mcs.site_no FROM man_wave_seed mws LEFT JOIN man_cache_site mcs ON mws.order_id = mcs.order_id man_wave_seed mws -- man_wave_seed mws LEFT JOIN man_cache_site mcs ON mws.order_id = mcs.order_id WHERE task_detl_id IN ( SELECT mtd.id FROM man_task mt INNER JOIN man_task_detl mtd ON mt.id = mtd.task_id <if test="taskNo != null and taskNo != ''">