From e230ba1bd38418e8262d2ca488467f34501490ae Mon Sep 17 00:00:00 2001 From: Yangwl <1726150332@qq.com> Date: Wed, 29 Nov 2023 23:06:29 +0800 Subject: [PATCH] =?UTF-8?q?SAP=E6=8A=A5=E5=B7=A5=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/domain/sap/SapRFW.java | 4 +- .../op/common/core/constant/Constants.java | 10 + .../com/op/sap/controller/SapController.java | 184 +++++++++--------- .../sap/service/impl/SapOrderServiceImpl.java | 11 +- 4 files changed, 113 insertions(+), 96 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java index 6d21a116..534fd004 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java @@ -44,7 +44,7 @@ public class SapRFW { } - public class lt_gs + public static class lt_gs { String conf_activity1; String conf_activity2; @@ -114,7 +114,7 @@ public class SapRFW { } } - public class lt_hw{ + public static class lt_hw{ String material; String entry_qnt; diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/constant/Constants.java b/op-common/op-common-core/src/main/java/com/op/common/core/constant/Constants.java index a22d102b..3a8f7782 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/constant/Constants.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/constant/Constants.java @@ -137,4 +137,14 @@ public class Constants { public static final String LOW="LOW"; public static final String HIGH="HIGH"; + + /** + * SAP物料移动类型 + */ + + //退料 + public static final Integer TL=262; + + //领料 + public static final Integer LL=261; } 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 77640f01..cdc632b1 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 @@ -52,27 +52,8 @@ public class SapController extends BaseController { @Autowired private SapBomMapper sapBomMapper; - /** - * 订单同步接口 - * @return - */ - @PostMapping("/shopOrderSync") - @Log(title = "同步SAP订单", businessType = BusinessType.SAP) - public R> shopOrderSync(@RequestBody SapShopOrderQuery sapProOrder){ - return sapOrderService.shopOrderSync(sapProOrder); - } - - /** - * SAP订单修改接口 - * 传递母订单号和母订单数量 - */ - @PostMapping("/shopUpdateSync") - @Log(title = "修改SAP订单", businessType = BusinessType.SAP) - public R shopUpdateSync(@RequestBody SapShopOrderQuery sapProOrder){ - return sapOrderService.shopUpdateSync(sapProOrder); - } - + /**====================主数据相关===================================================================================*/ /** * 物料同步接口 * @param @@ -113,7 +94,7 @@ public class SapController extends BaseController { } /** - * 物料清单同步接口 + * 物料清单BOM同步接口 * @return */ @PostMapping("/bomSync") @@ -151,7 +132,6 @@ public class SapController extends BaseController { } - /** * 工艺路线同步 * @return @@ -176,7 +156,7 @@ public class SapController extends BaseController { calendar.setTime(maxTime0); calendar.add(Calendar.DAY_OF_YEAR, 1); Date maxTime = calendar.getTime(); - // qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923 + // qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923 } qo.setWerks(dateSource.get("poolName").replace("ds_", ""));//工厂 @@ -190,74 +170,6 @@ public class SapController extends BaseController { return R.ok(); } - /** - * 生产订单备料单接口 - * @param shopOrder - * @return - */ - - @PostMapping("/materialPreparation") - @Log(title = "生产订单备料单接口", businessType = BusinessType.SAP) - public R> materialPreparation(@RequestParam("shopOrder") String shopOrder){ - return sapMaterialPreparationService.MaterialPreparation(shopOrder); - } - - - /** - * 反冲物料领料过账接口 - * ***与包材领料分开过账 - * @param sapBackflushMPQueryList - * @return - */ - @PostMapping("/sapBackflushMP") - @Log(title = "", businessType = BusinessType.SAP) - public R sapBackflushMP(@RequestBody List sapBackflushMPQueryList){ - return sapItemSyncService.sapBackflushMP(sapBackflushMPQueryList); - } - - @PostMapping("/sapMaterialPosting") - @Log(title = "订单物料领料过账、原材料补料、订单物料退料过账接口(MB1A)", businessType = BusinessType.SAP) - public R sapMaterialPosting(@RequestBody SapMaterialPosting sapMaterialPosting){ - return sapItemSyncService.sapMaterialPosting(sapMaterialPosting); - } - - - /** - * 生产订单创建接口 - * @param sapCreateOrderList - * @return - */ - - @PostMapping("/sapCreateOrder") - @Log(title = "生产订单创建接口", businessType = BusinessType.SAP) - public R>> SapCreateOrder(@RequestBody List sapCreateOrderList){ - return sapOrderService.SapCreateOrder(sapCreateOrderList); - } - - /** - * 生产订单关闭接口 - * 传母订单号即可 - * @param sapCloseOrderQuery - * @return - */ - @PostMapping("/sapCloseOrder") - @Log(title = "生产订单关闭接口", businessType = BusinessType.SAP) - public R sapCloseOrder(@RequestBody SapCloseOrderQuery sapCloseOrderQuery){ - return sapOrderService.sapCloseOrder(sapCloseOrderQuery); - } - - /** - * 报工 - * @param sapRFW - * @return - */ - @PostMapping("/sapRFWOrder") - @Log(title = "生产订单报工接口", businessType = BusinessType.SAP) - public R sapRFWOrder(@RequestBody SapRFW sapRFW){ - return sapOrderService.sapRFWOrder(sapRFW); - } - - /** * 工作中心 * @return @@ -382,6 +294,96 @@ public class SapController extends BaseController { } + /**==================================生产订单相关============================================================================*/ + + /** + * 订单同步接口 + * @return + */ + @PostMapping("/shopOrderSync") + @Log(title = "同步SAP订单", businessType = BusinessType.SAP) + public R> shopOrderSync(@RequestBody SapShopOrderQuery sapProOrder){ + return sapOrderService.shopOrderSync(sapProOrder); + } + /** + * 生产订单创建接口 + * @param sapCreateOrderList + * @return + */ + + @PostMapping("/sapCreateOrder") + @Log(title = "生产订单创建接口", businessType = BusinessType.SAP) + public R>> SapCreateOrder(@RequestBody List sapCreateOrderList){ + return sapOrderService.SapCreateOrder(sapCreateOrderList); + } + /** + * SAP订单修改接口 + * 传递母订单号和母订单数量 + */ + @PostMapping("/shopUpdateSync") + @Log(title = "修改SAP订单", businessType = BusinessType.SAP) + public R shopUpdateSync(@RequestBody SapShopOrderQuery sapProOrder){ + return sapOrderService.shopUpdateSync(sapProOrder); + } + + + /** + * 报工 + * @param sapRFW + * @return + */ + @PostMapping("/sapRFWOrder") + @Log(title = "生产订单报工接口", businessType = BusinessType.SAP) + public R sapRFWOrder(@RequestBody SapRFW sapRFW){ + return sapOrderService.sapRFWOrder(sapRFW); + } + + /** + * 生产订单关闭接口 + * 传母订单号即可 + * @param sapCloseOrderQuery + * @return + */ + @PostMapping("/sapCloseOrder") + @Log(title = "生产订单关闭接口", businessType = BusinessType.SAP) + public R sapCloseOrder(@RequestBody SapCloseOrderQuery sapCloseOrderQuery){ + return sapOrderService.sapCloseOrder(sapCloseOrderQuery); + } + + + + /** + * 生产订单备料单接口 + * @param shopOrder + * @return + */ + + @PostMapping("/materialPreparation") + @Log(title = "生产订单备料单接口", businessType = BusinessType.SAP) + public R> materialPreparation(@RequestParam("shopOrder") String shopOrder){ + return sapMaterialPreparationService.MaterialPreparation(shopOrder); + } + + /** + * 反冲物料领料过账接口 + * ***与包材领料分开过账 + * @param sapBackflushMPQueryList + * @return + */ + @PostMapping("/sapBackflushMP") + @Log(title = "", businessType = BusinessType.SAP) + public R sapBackflushMP(@RequestBody List sapBackflushMPQueryList){ + return sapItemSyncService.sapBackflushMP(sapBackflushMPQueryList); + } + + + @PostMapping("/sapMaterialPosting") + @Log(title = "订单物料领料过账、原材料补料、订单物料退料过账接口(MB1A)", businessType = BusinessType.SAP) + public R sapMaterialPosting(@RequestBody SapMaterialPosting sapMaterialPosting){ + return sapItemSyncService.sapMaterialPosting(sapMaterialPosting); + } + + /** * 采购订单接口 */ diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java index adc7b5bf..e3dca482 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java @@ -1,5 +1,6 @@ package com.op.sap.service.impl; +import com.alibaba.fastjson2.JSONObject; import com.op.common.core.constant.Constants; import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; @@ -244,6 +245,8 @@ public class SapOrderServiceImpl implements SapOrderService { @Override public R sapRFWOrder(SapRFW sapRFW) { + String json= JSONObject.toJSONString(sapRFW); + System.out.println(json); String MESSAGE=null; try { //获取连接 @@ -300,10 +303,10 @@ public class SapOrderServiceImpl implements SapOrderService { JCoParameterList J= func.getExportParameterList(); System.out.println(J); MESSAGE= func.getExportParameterList().getString("MESSAGE"); - if (StringUtils.isEmpty(MESSAGE)){ - return R.fail("订单号:"+sapRFW.getAufnr()+"报工失败"); + if (StringUtils.contains(MESSAGE,"错误")){ + return R.fail("订单号:"+sapRFW.getAufnr()+"报工失败"+MESSAGE); } - return R.ok(MESSAGE); + return R.ok("",MESSAGE); }catch (Exception e){ return R.fail(e.getMessage()); @@ -404,6 +407,8 @@ public class SapOrderServiceImpl implements SapOrderService { return R.fail(e.getMessage()); } } + + }