diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/mapper/ReservationOutMaterialDetailMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/mapper/ReservationOutMaterialDetailMapper.java index 33d72e1f0..a2cb51a8b 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/mapper/ReservationOutMaterialDetailMapper.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/mapper/ReservationOutMaterialDetailMapper.java @@ -57,9 +57,14 @@ public interface ReservationOutMaterialDetailMapper extends BaseMapper select IN_ORDER_NUMBER from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id} - + + + \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockOutOrder/StockOutOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockOutOrder/StockOutOrderApplicationService.java index 6db28a3f2..ce6c22dca 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockOutOrder/StockOutOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockOutOrder/StockOutOrderApplicationService.java @@ -1549,10 +1549,8 @@ public class StockOutOrderApplicationService { item.put("lineNum", split[1]); } } - item.put("itemNo", detail.getMaterialBaseInfoId() != null ? detail.getMaterialBaseInfoId().toString() : ""); + item.put("itemNo", detail.getMaterialCode() != null ? detail.getMaterialCode().toString() : ""); item.put("itemName", detail.getMaterialName() != null ? detail.getMaterialName() : ""); - item.put("spec", detail.getSpecificationModel() != null ? detail.getSpecificationModel() : ""); - item.put("unit", detail.getUnit() != null ? detail.getUnit() : ""); item.put("qty", detail.getQuantity()); // 获取物料详情 @@ -1561,7 +1559,8 @@ public class StockOutOrderApplicationService { if (materialBaseInfoPO != null) { item.put("erpCurr", materialBaseInfoPO.getCurrency() != null ? materialBaseInfoPO.getCurrency() : ""); item.put("erpPrice", materialBaseInfoPO.getUnitPrice()); - + item.put("spec", materialBaseInfoPO.getSpecificationModel() != null ? materialBaseInfoPO.getSpecificationModel() : ""); + item.put("unit", materialBaseInfoPO.getDeclarationUnit() != null ? materialBaseInfoPO.getDeclarationUnit() : ""); // 计算金额 BigDecimal unitPrice = materialBaseInfoPO.getUnitPrice(); BigDecimal quantity = detail.getQuantity(); @@ -1572,55 +1571,45 @@ public class StockOutOrderApplicationService { } } - // 库存关联信息(实体默认值 + WMS覆盖) - item.put("orderINo", detail.getInOrderNumber() != null ? detail.getInOrderNumber() : ""); - if (detail.getLotNo() != null && detail.getLotNo().contains("-")) { - String lotNumStr = detail.getLotNo().substring(detail.getLotNo().lastIndexOf("-") + 1); - try { - Integer lotRowNum = Integer.valueOf(lotNumStr); - item.put("orderIRow", lotRowNum); - item.put("billIRow", lotRowNum); - } catch (NumberFormatException ignored) {} - } - item.put("warehouse", detail.getWarehouseName() != null ? detail.getWarehouseName() : ""); - item.put("opWhLoc", detail.getStorageLocationName() != null ? detail.getStorageLocationName() : ""); - + Long materialInventoryId = detail.getMaterialInventoryId(); + MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId); // WMS仓储数据(如有则覆盖) - if (detail.getLotNo() != null) { + if (materialInventory != null) { + String inOrderNumber = materialInventory.getInOrderNumber(); + String warehouseCode = materialInventory.getWarehouseCode(); + String storageLocationCode = materialInventory.getStorageLocationCode(); + String inLotNo = materialInventory.getLotNumber(); Long kcId = stockOutOrderMapper.getKcId(detail.getLotNo()); if (kcId != null) { - String inOrderNumber = stockOutOrderMapper.getInOrderNumber(kcId); - String inLotNo = inOrderNumber != null ? stockOutOrderMapper.getInLotNo(inOrderNumber, detail.getMaterialBaseInfoId()) : null; - String warehouse = stockOutOrderMapper.getWarehouse(kcId); - String opWhLoc = stockOutOrderMapper.getOpWhLoc(kcId); if (inOrderNumber != null) { item.put("orderINo", inOrderNumber); } - if (warehouse != null) { - item.put("warehouse", warehouse); + if (warehouseCode != null) { + item.put("warehouse", warehouseCode); + } + if (storageLocationCode != null) { + item.put("opWhLoc", storageLocationCode); } - - item.put("opWhLoc", opWhLoc != null ? opWhLoc : ""); - // billI = 入库单号 if (inOrderNumber != null) { item.put("billI", inOrderNumber); } - if (inLotNo != null) { - if (inLotNo.contains("-")) { - String numStr = inLotNo.substring(inLotNo.lastIndexOf("-") + 1); - try { - Integer result = Integer.valueOf(numStr); - item.put("orderIRow", result); - item.put("billIRow", result); - } catch (NumberFormatException e) { - } + if (inLotNo != null && inLotNo.contains("-")) { + String[] split = inLotNo.split("-"); + if (split.length == 2) { + item.put("orderIRow", split[1]); + item.put("billIRow", split[1]); + } else { + item.put("orderIRow", 1); + item.put("billIRow", 1); } + } else { + item.put("orderIRow", 1); + item.put("billIRow", 1); } } } - orderList.add(item); } order.put("orderList", orderList);