|
|
|
@ -228,9 +228,9 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
handlingUnitPart(inData, i, transHeader, currentUser,shelfLife,receiptDetail); |
|
|
|
} |
|
|
|
// 免检更新库存 待检验的出入库记录状态为待检验 |
|
|
|
if ("N".equals(inData.getNeedCheck())) { |
|
|
|
//if ("N".equals(inData.getNeedCheck())) { |
|
|
|
genInventoryStock(inData, transHeader, receiptDetail); |
|
|
|
} |
|
|
|
//} |
|
|
|
// 处理料件属性(创建或更新) |
|
|
|
handlePartAttribute(inData); |
|
|
|
// 同步到IFS |
|
|
|
@ -415,10 +415,12 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
|
|
|
|
if (existingStock != null) { |
|
|
|
// 库存存在,更新库存 |
|
|
|
updateExistingStock(site, warehouseId, partNo, batchNo, locationId, wdr, transQty, huFlag); |
|
|
|
updateExistingStock(site, warehouseId, partNo, batchNo, locationId, wdr, transQty, |
|
|
|
huFlag,inData.getEngChgLevel()); |
|
|
|
} else { |
|
|
|
// 库存不存在,创建新库存记录 |
|
|
|
createNewStock(site, warehouseId, partNo, batchNo, locationId, wdr, transQty, huFlag, receiptDetail); |
|
|
|
createNewStock(site, warehouseId, partNo, batchNo, locationId, wdr, transQty, huFlag, |
|
|
|
receiptDetail,inData.getEngChgLevel(),inData.getPurchaseUOM()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -427,17 +429,17 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
*/ |
|
|
|
private void updateExistingStock(String site, String warehouseId, String partNo, |
|
|
|
String batchNo, String locationId, String wdr, |
|
|
|
BigDecimal addQty, String huFlag) { |
|
|
|
BigDecimal addQty, String huFlag,String engChgLevel) { |
|
|
|
int updateResult; |
|
|
|
|
|
|
|
if ("Y".equals(huFlag)) { |
|
|
|
// 如果是整箱入库,更新HandlingUnitQty字段 |
|
|
|
updateResult = inventoryStockMapper.updateStockWithHandlingUnit( |
|
|
|
site, warehouseId, partNo, batchNo, locationId, wdr, addQty); |
|
|
|
site, warehouseId, partNo, batchNo, locationId, wdr, addQty,engChgLevel); |
|
|
|
} else { |
|
|
|
// 普通入库,不更新HandlingUnitQty字段 |
|
|
|
updateResult = inventoryStockMapper.updateStockWithoutHandlingUnit( |
|
|
|
site, warehouseId, partNo, batchNo, locationId, wdr, addQty); |
|
|
|
site, warehouseId, partNo, batchNo, locationId, wdr, addQty,engChgLevel); |
|
|
|
} |
|
|
|
|
|
|
|
if (updateResult == 0) { |
|
|
|
@ -450,7 +452,8 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
*/ |
|
|
|
private void createNewStock(String site, String warehouseId, String partNo, |
|
|
|
String batchNo, String locationId, String wdr, |
|
|
|
BigDecimal transQty, String huFlag, PoReceiptDetail receiptDetail) { |
|
|
|
BigDecimal transQty, String huFlag, PoReceiptDetail receiptDetail, |
|
|
|
String engChgLevel,String purchaseUOM) { |
|
|
|
InventoryStock newStock = new InventoryStock(); |
|
|
|
newStock.setSite(site); |
|
|
|
newStock.setWarehouseId(warehouseId); |
|
|
|
@ -477,7 +480,8 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
if ("Y".equals(huFlag)) { |
|
|
|
newStock.setHandlingUnitQty(transQty); |
|
|
|
} |
|
|
|
|
|
|
|
newStock.setEngChgLevel(engChgLevel!=null?engChgLevel:"1"); |
|
|
|
newStock.setUmId(purchaseUOM); |
|
|
|
int insertResult = inventoryStockMapper.insert(newStock); |
|
|
|
if (insertResult == 0) { |
|
|
|
throw new XJException("库存记录创建失败"); |
|
|
|
|