Browse Source

打印数量

master
han\hanst 3 months ago
parent
commit
130ca9473e
  1. 3
      src/main/java/com/gaotao/modules/warehouse/entity/dto/BatchCreateHuRequestDto.java
  2. 13
      src/main/java/com/gaotao/modules/warehouse/service/impl/IfsInventoryInitServiceImpl.java

3
src/main/java/com/gaotao/modules/warehouse/entity/dto/BatchCreateHuRequestDto.java

@ -33,7 +33,8 @@ public class BatchCreateHuRequestDto {
private String wdr; // WDR
private String locationId; // 库位
private String umid; // 单位
private java.math.BigDecimal qtyOnHand; // 库存数量作为HU数量
private java.math.BigDecimal qtyOnHand; // 库存数量
private java.math.BigDecimal printQty; // 已打印数量
}
}

13
src/main/java/com/gaotao/modules/warehouse/service/impl/IfsInventoryInitServiceImpl.java

@ -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);

Loading…
Cancel
Save