|
|
|
@ -105,7 +105,7 @@ public class InventoryMoveServiceImpl implements InventoryMoveService { |
|
|
|
try { |
|
|
|
|
|
|
|
// 2. 验证HandlingUnit |
|
|
|
List<HandlingUnit> handlingUnits = validateHandlingUnits(dto); |
|
|
|
List<HandlingUnit> handlingUnits = validateHandlingUnitsForPallet(dto); |
|
|
|
|
|
|
|
// 3. 先保存原库位信息用于IFS同步,然后处理每个HandlingUnit |
|
|
|
Map<String, String> originalLocations = new HashMap<>(); |
|
|
|
@ -247,6 +247,35 @@ public class InventoryMoveServiceImpl implements InventoryMoveService { |
|
|
|
return handlingUnits; |
|
|
|
} |
|
|
|
|
|
|
|
private List<HandlingUnit> validateHandlingUnitsForPallet(InventoryMoveRequestDto dto) { |
|
|
|
List<HandlingUnit> handlingUnits = handlingUnitService.lambdaQuery() |
|
|
|
.eq(HandlingUnit::getSite, dto.getSite()) |
|
|
|
.in(HandlingUnit::getUnitId, dto.getHandlingUnitIds()) |
|
|
|
.list(); |
|
|
|
|
|
|
|
if (handlingUnits.size() != dto.getHandlingUnitIds().size()) { |
|
|
|
throw new XJException("部分HandlingUnit不存在或site不匹配"); |
|
|
|
} |
|
|
|
|
|
|
|
// 使用 Iterator 安全地遍历并删除 |
|
|
|
Iterator<HandlingUnit> iterator = handlingUnits.iterator(); |
|
|
|
while (iterator.hasNext()) { |
|
|
|
HandlingUnit hu = iterator.next(); |
|
|
|
|
|
|
|
// 校验是否在库 |
|
|
|
if (!"Y".equals(hu.getInStockFlag())) { |
|
|
|
throw new XJException("HandlingUnit不在库,无法移库: " + hu.getUnitId()); |
|
|
|
} |
|
|
|
|
|
|
|
// 如果目标库位和当前库位相同,跳过(从列表中移除) |
|
|
|
if (dto.getTargetLocationId().equals(hu.getLocationId())) { |
|
|
|
iterator.remove(); // ✅ 安全删除 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return handlingUnits; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 批量同步到IFS - 按site、partNo、locationNo、lotBatchNo合并后调用 |
|
|
|
*/ |
|
|
|
|