diff --git a/op-modules/op-sap/pom.xml b/op-modules/op-sap/pom.xml index bdd35833..b34d5b1f 100644 --- a/op-modules/op-sap/pom.xml +++ b/op-modules/op-sap/pom.xml @@ -100,14 +100,15 @@ com.sap.conn sapjco 3.0.8 - - + + junit junit + diff --git a/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java b/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java index f089ef7a..0984f878 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java @@ -495,6 +495,17 @@ public class SapController extends BaseController { return sapItemSyncService.FPinventory(mapList); } + /** + * 来料暂收接口 + * @param mapList + * @return + */ + @PostMapping("/temporarilyCollected") + @Log(title = "来料暂收接口", businessType = BusinessType.SAP) + public R temporarilyCollected(@RequestBody(required = false) List mapList) { + return sapItemSyncService.temporarilyCollected(mapList); + } + /** * 智慧工厂105移动类型(来料库存转换) */ @@ -518,4 +529,6 @@ public class SapController extends BaseController { dynamicRoutingDataSource.removeDataSource(dataSourceProperty.getPoolName()); return R.ok(); } + + } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java index 3bf189a3..46cab337 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java @@ -36,4 +36,6 @@ public interface SapItemSyncService { R FPinventory(Map mapList); R incomingConversion(Map mapList); + + R temporarilyCollected(List mapList); } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java index dd59c69d..b4c109f3 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java @@ -594,5 +594,55 @@ public class SapItemSyncImpl implements SapItemSyncService { } } + /** + * ZMES_103_MIGO函数取值说明:智慧工厂MIGO-103移动类型收货 + * 字段 类型 长度 小数位 描述 + * EBELN CHAR 10 0 采购凭证号 + * EBELP NUMC 5 0 采购凭证的项目编号 + * MATNR CHAR 18 0 物料号 + * WERKS CHAR 4 0 工厂 + * QUANTITY QUAN 13 3 数量 + * @param mapList + * @return + */ + @Override + public R temporarilyCollected(List mapList) { + try { + JCoRepository repository = dest.getRepository(); + JCoFunction func = repository.getFunction("ZMES_103_MIGO"); + if (func == null) { + throw new RuntimeException("Function does not exist in SAP"); + } + log.info("来料暂收参数-------" + mapList.toString()); + JCoTable L_ITEM = func.getTableParameterList().getTable("L_ITEM"); + System.out.println(L_ITEM); + for (Map map : mapList) { + L_ITEM.appendRow(); + L_ITEM.setValue("EBELN", map.get("EBELN")); + L_ITEM.setValue("EBELP", map.get("EBELP")); + L_ITEM.setValue("MATNR", map.get("MATNR")); + L_ITEM.setValue("WERKS", map.get("WERKS")); + L_ITEM.setValue("QUANTITY", map.get("QUANTITY")); + } + System.out.println(L_ITEM); + func.execute(dest);//执行调用函数 + /** + * RETCODE CHAR3 返回值:200-没有错误,500-有错误 + * L_MSG CHAR220 返回消息文本 + * MATERIALDOCUMENT CHAR10 物料凭证编号 + * MATDOCUMENTYEAR NUMC4 物料凭证年度 + */ + String RETCODE = func.getExportParameterList().getString("RETCODE"); + String MESSAGE = func.getExportParameterList().getString("L_MSG"); + String MATERIALDOCUMENT = func.getExportParameterList().getString("MATERIALDOCUMENT"); + String MATDOCUMENTYEAR = func.getExportParameterList().getString("MATDOCUMENTYEAR"); + System.out.println(RETCODE+"/" +MESSAGE+"/" +MATERIALDOCUMENT+"/" +MATDOCUMENTYEAR); + return R.ok(); + } catch (Exception e) { + log.error(e.getMessage()); + return R.fail(e.getMessage()); + } + } + }