From 4dced6b4214a531ea07e75fcc51faf8df150f546 Mon Sep 17 00:00:00 2001 From: mengjiao <3338049200@qq,com> Date: Sat, 23 Dec 2023 07:45:46 +0800 Subject: [PATCH] =?UTF-8?q?wms=E4=BF=AE=E6=94=B99.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/RemoteSapService.java | 4 +-- .../com/op/sap/service/SapOrderService.java | 7 ++--- .../sap/service/impl/SapOrderServiceImpl.java | 7 ++--- .../controller/WmsToWCSmissionController.java | 7 +++++ .../impl/OdsProcureOrderServiceImpl.java | 27 +++++++++++++++---- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java index 5c5f3d79..d5993b18 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java @@ -85,10 +85,10 @@ public interface RemoteSapService { public R sapProductWarehousing(@RequestBody(required = false) List> mapList); /**获取采购订单*/ - @PostMapping("/sapPurchaseOrderSync") + @PostMapping("/sap/sapPurchaseOrderSync") public R sapPurchaseOrderSync(@RequestBody SapPurchaseOrderQuery sapPurchaseOrderQuery); /**采购订单收货过账*/ - @PostMapping("/sapPOrderGoodsReceipt") + @PostMapping("/sap/sapPOrderGoodsReceipt") public R sapPOrderGoodsReceipt(@RequestBody(required = false) List> mapList); } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java index 14968ba9..11eccfe6 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java @@ -3,12 +3,9 @@ package com.op.sap.service; import com.op.common.core.domain.R; import com.op.sap.domain.vo.SapOrderReceiptQuery; -import com.op.sap.domain.vo.SapPurchaseOrderQuery; +import com.op.system.api.domain.sap.SapPurchaseOrderQuery;//SapPurchaseOrderQuery -import com.op.system.api.domain.sap.SapCloseOrderQuery; -import com.op.system.api.domain.sap.SapCreateOrder; -import com.op.system.api.domain.sap.SapRFW; -import com.op.system.api.domain.sap.SapShopOrderQuery; +import com.op.system.api.domain.sap.*; import com.op.system.api.model.SapProOrder; import java.util.List; 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 62c8c454..99448c0c 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 @@ -8,13 +8,10 @@ import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.sap.domain.vo.SapOrderReceiptQuery; -import com.op.sap.domain.vo.SapPurchaseOrderQuery; + import com.op.sap.service.SapOrderService; -import com.op.system.api.domain.sap.SapCloseOrderQuery; -import com.op.system.api.domain.sap.SapCreateOrder; -import com.op.system.api.domain.sap.SapRFW; -import com.op.system.api.domain.sap.SapShopOrderQuery; +import com.op.system.api.domain.sap.*; import com.op.system.api.model.SapProOrder; import com.sap.conn.jco.*; diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java index de54e9d5..945a8050 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java @@ -184,8 +184,15 @@ public WmsToWCSDTO packingMaterialsOutBoundCompleted(@RequestBody WmsToWCSDTO wc Integer result= odsProcureOrderService.ProductionMaterialRequisitionAdd(orderList); return success(result); } + + /** + * 采购提单 + * @param odsProcureOrder + * @return + */ @PostMapping("/sapPurchaseOrderSync") public AjaxResult sapPurchaseOrderSync(@RequestBody OdsProcureOrder odsProcureOrder){ + AjaxResult result= odsProcureOrderService.sapPurchaseOrderSync(odsProcureOrder); return result; } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java index 064a3a04..04a94a77 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java @@ -8,10 +8,7 @@ import com.alibaba.fastjson.JSONObject; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - +import java.util.*; import com.op.common.core.domain.R; @@ -22,6 +19,7 @@ import com.op.common.security.utils.SecurityUtils; import com.op.system.api.RemoteSapService; import com.op.system.api.domain.sap.SapBackflushMPQuery; import com.op.system.api.domain.sap.SapMaterialPosting; +import com.op.system.api.domain.sap.SapPurchaseOrderQuery; import okhttp3.OkHttpClient; import okhttp3.MediaType; import okhttp3.RequestBody; @@ -30,6 +28,7 @@ import okhttp3.Response; import java.io.IOException; + import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.utils.uuid.IdUtils; @@ -554,13 +553,19 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { sapBackflushMPQueryList.add(sapBackflushMPQuery); R result2= remoteSapService.sapBackflushMP(sapBackflushMPQueryList);//x int code= result2.getCode(); + String msg= result2.getMsg(); odsProcureOutOrder.setUserDefined11(msg); if (code==200){//过账成功 + Map map=new HashMap(); + map= (Map) result2.getData(); + String userDefined9= (String) map.get("MATERIALDOCUMENT"); + odsProcureOutOrder.setUserDefined9(userDefined9); odsProcureOutOrder.setUserDefined10("2");//成功 odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder); }else {// + odsProcureOutOrder.setUserDefined9(""); odsProcureOutOrder.setUserDefined10("3");//失败 odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder); } @@ -578,14 +583,20 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { sapMaterialPosting.setBatch(odsProcureOutOrder.getUserDefined2()); //批号 sapMaterialPostingList.add(sapMaterialPosting); R result= remoteSapService.sapMaterialPosting(sapMaterialPostingList); + int code= result.getCode(); String msg= result.getMsg(); odsProcureOutOrder.setUserDefined11(msg); if (code==200){//过账成功 + Map map=new HashMap(); + map= (Map) result.getData(); + String userDefined9= (String) map.get("MATERIALDOCUMENT"); + odsProcureOutOrder.setUserDefined9(userDefined9); odsProcureOutOrder.setUserDefined10("2");//成功 odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder); }else {// + odsProcureOutOrder.setUserDefined9(""); odsProcureOutOrder.setUserDefined10("3");//失败 odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder); } @@ -597,7 +608,13 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { @Override public AjaxResult sapPurchaseOrderSync(OdsProcureOrder odsProcureOrder) { - //remoteSapService.sapPurchaseOrderSync(); + DynamicDataSourceContextHolder.push("ds_" +odsProcureOrder.getFactoryCode()); + SapPurchaseOrderQuery sapPurchaseOrderQuery=new SapPurchaseOrderQuery(); + sapPurchaseOrderQuery.setEbeln(odsProcureOrder.getProcureCode()); + R result= remoteSapService.sapPurchaseOrderSync(sapPurchaseOrderQuery); + List sapPurchaseOrderQueryList=new ArrayList<>(); + sapPurchaseOrderQueryList= (List) result.getData(); + // sapPurchaseOrderQueryList return null; }