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 b49b2ff7..ef63ed29 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 @@ -1120,11 +1120,11 @@ public class SapItemSyncImpl implements SapItemSyncService { }else { continue; } - JCoFunction func2 = repository.getFunction("ZMES_106_MIGO");//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()); + log.info("106参数-------" + mapList.toString()); JCoTable L_ITEM = func2.getTableParameterList().getTable("L_ITEM"); L_ITEM.appendRow(); L_ITEM.setValue("LFBJA",map.get("LFBJA"));//参考凭证会计年度 @@ -1143,7 +1143,7 @@ public class SapItemSyncImpl implements SapItemSyncService { MESSAGE = func2.getExportParameterList().getString("L_MSG"); MATERIALDOCUMENT = func2.getExportParameterList().getString("MATERIALDOCUMENT"); MATDOCUMENTYEAR = func2.getExportParameterList().getString("MATDOCUMENTYEAR"); - log.info("105冲销结果结果-----" + RETCODE+"/" +MESSAGE+"/" +MATERIALDOCUMENT+"/" +MATDOCUMENTYEAR); + log.info("106冲销结果结果-----" + RETCODE+"/" +MESSAGE+"/" +MATERIALDOCUMENT+"/" +MATDOCUMENTYEAR); } if((Constants.FAIL).equals(Integer.parseInt(RETCODE))){ return R.fail(MESSAGE); diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java index 9d04816f..cb27f0ed 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java @@ -351,6 +351,18 @@ public class OdsProcureOrderController extends BaseController { odsProcureOrderService.OutboundPostingzcSAP(orderList); return success(); } + + /** + * 退货过账 + * + * @param orderList + * @return + */ + @PostMapping("/OutboundPostingzcSAPTH") + public AjaxResult OutboundPostingzcSAPTH(@RequestBody List orderList) { + odsProcureOrderService.OutboundPostingzcSAPTH(orderList); + return success(); + } /** * 领料单出库过账 * diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/OdsProcureOutOrderMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/OdsProcureOutOrderMapper.java index b01a5e6e..5193043e 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/OdsProcureOutOrderMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/OdsProcureOutOrderMapper.java @@ -171,4 +171,6 @@ public interface OdsProcureOutOrderMapper { void updateWmsRawMissionOutById(WmsOdsMateStorageNews wmsOdsMateStorageNews); String selectwmsFpStorageNewsTS(String formattedDate); + + List selectWmsOdsProcureReturnOrderByproduceCode(@Param("order")OdsProcureOutOrder order); } 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 a1a7ffe7..7c65f012 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 @@ -156,4 +156,6 @@ public interface IOdsProcureOrderService { void OutboundPostingzcSAPTS(List orderList); + + void OutboundPostingzcSAPTH(List orderList); } 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 b794dd79..9b2746b6 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 @@ -1673,6 +1673,82 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { } } + @Override + public void OutboundPostingzcSAPTH(List orderList) { + //先根据出库单获取 +// * 退料的移动类型为 262 +// * 领料的移动类型为 261-- and wms_ods_procure_out_order.Order_Status='3' + List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureReturnOrderByID(orderList); + List orderList2 = new ArrayList<>();//非反冲 + List> mapList = new ArrayList<>();//非反冲 + List sapMaterialPostingFCList = new ArrayList<>();//反冲 + List orderList2FC = new ArrayList<>();//反冲 + for (OdsProcureOutOrder odsProcureOutOrder : + orderList1) { + if (!"X".equals(odsProcureOutOrder.getUserDefined3())){ + Map map = new HashMap<>(); + map.put("AUFNR", odsProcureOutOrder.getProduceCode()); + map.put("PLANT", odsProcureOutOrder.getSiteCode()); + String lgort = baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode()); + map.put("LGORT", lgort); + map.put("MATNR", odsProcureOutOrder.getMaterialCode()); + map.put("QUANTITY", odsProcureOutOrder.getReturnNumber().toString()); + map.put("MEINS", odsProcureOutOrder.getUnit()); + mapList.add(map); + orderList2.add(odsProcureOutOrder); + }else { + SapBackflushMPQuery sapBackflushMPQuery = new SapBackflushMPQuery(); + sapBackflushMPQuery.setPlant(odsProcureOutOrder.getSiteCode()); //工厂 + String lgort = baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode()); + sapBackflushMPQuery.setLgort(lgort);//库存地点 + sapBackflushMPQuery.setUmlgo("0013"); + sapBackflushMPQuery.setMatnr(odsProcureOutOrder.getMaterialCode());//物料号 + sapBackflushMPQuery.setQuantity(odsProcureOutOrder.getOutNumber().toString()); //数量 + sapBackflushMPQuery.setMeins(odsProcureOutOrder.getUnit()); //基本计量单位 + sapBackflushMPQuery.setBatch(odsProcureOutOrder.getUserDefined2()); //批号 + sapMaterialPostingFCList.add(sapBackflushMPQuery); + orderList2FC.add(odsProcureOutOrder); + } + } + if (mapList.size() > 0) { + //非反冲过账 + SapMaterialPosting sapMaterialPosting = new SapMaterialPosting(); + sapMaterialPosting.setPostingType("262"); + sapMaterialPosting.setMapList(mapList); + R result = remoteSapService.sapMaterialPosting(sapMaterialPosting); + OdsProcureOutOrder order = new OdsProcureOutOrder(); + int code = result.getCode(); + String msg = result.getMsg(); + //order.setSapMaterialPostingList(sapMaterialPostingList); + order.setUserDefined11(msg); + if (code == 200) { + //过账成功 + Map map = new HashMap(); + map = (Map) result.getData(); + String userDefined9 = (String) map.get("MATERIALDOCUMENT"); + order.setUserDefined9(userDefined9); + order.setUserDefined10("2");//成功 + odsProcureOutOrderMapper.updateWMSOdsProcureReturnOrderByids(order, orderList2); + for (OdsProcureOutOrder order1: + orderList2) { + //过账成功--减库存 + List odsEmStorageNews= odsProcureOutOrderMapper.selectWmsRawMissionOutByPrdAndMa(order1); + for (WmsOdsMateStorageNews wmsOdsMateStorageNews: + odsEmStorageNews) { + //wmsOdsMateStorageNews + wmsOdsMateStorageNews.setLastModifiedBy(SecurityUtils.getUsername()); + wmsOdsMateStorageNewsSnMapper.updatesub(wmsOdsMateStorageNews);//库存调整 + } + } + } else { + // + order.setUserDefined9(""); + order.setUserDefined10("3");//失败 + odsProcureOutOrderMapper.updateWMSOdsProcureReturnOrderByids(order, orderList2); + } + } + } + @Override @DS("#header.poolName") @@ -2868,7 +2944,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { } OdsProcureOutOrder order=new OdsProcureOutOrder(); order.setProduceCode(produceCode); - List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureReturnOrderStatus(order); + List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureReturnOrderByproduceCode(order); String fx=""; for(OdsProcureOutOrder order1:orderList1){ if(order1.getProduceCode().length()<=11){ @@ -3714,7 +3790,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { public void OutboundPostingzcSAPGYTH(List orderList){ //先根据出库单获取 // * 退料的移动类型为 262 -// * 领料的移动类型为 261-- and wms_ods_procure_out_order.Order_Status='3' +// * 领料的移动类型为 261-- and wms_ods_procure_out_order.Order_Status='3' List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureReturnOrderByID(orderList); List orderList2 = new ArrayList<>();//非反冲 List> mapList = new ArrayList<>();//非反冲