|
|
@ -248,6 +248,9 @@ public class QualifiedStorageServiceImpl implements QualifiedStorageService { |
|
|
String engChgLevel = params.get("engChgLevel") != null ? |
|
|
String engChgLevel = params.get("engChgLevel") != null ? |
|
|
params.get("engChgLevel").toString() : "1"; |
|
|
params.get("engChgLevel").toString() : "1"; |
|
|
|
|
|
|
|
|
|
|
|
String uom = params.get("uom") != null ? |
|
|
|
|
|
params.get("uom").toString() : null; |
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
@SuppressWarnings("unchecked") |
|
|
List<String> handlingUnitIds = (List<String>) params.get("handlingUnitIds"); |
|
|
List<String> handlingUnitIds = (List<String>) params.get("handlingUnitIds"); |
|
|
|
|
|
|
|
|
@ -366,7 +369,7 @@ public class QualifiedStorageServiceImpl implements QualifiedStorageService { |
|
|
handlingUnitService.update(huUpdate, huWrapper); |
|
|
handlingUnitService.update(huUpdate, huWrapper); |
|
|
|
|
|
|
|
|
// 6. 更新库存 |
|
|
// 6. 更新库存 |
|
|
updateInventoryStock(inboundHeader, inboundDetail, qtyToMove, firstHu); |
|
|
|
|
|
|
|
|
updateInventoryStock(inboundHeader, inboundDetail, qtyToMove, firstHu,engChgLevel,uom); |
|
|
|
|
|
|
|
|
// 7. 调用IFS接口进行移库 |
|
|
// 7. 调用IFS接口进行移库 |
|
|
PurchaseOrderMoveToStockDto moveDto = new PurchaseOrderMoveToStockDto(); |
|
|
PurchaseOrderMoveToStockDto moveDto = new PurchaseOrderMoveToStockDto(); |
|
|
@ -413,7 +416,7 @@ public class QualifiedStorageServiceImpl implements QualifiedStorageService { |
|
|
* 更新库存 |
|
|
* 更新库存 |
|
|
*/ |
|
|
*/ |
|
|
private void updateInventoryStock(TransHeader transHeader, TransDetail transDetail, BigDecimal qty, |
|
|
private void updateInventoryStock(TransHeader transHeader, TransDetail transDetail, BigDecimal qty, |
|
|
HandlingUnit firstHu) { |
|
|
|
|
|
|
|
|
HandlingUnit firstHu,String engChgLevel, String uom) { |
|
|
// 直接在此方法中实现库存创建逻辑,使用带行锁的库存操作,防止并发 |
|
|
// 直接在此方法中实现库存创建逻辑,使用带行锁的库存操作,防止并发 |
|
|
String site = transDetail.getSite(); |
|
|
String site = transDetail.getSite(); |
|
|
String locationId = transDetail.getLocationId(); |
|
|
String locationId = transDetail.getLocationId(); |
|
|
@ -440,10 +443,10 @@ public class QualifiedStorageServiceImpl implements QualifiedStorageService { |
|
|
|
|
|
|
|
|
if (existingStock != null) { |
|
|
if (existingStock != null) { |
|
|
// 库存存在,更新库存(检验入库一般不涉及HandlingUnit) |
|
|
// 库存存在,更新库存(检验入库一般不涉及HandlingUnit) |
|
|
updateExistingStockForInspection(site, warehouseId, partNo, batchNo, locationId, wdr, transQty); |
|
|
|
|
|
|
|
|
updateExistingStockForInspection(site, warehouseId, partNo, batchNo, locationId, wdr, transQty,engChgLevel); |
|
|
} else { |
|
|
} else { |
|
|
// 库存不存在,创建新库存记录 |
|
|
// 库存不存在,创建新库存记录 |
|
|
createNewStockForInspection(site, warehouseId, partNo, batchNo, locationId, wdr, transQty, firstHu); |
|
|
|
|
|
|
|
|
createNewStockForInspection(site, warehouseId, partNo, batchNo, locationId, wdr, transQty, firstHu,uom); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -452,10 +455,10 @@ public class QualifiedStorageServiceImpl implements QualifiedStorageService { |
|
|
*/ |
|
|
*/ |
|
|
private void updateExistingStockForInspection(String site, String warehouseId, String partNo, |
|
|
private void updateExistingStockForInspection(String site, String warehouseId, String partNo, |
|
|
String batchNo, String locationId, String wdr, |
|
|
String batchNo, String locationId, String wdr, |
|
|
BigDecimal addQty) { |
|
|
|
|
|
|
|
|
BigDecimal addQty,String engChgLevel) { |
|
|
// 检验入库一般不更新HandlingUnit数量 |
|
|
// 检验入库一般不更新HandlingUnit数量 |
|
|
int updateResult = inventoryStockMapper.updateStockWithoutHandlingUnit( |
|
|
int updateResult = inventoryStockMapper.updateStockWithoutHandlingUnit( |
|
|
site, warehouseId, partNo, batchNo, locationId, wdr, addQty); |
|
|
|
|
|
|
|
|
site, warehouseId, partNo, batchNo, locationId, wdr, addQty,engChgLevel); |
|
|
|
|
|
|
|
|
if (updateResult == 0) { |
|
|
if (updateResult == 0) { |
|
|
throw new XJException("库存更新失败,可能记录已被删除或修改"); |
|
|
throw new XJException("库存更新失败,可能记录已被删除或修改"); |
|
|
@ -467,7 +470,7 @@ public class QualifiedStorageServiceImpl implements QualifiedStorageService { |
|
|
*/ |
|
|
*/ |
|
|
private void createNewStockForInspection(String site, String warehouseId, String partNo, |
|
|
private void createNewStockForInspection(String site, String warehouseId, String partNo, |
|
|
String batchNo, String locationId, String wdr, |
|
|
String batchNo, String locationId, String wdr, |
|
|
BigDecimal transQty, HandlingUnit firstHu) { |
|
|
|
|
|
|
|
|
BigDecimal transQty, HandlingUnit firstHu,String uom) { |
|
|
InventoryStock newStock = new InventoryStock(); |
|
|
InventoryStock newStock = new InventoryStock(); |
|
|
newStock.setSite(site); |
|
|
newStock.setSite(site); |
|
|
newStock.setWarehouseId(warehouseId); |
|
|
newStock.setWarehouseId(warehouseId); |
|
|
@ -494,7 +497,7 @@ public class QualifiedStorageServiceImpl implements QualifiedStorageService { |
|
|
// 从 PoReceiptDetail 中获取长度和宽度 |
|
|
// 从 PoReceiptDetail 中获取长度和宽度 |
|
|
newStock.setLength(firstHu.getLength()); |
|
|
newStock.setLength(firstHu.getLength()); |
|
|
newStock.setWidth(firstHu.getWidth()); |
|
|
newStock.setWidth(firstHu.getWidth()); |
|
|
|
|
|
|
|
|
|
|
|
newStock.setUmId(uom); |
|
|
|
|
|
|
|
|
// 检验入库一般不设置HandlingUnitQty |
|
|
// 检验入库一般不设置HandlingUnitQty |
|
|
|
|
|
|
|
|
|