diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/shiftManage/ShiftManageApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/shiftManage/ShiftManageApplicationService.java index b37b23248..261ea7177 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/shiftManage/ShiftManageApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/shiftManage/ShiftManageApplicationService.java @@ -741,6 +741,22 @@ public class ShiftManageApplicationService { if (CollectionUtils.isEmpty(shiftMoveMaterialQuantityList)){ continue; } + // 兼容:容器移位通常只有一个目标库位,若部分子项未传 newStorageLocationId,从同组第一个有值的子项复制 + ShiftMoveMaterialQuantityPO firstWithTarget = shiftMoveMaterialQuantityList.stream() + .filter(c -> c.getNewStorageLocationId() != null && c.getNewStorageLocationId() > 0) + .findFirst().orElse(null); + if (firstWithTarget != null) { + shiftMoveMaterialQuantityList.forEach(c -> { + if (c.getNewStorageLocationId() == null || c.getNewStorageLocationId() <= 0) { + c.setNewStorageLocationId(firstWithTarget.getNewStorageLocationId()); + c.setNewStorageSectionId(firstWithTarget.getNewStorageSectionId()); + c.setNewStorageCode(firstWithTarget.getNewStorageCode()); + c.setNewStorageName(firstWithTarget.getNewStorageName()); + c.setNewStorageLocationCode(firstWithTarget.getNewStorageLocationCode()); + c.setNewStorageLocationName(firstWithTarget.getNewStorageLocationName()); + } + }); + } shiftMoveMaterialQuantityList.forEach(shiftMoveMaterialQuantityPO -> { Long newStorageLocationId = shiftMoveMaterialQuantityPO.getNewStorageLocationId(); if (newStorageLocationId == null || newStorageLocationId <= 0) {