|
|
|
@ -53,9 +53,6 @@ public class OtherOutboundServiceImpl implements OtherOutboundService { |
|
|
|
@Autowired |
|
|
|
private HandlingUnitService handlingUnitService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private InventoryStockService inventoryStockService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IfsApiIssueAndReturnService ifsApiIssueAndReturnService; |
|
|
|
|
|
|
|
@ -69,7 +66,7 @@ public class OtherOutboundServiceImpl implements OtherOutboundService { |
|
|
|
List<HandlingUnit> handlingUnits = validateHandlingUnits(dto); |
|
|
|
|
|
|
|
// 2. 验证库存是否足够 |
|
|
|
validateInventoryStock(handlingUnits); |
|
|
|
//validateInventoryStock(handlingUnits); |
|
|
|
|
|
|
|
// 3. 构建OtherOutboundTransRequestDto |
|
|
|
OtherOutboundTransRequestDto transRequest = buildOtherOutboundTransRequest(dto, currentUser); |
|
|
|
@ -177,31 +174,6 @@ public class OtherOutboundServiceImpl implements OtherOutboundService { |
|
|
|
return handlingUnits; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 验证库存是否足够 |
|
|
|
*/ |
|
|
|
private void validateInventoryStock(List<HandlingUnit> handlingUnits) { |
|
|
|
for (HandlingUnit hu : handlingUnits) { |
|
|
|
// 查询当前库存 |
|
|
|
InventoryStock stock = inventoryStockService.lambdaQuery() |
|
|
|
.eq(InventoryStock::getSite, hu.getSite()) |
|
|
|
.eq(InventoryStock::getWarehouseId, hu.getWarehouseId()) |
|
|
|
.eq(InventoryStock::getPartNo, hu.getPartNo()) |
|
|
|
.eq(InventoryStock::getBatchNo, hu.getBatchNo()) |
|
|
|
.eq(InventoryStock::getLocationId, hu.getLocationId()) |
|
|
|
.one(); |
|
|
|
|
|
|
|
if (stock == null) { |
|
|
|
throw new XJException("库存不存在,无法出库: " + hu.getPartNo() + " 批次:" + hu.getBatchNo()); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查库存数量是否足够 |
|
|
|
if (stock.getQtyOnHand().compareTo(hu.getQty()) < 0) { |
|
|
|
throw new XJException("库存不足,无法出库: " + hu.getPartNo() + |
|
|
|
" 当前库存:" + stock.getQtyOnHand() + " 需要出库:" + hu.getQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 构建OtherOutboundTransRequestDto |
|
|
|
|