diff --git a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/NormalPGIControllerService.java b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/NormalPGIControllerService.java index 6734850a..ee3e57b7 100644 --- a/nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/NormalPGIControllerService.java +++ b/nflg-wms-admin/src/main/java/com/nflg/wms/admin/service/NormalPGIControllerService.java @@ -109,11 +109,9 @@ public class NormalPGIControllerService { List orderItemList = wmsSrmOrderItemService.lambdaQuery() .eq(WmsSrmOrderItem::getOrderId, order.getId()) .list(); - if (CollectionUtil.isEmpty(orderItemList)) { return pdaOrderVO; } - // if (CollectionUtil.isNotEmpty(orderItemList)) { List orderItemVOList = new ArrayList<>(); // 遍历订单行项目,填充详细信息并从 SAP 获取补充数据 for (WmsSrmOrderItem item : orderItemList) { 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 3abe3367..2e7a8497 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 @@ -1016,6 +1016,106 @@ public class SapService { return result; } +/** + * 厂内调库过账接口 + *

+ * 该方法用于调用 SAP 的 RFC 函数 ZWM00_MB113,完成厂内调库的过账操作。 + *

+ * + * @param query 查询参数对象,包含过账所需的输入信息和物料明细列表 + * @return 返回包含物料凭证号(MBLNR)和年度(MJAHR)的结果对象 + */ +// 厂内调库过账接口 +public ZWM00MB113DTO zwm3a11(ZWM00MB113QO query) { + // 校验查询参数及物料明细是否为空 + VUtil.trueThrowBusinessError(Objects.isNull(query)).throwMessage("查询内容不可以为空"); + VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(query.getT_list1())).throwMessage("物料明细不能为空"); + + // 构造函数调用所需的输入参数 + Map parameters = new HashMap<>(); + parameters.put("I_RSNUM", query.getIRsnum()); + parameters.put("I_UMLGO", query.getIUmlgo()); + parameters.put("I_USNAM", UserUtil.getUserName()); + + // 将构造好的表数据放入输入参数中 + Map>> tables = new HashMap<>(); + if (CollectionUtil.isNotEmpty(query.getT_list1())) { + tables.put("T_LIST1", JCoUtil.toMapList(query.getT_list1())); + } + + if (CollectionUtil.isNotEmpty(query.getT_list2())) { + tables.put("T_LIST2", JCoUtil.toMapList(query.getT_list2())); + } + + // 调用 SAP RFC 函数 ZWM00_MB112 + JCoFunction function = exec("ZWM00_MB113", parameters, tables); + + // 处理返回表 T_RETURN,判断执行是否成功 + JCoTable returnTable = function.getTableParameterList().getTable("T_RETURN"); + VUtil.trueThrowBusinessError(returnTable.getNumRows() <= 0).throwMessage("获取Type信息有误"); + returnTable.setRow(0); + VUtil.trueThrowBusinessError(!StrUtil.equals(returnTable.getString("TYPE"), "S")) + .throwMessage(returnTable.getString("MESSAGE")); + log.info("SAP返回: {}", returnTable); + + // 获取导出参数,构造返回结果对象 + JCoParameterList exportParam = function.getExportParameterList(); + VUtil.trueThrowBusinessError(Objects.isNull(exportParam)).throwMessage("无法获取到有效的物料凭证信息"); + ZWM00MB113DTO result = new ZWM00MB113DTO() + .setEMjahr(exportParam.getString("E_MJAHR")) + .setEMblnr(exportParam.getString("E_MBLNR")); + log.info("SAP返回物料凭证信息: MBLNR={}, MJAHR={}", result.getEMblnr(), result.getEMjahr()); + return result; +} + +/** + * 获取物料的属性信息(仓库、库位、批次管理、序号管理,是否质检) + * + * @param query 查询条件封装对象,包含工厂、仓库、物料等信息 + * @return 物料属性信息列表,每个元素为 {@link ZWM3A21ResultDTO} 类型 + */ +public List zwm3a21(ZWM3A21QueryDTO query) { + // 校验查询参数及物料明细是否为空 + VUtil.trueThrowBusinessError(Objects.isNull(query)).throwMessage("查询内容不可以为空"); + VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(query.getIt_matnr())).throwMessage("物料明细不能为空"); + + // 构造函数调用所需的输入参数 + Map parameters = new HashMap<>(); + parameters.put("I_WERKS", query.getI_werks()); + + // 将构造好的表数据放入输入参数中 + Map>> tables = new HashMap<>(); + if (CollectionUtil.isNotEmpty(query.getIt_lgort())) { + tables.put("IT_LGORT", JCoUtil.toMapList(query.getIt_lgort())); + } + + if (CollectionUtil.isNotEmpty(query.getIt_matnr())) { + tables.put("IT_MATNR", JCoUtil.toMapList(query.getIt_matnr())); + } + + // 调用 SAP RFC 函数 ZWM3A21 + JCoFunction function = exec("ZWM3A21", parameters, tables); + + // 获取并校验导出参数,判断调用是否成功 + JCoParameterList exportParam = function.getExportParameterList(); + VUtil.trueThrowBusinessError(Objects.isNull(exportParam)).throwMessage("无法获取到有效的物料信息"); + VUtil.trueThrowBusinessError(!StrUtil.equals(exportParam.getString("TYPE"), "S")) + .throwMessage(exportParam.getString("MESSAGE")); + + // 处理返回表数据,转换为结果对象列表 + JCoTable returnTable = function.getTableParameterList().getTable("T_OUT"); + VUtil.trueThrowBusinessError(returnTable.getNumRows() <= 0).throwMessage("获取物料信息有误"); + log.info("SAP返回: {}", returnTable); + if(returnTable.getNumRows() > 0) + { + return JCoUtil.toBeanList(returnTable, ZWM3A21ResultDTO.class); + } + else + { + return Collections.emptyList(); + } +} + private JCoTable execReturnTable(String functionName, Map parameters) { return execReturnTable(functionName, parameters, null, "T_OUT"); } diff --git a/nflg-wms-admin/src/test/java/com/nflg/wms/admin/SapMetaPrintTest.java b/nflg-wms-admin/src/test/java/com/nflg/wms/admin/SapMetaPrintTest.java index 4bf06ab4..bc7b602c 100644 --- a/nflg-wms-admin/src/test/java/com/nflg/wms/admin/SapMetaPrintTest.java +++ b/nflg-wms-admin/src/test/java/com/nflg/wms/admin/SapMetaPrintTest.java @@ -153,6 +153,13 @@ public class SapMetaPrintTest { printMeta("ZWM00_MB116"); } + @Test + public void ZWM3A21() throws JCoException { + printMeta("ZWM3A21"); + } + + + public void printMeta(String functionName) throws JCoException { functionName = functionName.toUpperCase(); JCoFunction function = repository.getFunction(functionName); diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM00MB113DTO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM00MB113DTO.java new file mode 100644 index 00000000..9c5369a6 --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM00MB113DTO.java @@ -0,0 +1,13 @@ +package com.nflg.wms.common.pojo.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ZWM00MB113DTO { + // 物料凭证年度 + private String eMjahr; + // 物料凭证编号 + private String eMblnr; +} \ No newline at end of file diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21LgortItemDTO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21LgortItemDTO.java new file mode 100644 index 00000000..0e1f4076 --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21LgortItemDTO.java @@ -0,0 +1,11 @@ +package com.nflg.wms.common.pojo.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ZWM3A21LgortItemDTO { + //库存地点 + private String lgort; +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21MatnrItemDTO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21MatnrItemDTO.java new file mode 100644 index 00000000..267f8013 --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21MatnrItemDTO.java @@ -0,0 +1,11 @@ +package com.nflg.wms.common.pojo.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ZWM3A21MatnrItemDTO { + //物料号 + private String matnr; +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21QueryDTO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21QueryDTO.java new file mode 100644 index 00000000..df204bdc --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21QueryDTO.java @@ -0,0 +1,17 @@ +package com.nflg.wms.common.pojo.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class ZWM3A21QueryDTO{ + //工厂 + private String i_werks; + + // 库存地点 + private List it_lgort; + + //物料号 + private Listit_matnr; +} \ No newline at end of file diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21ResultDTO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21ResultDTO.java new file mode 100644 index 00000000..0f27f62c --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/dto/ZWM3A21ResultDTO.java @@ -0,0 +1,23 @@ +package com.nflg.wms.common.pojo.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ZWM3A21ResultDTO { + //工厂 + private String werks; + //物料描述(短文本) + private String maktx; + //序列号参数文件 + private String sernp; + //物料编号 + private String matnr; + //库存仓位 + private String lgpbe; + //批次管理需求的标识 + private String xchpf; + //kzkri + private String kzkri; +} diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113LIST1QO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113LIST1QO.java new file mode 100644 index 00000000..28fe9623 --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113LIST1QO.java @@ -0,0 +1,19 @@ +package com.nflg.wms.common.pojo.qo; + +import lombok.Data; + +@Data +public class ZWM00MB113LIST1QO { + //工厂 + private String werks; + //库存地点 + private String lgort; + //以输入单位计的数量 + private String erfmg; + //物料号 + private String matnr; + //基本计量单位 + private String meins; + //预留/相关需求的项目编号 + private String rspos; +} \ No newline at end of file diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113LIST2QO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113LIST2QO.java new file mode 100644 index 00000000..21f3cbdf --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113LIST2QO.java @@ -0,0 +1,13 @@ +package com.nflg.wms.common.pojo.qo; + +import lombok.Data; + +@Data +public class ZWM00MB113LIST2QO { + //序列号 + private String sernr; + //标志,X表示合格品,空表示不合格品 + private String flag; + //预留/相关需求的项目编号 + private String rspos; +} \ No newline at end of file diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113QO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113QO.java new file mode 100644 index 00000000..b32a68af --- /dev/null +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/ZWM00MB113QO.java @@ -0,0 +1,17 @@ +package com.nflg.wms.common.pojo.qo; + +import lombok.Data; + +import java.util.List; + +@Data +public class ZWM00MB113QO { + //预留/相关需求的编号 + private String iRsnum; + //收货/发货库存地点 + private String iUmlgo; + //创建311物料凭证接口输入结构 + private List t_list1; + //创建311物料凭证接口序列号结构 + private List t_list2; +} \ No newline at end of file