zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/controller/InStockController.java
@@ -4,6 +4,7 @@ import com.zy.asrs.wms.apis.wcs.entity.request.ContainerArrivedParam; import com.zy.asrs.wms.apis.wcs.entity.request.TasksStatusCallbackParam; import com.zy.asrs.wms.apis.wcs.services.WcsApiService; import com.zy.asrs.wms.system.controller.BaseController; import io.netty.util.internal.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -13,7 +14,7 @@ @RequestMapping("/in/stock/") @RestController public class InStockController { public class InStockController extends BaseController { @Autowired private WcsApiService wcsApiService; @@ -34,7 +35,7 @@ return R.error("输送线节点编码不能为空!!"); } return wcsApiService.containerArrivedNotify(arrivedParam, "inStock"); return wcsApiService.containerArrivedNotify(arrivedParam, "inStock", getHostId()); } @@ -53,7 +54,7 @@ if (StringUtil.isNullOrEmpty(callbackParam.getTaskCode())) { return R.error("任务编码不能为空!!"); } wcsApiService.receiveTaskStatus(callbackParam, "inStock"); wcsApiService.receiveTaskStatus(callbackParam, "inStock", getHostId()); } else { return R.error("上报事件类型不能为空!!"); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/controller/OutStockController.java
@@ -5,6 +5,7 @@ import com.zy.asrs.wms.apis.wcs.entity.request.ContainerArrivedParam; import com.zy.asrs.wms.apis.wcs.entity.request.TasksStatusCallbackParam; import com.zy.asrs.wms.apis.wcs.services.WcsApiService; 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; @@ -16,7 +17,7 @@ @Slf4j @RestController @RequestMapping("/out/stock/") public class OutStockController { public class OutStockController extends BaseController { @Autowired private WcsApiService wcsApiService; @@ -35,7 +36,7 @@ if (StringUtil.isNullOrEmpty(callbackParam.getTaskCode())) { return R.error("任务编码不能为空!!"); } wcsApiService.receiveTaskStatus(callbackParam, "outStock"); wcsApiService.receiveTaskStatus(callbackParam, "outStock", getHostId()); } else { return R.error("上报事件类型不能为空!!"); } @@ -58,7 +59,7 @@ return R.error("输送线节点编码不能为空!!"); } return wcsApiService.containerArrivedNotify(arrivedParam, "outStock"); return wcsApiService.containerArrivedNotify(arrivedParam, "outStock", getHostId()); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java
@@ -6,10 +6,8 @@ import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.apis.wcs.entity.domain.EssTaskStatus; 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.asrs.entity.Task; import com.zy.asrs.wms.asrs.entity.WaitPakin; import com.zy.asrs.wms.asrs.entity.enums.TaskStsType; import com.zy.asrs.wms.asrs.service.TaskService; import com.zy.asrs.wms.asrs.service.WaitPakinService; @@ -20,10 +18,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @Slf4j @Service @@ -41,16 +36,18 @@ /** * 容器到达接收 * 根据ESS返回的容器编码修改任务档中的输送线起始位置节点,及任务档执行状态 * * 当前问题: * * //TODO 1. 目前任务下发接口沟通下来,是需要目标位置的,这里我们只是刚组拖完成,并不是通知流动,没有目标位置 * * //TODO 2. 文档上的搬运任务下发指的都是多任务,多容器搬运,而不是我们需要物料信息同步功能 * * //TODO 3. 流程走不通暂时先跳过,确认是否需要WMS触发料箱滚动至扫码区 * * 当前问题: * * //TODO 1. 目前任务下发接口沟通下来,是需要目标位置的,这里我们只是刚组拖完成,并不是通知流动,没有目标位置 * * //TODO 2. 文档上的搬运任务下发指的都是多任务,多容器搬运,而不是我们需要物料信息同步功能 * * //TODO 3. 流程走不通暂时先跳过,确认是否需要WMS触发料箱滚动至扫码区 * * @param arrivedParam * @param hostId * @return */ @Override @Transactional(rollbackFor = Exception.class) public R containerArrivedNotify(ContainerArrivedParam arrivedParam, String taskType) { 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)) { return R.error("任务不存在!!"); @@ -75,7 +72,7 @@ @Override @Transactional(rollbackFor = Exception.class) public void receiveTaskStatus(TasksStatusCallbackParam callbackParam, String stockType) { public void receiveTaskStatus(TasksStatusCallbackParam callbackParam, String stockType, Long hostId) { List<Task> list = taskService.list(new LambdaQueryWrapper<Task>() .eq(Task::getBarcode, callbackParam.getContainerCode()) .eq(Task::getTaskNo, callbackParam.getTaskCode())); @@ -161,6 +158,8 @@ } }); } else { throw new CoolException("更新内容不存在!!"); } } zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/WcsApiService.java
@@ -2,17 +2,12 @@ import com.zy.asrs.framework.common.R; import com.zy.asrs.wms.apis.wcs.entity.request.ContainerArrivedParam; import com.zy.asrs.wms.apis.wcs.entity.request.ConveyorStarParam; import com.zy.asrs.wms.apis.wcs.entity.request.TasksStatusCallbackParam; import com.zy.asrs.wms.apis.wcs.entity.response.CommonReponse; import com.zy.asrs.wms.asrs.entity.WaitPakin; import java.util.List; public interface WcsApiService { R containerArrivedNotify(ContainerArrivedParam arrivedParam, String taskType); R containerArrivedNotify(ContainerArrivedParam arrivedParam, String taskType, Long hostId); void receiveTaskStatus(TasksStatusCallbackParam callbackParam, String stockType); void receiveTaskStatus(TasksStatusCallbackParam callbackParam, String stockType, Long hostId); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java
@@ -73,63 +73,46 @@ if (taskDetls.isEmpty()) { throw new CoolException("任务明细不存在"); } else { //XXX 先更新订单,后删除任务明细 if (task.getTaskType() == 53L) { List<Long> waveIds = taskDetls.stream().map(TaskDetl::getWaveId).collect(Collectors.toList()); List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getWaveId, waveIds)); orders.forEach(order -> { }); } else { } } else { //TODO 先更新订单,后删除任务明细。任务为53时,需更新明细。 // if (task.getTaskType() == 53L) { // List<Long> waveIds = taskDetls.stream().map(TaskDetl::getWaveId).collect(Collectors.toList()); // List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getWaveId, waveIds)); // orders.forEach(order -> { // // }); // } else { //任务类型为53,根据WaveId修改订单明细 for (TaskDetl taskDetl : taskDetls) { if (task.getTaskType() == 53L) { List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getWaveId, taskDetl.getWaveId())); orders.forEach(order -> { List<OrderDetl> detls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId())); if (!detls.isEmpty()) { detls.forEach(detl -> { detl.setWorkQty(detl.getWorkQty() - taskDetl.getAnfme());//工作中数量减少 detl.setQty(detl.getQty() + taskDetl.getAnfme());//已完成数量增加 detl.setUpdateTime(new Date()); }); } }); } else { if (taskDetl.getDetlId() == null) { continue; if (taskDetl.getDetlId() == null) { continue; } OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId()); if (orderDetl == null) { throw new CoolException("订单明细不存在"); } orderDetl.setWorkQty(orderDetl.getWorkQty() - taskDetl.getAnfme());//工作中数量减少 orderDetl.setQty(orderDetl.getQty() + taskDetl.getAnfme());//已完成数量增加 orderDetl.setUpdateTime(new Date()); if (!orderDetlService.updateById(orderDetl)) { throw new CoolException("更新订单明细失败"); } //检测订单是否完成 boolean checkOrderComplete = orderService.checkOrderComplete(orderDetl.getOrderId()); if (checkOrderComplete) { //订单已经完成 Order order = orderService.getById(orderDetl.getOrderId()); if (order == null) { throw new CoolException("订单不存在"); } OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId()); if (orderDetl == null) { throw new CoolException("订单明细不存在"); order.setOrderSettle(OrderSettleType.COMPLETE.val()); order.setUpdateTime(new Date()); if (!orderService.updateById(order)) { throw new CoolException("订单更新失败"); } orderDetl.setWorkQty(orderDetl.getWorkQty() - taskDetl.getAnfme());//工作中数量减少 orderDetl.setQty(orderDetl.getQty() + taskDetl.getAnfme());//已完成数量增加 orderDetl.setUpdateTime(new Date()); if (!orderDetlService.updateById(orderDetl)) { throw new CoolException("更新订单明细失败"); } //检测订单是否完成 boolean checkOrderComplete = orderService.checkOrderComplete(orderDetl.getOrderId()); if (checkOrderComplete) { //订单已经完成 Order order = orderService.getById(orderDetl.getOrderId()); if (order == null) { throw new CoolException("订单不存在"); } order.setOrderSettle(OrderSettleType.COMPLETE.val()); order.setUpdateTime(new Date()); if (!orderService.updateById(order)) { throw new CoolException("订单更新失败"); } } } } // } } //删除任务历史档案 @@ -196,7 +179,7 @@ } Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "taskLogDiffDays").eq(Dict::getStatus, 1)); if(dict == null) { if (dict == null) { return; } for (Task task : list) { zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/MybatisPlusConfig.java
@@ -93,7 +93,8 @@ } catch (Exception e) { System.out.println(e.getMessage()); } return new NullValue(); // return new NullValue(); return new LongValue(1); } @Bean zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/controller/BaseController.java
@@ -6,6 +6,7 @@ import com.zy.asrs.wms.system.service.UserLoginService; import com.zy.asrs.wms.system.service.UserRoleService; import com.zy.asrs.wms.system.service.UserService; import net.sf.jsqlparser.expression.LongValue; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; @@ -47,12 +48,12 @@ public Long getLoginUserId() { User loginUser = getLoginUser(); return loginUser == null ? null : loginUser.getId(); return loginUser == null ? 1 : loginUser.getId(); } public Long getHostId() { User loginUser = getLoginUser(); return loginUser.getHostId(); return loginUser == null ? 1 : loginUser.getHostId(); } public <T extends BaseParam> T buildParam(Map<String, Object> map, Class<T> clz) {