| | |
| | | throw new CoolException("组托明细修执行数量修改失败!!"); |
| | | } |
| | | }); |
| | | syncAsnOrderItemBarcodeByPakin(waitPakinItems, pakin.getBarcode(), loginUserId); |
| | | }); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | |
| | | throw new CoolException("组托明细修执行数量修改失败!!"); |
| | | } |
| | | }); |
| | | syncAsnOrderItemBarcodeByPakin(waitPakinItems, pakin.getBarcode(), loginUserId); |
| | | }); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | |
| | | throw new CoolException("组托明细修执行数量修改失败!!"); |
| | | } |
| | | }); |
| | | syncAsnOrderItemBarcodeByPakin(waitPakinItems, pakin.getBarcode(), loginUserId); |
| | | }); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | |
| | | throw new CoolException("组拖状态修改失败!!"); |
| | | } |
| | | return R.ok("任务生成完毕!"); |
| | | } |
| | | |
| | | /** 组托后将通知单明细条码回写为料箱码 */ |
| | | private void syncAsnOrderItemBarcodeByPakin(List<WaitPakinItem> waitPakinItems, String pakinBarcode, Long loginUserId) { |
| | | if (waitPakinItems == null || waitPakinItems.isEmpty() || StringUtils.isBlank(pakinBarcode)) { |
| | | return; |
| | | } |
| | | Set<Long> asnItemIds = waitPakinItems.stream() |
| | | .map(WaitPakinItem::getAsnItemId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | if (asnItemIds.isEmpty()) { |
| | | return; |
| | | } |
| | | if (!asnOrderItemService.update(new LambdaUpdateWrapper<WkOrderItem>() |
| | | .in(WkOrderItem::getId, asnItemIds) |
| | | .set(WkOrderItem::getBarcode, pakinBarcode) |
| | | .set(WkOrderItem::getUpdateBy, loginUserId) |
| | | .set(WkOrderItem::getUpdateTime, new Date()))) { |
| | | throw new CoolException("通知单明细条码回写失败!!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | WkOrder o = asnOrderService.getById(e.getKey()); |
| | | if (o != null) { |
| | | Double newQty = QuantityUtils.roundToScale(QuantityUtils.add(o.getQty() != null ? o.getQty() : 0.0, e.getValue())); |
| | | Double planQty = QuantityUtils.roundToScale(o.getAnfme() != null ? o.getAnfme() : 0.0); |
| | | if (QuantityUtils.compare(newQty, planQty) > 0) { |
| | | newQty = planQty; |
| | | } |
| | | o.setQty(newQty); |
| | | if (!asnOrderService.updateById(o)) { |
| | | throw new CoolException("入库单完成数量更新失败!!"); |
| | |
| | | WkOrderItem oi = asnOrderItemService.getById(e.getKey()); |
| | | if (oi != null) { |
| | | Double newQty = QuantityUtils.roundToScale(QuantityUtils.add(oi.getQty() != null ? oi.getQty() : 0.0, e.getValue())); |
| | | Double planQty = QuantityUtils.roundToScale(oi.getAnfme() != null ? oi.getAnfme() : 0.0); |
| | | if (QuantityUtils.compare(newQty, planQty) > 0) { |
| | | newQty = planQty; |
| | | } |
| | | oi.setQty(newQty); |
| | | if (!asnOrderItemService.updateById(oi)) { |
| | | throw new CoolException("入库单明细完成数量更新失败!!"); |
| | |
| | | } |
| | | } |
| | | } |
| | | // 入/出库均仅云仓来源单据参与上报(明细需带 platOrderCode 或 platWorkCode) |
| | | boolean hasCloudSource = taskItems.stream().anyMatch(this::hasCloudOrderRef); |
| | | // 入库组托场景允许按 WaitPakinItem.asnCode 兜底识别云仓来源,避免 plat* 为空时误跳过 |
| | | boolean hasCloudSource = taskItems.stream().anyMatch(this::hasCloudOrderRef) |
| | | || (isInbound && !sourceToOrderNo.isEmpty()); |
| | | if (!hasCloudSource) { |
| | | log.info("入/出库结果上报待办跳过:无云仓来源单据,taskId={}", task.getId()); |
| | | return; |
| | |
| | | ObjectMapper om = new ObjectMapper(); |
| | | Date now = new Date(); |
| | | for (TaskItem item : taskItems) { |
| | | if (!hasCloudOrderRef(item)) { |
| | | if (item == null) { |
| | | continue; |
| | | } |
| | | boolean hasTaskItemCloudRef = hasCloudOrderRef(item); |
| | | boolean hasInboundAsnFallbackRef = isInbound |
| | | && item.getSource() != null |
| | | && StringUtils.isNotBlank(sourceToOrderNo.get(item.getSource())); |
| | | if (!hasTaskItemCloudRef && !hasInboundAsnFallbackRef) { |
| | | continue; |
| | | } |
| | | String orderNo = isInbound ? sourceToOrderNo.get(item.getSource()) : (item.getPlatOrderCode() != null ? item.getPlatOrderCode() : item.getPlatWorkCode()); |