diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index 78794a5..526cc70 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java @@ -1073,6 +1073,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea return Result.error("完成入库任务时,没有找到目的库位"); } InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); + if (inventoryHeader != null && taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT && !fromLocationCode.equals(toLocationCode)) { + inventoryHeader.setLocationCode(toLocationCode); + inventoryHeader.setZoneCode(zoneCode); + if (!inventoryHeaderService.updateById(inventoryHeader)) { + throw new JeecgBootException("完成入库任务时, 更新库存头失败"); + } + List<InventoryDetail> inventoryDetails = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); + for (InventoryDetail inventoryDetail : inventoryDetails) { + inventoryDetail.setLocationCode(toLocationCode); + inventoryDetail.setZoneCode(zoneCode); + if (!inventoryDetailService.updateById(inventoryDetail)) { + throw new JeecgBootException("完成入库任务时, 更新库存详情失败"); + } + } + } if (inventoryHeader == null) { inventoryHeader = new InventoryHeader(); inventoryHeader.setWarehouseCode(warehouseCode);