From 1ab20ef4274b8e69bb73cedc76433131840efbf8 Mon Sep 17 00:00:00 2001 From: mengjiao <3338049200@qq,com> Date: Mon, 25 Nov 2024 11:31:49 +0800 Subject: [PATCH] =?UTF-8?q?wms=E9=97=AE=E9=A2=981?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/RemoteSapService.java | 4 +- .../api/factory/RemoteSapFallbackFactory.java | 5 + .../com/op/sap/controller/SapController.java | 19 +++ .../op/sap/service/SapItemSyncService.java | 2 + .../com/op/sap/service/SapWmsService.java | 2 + .../op/sap/service/impl/SapItemSyncImpl.java | 154 ++++++++++++++++++ .../sap/service/impl/SapWmsServicelmpl.java | 76 +++++++++ .../controller/WmsRawOrderInController.java | 10 ++ .../wms/service/IOdsProcureOrderService.java | 4 + .../impl/OdsProcureOrderServiceImpl.java | 145 +++++++++++++++++ .../impl/WmsProductPutServiceImpl.java | 3 + 11 files changed, 423 insertions(+), 1 deletion(-) 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 a1cdefcd..78849497 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 @@ -138,6 +138,8 @@ public interface RemoteSapService { */ @PostMapping("/sap/sap105temporarilyCollected") public R sap105temporarilyCollected(@RequestBody(required = false) List mapList) ; - } + @PostMapping("/sap/handleUpdateSAP103") + public R handleUpdateSAP103(@RequestBody(required = false)List mapList); +} 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 bf398baa..cbaf15a1 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 @@ -153,6 +153,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory mapList) { + return R.fail("103的冲销失败" + throwable.getMessage()); + } + }; } } 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 ed2cb9fb..b0139d88 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 @@ -476,6 +476,20 @@ public class SapController extends BaseController { return sapWmsService.sapProductWarehousing(mapList); } + /** + * ZMES_201_MB1A 成本中心出库 + * @param mapList + * @return + */ + @PostMapping("/sapProductOutboundCostCenter") + @Log(title = "成品下线入库", businessType = BusinessType.SAP) + public R sapProductOutboundCostCenter(@RequestBody(required = false) List> mapList) { + return sapWmsService.sapProductOutboundCostCenter(mapList); + } + + + + /** * 来料检验 @@ -524,6 +538,11 @@ public class SapController extends BaseController { public R sap105temporarilyCollected(@RequestBody(required = false) List mapList) { return sapItemSyncService.sap105temporarilyCollected(mapList); } + @PostMapping("/handleUpdateSAP103") + @Log(title = "sap103冲销接口", businessType = BusinessType.SAP) + public R handleUpdateSAP103(@RequestBody(required = false) List mapList) { + return sapItemSyncService.handleUpdateSAP103(mapList); + } /*******************设备*****************/ @PostMapping("/sapZmesAnlaGet") 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 594f7732..c68f347b 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 @@ -42,4 +42,6 @@ public interface SapItemSyncService { R sap105temporarilyCollected(List mapList); R ZmesPurwqGet(Map paramMap); + + R handleUpdateSAP103(List mapList); } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapWmsService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapWmsService.java index 03644f8a..f92624c4 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/SapWmsService.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapWmsService.java @@ -10,4 +10,6 @@ public interface SapWmsService { R sapLgortInfo(List> mapList); R sapProductWarehousing(List> mapList); + + R sapProductOutboundCostCenter(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 3a837677..b7fd6840 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 @@ -856,4 +856,158 @@ public class SapItemSyncImpl implements SapItemSyncService { return R.fail(e.getMessage()); } } + + @Override + public R handleUpdateSAP103(List mapList) { + try { + Map map= mapList.get(0); + JCoRepository repository = dest.getRepository(); + JCoFunction func = repository.getFunction("ZMES_GET_MSEG"); + if (func == null) { + 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"); + //销售凭证类型 + JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR"); + // S_MBLNR.setValue("S_MBLNR", S_MBLNR); + S_MBLNR.appendRow(); + S_MBLNR.setValue(Constants.SIGN, "I"); + S_MBLNR.setValue(Constants.OPTION, "BT"); + S_MBLNR.setValue(Constants.LOW,map.get("S_MBLNR")); + S_MBLNR.setValue(Constants.HIGH,map.get("S_MBLNR")); + S_MJAHR.appendRow(); + S_MJAHR.setValue(Constants.SIGN, "I"); + S_MJAHR.setValue(Constants.OPTION, "BT"); + S_MJAHR.setValue(Constants.LOW,map.get("S_MJAHR")); + S_MJAHR.setValue(Constants.HIGH,map.get("S_MJAHR")); + S_MATNR.appendRow(); + S_MATNR.setValue(Constants.SIGN, "I"); + S_MATNR.setValue(Constants.OPTION, "BT"); + S_MATNR.setValue(Constants.LOW,map.get("S_MATNR")); + S_MATNR.setValue(Constants.HIGH,map.get("S_MATNR")); + func.execute(dest);//执行调用函数 + /** + * MBLNR + * MJAHR + * ZEILE + * EBELN + * EBELP + * MATNR + * WERKS + * LGORT + * MENGE + * MEINS + * ERFMG + * ERFME + * BPMNG + * BPRME + */ + JCoTable maraTable = func.getTableParameterList().getTable("LT_MSEG"); +// 首先检查表中是否有行 + if (maraTable.getNumRows() > 0) { + // 遍历每一行 + + String mblnr = new String(); // 物料凭证编号 + String mjahr = new String(); // 物料凭证年度 + String zeile = new String(); // 物料凭证中的项目 + String ebeln = new String(); // 采购订单编号 + String ebelp = new String(); // 采购凭证的项目编号 + String matnr = new String(); // 物料号 + String werks = new String(); // 工厂 + String lgort = new String(); // 库存地点 + String menge = new String(); // 数量 + String meins = new String(); // 基本计量单位 + String erfmg = new String(); // 以输入单位计的数量 + String erfme = new String(); // 条目单位 + String bpmng = new String(); // 采购订单价格单位的数量 + String bprme = new String(); // 订单价格单位(采购) + String RETCODE= new String(); + String MESSAGE= new String(); + String MATERIALDOCUMENT = new String(); + String MATDOCUMENTYEAR= new String(); + String tem="0"; + for (int i = 0; i < maraTable.getNumRows(); i++) { + maraTable.setRow(i); + mblnr = maraTable.getString("MBLNR"); // 物料凭证编号 + mjahr = maraTable.getString("MJAHR"); // 物料凭证年度 + zeile = maraTable.getString("ZEILE"); // 物料凭证中的项目 + ebeln = maraTable.getString("EBELN"); // 采购订单编号 + matnr = maraTable.getString("MATNR"); // 物料号 + werks = maraTable.getString("WERKS"); // 工厂 + lgort = maraTable.getString("LGORT"); // 库存地点 + menge = maraTable.getString("MENGE"); // 数量 + meins = maraTable.getString("MEINS"); // 基本计量单位 + erfmg = maraTable.getString("ERFMG"); // 以输入单位计的数量 + erfme = maraTable.getString("ERFME"); // 条目单位 + bpmng = maraTable.getString("BPMNG"); // 采购订单价格单位的数量 + bprme = maraTable.getString("BPRME"); // 订单价格单位(采购) + + // 处理获取到的字段值 + System.out.println("物料凭证编号: " + mblnr); + System.out.println("物料凭证年度: " + mjahr); + System.out.println("物料凭证中的项目: " + zeile); + System.out.println("采购订单编号: " + ebeln); + System.out.println("采购凭证的项目编号: " + ebelp); + System.out.println("物料号: " + matnr); + System.out.println("工厂: " + werks); + System.out.println("库存地点: " + lgort); + System.out.println("数量: " + menge); + System.out.println("基本计量单位: " + meins); + System.out.println("以输入单位计的数量: " + erfmg); + System.out.println("条目单位: " + erfme); + System.out.println("采购订单价格单位的数量: " + bpmng); + System.out.println("订单价格单位(采购): " + bprme); + //需要做判断 + if (map.get("poNo").equals(ebeln)&&map.get("S_MATNR").equals(matnr)){//需要判断采购单和物料 + tem="1"; + }else { + continue; + } + JCoFunction func2 = repository.getFunction("ZMES_MIGO_102");//103冲销 + 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("LFPOS",zeile);//参考凭证项目 + L_ITEM.setValue("EBELN", ebeln);//采购订单编号 采购凭证号 + L_ITEM.setValue("MATNR", matnr);//采购订单编号 采购凭证号 + L_ITEM.setValue("EBELP",map.get("ebelp") );//采购凭证的项目编号 + 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"); + MESSAGE = func2.getExportParameterList().getString("L_MSG"); + MATERIALDOCUMENT = func2.getExportParameterList().getString("MATERIALDOCUMENT"); + MATDOCUMENTYEAR = func2.getExportParameterList().getString("MATDOCUMENTYEAR"); + log.info("103冲销结果结果-----" + RETCODE+"/" +MESSAGE+"/" +MATERIALDOCUMENT+"/" +MATDOCUMENTYEAR); + } + if((Constants.FAIL).equals(Integer.parseInt(RETCODE))){ + return R.fail(MESSAGE); + } + Map Resmap = new HashMap(); + Resmap.put("MATERIALDOCUMENT", MATERIALDOCUMENT); + Resmap.put("MATDOCUMENTYEAR", MATDOCUMENTYEAR); + return R.ok(Resmap, MESSAGE); + } else { + // 表为空的处理 + System.out.println("表中没有数据。"); + return R.fail("没有暂收数据"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return R.fail(e.getMessage()); + } + } } 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 18c7a509..4308450d 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 @@ -130,6 +130,82 @@ public class SapWmsServicelmpl implements SapWmsService { } + String L_MSG = func.getExportParameterList().getString("L_MSG"); + String RETCODE = func.getExportParameterList().getString("RETCODE"); + String MATERIALDOCUMENT = func.getExportParameterList().getString("MATERIALDOCUMENT"); + String MATDOCUMENTYEAR = func.getExportParameterList().getString("MATDOCUMENTYEAR"); + System.out.println("L_MSG" + L_MSG); + System.out.println("返回值:0-没有错误,1-有错误:" + RETCODE); + System.out.println("物料凭证编号" + MATERIALDOCUMENT); + System.out.println("物料凭证年度" + MATDOCUMENTYEAR); + if (!("0").equals(RETCODE)) { + return R.fail("", Msg.toString()); + } else { + Map map = new HashMap(); + map.put("MATERIALDOCUMENT", MATERIALDOCUMENT); + map.put("MATDOCUMENTYEAR", MATDOCUMENTYEAR); + return R.ok(map, Msg.toString()); + } + + } catch (Exception e) { + log.error(e.getMessage()); + return R.fail(e.getMessage()); + } + } + + @Override + public R sapProductOutboundCostCenter(List> mapList) { + + try { + JCoRepository repository = dest.getRepository(); + JCoFunction func = repository.getFunction("ZMES_201_MB1A"); + if (func == null) { + throw new RuntimeException("Function does not exist in SAP"); + } + log.info("成品移动ZMES_PRODUCT_MB1A-------" + mapList.toString()); + /** + AUFNR 订单号 + POSNR 订单项目编号 + BWART 移动类型(库存管理) + PLANT 工厂 + LGORT 库存地点 + KOSTL 成本中心 + MATNR 物料号 + QUANTITY 数量 + MEINS 基本计量单位 + BATCH 批号 + HSDAT 生产日期 + VFDAT 货架寿命到期日 + */ + 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")); + } + System.out.println(L_ITEM); + func.execute(dest);//执行调用函数 + // 获取 内表 - ZMES_PRO + + JCoTable LT_RETURN = func.getTableParameterList().getTable("LT_RETURN"); + StringBuilder Msg = new StringBuilder(); + for (int i = 0; i < LT_RETURN.getNumRows(); i++) { + LT_RETURN.setRow(i); + String MESSAGE = LT_RETURN.getString("MESSAGE"); + Msg.append(MESSAGE + "/"); + } + + String L_MSG = func.getExportParameterList().getString("L_MSG"); String RETCODE = func.getExportParameterList().getString("RETCODE"); String MATERIALDOCUMENT = func.getExportParameterList().getString("MATERIALDOCUMENT"); diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsRawOrderInController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsRawOrderInController.java index 07b833bb..3cc9e3fd 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsRawOrderInController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsRawOrderInController.java @@ -106,4 +106,14 @@ public class WmsRawOrderInController extends BaseController { String result = odsProcureOrderService.sap105temporarilyCollected(odsProcureOrder); return success(result); } + @PostMapping("/handleUpdateSAP103") + public AjaxResult handleUpdateSAP103(@RequestBody List odsProcureOrder) { + String result = odsProcureOrderService.handleUpdateSAP103(odsProcureOrder); + return success(result); + } + @PostMapping("/handleUpdateSAP105") + public AjaxResult handleUpdateSAP105(@RequestBody List odsProcureOrder) { + String result = odsProcureOrderService.handleUpdateSAP105(odsProcureOrder); + return success(result); + } } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java index f46155cd..69918bc5 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java @@ -143,4 +143,8 @@ public interface IOdsProcureOrderService { List CKlist(OdsProcureOutOrder odsProcureOutOrder); String ArrivalRegistrationSH(OdsProcureOrder odsProcureOrder); + + String handleUpdateSAP103(List odsProcureOrder); + + String handleUpdateSAP105(List odsProcureOrder); } 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 902aa747..66d26911 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 @@ -1576,6 +1576,9 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { return result; } + + + @Override public List ProductionMaterialRequisitionSC(OdsProcureOutOrder odsProcureOutOrder) { DynamicDataSourceContextHolder.push("ds_" + odsProcureOutOrder.getFactoryCode()); @@ -2618,6 +2621,148 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { return result; } + /** + * 103冲销 + * @param odsProcureOrders + * @return + */ + @Override + public String handleUpdateSAP103(List odsProcureOrders) { + String result="操作成功"; + for (OdsProcureOrder order: odsProcureOrders){ + OdsProcureOrder odsProcureOrder = order; + WmsRawOrderIn wmsRawOrderIn= wmsRawOrderInMapper.selectWmsRawOrderInByRawOrderInIdTWO(odsProcureOrder.getID()); + //暂收状态的--其中备用字段1是用来保存暂收的凭证的,, + 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("poNo",wmsRawOrderIn.getPoNo()); + mapList.add(paramMap); + R result2 = remoteSapService.handleUpdateSAP103(mapList); + if (result2.getCode()==200){ + //暂收冲销成功 + Map map = new HashMap(); + map = (Map) result2.getData(); + String MATERIALDOCUMENT = (String) map.get("MATERIALDOCUMENT"); + String MATDOCUMENTYEAR = (String) map.get("MATDOCUMENTYEAR"); + //成功了--成功了,根据 + WmsRawOrderInSn wmsRawOrderInSn=new WmsRawOrderInSn(); + wmsRawOrderInSn.setUserDefined5(wmsRawOrderIn.getDnNo()); + wmsRawOrderInSn.setUserDefined1("1");//暂收--1是收货,2是入库,,3是103冲销 + + wmsRawOrderInSn.setUserDefined3(wmsRawOrderIn.getKem()); + List wmsRawOrderInSnList= wmsRawOrderInSnMapper.selectWmsRawOrderInSnList(wmsRawOrderInSn); + for (WmsRawOrderInSn wmsRawOrderInSn1: + wmsRawOrderInSnList) { + WmsOdsMateStorageNewsSn wmsRawOrderInNewsSn=new WmsOdsMateStorageNewsSn(); + wmsRawOrderInNewsSn.setMaterialCode(wmsRawOrderInSn1.getMaterialCode()); + wmsRawOrderInNewsSn.setWaCode(wmsRawOrderInSn1.getWaCode()); + wmsRawOrderInNewsSn.setWhCode(wmsRawOrderInSn1.getWhCode()); + wmsRawOrderInNewsSn.setWlCode(wmsRawOrderInSn1.getWlCode()); + wmsRawOrderInNewsSn.setUserDefined3("1"); + wmsOdsMateStorageNewsSnMapper.updateWmsOdsMateStorageNewsSnTWM(wmsRawOrderInNewsSn);//wms_ods_mate_storage_news_sn + wmsRawOrderInSn1.setUserDefined1("2"); + wmsRawOrderInSnMapper.updateWmsRawOrderInSn(wmsRawOrderInSn1); + WmsOdsMateStorageNews wmsOdsMateStorageNews=new WmsOdsMateStorageNews(); + wmsOdsMateStorageNews.setMaterialCode(wmsRawOrderInSn1.getMaterialCode()); + wmsOdsMateStorageNews.setWaCode(wmsRawOrderInSn1.getWaCode()); + wmsOdsMateStorageNews.setWlCode(wmsRawOrderInSn1.getWlCode()); + wmsOdsMateStorageNews.setWhCode(wmsRawOrderInSn1.getWhCode()); + wmsOdsMateStorageNews.setStorageAmount(wmsRawOrderInSn1.getAmount()); + wmsOdsMateStorageNewsMapper.updateWmsOdsMateStorageNewsUpdateStorageAmount(wmsOdsMateStorageNews); + } + wmsRawOrderIn.setOrderStatus("1"); + wmsRawOrderIn.setAccountingTime(new Date()); + wmsRawOrderIn.setAccountingMessage(result2.getMsg()); + wmsRawOrderIn.setUserDefined4(MATERIALDOCUMENT); + wmsRawOrderIn.setUserDefined5(MATDOCUMENTYEAR); + wmsRawOrderInMapper.updateWmsRawOrderIn(wmsRawOrderIn); + + }else { + //失败了 + wmsRawOrderIn.setAccountingTime(new Date()); + wmsRawOrderIn.setAccountingMessage(result2.getMsg()); + wmsRawOrderInMapper.updateWmsRawOrderIn(wmsRawOrderIn); + + } + } + return result; + } + /** + * 105冲销 + * @param odsProcureOrders + * @return + */ + @Override + public String handleUpdateSAP105(List odsProcureOrders) { + String result="操作成功"; + for (OdsProcureOrder order: odsProcureOrders){ + OdsProcureOrder odsProcureOrder = order; + WmsRawOrderIn wmsRawOrderIn= wmsRawOrderInMapper.selectWmsRawOrderInByRawOrderInIdTWO(odsProcureOrder.getID()); + //这个地方 + 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("poNo",wmsRawOrderIn.getPoNo()); + mapList.add(paramMap); + R result2 = remoteSapService.sap105temporarilyCollected(mapList); + if (result2.getCode()==200){ + Map map = new HashMap(); + map = (Map) result2.getData(); + String MATERIALDOCUMENT = (String) map.get("MATERIALDOCUMENT"); + String MATDOCUMENTYEAR = (String) map.get("MATDOCUMENTYEAR"); + //成功了--成功了,根据 + WmsRawOrderInSn wmsRawOrderInSn=new WmsRawOrderInSn(); + wmsRawOrderInSn.setUserDefined5(wmsRawOrderIn.getDnNo()); + wmsRawOrderInSn.setUserDefined1("1");//暂收 + + wmsRawOrderInSn.setUserDefined3(wmsRawOrderIn.getKem()); + List wmsRawOrderInSnList= wmsRawOrderInSnMapper.selectWmsRawOrderInSnList(wmsRawOrderInSn); + for (WmsRawOrderInSn wmsRawOrderInSn1: + wmsRawOrderInSnList) { + WmsOdsMateStorageNewsSn wmsRawOrderInNewsSn=new WmsOdsMateStorageNewsSn(); + wmsRawOrderInNewsSn.setMaterialCode(wmsRawOrderInSn1.getMaterialCode()); + wmsRawOrderInNewsSn.setWaCode(wmsRawOrderInSn1.getWaCode()); + wmsRawOrderInNewsSn.setWhCode(wmsRawOrderInSn1.getWhCode()); + wmsRawOrderInNewsSn.setWlCode(wmsRawOrderInSn1.getWlCode()); + wmsRawOrderInNewsSn.setUserDefined3("1"); + wmsOdsMateStorageNewsSnMapper.updateWmsOdsMateStorageNewsSnTWM(wmsRawOrderInNewsSn); + wmsRawOrderInSn1.setUserDefined1("2"); + wmsRawOrderInSnMapper.updateWmsRawOrderInSn(wmsRawOrderInSn1); + WmsOdsMateStorageNews wmsOdsMateStorageNews=new WmsOdsMateStorageNews(); + wmsOdsMateStorageNews.setMaterialCode(wmsRawOrderInSn1.getMaterialCode()); + wmsOdsMateStorageNews.setWaCode(wmsRawOrderInSn1.getWaCode()); + wmsOdsMateStorageNews.setWlCode(wmsRawOrderInSn1.getWlCode()); + wmsOdsMateStorageNews.setWhCode(wmsRawOrderInSn1.getWhCode()); + wmsOdsMateStorageNews.setStorageAmount(wmsRawOrderInSn1.getAmount()); + wmsOdsMateStorageNewsMapper.updateWmsOdsMateStorageNewsUpdateStorageAmount(wmsOdsMateStorageNews); + } + wmsRawOrderIn.setOrderStatus("1"); + wmsRawOrderIn.setAccountingTime(new Date()); + wmsRawOrderIn.setAccountingMessage(result2.getMsg()); + wmsRawOrderIn.setUserDefined4(MATERIALDOCUMENT); + wmsRawOrderIn.setUserDefined5(MATDOCUMENTYEAR); + wmsRawOrderInMapper.updateWmsRawOrderIn(wmsRawOrderIn); + + }else { + //失败了 + wmsRawOrderIn.setAccountingTime(new Date()); + wmsRawOrderIn.setAccountingMessage(result2.getMsg()); + wmsRawOrderInMapper.updateWmsRawOrderIn(wmsRawOrderIn); + + } + } + return result; + } + // @Override // public String addReturnSC(List orderList) { // String factoryCode = orderList.get(0).getFactoryCode(); diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java index 5d9e0582..812b5955 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java @@ -649,6 +649,7 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { String result="入库成功"; //先判断这个订单是否存在//如果存在--就修改订单。-如果不存在就添加上, DynamicDataSourceContextHolder.push("ds_" + wmsOdsWhiteEmbryoIn.getSiteCode()); + String unit= wmsOdsWhiteEmbryoIn.getUnit(); String userDefined1= wmsOdsWhiteEmbryoIn.getUserDefined1(); WmsOdsWhiteEmbryoIn wmsOdsWhiteEmbryoIn1= wmsOdsWhiteEmbryoInMapper.selectWmsOdsWhiteEmbryoInByOrderCodeAndUserDefined1(wmsOdsWhiteEmbryoIn); if (wmsOdsWhiteEmbryoIn1==null){ @@ -692,12 +693,14 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { wmsOdsEmStorageNewsSn.setGmtCreate(new Date()); wmsOdsEmStorageNewsSn.setActiveFlag("1"); wmsOdsEmStorageNewsSn.setUserDefined1(wmsOdsWhiteEmbryoIn.getOrderCode()); + wmsOdsEmStorageNewsSn.setUserDefined2(unit); wmsOdsEmStorageNewsSn.setFactoryCode(wmsOdsWhiteEmbryoIn.getSiteCode()); wmsOdsEmStorageNewsSnMapper.insertWmsOdsEmStorageNewsSn(wmsOdsEmStorageNewsSn); WmsOdsEmStorageNews wmsOdsEmStorageNews=new WmsOdsEmStorageNews(); wmsOdsEmStorageNews.setWlCode(wmsWhiteBilletInfor.getWlCode()); wmsOdsEmStorageNews.setMaterialCode(wmsOdsWhiteEmbryoIn.getMaterialCode()); wmsOdsEmStorageNews.setMaterialDesc(wmsOdsWhiteEmbryoIn.getMaterialDesc()); + wmsOdsEmStorageNews.setUserDefined1(unit); wmsOdsEmStorageNews.setActiveFlag("1"); List wmsOdsEmStorageNewsList= wmsOdsEmStorageNewsMapper.selectWmsOdsEmStorageNewsList(wmsOdsEmStorageNews); if (wmsOdsEmStorageNewsList.size()>0){