From b1765b65a0188e20227a5cac00d9e4ad6ba8e84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Mon, 4 Aug 2025 15:54:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StructuralPackageOrderController.java | 4 - .../nflg/wms/admin/service/SapService.java | 164 +++++++++--------- .../wms/repository/entity/WmsInventory.java | 15 -- 3 files changed, 78 insertions(+), 105 deletions(-) diff --git a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/StructuralPackageOrderController.java b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/StructuralPackageOrderController.java index 2a6e7f22..8c87a70c 100644 --- a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/StructuralPackageOrderController.java +++ b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/controller/StructuralPackageOrderController.java @@ -852,7 +852,6 @@ public class StructuralPackageOrderController extends BaseController { public void saveInventory(WmsInTaskItem item,BigDecimal total){ WmsInventory inventory = inventoryService.lambdaQuery() .eq(WmsInventory::getMaterialNo, item.getItemCode()) - .eq(WmsInventory::getExternalOrderNo, item.getPoNum()) .eq(WmsInventory::getBatchNumber, item.getBatchNumber()) .one(); if (Objects.isNull(inventory)) { @@ -861,9 +860,6 @@ public class StructuralPackageOrderController extends BaseController { .setNum(total) .setFactoryNo(item.getFactory()) .setWarehouseNo(item.getReceivedWarehouse()) - .setBinNos(item.getStorageLocation()) - .setExternalOrderNo(item.getPoNum()) - .setRowNo(item.getPoLineNumber()) .setCreateBy(UserUtil.getUserName()) .setCreateTime(LocalDateTime.now()); inventoryService.save(inventory); diff --git a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/SapService.java b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/SapService.java index 2de525d7..0e1fb385 100644 --- a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/SapService.java +++ b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/SapService.java @@ -6,6 +6,7 @@ import cn.hutool.json.JSONUtil; import com.nflg.wms.admin.pojo.dto.SAPMaterialInfoInOrderDTO; import com.nflg.wms.admin.pojo.dto.ZIM003105DTO; import com.nflg.wms.admin.pojo.dto.ZIM003DTO; +import com.nflg.wms.common.constant.Constant; import com.nflg.wms.common.constant.STATE; import com.nflg.wms.common.exception.NflgException; import com.nflg.wms.common.pojo.dto.*; @@ -18,6 +19,7 @@ import com.nflg.wms.common.util.VUtil; import com.sap.conn.jco.*; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; +import org.slf4j.MDC; import org.springframework.stereotype.Component; import java.math.BigDecimal; @@ -43,53 +45,48 @@ public class SapService { parameters.put("EBELN", orderNo); Zim001QueryResultDTO result=new Zim001QueryResultDTO(); - try { - JCoFunction function = exec("ZIM_001_QUERY", parameters, null); + JCoFunction function = exec("ZIM_001_QUERY", parameters, null); - JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT"); - VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S")) - .throwMessage("SAP错误:" + structure.getString("MSG")); + JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT"); + VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S")) + .throwMessage("SAP错误:" + structure.getString("MSG")); - JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1"); - List items1 = new ArrayList<>(); - for (int i = 0; i < ot1.getNumRows(); i++) { - ot1.setRow(i); - items1.add(new Zim001QueryResultItem1DTO() - .setEBELN(ot1.getString("EBELN")) - .setEBELP(ot1.getString("EBELP")) - .setMATNR(ot1.getString("MATNR")) - .setMAKTX(ot1.getString("MAKTX")) - .setMEINS(ot1.getString("MEINS")) - .setCHARG(ot1.getString("CHARG")) - .setWERKS(ot1.getString("WERKS")) - .setLGORT(ot1.getString("LGORT")) - .setLFBJA(ot1.getString("LFBJA")) - .setLFBNR(ot1.getString("LFBNR")) - .setLFPOS(ot1.getString("LFPOS")) - ); - } - result.setItem1(items1); - - JCoTable ot2 = function.getTableParameterList().getTable("OUTPUT2"); - List items2 = new ArrayList<>(); - for (int i = 0; i < ot2.getNumRows(); i++) { - ot2.setRow(i); - items2.add(new Zim001QueryResultItem2DTO() - .setEBELN(ot2.getString("EBELN")) - .setEBELP(ot2.getString("EBELP")) - .setSERNR(ot2.getString("SERNR")) - .setLFBJA(ot2.getString("LFBJA")) - .setLFBNR(ot2.getString("LFBNR")) - .setLFPOS(ot2.getString("LFPOS")) - ); - } - result.setItem2(items2); - - log.debug("数据:{}", JSONUtil.toJsonStr(result)); - } catch (JCoException e) { - log.error("SAP错误", e); - VUtil.trueThrowBusinessError(true).throwMessage("SAP错误:" + e.getMessage()); + JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1"); + List items1 = new ArrayList<>(); + for (int i = 0; i < ot1.getNumRows(); i++) { + ot1.setRow(i); + items1.add(new Zim001QueryResultItem1DTO() + .setEBELN(ot1.getString("EBELN")) + .setEBELP(ot1.getString("EBELP")) + .setMATNR(ot1.getString("MATNR")) + .setMAKTX(ot1.getString("MAKTX")) + .setMEINS(ot1.getString("MEINS")) + .setCHARG(ot1.getString("CHARG")) + .setWERKS(ot1.getString("WERKS")) + .setLGORT(ot1.getString("LGORT")) + .setLFBJA(ot1.getString("LFBJA")) + .setLFBNR(ot1.getString("LFBNR")) + .setLFPOS(ot1.getString("LFPOS")) + ); } + result.setItem1(items1); + + JCoTable ot2 = function.getTableParameterList().getTable("OUTPUT2"); + List items2 = new ArrayList<>(); + for (int i = 0; i < ot2.getNumRows(); i++) { + ot2.setRow(i); + items2.add(new Zim001QueryResultItem2DTO() + .setEBELN(ot2.getString("EBELN")) + .setEBELP(ot2.getString("EBELP")) + .setSERNR(ot2.getString("SERNR")) + .setLFBJA(ot2.getString("LFBJA")) + .setLFBNR(ot2.getString("LFBNR")) + .setLFPOS(ot2.getString("LFPOS")) + ); + } + result.setItem2(items2); + + log.debug("数据:{}", JSONUtil.toJsonStr(result)); return result; } @@ -372,7 +369,7 @@ public class SapService { * @param resebRsNum 退库单号 * @return 预留单号 */ - public List zwm00_MB017(String resebRsNum) throws JCoException { + public List zwm00_MB017(String resebRsNum) { Map parameters = new HashMap<>(); parameters.put("I_RSNUM", resebRsNum); JCoFunction function = exec("ZWM00_MB017", parameters, null); @@ -396,7 +393,7 @@ public class SapService { } // 成本中心退库确认 - public C_MaterialReturnDTO zwm00_MB112(C_MaterialReturnQO request) throws JCoException { + public C_MaterialReturnDTO zwm00_MB112(C_MaterialReturnQO request) { Map parameters = new HashMap<>(); parameters.put("I_RSNUM", request.getResbRsNum()); parameters.put("I_USNAM", UserUtil.getUserName()); @@ -447,12 +444,12 @@ public class SapService { } //成本中心领料查询 - public C_MaterialOutboundQueryDTO zwm00_MB026(String resebRsNum) throws JCoException { + public C_MaterialOutboundQueryDTO zwm00_MB026(String resebRsNum) { return null; } - public C_MaterialOutboundDTO ZWM00_MB115(C_MaterialOutboundQO request) throws JCoException { + public C_MaterialOutboundDTO ZWM00_MB115(C_MaterialOutboundQO request) { return null; } @@ -468,53 +465,48 @@ public class SapService { } private JCoTable execReturnTable(String functionName, Map parameters, Map>> tables, String outName) { - try { - JCoFunction function = exec(functionName, parameters, tables); - JCoTable out = function.getTableParameterList().getTable(outName); - log.info("SAP返回: {}", out); - return out; - } catch (JCoException ex) { - log.error("SAP错误", ex); - throw new NflgException(STATE.BusinessError, "SAP错误"); - } + JCoFunction function = exec(functionName, parameters, tables); + JCoTable out = function.getTableParameterList().getTable(outName); + log.info("SAP返回: {}", out); + return out; } private JCoParameterList execReturnParameter(String functionName, Map parameters, Map>> tables) { - try { - JCoFunction function = exec(functionName, parameters, tables); - JCoParameterList out = function.getExportParameterList(); - log.info("SAP返回: {}", out); - return out; - } catch (JCoException ex) { - log.error("SAP错误", ex); - throw new NflgException(STATE.BusinessError, "SAP错误"); - } + JCoFunction function = exec(functionName, parameters, tables); + JCoParameterList out = function.getExportParameterList(); + log.info("SAP返回: {}", out); + return out; } - private JCoFunction exec(String functionName, Map parameters, Map>> tables) throws JCoException { - functionName=functionName.toUpperCase(); - log.info("SAP functionName:{}", functionName); - JCoFunction function = repository.getFunction(functionName); + private JCoFunction exec(String functionName, Map parameters, Map>> tables) { + try { + functionName=functionName.toUpperCase(); + log.info("SAP functionName:{}", functionName); + JCoFunction function = repository.getFunction(functionName); - log.info("SAP ImportParameter:{}", JSONUtil.toJsonStr(parameters)); - log.info("---{}", function.getImportParameterList().getListMetaData()); + log.info("SAP ImportParameter:{}", JSONUtil.toJsonStr(parameters)); + log.info("---{}", function.getImportParameterList().getListMetaData()); - if (CollectionUtil.isNotEmpty(parameters)) { - parameters.forEach((name, value) -> function.getImportParameterList().setValue(name, value)); - } - if (CollectionUtil.isNotEmpty(tables)) { - tables.forEach((tableName, list) -> { - log.info("SAP TableParameter:{}", tableName); - log.info(JSONUtil.toJsonStr(list)); - JCoTable jt = function.getTableParameterList().getTable(tableName); - list.forEach(vl -> { - jt.appendRow(); - vl.forEach(jt::setValue); + if (CollectionUtil.isNotEmpty(parameters)) { + parameters.forEach((name, value) -> function.getImportParameterList().setValue(name, value)); + } + if (CollectionUtil.isNotEmpty(tables)) { + tables.forEach((tableName, list) -> { + log.info("SAP TableParameter:{}", tableName); + log.info(JSONUtil.toJsonStr(list)); + JCoTable jt = function.getTableParameterList().getTable(tableName); + list.forEach(vl -> { + jt.appendRow(); + vl.forEach(jt::setValue); + }); }); - }); + } + function.execute(destination); + return function; + } catch (JCoException e) { + log.error("SAP调用异常", e); + throw new NflgException(STATE.BusinessError, "SAP调用异常:" + MDC.get(Constant.TRACE_ID)); } - function.execute(destination); - return function; } public void printMeta(String functionName) throws JCoException { diff --git a/nflg-wms-repository/src/main/java/com/nflg/wms/repository/entity/WmsInventory.java b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/entity/WmsInventory.java index 44ca1ddd..2f5cf163 100644 --- a/nflg-wms-repository/src/main/java/com/nflg/wms/repository/entity/WmsInventory.java +++ b/nflg-wms-repository/src/main/java/com/nflg/wms/repository/entity/WmsInventory.java @@ -48,11 +48,6 @@ public class WmsInventory implements Serializable { */ private String warehouseNo; - /** - * 储位编号,逗号分隔 - */ - private String binNos; - /** * 数量 */ @@ -78,16 +73,6 @@ public class WmsInventory implements Serializable { */ private LocalDateTime updateTime; - /** - * 采购单订单号 - */ - private String externalOrderNo; - - /** - * 采购单订单行号 - */ - private String rowNo; - /** * 批次号 */