Browse Source

engChgLevel+uom

master
han\hanst 3 months ago
parent
commit
ca3587c4f6
  1. 19
      src/main/java/com/gaotao/modules/inspection/service/impl/QualifiedStorageServiceImpl.java
  2. 22
      src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java
  3. 14
      src/main/java/com/gaotao/modules/warehouse/dao/InventoryStockMapper.java
  4. 3
      src/main/java/com/gaotao/modules/warehouse/entity/InventoryStock.java

19
src/main/java/com/gaotao/modules/inspection/service/impl/QualifiedStorageServiceImpl.java

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

22
src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java

@ -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("库存记录创建失败");

14
src/main/java/com/gaotao/modules/warehouse/dao/InventoryStockMapper.java

@ -35,7 +35,7 @@ public interface InventoryStockMapper extends BaseMapper<InventoryStock> {
* 更新库存记录
*/
int updateInventoryStock(@Param("stock") InventoryStock stock);
/**
* 增加库存数量带HandlingUnit
*/
@ -47,15 +47,16 @@ public interface InventoryStockMapper extends BaseMapper<InventoryStock> {
"handling_unit_qty = handling_unit_qty + #{addQty}, " +
"latest_in_date = GETDATE() " +
"WHERE site = #{site} AND warehouse_id = #{warehouseId} AND part_no = #{partNo} " +
"AND batch_no = #{batchNo} AND location_id = #{locationId} AND wdr = #{wdr}")
"AND batch_no = #{batchNo} AND location_id = #{locationId} AND wdr = #{wdr} AND eng_chg_level = #{engChgLevel}")
int updateStockWithHandlingUnit(@Param("site") String site,
@Param("warehouseId") String warehouseId,
@Param("partNo") String partNo,
@Param("batchNo") String batchNo,
@Param("locationId") String locationId,
@Param("wdr") String wdr,
@Param("addQty") BigDecimal addQty);
@Param("addQty") BigDecimal addQty,
@Param("engChgLevel") String engChgLevel);
/**
* 增加库存数量不更新HandlingUnit
*/
@ -66,12 +67,13 @@ public interface InventoryStockMapper extends BaseMapper<InventoryStock> {
"qty_on_hand = qty_on_hand + #{addQty}, " +
"latest_in_date = GETDATE() " +
"WHERE site = #{site} AND warehouse_id = #{warehouseId} AND part_no = #{partNo} " +
"AND batch_no = #{batchNo} AND location_id = #{locationId} AND wdr = #{wdr}")
"AND batch_no = #{batchNo} AND location_id = #{locationId} AND wdr = #{wdr} AND eng_chg_level = #{engChgLevel}")
int updateStockWithoutHandlingUnit(@Param("site") String site,
@Param("warehouseId") String warehouseId,
@Param("partNo") String partNo,
@Param("batchNo") String batchNo,
@Param("locationId") String locationId,
@Param("wdr") String wdr,
@Param("addQty") BigDecimal addQty);
@Param("addQty") BigDecimal addQty,
@Param("engChgLevel") String engChgLevel);
}

3
src/main/java/com/gaotao/modules/warehouse/entity/InventoryStock.java

@ -83,8 +83,7 @@ public class InventoryStock {
@TableField(exist = false)
private BigDecimal unPrintQty;
@TableField(exist = false)
private String umid;
private String umId;
// 查询条件字段
@TableField(exist = false)

Loading…
Cancel
Save