From a125c6fffc5f657978150b72e1bc52062c281bbb Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Tue, 31 Mar 2026 11:54:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=BA=9F=E5=B8=A6=E4=B8=8AengChgLevel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/scrap/entity/ScrapLabelDto.java | 1 + .../scrap/service/impl/ScrapServiceImpl.java | 40 +++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/gaotao/modules/scrap/entity/ScrapLabelDto.java b/src/main/java/com/gaotao/modules/scrap/entity/ScrapLabelDto.java index 7ab0809..e0d7eb8 100644 --- a/src/main/java/com/gaotao/modules/scrap/entity/ScrapLabelDto.java +++ b/src/main/java/com/gaotao/modules/scrap/entity/ScrapLabelDto.java @@ -18,4 +18,5 @@ public class ScrapLabelDto { private String locationId; private String warehouseId; private String inStockFlag; + private String engChgLevel; } diff --git a/src/main/java/com/gaotao/modules/scrap/service/impl/ScrapServiceImpl.java b/src/main/java/com/gaotao/modules/scrap/service/impl/ScrapServiceImpl.java index df1ea8f..07de12e 100644 --- a/src/main/java/com/gaotao/modules/scrap/service/impl/ScrapServiceImpl.java +++ b/src/main/java/com/gaotao/modules/scrap/service/impl/ScrapServiceImpl.java @@ -121,7 +121,7 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService labelInfo.setLocationId(handlingUnit.getLocationId()); labelInfo.setWarehouseId(handlingUnit.getWarehouseId()); labelInfo.setInStockFlag(handlingUnit.getInStockFlag()); - + labelInfo.setEngChgLevel(handlingUnit.getEngChgLevel()); return labelInfo; } catch (Exception e) { @@ -209,14 +209,19 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService return; } - // 查询对应的库存记录,增加WDR条件 + String engChgLevel = StringUtils.isNotBlank(label.getEngChgLevel()) + ? label.getEngChgLevel() + : (StringUtils.isNotBlank(handlingUnit.getEngChgLevel()) ? handlingUnit.getEngChgLevel() : "1"); + + // 查询对应的库存记录,增加WDR和ENG_CHG_LEVEL条件 QueryWrapper stockWrapper = new QueryWrapper<>(); stockWrapper.eq("site", site) .eq("part_no", label.getPartNo()) .eq("batch_no", label.getBatchNo()) .eq("location_id", label.getLocationId()) .eq("warehouse_id", label.getWarehouseId()) - .eq("wdr", handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "*"); + .eq("wdr", handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "*") + .eq("eng_chg_level", engChgLevel); InventoryStock stock = inventoryStockService.getOne(stockWrapper); if (stock != null) { @@ -241,16 +246,17 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService .eq(InventoryStock::getPartNo, label.getPartNo()) .eq(InventoryStock::getBatchNo, label.getBatchNo()) .eq(InventoryStock::getLocationId, label.getLocationId()) - .eq(InventoryStock::getWdr, handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "*"); + .eq(InventoryStock::getWdr, handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "*") + .eq(InventoryStock::getEngChgLevel, engChgLevel); inventoryStockService.update(stock, updateWrapper); - log.info("库存更新成功 - 物料: {}, 批次: {}, 库位: {}, WDR: {}, 原库存: {}, 报废数量: {}, 新库存: {}", + log.info("库存更新成功 - 物料: {}, 批次: {}, 库位: {}, WDR: {}, ENG_CHG_LEVEL: {}, 原库存: {}, 报废数量: {}, 新库存: {}", label.getPartNo(), label.getBatchNo(), label.getLocationId(), - handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "", currentQty, label.getQuantity(), newQty); + handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "", engChgLevel, currentQty, label.getQuantity(), newQty); } else { - log.warn("未找到对应的库存记录 - 物料: {}, 批次: {}, 库位: {}, WDR: {}", + log.warn("未找到对应的库存记录 - 物料: {}, 批次: {}, 库位: {}, WDR: {}, ENG_CHG_LEVEL: {}", label.getPartNo(), label.getBatchNo(), label.getLocationId(), - handlingUnit.getWdr() != null ? handlingUnit.getWdr() : ""); + handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "", engChgLevel); throw new RuntimeException("库存不存在"); } } catch (Exception e) { @@ -279,12 +285,17 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService continue; } - // 生成汇总键:物料号+批次号+库位+WDR - String summaryKey = String.format("%s|%s|%s|%s", + String engChgLevel = StringUtils.isNotBlank(label.getEngChgLevel()) + ? label.getEngChgLevel() + : (StringUtils.isNotBlank(handlingUnit.getEngChgLevel()) ? handlingUnit.getEngChgLevel() : "1"); + + // 生成汇总键:物料号+批次号+库位+WDR+ENG_CHG_LEVEL + String summaryKey = String.format("%s|%s|%s|%s|%s", label.getPartNo(), label.getBatchNo() != null ? label.getBatchNo() : "", label.getLocationId() != null ? label.getLocationId() : "", - handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "*" + handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "*", + engChgLevel ); ScrapSummaryInfo summaryInfo = summaryMap.computeIfAbsent(summaryKey, k -> { @@ -293,6 +304,7 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService info.setBatchNo(label.getBatchNo() != null ? label.getBatchNo() : ""); info.setLocationId(label.getLocationId() != null ? label.getLocationId() : ""); info.setWdr(handlingUnit.getWdr() != null ? handlingUnit.getWdr() : "*"); + info.setEngChgLevel(engChgLevel); info.setTotalQty(BigDecimal.ZERO); info.setHuList(new ArrayList<>()); return info; @@ -332,7 +344,7 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService Map.entry("ifsLocationNo", summaryInfo.getLocationId() != null ? summaryInfo.getLocationId() : ""), Map.entry("ifsLotBatchNo", summaryInfo.getBatchNo() != null ? summaryInfo.getBatchNo() : ""), Map.entry("ifsSerialNo", "*"), - Map.entry("ifsEngChgLevel", "1"), + Map.entry("ifsEngChgLevel", summaryInfo.getEngChgLevel() != null ? summaryInfo.getEngChgLevel() : "1"), Map.entry("ifsWdrNo", summaryInfo.getWdr() != null ? summaryInfo.getWdr() : "*"), Map.entry("ifsHandlingUntiID", "0"), Map.entry("ifsQtyScrapped", summaryInfo.getTotalQty()), // 保持 BigDecimal 精度 @@ -378,6 +390,7 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService private String batchNo; private String locationId; private String wdr; + private String engChgLevel; private BigDecimal totalQty; private List huList; @@ -394,6 +407,9 @@ public class ScrapServiceImpl extends AbstractController implements ScrapService public String getWdr() { return wdr; } public void setWdr(String wdr) { this.wdr = wdr; } + public String getEngChgLevel() { return engChgLevel; } + public void setEngChgLevel(String engChgLevel) { this.engChgLevel = engChgLevel; } + public BigDecimal getTotalQty() { return totalQty; } public void setTotalQty(BigDecimal totalQty) { this.totalQty = totalQty; }