| | |
| | | @Autowired |
| | | private OutStockItemService outStockItemService; |
| | | @Autowired |
| | | private OutStockService outStockService; |
| | | @Autowired |
| | | private WaveRuleService waveRuleService; |
| | | @Autowired |
| | | private LocItemService locItemService; |
| | |
| | | private LocService locService; |
| | | @Autowired |
| | | private WaveOrderRelaServiceImpl waveOrderRelaService; |
| | | @Autowired |
| | | private AsnOrderService asnOrderService; |
| | | |
| | | |
| | | /** |
| | |
| | | return LocUtils.isShallowLoc(item.getLocCode()) ? 1 : 0; |
| | | }).reversed()).collect(Collectors.toList()); |
| | | |
| | | WkOrder wkOrder = outStockService.getById(outId); |
| | | WkOrder wkOrder = this.getById(outId); |
| | | if (Cools.isEmpty(wkOrder)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | |
| | | .setSourceId(outId) |
| | | .setSiteNo(param.getSiteNo()); |
| | | //增加备货出库类型判断 |
| | | Short type = wkOrder.getType().equals(OrderType.ORDER_PRE.type) || wkOrder.getType().equals(OrderType.ORDER_PRE_NOT_OUT.type) |
| | | ?TaskResouceType.TASK_RESOUCE_STOCK_UP.val |
| | | :TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val; |
| | | Short type = null; |
| | | switch (wkOrder.getType()) { |
| | | case "pre": |
| | | type = TaskResouceType.TASK_RESOUCE_STOCK_UP.val; |
| | | break; |
| | | case "preNot": |
| | | type = TaskResouceType.TASK_RESOUCE_STOCK_NOT_OUT.val; |
| | | break; |
| | | default: |
| | | type = TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val; |
| | | } |
| | | try { |
| | | //生成出库任务 |
| | | locItemService.generateTask(type, taskParams, loginUserId); |
| | |
| | | |
| | | Double sum = itemList.stream().mapToDouble(OutStockToTaskParams::getOutQty).sum(); |
| | | //更新出库单明细及主单 |
| | | WkOrder outOrder = outStockService.getById(outId); |
| | | WkOrder outOrder = this.getById(outId); |
| | | if (Objects.isNull(outOrder)) { |
| | | throw new CoolException("出库单据不存在!!"); |
| | | } |
| | |
| | | |
| | | outOrder.setWorkQty(workQty).setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_CREATE.val); |
| | | |
| | | if (!outStockService.updateById(outOrder)) { |
| | | if (!this.updateById(outOrder)) { |
| | | throw new CoolException("出库单状态修改失败!!"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | private List<OrderOutItemDto> getOutOrderList(Long orderId, WaveRule waveRule,List<Long> orderItemIdList) { |
| | | WkOrder wkOrder = asnOrderService.getById(orderId); |
| | | if (Cools.isEmpty(wkOrder)) { |
| | | throw new CoolException("未查询到相关单据,单号ID:"+orderId); |
| | | } |
| | | boolean sign = false; |
| | | if (wkOrder.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_NORMAL_MATERIAL_PREPARATION.type) |
| | | || wkOrder.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_FEED_IN_MATERIAL_PREPARATION.type)){ |
| | | sign = true; |
| | | } |
| | | List<WkOrderItem> wkOrderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>() |
| | | .in(WkOrderItem::getId, orderItemIdList).eq(WkOrderItem::getOrderId, orderId)); |
| | | List<OrderOutItemDto> list = new ArrayList<>(); |
| | |
| | | locItems = LocManageUtil.getFirstInFirstOutItemList(wkOrderItem.getMatnrCode(), wkOrderItem.getSplrBatch(), wkOrderItem.getAnfme()); |
| | | } |
| | | for (LocItem locItem : locItems) { |
| | | if (sign){ |
| | | if (locItem.getType().equals(OrderType.ORDER_PRE.type) || locItem.getType().equals(OrderType.ORDER_PRE_NOT_OUT.type)) { |
| | | continue; |
| | | } |
| | | } |
| | | Loc loc = locService.getById(locItem.getLocId()); |
| | | List<LocItem> itemList = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, locItem.getLocCode())); |
| | | if (issued.doubleValue() > 0) { |