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 9a2dec95..98b3f416 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 @@ -130,4 +130,11 @@ public interface RemoteSapService { */ @PostMapping("/sap/temporarilyCollected") public R temporarilyCollected(@RequestBody(required = false) List mapList) ; + /** + *sap105过账接口 + */ + @PostMapping("/sap/sap105temporarilyCollected") + public R sap105temporarilyCollected(@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 c7bc2477..8578ab5f 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 @@ -143,6 +143,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory 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 93955ca8..1f8bc9b4 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 @@ -653,42 +653,140 @@ public class SapItemSyncImpl implements SapItemSyncService { @Override public R sap105temporarilyCollected(List mapList) { try { + Map map= mapList.get(0); JCoRepository repository = dest.getRepository(); - JCoFunction func = repository.getFunction("ZMES_103_MIGO"); + JCoFunction func = repository.getFunction("ZMES_GET_MSEG"); 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); + 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);//执行调用函数 /** - * RETCODE CHAR3 返回值:200-没有错误,500-有错误 - * L_MSG CHAR220 返回消息文本 - * MATERIALDOCUMENT CHAR10 物料凭证编号 - * MATDOCUMENTYEAR NUMC4 物料凭证年度 + * MBLNR + * MJAHR + * ZEILE + * EBELN + * EBELP + * MATNR + * WERKS + * LGORT + * MENGE + * MEINS + * ERFMG + * ERFME + * BPMNG + * BPRME */ - 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"); - log.info("暂收结果结果-----" + RETCODE+"/" +MESSAGE+"/" +MATERIALDOCUMENT+"/" +MATDOCUMENTYEAR); - if((Constants.FAIL).equals(Integer.parseInt(RETCODE))){ - return R.fail(MESSAGE); + 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(); + for (int i = 0; i < maraTable.getNumRows(); 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); + JCoFunction func2 = repository.getFunction("ZMES_105_MIGO"); + 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("LFBNR",mblnr);//参考凭证的凭证号 + L_ITEM.setValue("LFPOS",zeile);//参考凭证项目 + L_ITEM.setValue("BSTNR", ebeln);//采购订单编号 + L_ITEM.setValue("EBELP", ebelp);//采购凭证的项目编号 + L_ITEM.setValue("WERKS", werks);//工厂 + L_ITEM.setValue("LGORT", lgort);//库存地点 + 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("105结果结果-----" + 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("没有暂收数据"); } - Map Resmap = new HashMap(); - Resmap.put("MATERIALDOCUMENT", MATERIALDOCUMENT); - Resmap.put("MATDOCUMENTYEAR", MATDOCUMENTYEAR); - return R.ok(Resmap, MESSAGE); } catch (Exception e) { log.error(e.getMessage()); return R.fail(e.getMessage()); 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 2134f0fd..e0c2d168 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 @@ -3,6 +3,8 @@ package com.op.wms.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.op.wms.domain.OdsProcureOrder; +import com.op.wms.service.IOdsProcureOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -22,6 +24,8 @@ import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.web.page.TableDataInfo; +import static com.op.common.core.web.domain.AjaxResult.success; + /** * 包材到货单Controller * @@ -34,6 +38,8 @@ public class WmsRawOrderInController extends BaseController { @Autowired private IWmsRawOrderInService wmsRawOrderInService; + @Autowired + private IOdsProcureOrderService odsProcureOrderService; /** * 查询包材到货单列表 */ @@ -95,4 +101,9 @@ public class WmsRawOrderInController extends BaseController { public AjaxResult remove(@PathVariable String[] rawOrderInIds) { return toAjax(wmsRawOrderInService.deleteWmsRawOrderInByRawOrderInIds(rawOrderInIds)); } +// @PostMapping("/sap105temporarilyCollected") +// public AjaxResult sap105temporarilyCollected(@RequestBody List odsProcureOrder) { +// String result = odsProcureOrderService.sap105temporarilyCollected(odsProcureOrder); +// return success(result); +// } } 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 1545e916..5eda1c3f 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 @@ -794,4 +794,5 @@ public class WmsToWCSmissionController { return success(result); } + } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsRawOrderIn.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsRawOrderIn.java index 36d11ca3..c1332a02 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsRawOrderIn.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsRawOrderIn.java @@ -339,6 +339,7 @@ public class WmsRawOrderIn extends BaseEntity { */ @Excel(name = "有效标记") private String activeFlag; + private String incomeBatchNo; public void setRawOrderInId(String rawOrderInId) { this.rawOrderInId = rawOrderInId; 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 f1eea556..08b624e2 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 @@ -62,8 +62,10 @@ public interface WmsOdsMateStorageNewsMapper { */ public int deleteWmsOdsMateStorageNewsByStorageIds(String[] storageIds); - WmsOdsMateStorageNews selectByWhCodeAndMate(WmsOdsEmStorageNews wmsOdsEmStorageNews); + public WmsOdsMateStorageNews selectByWhCodeAndMate(WmsOdsEmStorageNews wmsOdsEmStorageNews); - WmsOdsMateStorageNews selectBaseProductByCode(WCSInventoryPlan wcsInventoryPlan); + public WmsOdsMateStorageNews selectBaseProductByCode(WCSInventoryPlan wcsInventoryPlan); + + public void updateWmsOdsMateStorageNewsUpdateStorageAmount(WmsOdsMateStorageNews wmsOdsMateStorageNews); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsRawOrderInMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsRawOrderInMapper.java index 96d459f1..7c8a95b7 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsRawOrderInMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsRawOrderInMapper.java @@ -65,4 +65,6 @@ public interface WmsRawOrderInMapper { WmsToWCSDTO finishedProductRequestInbound(WmsToWCSDTO wcsdto); List finishedProductRequestInboundsn(WmsToWCSDTO wcsdto); + + WmsRawOrderIn selectWmsRawOrderInByRawOrderInIdTWO(String rawOrderInId); } 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 b56308ce..45746ecd 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 @@ -220,4 +220,10 @@ select DISTINCT material_desc,user_defined1 from wms_ods_mate_storage_news where material_code=#{sku} + + 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} + diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/WmsRawOrderInMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/WmsRawOrderInMapper.xml index 8401b5be..4d76dbaa 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/WmsRawOrderInMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/WmsRawOrderInMapper.xml @@ -57,6 +57,7 @@ + @@ -128,7 +129,68 @@ where raw_order_in_id = #{rawOrderInId} + insert into wms_raw_order_in