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..7939dce7 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,8 @@ public interface OdsProcureOutOrderMapper { void updateWmsRawMissionOutById(WmsOdsMateStorageNews wmsOdsMateStorageNews); String selectwmsFpStorageNewsTS(String formattedDate); + + List selectWmsOdsProcureReturnOrderByproduceCode(@Param("order")OdsProcureOutOrder order); + + List selectWmsOdsProcureOutOrderByIDsTS(List orderList); } 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..66895c1c 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 @@ -1571,7 +1571,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { //先根据出库单获取 // * 退料的移动类型为 262 // * 领料的移动类型为 261 - List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByIDs(orderList); + List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByIDsTS(orderList); List orderList2 = new ArrayList<>();//非反冲 List> mapList = new ArrayList<>();//非反冲 List sapMaterialPostingFCList = new ArrayList<>();//反冲 @@ -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<>();//非反冲 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 b5555e43..d881910a 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 @@ -848,6 +848,53 @@ AND (COALESCE ( wms_ods_procure_out_order.Out_Number, 0 ) - COALESCE ( wms_ods_procure_out_order.Sap_Number, 0 ))>0 + + SELECT DISTINCT + wms_ods_procure_return_order.Site_code, + wms_ods_procure_return_order.ID, + wms_ods_procure_return_order.Produce_Code, + wms_ods_procure_return_order.Material_Code, + wms_ods_procure_return_order.Material_Desc, + wms_ods_procure_return_order.Plan_Date, + wms_ods_procure_return_order.Plan_Number, + wms_ods_procure_return_order.Unit, + COALESCE ( wms_ods_procure_return_order.Return_Number, 0 ) AS Return_Number, + wms_raw_mission_out.user_defined2 Loc_Code, + wms_ods_procure_return_order.Loc_Desc, + wms_ods_procure_return_order.Production_Line_Desc, + wms_ods_procure_return_order.Production_Line_Code, + wms_ods_procure_return_order.Order_Status, + wms_ods_procure_return_order.User_Defined1, + wms_ods_procure_return_order.User_Defined2, + wms_ods_procure_return_order.User_Defined3, + wms_ods_procure_return_order.User_Defined4, + wms_ods_procure_return_order.User_Defined5, + wms_ods_procure_return_order.User_Defined6, + wms_ods_procure_return_order.User_Defined7, + wms_ods_procure_return_order.User_Defined8, + wms_ods_procure_return_order.User_Defined9, + wms_ods_procure_return_order.User_Defined10, + wms_ods_procure_return_order.User_Defined11, + wms_ods_procure_return_order.Supplier_Code, + wms_ods_procure_return_order.Supplier_Name, + wms_ods_procure_return_order.Create_By, + wms_ods_procure_return_order.Create_Date, + wms_ods_procure_return_order.Last_Update_By, + wms_ods_procure_return_order.Last_Update_Date, + wms_ods_procure_return_order.Active, + wms_ods_procure_return_order.Enterprise_Id, + wms_ods_procure_return_order.Enterprise_Code + FROM + wms_ods_procure_return_order + LEFT JOIN wms_raw_mission_out ON wms_raw_mission_out.prd_order = wms_ods_procure_return_order.Produce_Code + AND wms_raw_mission_out.material_code = wms_ods_procure_return_order.Material_Code + where wms_ods_procure_return_order.Produce_Code=#{order.produceCode} + and wms_ods_procure_return_order.User_Defined10!='2' +