From 7f0f20a47f8df9fbbc47d7553872335c78595ae6 Mon Sep 17 00:00:00 2001 From: mengjiao <3338049200@qq,com> Date: Tue, 17 Dec 2024 16:26:22 +0800 Subject: [PATCH] =?UTF-8?q?wms=E5=86=B2=E9=94=80BUG2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/RemoteSapService.java | 2 ++ .../api/factory/RemoteSapFallbackFactory.java | 5 +++ .../op/sap/service/impl/SapItemSyncImpl.java | 14 ++++---- .../sap/service/impl/SapWmsServicelmpl.java | 31 ++++++++++-------- .../mapper/WmsOdsMateStorageNewsMapper.java | 2 ++ .../impl/OdsProcureOrderServiceImpl.java | 32 ++++++++++--------- .../impl/OdsProcureOutOrderServiceImpl.java | 31 ++++++++++++++---- .../impl/WmsSellOutEmbryoServiceImpl.java | 2 ++ .../mapper/wms/OdsProcureOutOrderMapper.xml | 3 +- .../wms/WmsOdsMateStorageNewsMapper.xml | 11 ++++++- 10 files changed, 88 insertions(+), 45 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 c7fc7b7c..5db2c3ce 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 @@ -133,6 +133,8 @@ public interface RemoteSapService { */ @PostMapping("/sap/temporarilyCollected") public R temporarilyCollected(@RequestBody(required = false) List mapList) ; + @PostMapping("/sap/sapProductOutboundCostCenter") + public R sapProductOutboundCostCenter(@RequestBody(required = false) List mapList) ; /** *sap105过账接口 */ diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java index f6ec47f1..48cae138 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java @@ -148,6 +148,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory mapList) { + return R.fail("ZMES_201_MB1A过账失败" + throwable.getMessage()); + } + @Override public R sap105temporarilyCollected(List mapList) { return R.fail("105过账失败" + throwable.getMessage()); 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 2940ae06..ea72ddad 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 @@ -967,7 +967,7 @@ public class SapItemSyncImpl implements SapItemSyncService { }else { continue; } - JCoFunction func2 = repository.getFunction("ZMES_MIGO_104");//103冲销 + JCoFunction func2 = repository.getFunction("ZMES_104_MIGO");//103冲销 if (func2 == null) { throw new RuntimeException("Function does not exist in SAP"); } @@ -1021,7 +1021,6 @@ public class SapItemSyncImpl implements SapItemSyncService { throw new RuntimeException("Function does not exist in SAP"); } log.info("取物料凭证数据接口的参数-------" + mapList.toString()); - JCoTable S_MBLNR = func.getTableParameterList().getTable("S_MBLNR"); //交货单号 JCoTable S_MJAHR = func.getTableParameterList().getTable("S_MJAHR"); @@ -1121,24 +1120,23 @@ public class SapItemSyncImpl implements SapItemSyncService { }else { continue; } - JCoFunction func2 = repository.getFunction("ZMES_MIGO_106");//105冲销 + JCoFunction func2 = repository.getFunction("ZMES_106_MIGO");//105冲销 if (func2 == null) { throw new RuntimeException("Function does not exist in SAP"); } log.info("105参数-------" + mapList.toString()); JCoTable L_ITEM = func2.getTableParameterList().getTable("L_ITEM"); L_ITEM.appendRow(); - L_ITEM.setValue("LFBJA",mjahr);//参考凭证会计年度 - L_ITEM.setValue("LFBNR",mblnr);//参考凭证的凭证号 + L_ITEM.setValue("LFBJA",map.get("LFBJA"));//参考凭证会计年度 + L_ITEM.setValue("LFBNR",map.get("LFBNR"));//参考凭证的凭证号 L_ITEM.setValue("LFPOS",zeile);//参考凭证项目 L_ITEM.setValue("EBELN", ebeln);//采购订单编号 采购凭证号 - L_ITEM.setValue("MATNR", matnr);//采购订单编号 采购凭证号 L_ITEM.setValue("EBELP",map.get("ebelp") );//采购凭证的项目编号 + L_ITEM.setValue("MATNR", matnr);//物料号 L_ITEM.setValue("WERKS", werks);//工厂 L_ITEM.setValue("LGORT", "0001");//库存地点 L_ITEM.setValue("QUANTITY",menge);//数量 - // L_ITEM.setValue("BATCH", map.get("incomeBatchNo"));//批号 - // L_ITEM.setValue("HSDAT","");//生产日期 + System.out.println(L_ITEM); func2.execute(dest);//执行调用函数 RETCODE = func2.getExportParameterList().getString("RETCODE"); diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapWmsServicelmpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapWmsServicelmpl.java index 4308450d..9eee4fac 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapWmsServicelmpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapWmsServicelmpl.java @@ -162,7 +162,7 @@ public class SapWmsServicelmpl implements SapWmsService { if (func == null) { throw new RuntimeException("Function does not exist in SAP"); } - log.info("成品移动ZMES_PRODUCT_MB1A-------" + mapList.toString()); + log.info("成品ZMES_201_MB1A-------" + mapList.toString()); /** AUFNR 订单号 POSNR 订单项目编号 @@ -176,22 +176,27 @@ public class SapWmsServicelmpl implements SapWmsService { BATCH 批号 HSDAT 生产日期 VFDAT 货架寿命到期日 + LGORT CHAR 4 0 库存地点 + MATNR CHAR 18 0 物料号 + QUANTITY QUAN 13 3 数量 + MEINS UNIT 3 0 条目单位 + BATCH CHAR 10 0 批号 + PROD_DATE DATS 8 0 生产日期 + EXPIRYDATE DATS 8 0 货架寿命到期日 + */ JCoTable L_ITEM = func.getTableParameterList().getTable("L_ITEM"); for (Map stringObjectMap : mapList) { L_ITEM.appendRow(); - L_ITEM.setValue("AUFNR", stringObjectMap.get("AUFNR")); - L_ITEM.setValue("POSNR", stringObjectMap.get("POSNR")); - L_ITEM.setValue("BWART", stringObjectMap.get("BWART")); - L_ITEM.setValue("PLANT", stringObjectMap.get("PLANT")); - L_ITEM.setValue("LGORT", stringObjectMap.get("LGORT")); - L_ITEM.setValue("KOSTL", stringObjectMap.get("KOSTL")); - L_ITEM.setValue("MATNR", stringObjectMap.get("MATNR")); - L_ITEM.setValue("QUANTITY", stringObjectMap.get("QUANTITY")); - L_ITEM.setValue("MEINS", stringObjectMap.get("MEINS")); - L_ITEM.setValue("BATCH", stringObjectMap.get("BATCH")); - L_ITEM.setValue("HSDAT", stringObjectMap.get("HSDAT")); - L_ITEM.setValue("VFDAT", stringObjectMap.get("VFDAT")); + L_ITEM.setValue("COSTCENTER", stringObjectMap.get("COSTCENTER")); + L_ITEM.setValue("PLANT", stringObjectMap.get("PLANT"));//工厂 + L_ITEM.setValue("LGORT", stringObjectMap.get("LGORT"));//库存地点 + L_ITEM.setValue("MATNR", stringObjectMap.get("MATNR"));// + L_ITEM.setValue("QUANTITY", stringObjectMap.get("QUANTITY"));// + L_ITEM.setValue("MEINS", stringObjectMap.get("MEINS"));// + L_ITEM.setValue("BATCH", stringObjectMap.get("BATCH"));// + L_ITEM.setValue("PROD_DATE", stringObjectMap.get("PROD_DATE"));//生产日期 + L_ITEM.setValue("EXPIRYDATE", stringObjectMap.get("EXPIRYDATE"));//货架寿命到期日 } System.out.println(L_ITEM); func.execute(dest);//执行调用函数 diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsOdsMateStorageNewsMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsOdsMateStorageNewsMapper.java index 0195c3ce..46c74ee7 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsOdsMateStorageNewsMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsOdsMateStorageNewsMapper.java @@ -83,4 +83,6 @@ public interface WmsOdsMateStorageNewsMapper { public void deleteWmsOdsMateStorageNewsBycard(@Param("wlCode")String wlCode); public void updateodsProcureOrderCard(@Param("userDefined6")String userDefined6); + + public void updateWmsOdsMateStorageNewsUpdateStorageAmountFC(WmsOdsMateStorageNews wmsOdsMateStorageNews); } 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 6938a111..b354accd 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 @@ -1929,7 +1929,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { wmsOdsMateStorageNews.setStorageAmount(wmsRawOrderInSn1.getAmount()); wmsOdsMateStorageNewsMapper.updateWmsOdsMateStorageNewsUpdateStorageAmount(wmsOdsMateStorageNews); } - wmsRawOrderIn.setOrderStatus("1"); + wmsRawOrderIn.setOrderStatus("0"); wmsRawOrderIn.setAccountingTime(new Date()); wmsRawOrderIn.setAccountingMessage(result2.getMsg()); wmsRawOrderIn.setUserDefined4(MATERIALDOCUMENT); @@ -3079,12 +3079,15 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { //这个地方 Map paramMap=new HashMap<>(); List mapList = new ArrayList<>(); - paramMap.put("S_MBLNR",wmsRawOrderIn.getUserDefined1()); - paramMap.put("S_MJAHR",wmsRawOrderIn.getUserDefined2()); - paramMap.put("S_MATNR",wmsRawOrderIn.getMaterialCode()); - paramMap.put("incomeBatchNo",wmsRawOrderIn.getIncomeBatchNo()); //批次 - paramMap.put("ebelp",wmsRawOrderIn.getPoLine()); + paramMap.put("S_MBLNR",wmsRawOrderIn.getUserDefined1());//u1是暂收凭证 + paramMap.put("S_MJAHR",wmsRawOrderIn.getUserDefined2());//u2是暂收年度凭证 + paramMap.put("S_MATNR",wmsRawOrderIn.getMaterialCode());//物料 + paramMap.put("incomeBatchNo",wmsRawOrderIn.getIncomeBatchNo()); //批次 //批次 + + paramMap.put("ebelp",wmsRawOrderIn.getPoLine());//行项目 paramMap.put("poNo",wmsRawOrderIn.getPoNo()); + paramMap.put("LFBJA",wmsRawOrderIn.getUserDefined5());//参考凭证会计年度 + paramMap.put("LFBNR",wmsRawOrderIn.getUserDefined4());//参考凭证的凭证号 mapList.add(paramMap); R result2 = remoteSapService.handleUpdateSAP105(mapList); if (result2.getCode()==200){ @@ -3095,7 +3098,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { //成功了--成功了,根据 WmsRawOrderInSn wmsRawOrderInSn=new WmsRawOrderInSn(); wmsRawOrderInSn.setUserDefined5(wmsRawOrderIn.getDnNo()); - wmsRawOrderInSn.setUserDefined1("1");//暂收 + wmsRawOrderInSn.setUserDefined1("2");//暂收 wmsRawOrderInSn.setUserDefined3(wmsRawOrderIn.getKem()); List wmsRawOrderInSnList= wmsRawOrderInSnMapper.selectWmsRawOrderInSnList(wmsRawOrderInSn); @@ -3106,9 +3109,9 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { wmsRawOrderInNewsSn.setWaCode(wmsRawOrderInSn1.getWaCode()); wmsRawOrderInNewsSn.setWhCode(wmsRawOrderInSn1.getWhCode()); wmsRawOrderInNewsSn.setWlCode(wmsRawOrderInSn1.getWlCode()); - wmsRawOrderInNewsSn.setUserDefined3("1"); + wmsRawOrderInNewsSn.setUserDefined3("0"); wmsOdsMateStorageNewsSnMapper.updateWmsOdsMateStorageNewsSnTWM(wmsRawOrderInNewsSn); - wmsRawOrderInSn1.setUserDefined1("2"); + wmsRawOrderInSn1.setUserDefined1("1"); wmsRawOrderInSnMapper.updateWmsRawOrderInSn(wmsRawOrderInSn1); WmsOdsMateStorageNews wmsOdsMateStorageNews=new WmsOdsMateStorageNews(); wmsOdsMateStorageNews.setMaterialCode(wmsRawOrderInSn1.getMaterialCode()); @@ -3116,21 +3119,20 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { wmsOdsMateStorageNews.setWlCode(wmsRawOrderInSn1.getWlCode()); wmsOdsMateStorageNews.setWhCode(wmsRawOrderInSn1.getWhCode()); wmsOdsMateStorageNews.setStorageAmount(wmsRawOrderInSn1.getAmount()); - wmsOdsMateStorageNewsMapper.updateWmsOdsMateStorageNewsUpdateStorageAmount(wmsOdsMateStorageNews); + wmsOdsMateStorageNewsMapper.updateWmsOdsMateStorageNewsUpdateStorageAmountFC(wmsOdsMateStorageNews); } wmsRawOrderIn.setOrderStatus("1"); wmsRawOrderIn.setAccountingTime(new Date()); - wmsRawOrderIn.setAccountingMessage(result2.getMsg()); - wmsRawOrderIn.setUserDefined4(MATERIALDOCUMENT); - wmsRawOrderIn.setUserDefined5(MATDOCUMENTYEAR); + wmsRawOrderIn.setUserDefined10(result2.getMsg()); +// wmsRawOrderIn.setUserDefined4(MATERIALDOCUMENT); +// wmsRawOrderIn.setUserDefined5(MATDOCUMENTYEAR); wmsRawOrderInMapper.updateWmsRawOrderIn(wmsRawOrderIn); }else { //失败了 wmsRawOrderIn.setAccountingTime(new Date()); - wmsRawOrderIn.setAccountingMessage(result2.getMsg()); + wmsRawOrderIn.setUserDefined10(result2.getMsg()); wmsRawOrderInMapper.updateWmsRawOrderIn(wmsRawOrderIn); - } } return result; diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOutOrderServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOutOrderServiceImpl.java index bb31e3f4..27accbc8 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOutOrderServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOutOrderServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.domain.R; import com.op.common.core.utils.uuid.IdUtils; 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.wms.domain.*; @@ -35,7 +36,8 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService private OdsProcureOutOrderMapper odsProcureOutOrderMapper; @Autowired private WmsOdsMateStorageNewsSnMapper wmsOdsMateStorageNewsSnMapper; - + @Autowired + private RemoteSapService remoteSapService; @Autowired private WmsSellOutEmbryoMapper wmsSellOutEmbryoMapper; /** @@ -455,15 +457,30 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService // * 领料的移动类型为 261-- and wms_ods_procure_out_order.Order_Status='3' //我把过账状态-- and wms_ods_procure_out_order.User_Defined10!='2'去掉了 List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderSpecialByIDs(orderList); - if (orderList1.size()>0){ - return; - } + for (OdsProcureOutOrder order: + orderList1 ) { + if ("成本中心".equals(orderList1.get(0).getUserDefined6())){//区分出来内部订单 + + Map paramMap=new HashMap<>(); + List mapList = new ArrayList<>(); + paramMap.put("COSTCENTER", order.getUserDefined3());// + paramMap.put("PLANT", order.getSiteCode());//工厂 + paramMap.put("LGORT", order.getLocCode());//库存地点 + paramMap.put("MATNR", order.getMaterialCode());// + paramMap.put("QUANTITY", order.getPlanNumber());// + paramMap.put("MEINS", order.getUnit());// + paramMap.put("BATCH", order.getUserDefined1());// + paramMap.put("PROD_DATE", order.getPlanDate());//生产日期 + paramMap.put("EXPIRYDATE", order.getUserDefined5());//货架寿命到期日 + mapList.add(paramMap); + R result2 = remoteSapService.sapProductOutboundCostCenter(mapList); + }else { + //内部订单 - if ("成本中心".equals(orderList1.get(0).getUserDefined6())){//区分出来内部订单 + } + } - }else {//内部订单 - } // List orderList2 = new ArrayList<>();//非反冲 // List> mapList = new ArrayList<>();//非反冲 // List sapMaterialPostingFCList = new ArrayList<>();//反冲 diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsSellOutEmbryoServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsSellOutEmbryoServiceImpl.java index b2f3c360..414577c0 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsSellOutEmbryoServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsSellOutEmbryoServiceImpl.java @@ -182,7 +182,9 @@ public class WmsSellOutEmbryoServiceImpl implements IWmsSellOutEmbryoService { BigDecimal tem= wmsFpStorageNewsSn.getAmount(); if(planQuantity.compareTo(tem)<=0){ //生成一个 + wmsSellOutEmbryo1.setPlanQuantity(planQuantity); + wmsSellOutEmbryoMapper.insertWmsSellOutEmbryo(wmsSellOutEmbryo); return result; }else { diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml index f2614452..b5555e43 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml @@ -1939,9 +1939,10 @@ wms_ods_procure_out_order_special.Material_Desc, wms_ods_procure_out_order_special.Plan_Date, wms_ods_procure_out_order_special.Plan_Number, - wms_ods_procure_out_order_special.Unit, +-- wms_ods_procure_out_order_special.Unit, COALESCE ( wms_ods_procure_out_order_special.Out_Number, 0 ) - COALESCE ( wms_ods_procure_out_order_special.Sap_Number, 0 ) AS Out_Number , wms_raw_mission_out.user_defined2 Loc_Code, + wms_raw_mission_out.unit Unit, wms_ods_procure_out_order_special.Loc_Desc, wms_ods_procure_out_order_special.Production_Line_Desc, wms_ods_procure_out_order_special.Production_Line_Code, diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/WmsOdsMateStorageNewsMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/WmsOdsMateStorageNewsMapper.xml index 82064773..8c823fec 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/WmsOdsMateStorageNewsMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/WmsOdsMateStorageNewsMapper.xml @@ -406,6 +406,13 @@ gmt_modified=GETDATE() where wh_code=#{whCode} and wl_code=#{wlCode} and wa_code=#{waCode} and material_code=#{materialCode} + + + update wms_ods_mate_storage_news + set storage_amount = ISNULL(storage_amount, 0) + #{storageAmount}, + gmt_modified=GETDATE() + where wh_code=#{whCode} and wl_code=#{wlCode} and wa_code=#{waCode} and material_code=#{materialCode} + update ods_procure_order_card - SET User_Defined10 = '0' + SET User_Defined10 = '0', + Reality_Number = '0', + Tem_Number = Plan_Number where User_Defined1 = #{userDefined6}