Commit 68c8d8ef377825b53cf4e4a634ed29d3e212c822
1 parent
f97dee93
完善悬架库出库
Showing
4 changed files
with
269 additions
and
9 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java
... | ... | @@ -19,6 +19,8 @@ public interface IContainerService extends IService<Container> { |
19 | 19 | |
20 | 20 | Container getContainerByCode(String containCode, String warehouseCode); |
21 | 21 | |
22 | + boolean removeContainerByCode(String containCode, String warehouseCode); | |
23 | + | |
22 | 24 | Container getContainerByLocationCode(String locationCode, String warehouseCode); |
23 | 25 | |
24 | 26 | boolean updateStatus(String containerCode, String status, String warehouseCode); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java
... | ... | @@ -92,6 +92,19 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
92 | 92 | } |
93 | 93 | |
94 | 94 | @Override |
95 | + public boolean removeContainerByCode(String containCode, String warehouseCode) { | |
96 | + if (StringUtils.isEmpty(containCode)) { | |
97 | + throw new JeecgBootException("容器编码为空"); | |
98 | + } | |
99 | + if (StringUtils.havaLowerCase(containCode)) { | |
100 | + throw new JeecgBootException("容器不能有小字母" + containCode); | |
101 | + } | |
102 | + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
103 | + containerLambdaQueryWrapper.eq(Container::getCode, containCode).eq(Container::getWarehouseCode, warehouseCode); | |
104 | + return containerService.remove(containerLambdaQueryWrapper); | |
105 | + } | |
106 | + | |
107 | + @Override | |
95 | 108 | public Container getContainerByLocationCode(String locationCode, String warehouseCode) { |
96 | 109 | if (StringUtils.isEmpty(locationCode)) { |
97 | 110 | throw new JeecgBootException("库位编码为空"); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java
... | ... | @@ -66,11 +66,19 @@ public interface ITaskHeaderService extends IService<TaskHeader> { |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * 通过目标库位编码,获取任务信息 |
69 | - * @param toLocationCode | |
69 | + * @param fromLocationCode | |
70 | + * @param warehouseCode | |
71 | + * @return | |
72 | + */ | |
73 | + TaskHeader getUnCompleteTransferTaskByFromLocationCode(String fromLocationCode, String warehouseCode); | |
74 | + | |
75 | + /** | |
76 | + * 通过目标库位编码,获取任务信息 | |
77 | + * @param fromLocationCode | |
70 | 78 | * @param warehouseCode |
71 | 79 | * @return |
72 | 80 | */ |
73 | - TaskHeader getUnCompleteTransferTaskByFromLocationCode(String toLocationCode, String warehouseCode); | |
81 | + TaskHeader getUnCompleteShipmentTaskByFromLocationCode(String fromLocationCode, String warehouseCode); | |
74 | 82 | |
75 | 83 | /** |
76 | 84 | * 通过库位编码,获取任务信息 |
... | ... | @@ -302,6 +310,13 @@ public interface ITaskHeaderService extends IService<TaskHeader> { |
302 | 310 | Result completeShipmentTask(TaskHeader taskHeader); |
303 | 311 | |
304 | 312 | /** |
313 | + * 完成悬臂库出库 | |
314 | + * @param taskHeader | |
315 | + * @return | |
316 | + */ | |
317 | + Result completeCantaleverShipmentTask(TaskHeader taskHeader); | |
318 | + | |
319 | + /** | |
305 | 320 | * 完成整出出库,清空库存 |
306 | 321 | * @param inventoryDetailList |
307 | 322 | * @return |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -1025,6 +1025,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | @Override |
1028 | + public TaskHeader getUnCompleteShipmentTaskByFromLocationCode(String fromLocationCode, String warehouseCode) { | |
1029 | + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
1030 | + taskHeaderLambdaQueryWrapper.eq(TaskHeader::getFromLocationCode, fromLocationCode).eq(TaskHeader::getTaskType, QuantityConstant.TASK_TYPE_WHOLESHIPMENT). | |
1031 | + eq(TaskHeader::getWarehouseCode, warehouseCode).lt(TaskHeader::getStatus, | |
1032 | + QuantityConstant.TASK_STATUS_COMPLETED); | |
1033 | + TaskHeader taskHeader = taskHeaderService.getOne(taskHeaderLambdaQueryWrapper); | |
1034 | + return taskHeader; | |
1035 | + } | |
1036 | + | |
1037 | + @Override | |
1028 | 1038 | public TaskHeader getUnCompleteTaskByLocationCode(String locationCode, String warehouseCode) { |
1029 | 1039 | TaskHeader taskHeader = getUnCompleteTaskByFromLocationCode(locationCode, warehouseCode); |
1030 | 1040 | if (taskHeader == null) { |
... | ... | @@ -1101,7 +1111,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1101 | 1111 | break; |
1102 | 1112 | case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: |
1103 | 1113 | case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: |
1104 | - result = taskHeaderService.completeShipmentTask(taskHeader); | |
1114 | + if (zoneCode.equals(QuantityConstant.ZONE_B)) { | |
1115 | + result = taskHeaderService.completeCantaleverShipmentTask(taskHeader); | |
1116 | + } else { | |
1117 | + result = taskHeaderService.completeShipmentTask(taskHeader); | |
1118 | + } | |
1105 | 1119 | break; |
1106 | 1120 | case QuantityConstant.TASK_TYPE_CYCLECOUNT: |
1107 | 1121 | result = taskHeaderService.completeCycleCountTask(taskHeader); |
... | ... | @@ -1648,7 +1662,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1648 | 1662 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_TRANSFER); |
1649 | 1663 | taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_TRANSFER_POSITION); |
1650 | 1664 | taskHeader.setZoneCode(zoneCode); |
1651 | - taskHeader.setContainerCode(fromLocation.getContainerCode()); | |
1665 | + taskHeader.setContainerCode(containerCode); | |
1652 | 1666 | taskHeader.setFromLocationCode(fromLocationCode); |
1653 | 1667 | taskHeader.setToLocationCode(toLocationCode); |
1654 | 1668 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
... | ... | @@ -2376,6 +2390,219 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2376 | 2390 | |
2377 | 2391 | @Override |
2378 | 2392 | @Transactional(rollbackFor = Exception.class) |
2393 | + @OperationLog(bizId = "''", bizType = "'任务追踪'", tag = "'出库任务完成'", extra = "#extraJsonString1", | |
2394 | + msg = "#taskHeader == null ? '' : '任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", | |
2395 | + recordReturnValue = true) | |
2396 | + @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'出库任务完成'", extra = "#extraJsonString1", | |
2397 | + msg = "'任务ID:' + #taskHeader.getId() + ',库位编码:' + #taskHeader.getFromLocationCode() + ',容器编码:' + #taskHeader.getContainerCode() + ',目标出入口:' + #taskHeader.getToPortCode()", | |
2398 | + recordReturnValue = true) | |
2399 | + @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'详情出库完成'", extra = "#extraJsonString2", msg = "''", recordReturnValue = true) | |
2400 | + public Result completeCantaleverShipmentTask(TaskHeader taskHeader) { | |
2401 | + if (taskHeader == null) { | |
2402 | + return Result.error("完成出库任务未找到,执行中止"); | |
2403 | + } | |
2404 | + log.info("开始完成出库任务,任务号:" + taskHeader.getId()); | |
2405 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
2406 | + String fromLocationCode = taskHeader.getFromLocationCode(); | |
2407 | + String toLocationCode = taskHeader.getToLocationCode(); | |
2408 | + String containerCode = taskHeader.getContainerCode(); | |
2409 | + String zoneCode = taskHeader.getZoneCode(); | |
2410 | + int taskType = taskHeader.getTaskType(); | |
2411 | + List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); | |
2412 | + boolean success = false; | |
2413 | + if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { | |
2414 | + return Result.ok("完成出库任务,(" + taskHeader.getId() + ")任务已经是完成的!"); | |
2415 | + } | |
2416 | + // 如果任务详情为空,那么就是呼叫料盒,但是又没入库进去。 | |
2417 | + if (taskDetailList.isEmpty()) { | |
2418 | + throw new JeecgBootException("完成出库任务失败,任务详情为空"); | |
2419 | + } | |
2420 | + if (StringUtils.isEmpty(fromLocationCode)) { | |
2421 | + return Result.error("完成出库任务" + taskHeader.getId() + "没有起始库位,执行中止"); | |
2422 | + } | |
2423 | + if (StringUtils.isEmpty(toLocationCode) && (taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT)) { | |
2424 | + return Result.error("完成出库任务,任务" + taskHeader.getId() + "没有目的库位,执行中止"); | |
2425 | + } | |
2426 | + InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | |
2427 | + if (inventoryHeader == null) { | |
2428 | + return Result.error("完成出库任务,出库任务" + taskHeader.getId() + "没有找到库存头"); | |
2429 | + } | |
2430 | + List<InventoryTransaction> inventoryTransactionList = new ArrayList<>(); | |
2431 | + List<Integer> shipmentIdList = new ArrayList<>(); | |
2432 | + List<ShipmentDetail> shipmentDetailList = new ArrayList<>(); | |
2433 | + List<ShipmentDetail> updateStatusShipmentDetailList = new ArrayList<>(); | |
2434 | + for (TaskDetail taskDetail : taskDetailList) { | |
2435 | + ShipmentContainerDetail shipmentContainerDetail = shipmentContainerDetailService.getById(taskDetail.getShipmentContainerDetailId()); | |
2436 | + if (shipmentContainerDetail == null) { | |
2437 | + throw new JeecgBootException("完成出库任务, 出库任务没有找到出库组盘详情" + taskDetail.getShipmentContainerDetailId()); | |
2438 | + } | |
2439 | + ShipmentDetail shipmentDetail = shipmentDetailService.getById(taskDetail.getShipmentDetailId()); | |
2440 | + if (shipmentDetail == null) { | |
2441 | + throw new JeecgBootException("完成出库任务, 出库任务没有找到出库详情" + taskDetail.getShipmentDetailId()); | |
2442 | + } | |
2443 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(shipmentDetail.getShipmentId()); | |
2444 | + if (shipmentHeader == null) { | |
2445 | + throw new JeecgBootException("完成出库任务, 出库任务没有找到出库单" + shipmentDetail.getShipmentId()); | |
2446 | + } | |
2447 | + taskDetail.setShipmentCode(shipmentDetail.getShipmentCode()); | |
2448 | + int shipmentDetailId = shipmentDetail.getId(); | |
2449 | + BigDecimal shipmentQty = shipmentDetail.getShipmentQty(); | |
2450 | + shipmentQty = shipmentQty.add(taskDetail.getQty()); | |
2451 | + int status = QuantityConstant.SHIPMENT_HEADER_COMPLETED; | |
2452 | + if (shipmentDetail.getQty().compareTo(shipmentQty) == 0) { | |
2453 | + status = QuantityConstant.SHIPMENT_HEADER_COMPLETED; | |
2454 | + } else if (shipmentDetail.getQty().compareTo(shipmentQty) > 0) { | |
2455 | + status = QuantityConstant.SHIPMENT_HEADER_OFF_SHELF; | |
2456 | + } else if (shipmentDetail.getQty().compareTo(shipmentQty) < 0) { | |
2457 | + throw new JeecgBootException("完成出库任务时, 出库单 单据数量不能小于出库数量"); | |
2458 | + } | |
2459 | + shipmentDetailList.add(shipmentDetail); | |
2460 | + ShipmentDetail updateStatusShipmentDetail = new ShipmentDetail(); | |
2461 | + updateStatusShipmentDetail.setId(shipmentDetailId); | |
2462 | + updateStatusShipmentDetail.setStatus(status); | |
2463 | + updateStatusShipmentDetail.setShipmentQty(shipmentQty); | |
2464 | + updateStatusShipmentDetailList.add(updateStatusShipmentDetail); | |
2465 | + success = shipmentDetailService.updateById(updateStatusShipmentDetail); | |
2466 | + if (!success) { | |
2467 | + throw new JeecgBootException("完成出库任务,更新出库详情失败"); | |
2468 | + } | |
2469 | + InventoryDetail inventoryDetail = inventoryDetailService.getById(taskDetail.getFromInventoryDetailId()); | |
2470 | + if (inventoryDetail == null) { | |
2471 | + throw new JeecgBootException("完成出库任务,出库任务没有找到库存详情" + taskDetail.getFromInventoryDetailId()); | |
2472 | + } | |
2473 | + BigDecimal taskQty = BigDecimal.ZERO; | |
2474 | + BigDecimal qty = inventoryDetail.getQty().subtract(taskDetail.getQty()); | |
2475 | + inventoryDetail.setTaskQty(taskQty); | |
2476 | + inventoryDetail.setQty(qty); | |
2477 | + inventoryDetail.setLocationCode(toLocationCode); | |
2478 | + // 扣减后的库存不能小于0 | |
2479 | + if (inventoryDetail.getQty().compareTo(BigDecimal.ZERO) < 0) { | |
2480 | + throw new JeecgBootException("完成出库任务,扣减库存大于wms库存"); | |
2481 | + } | |
2482 | + if (inventoryDetail.getQty().compareTo(BigDecimal.ZERO) == 0) { | |
2483 | + if (inventoryDetail.getTaskQty().compareTo(BigDecimal.ZERO) != 0) { | |
2484 | + throw new JeecgBootException("完成出库任务,已无库存量可以扣减"); | |
2485 | + } | |
2486 | + success = inventoryDetailService.removeById(inventoryDetail.getId()); | |
2487 | + if (!success) { | |
2488 | + throw new JeecgBootException("完成出库任务,删除库存详情失败"); | |
2489 | + } | |
2490 | + } else { | |
2491 | + success = inventoryDetailService.updateQtyAndTaskQtyAndLocationCode(qty, taskQty, toLocationCode, inventoryDetail.getId()); | |
2492 | + if (!success) { | |
2493 | + throw new JeecgBootException("完成出库任务,更新库存详情失败"); | |
2494 | + } | |
2495 | + } | |
2496 | + | |
2497 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
2498 | + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_SHIPMENT); | |
2499 | + inventoryTransaction.setWarehouseCode(warehouseCode); | |
2500 | + inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); | |
2501 | + inventoryTransaction.setContainerCode(containerCode); | |
2502 | + inventoryTransaction.setZoneCode(zoneCode); | |
2503 | + inventoryTransaction.setFromLocationCode(fromLocationCode); | |
2504 | + inventoryTransaction.setToLocationCode(toLocationCode); | |
2505 | + inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); | |
2506 | + inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); | |
2507 | + inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
2508 | + inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
2509 | + inventoryTransaction.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
2510 | + inventoryTransaction.setShipmentId(taskDetail.getShipmentId()); | |
2511 | + inventoryTransaction.setShipmentCode(shipmentHeader.getCode()); | |
2512 | + inventoryTransaction.setShipmentType(shipmentHeader.getType()); | |
2513 | + inventoryTransaction.setShipmentDetailId(taskDetail.getShipmentDetailId()); | |
2514 | + inventoryTransaction.setShipmentContainerDetailId(taskDetail.getShipmentContainerDetailId()); | |
2515 | + inventoryTransaction.setBatch(inventoryDetail.getBatch()); | |
2516 | + inventoryTransaction.setLot(inventoryDetail.getLot()); | |
2517 | + inventoryTransaction.setProject(inventoryDetail.getProject()); | |
2518 | + inventoryTransaction.setQty(taskDetail.getQty()); | |
2519 | + inventoryTransaction.setShipmentQty(taskDetail.getQty()); | |
2520 | + BigDecimal inventoryQty = inventoryDetailService.getInventorySumQty(inventoryDetail); | |
2521 | + // 获得物料在这个托盘上的库存数 | |
2522 | + BigDecimal containerInventoryQty = inventoryDetailService.getContainerInventorySumQty(inventoryDetail); | |
2523 | + inventoryTransaction.setInventoryQty(inventoryQty); | |
2524 | + inventoryTransaction.setContainerInventoryQty(containerInventoryQty); | |
2525 | + inventoryTransactionList.add(inventoryTransaction); | |
2526 | + shipmentIdList.add(taskDetail.getShipmentId()); | |
2527 | + } | |
2528 | + success = inventoryTransactionService.saveBatch(inventoryTransactionList); | |
2529 | + if (!success) { | |
2530 | + throw new JeecgBootException("完成出库任务,保存库存详情失败"); | |
2531 | + } | |
2532 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | |
2533 | + if (inventoryDetailList.size() == 0) { | |
2534 | + success = inventoryHeaderService.removeById(inventoryHeader.getId()); | |
2535 | + if (!success) { | |
2536 | + throw new JeecgBootException("完成出库任务,删除库存头失败"); | |
2537 | + } | |
2538 | + success = containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2539 | + if (!success) { | |
2540 | + throw new JeecgBootException("完成出库任务,更新容器状态失败"); | |
2541 | + } | |
2542 | + success = locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2543 | + if (!success) { | |
2544 | + throw new JeecgBootException("完成出库任务, 任务类型" + taskType + "完成任务时, 更新源库位失败"); | |
2545 | + } | |
2546 | + success = containerService.removeContainerByCode(containerCode, warehouseCode); | |
2547 | + if (!success) { | |
2548 | + throw new JeecgBootException("完成出库任务,删除容器失败"); | |
2549 | + } | |
2550 | + } else { | |
2551 | + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2552 | + if (!success) { | |
2553 | + throw new JeecgBootException("完成出库任务,更新容器状态失败"); | |
2554 | + } | |
2555 | + success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2556 | + if (!success) { | |
2557 | + throw new JeecgBootException("完成出库任务, 任务类型" + taskType + "完成任务时, 更新源库位失败"); | |
2558 | + } | |
2559 | + if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) { | |
2560 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新托盘状态失败"); | |
2561 | + } | |
2562 | + | |
2563 | + } | |
2564 | + ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(taskHeader.getShipmentContainerHeaderId()); | |
2565 | + if (shipmentContainerHeader == null) { | |
2566 | + throw new JeecgBootException("完成出库任务,获取出库组盘头失败"); | |
2567 | + } | |
2568 | + shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_FINISHED); | |
2569 | + success = shipmentContainerHeaderService.updateStatusById(QuantityConstant.SHIPMENT_CONTAINER_FINISHED, shipmentContainerHeader.getId()); | |
2570 | + if (!success) { | |
2571 | + throw new JeecgBootException("完成出库任务,更新出库组盘头失败"); | |
2572 | + } | |
2573 | + inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | |
2574 | + if (inventoryDetailList.size() != 0) { | |
2575 | + if (!taskHeaderService.combineInventoryDetail(containerCode, warehouseCode)) { | |
2576 | + throw new JeecgBootException("合并入库库存失败"); | |
2577 | + } | |
2578 | + } | |
2579 | + shipmentIdList = shipmentIdList.stream().distinct().collect(Collectors.toList()); | |
2580 | + for (Integer shipmentId : shipmentIdList) { | |
2581 | + success = shipmentHeaderService.updateShipmentHeaderStatus(shipmentId); | |
2582 | + if (!success) { | |
2583 | + throw new JeecgBootException("完成出库任务,更新出库单头失败"); | |
2584 | + } | |
2585 | + } | |
2586 | +// Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode, | |
2587 | +// toLocationCode, warehouseCode); | |
2588 | +// if (!result.isSuccess()) { | |
2589 | +// throw new JeecgBootException(result.getMessage()); | |
2590 | +// } | |
2591 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
2592 | + if (!success) { | |
2593 | + throw new JeecgBootException("完成出库任务,保存任务头失败"); | |
2594 | + } | |
2595 | + // 操作记录添加 | |
2596 | + shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList()); | |
2597 | + LogRecordContext.putVariable("taskHeader", taskHeader); | |
2598 | + LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); | |
2599 | + LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(shipmentDetailList)); | |
2600 | + log.info("完成出库任务,任务号:" + taskHeader.getId()); | |
2601 | + return Result.ok("完成出库任务"); | |
2602 | + } | |
2603 | + | |
2604 | + @Override | |
2605 | + @Transactional(rollbackFor = Exception.class) | |
2379 | 2606 | public Result completeWholeShipmentTaskClearInventory(InventoryHeader inventoryHeader, List<InventoryDetail> inventoryDetailList) { |
2380 | 2607 | List<InventoryTransaction> inventoryTransactionList = new ArrayList<>(); |
2381 | 2608 | for (InventoryDetail inventoryDetail : inventoryDetailList) { |
... | ... | @@ -3636,11 +3863,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
3636 | 3863 | throw new JeecgBootException("完成移库任务时,更新起始库位失败"); |
3637 | 3864 | } |
3638 | 3865 | } else { |
3639 | - if (!containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode)) { | |
3640 | - throw new JeecgBootException("完成移库任务时,更新起始容器失败"); | |
3641 | - } | |
3642 | - if (!locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode)) { | |
3643 | - throw new JeecgBootException("完成移库任务时,更新起始库位失败"); | |
3866 | + TaskHeader unCompleteTask = taskHeaderService.getUnCompleteShipmentTaskByFromLocationCode(fromLocationCode, warehouseCode); | |
3867 | + if (unCompleteTask == null) { | |
3868 | + if (!containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode)) { | |
3869 | + throw new JeecgBootException("完成移库任务时,更新起始容器失败"); | |
3870 | + } | |
3871 | + if (!locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode)) { | |
3872 | + throw new JeecgBootException("完成移库任务时,更新起始库位失败"); | |
3873 | + } | |
3644 | 3874 | } |
3645 | 3875 | } |
3646 | 3876 | if (!containerService.updateLocationCode(toContainerCode, toLocationCode, warehouseCode)) { |
... | ... |