|
|
|
@ -422,7 +422,9 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { |
|
|
|
handlingUnit.setUnitTypeDb("ROLL"); |
|
|
|
handlingUnit.setPartNo(item.getPartNo()); |
|
|
|
handlingUnit.setPartDesc(item.getPartDesc()); |
|
|
|
handlingUnit.setQty(item.getQtyOnHand()); // HU数量使用库存数量 |
|
|
|
// HU数量 = 库存数量 - 已打印数量 |
|
|
|
BigDecimal huQty = item.getQtyOnHand().subtract(item.getPrintQty() != null ? item.getPrintQty() : BigDecimal.ZERO); |
|
|
|
handlingUnit.setQty(huQty); |
|
|
|
handlingUnit.setBatchNo(item.getBatchNo()); // 使用每行自己的批次号 |
|
|
|
handlingUnit.setLocationId(item.getLocationId()); |
|
|
|
handlingUnit.setWarehouseId("TEMP"); |
|
|
|
@ -475,18 +477,17 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { |
|
|
|
allUnitIds.add(unitId); |
|
|
|
|
|
|
|
// 更新打印数量 |
|
|
|
BigDecimal totalPrintQty = item.getQtyOnHand(); |
|
|
|
|
|
|
|
// 校验打印数量不能超过入库数量 |
|
|
|
if (ifsStock.getQtyOnHand() != null) { |
|
|
|
BigDecimal currentPrintQty = ifsStock.getPrintQty() != null ? ifsStock.getPrintQty() : BigDecimal.ZERO; |
|
|
|
BigDecimal newPrintQty = currentPrintQty.add(totalPrintQty); |
|
|
|
BigDecimal newPrintQty = currentPrintQty.add(huQty); |
|
|
|
if (newPrintQty.compareTo(ifsStock.getQtyOnHand()) > 0) { |
|
|
|
log.error("打印数量超过库存数量: 当前已打印={}, 本次打印={}, 库存数量={}", |
|
|
|
currentPrintQty, totalPrintQty, ifsStock.getQtyOnHand()); |
|
|
|
currentPrintQty, huQty, ifsStock.getQtyOnHand()); |
|
|
|
throw new RuntimeException(String.format( |
|
|
|
"打印数量不能超过库存数量!当前已打印:%s,本次打印:%s,库存数量:%s", |
|
|
|
currentPrintQty, totalPrintQty, ifsStock.getQtyOnHand())); |
|
|
|
currentPrintQty, huQty, ifsStock.getQtyOnHand())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -497,7 +498,7 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { |
|
|
|
item.getBatchNo(), |
|
|
|
item.getLocationId(), |
|
|
|
item.getWdr(), |
|
|
|
totalPrintQty |
|
|
|
huQty |
|
|
|
); |
|
|
|
|
|
|
|
log.info("HU创建成功: unitId={}", unitId); |
|
|
|
|