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 b9aabb87..8d584adb 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 @@ -146,6 +146,8 @@ public interface RemoteSapService { public R handleUpdateSAP105(@RequestBody(required = false)List mapList); @PostMapping("/sap/handleUpdateSAP102") public R handleUpdateSAP102(@RequestBody(required = false)List mapList); + @PostMapping("/sap/sapProductOutboundCostTW") + public R sapProductOutboundCostTW(@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 48cae138..da303b05 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 @@ -173,6 +173,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory mapList) { + return R.fail("内部订单的收货过账失败" + 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 4b49a319..d00938c2 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 @@ -494,7 +494,7 @@ public class SapController extends BaseController { @PostMapping("/sapProductOutboundCostTW") @Log(title = "有关内部订单的收货", businessType = BusinessType.SAP) public R sapProductOutboundCostTW(@RequestBody(required = false) List> mapList) { - return sapWmsService.sapProductOutboundCostCenter(mapList); + return sapWmsService.sapProductOutboundCostTW(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 f92624c4..6c9debd3 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 @@ -12,4 +12,6 @@ public interface SapWmsService { R sapProductWarehousing(List> mapList); R sapProductOutboundCostCenter(List> mapList); + + R sapProductOutboundCostTW(List> mapList); } 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 4a8d9c2a..b4faa12a 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 @@ -211,6 +211,87 @@ 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 sapProductOutboundCostTW(List> mapList) { + + try { + JCoRepository repository = dest.getRepository(); + JCoFunction func = repository.getFunction("ZMES_961_MB1A"); + if (func == null) { + throw new RuntimeException("Function does not exist in SAP"); + } + log.info("成品ZMES_201_MB1A-------" + mapList.toString()); + /** + AUFNR 订单号 + POSNR 订单项目编号 + BWART 移动类型(库存管理) + PLANT 工厂 + LGORT 库存地点 + KOSTL 成本中心 + MATNR 物料号 + QUANTITY 数量 + MEINS 基本计量单位 + 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("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);//执行调用函数 + // 获取 内表 - 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/OdsProcureOutOrderController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOutOrderController.java index ba2fab76..c8801729 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOutOrderController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOutOrderController.java @@ -71,6 +71,12 @@ public class OdsProcureOutOrderController extends BaseController { List list = odsProcureOutOrderService.selectOdsProcureOutOrderListZC(odsProcureOutOrder); return getDataTable(list); } + @PostMapping("/listZCTC") + public TableDataInfo listZCTC(OdsProcureOutOrder odsProcureOutOrder) { + startPage(); + List list = odsProcureOutOrderService.selectOdsProcureOutOrderListZCTC(odsProcureOutOrder); + return getDataTable(list); + } /** * 导出包材出库单列表 */ 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 7939dce7..2fc6b4f2 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 @@ -117,7 +117,7 @@ public interface OdsProcureOutOrderMapper { public void updateWmsOdsProcureOutOrder(OdsProcureOutOrder odsProcureOutOrder1); public List selectOdsProcureOutOrderListZC(OdsProcureOutOrder odsProcureOutOrder); - + public List selectOdsProcureOutOrderListZCTW(OdsProcureOutOrder odsProcureOutOrder); public List selectWmsOdsProcureOutOrderByIDs(@Param("list") List orderList); public void updateWMSOdsProcureOutOrderByids(@Param("order") OdsProcureOutOrder order, @Param("list") List sapMaterialPostingList); @@ -175,4 +175,8 @@ public interface OdsProcureOutOrderMapper { List selectWmsOdsProcureReturnOrderByproduceCode(@Param("order")OdsProcureOutOrder order); List selectWmsOdsProcureOutOrderByIDsTS(List orderList); + + void updateWMSOdsProcureOutOrdersapSpecialById(OdsProcureOutOrder order1); + + void updateWMSOdsProcureOutOrdersapSpecialTWById(OdsProcureOutOrder order1); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOutOrderService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOutOrderService.java index 64f4b580..6e4338c8 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOutOrderService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOutOrderService.java @@ -86,4 +86,6 @@ public interface IOdsProcureOutOrderService { String OdsProcureOutOrderTSCK(OdsProcureOutOrder order); String addwmsFpStorageNewsTS(List orderList); + + List selectOdsProcureOutOrderListZCTC(OdsProcureOutOrder odsProcureOutOrder); } 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 d475506d..e8775496 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 @@ -154,10 +154,10 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService @Override @DS("#header.poolName") public List selectOdsProcureOutOrderListZC(OdsProcureOutOrder odsProcureOutOrder) { + odsProcureOutOrder.setUserDefined3("X"); List orderList = odsProcureOutOrderMapper.selectOdsProcureOutOrderListZC(odsProcureOutOrder); for (OdsProcureOutOrder order: orderList) { - if (order.getUserDefined4().length()>10){ String tem= odsProcureOutOrderMapper.selectMesReportWorkConsume(order); if(tem==null){ order.setBGNumber(new BigDecimal("0")); @@ -165,13 +165,6 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService order.setBGNumber(new BigDecimal(tem)); } - }else { - //这个反冲的 - List odsProcureOutOrderList=odsProcureOutOrderMapper.selectMesReportWorkConsumeFC(order.getUserDefined4(),order.getMaterialCode()); - if (odsProcureOutOrderList.size()>0){ - order.setBGNumber( odsProcureOutOrderList.get(0).getPlanNumber()); - } - } } return orderList; @@ -310,6 +303,7 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService // factoryCode工厂号 // createBy操作人 // "produceCode": + String ID=""; if(orderList.size()>0){ String factoryCode = orderList.get(0).getFactoryCode(); DynamicDataSourceContextHolder.push("ds_" + factoryCode); @@ -346,6 +340,7 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService odsProcureOutOrder1.setMaterialCode(materialCode); List odsProcureOutOrders = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderSpecial(odsProcureOutOrder1); //包材出库单----会有特殊的那种二次过账的单子--就看前端会不会传对应的标识卡了 + ID=odsProcureOutOrders.get(0).getID(); OdsProcureOutOrder order1= odsProcureOutOrders.get(0); order.setUserDefined4(order1.getUserDefined4()); //出库明细 @@ -358,7 +353,7 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService if (tem.compareTo(realityNumber)>= 0) { order1.setOrderStatus("3");//3是满足出库数量 } else { - order1.setOrderStatus("2"); + order1.setOrderStatus("2");//进行 } order1.setOutNumber(tem);//这样的话,就可以用已经过账的数量来计算要过账的数量,用出库数量减去已经过账的数量,就是要过账的数量,只要不为0,就可以进行 @@ -380,13 +375,13 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService } } OdsProcureOutOrder order=new OdsProcureOutOrder(); - + order.setID(ID); List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByOrderStatusSpecial(order); - if (orderList1.size()>0){ - OutboundPostingzcSAPGYTS(orderList1); - } +// if (orderList1.size()>0){ +// OutboundPostingzcSAPGYTS(orderList1); +// } if (gzList.size()>0) { for (OdsProcureOutOrder order1: gzList) { @@ -451,9 +446,26 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService return results; } + @Override + public List selectOdsProcureOutOrderListZCTC(OdsProcureOutOrder odsProcureOutOrder) { + odsProcureOutOrder.setUserDefined3("X"); + List orderList = odsProcureOutOrderMapper.selectOdsProcureOutOrderListZCTW(odsProcureOutOrder); + for (OdsProcureOutOrder order: + orderList) { + String tem= odsProcureOutOrderMapper.selectMesReportWorkConsume(order); + if(tem==null){ + order.setBGNumber(new BigDecimal("0")); + }else { + order.setBGNumber(new BigDecimal(tem)); + } + + } + + return orderList; + } + public void OutboundPostingzcSAPGYTS(List orderList) { //先根据出库单获取 -// // -- and wms_ods_procure_out_order.Order_Status='3' //我把过账状态-- and wms_ods_procure_out_order.User_Defined10!='2'去掉了 List orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderSpecialByIDs(orderList); @@ -462,7 +474,9 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService if ("成本中心".equals(orderList1.get(0).getUserDefined6())){//区分出来内部订单 Map paramMap=new HashMap<>(); List mapList = new ArrayList<>(); + paramMap.put("GL_ACCOUNT", order.getUserDefined2());//总帐科目编号 paramMap.put("COSTCENTER", order.getUserDefined3());//成本中心 + paramMap.put("GR_RCPT", order.getUserDefined4());//收货方/运达方 paramMap.put("PLANT", order.getSiteCode());//工厂 paramMap.put("LGORT", order.getLocCode());//库存地点 paramMap.put("MATNR", order.getMaterialCode());//物料号 @@ -483,14 +497,24 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService Map map = new HashMap(); map = (Map) result2.getData(); String userDefined9 = (String) map.get("MATERIALDOCUMENT"); - order.setUserDefined9(userDefined9); - order.setUserDefined10("2");//成功 + //order.setUserDefined9(userDefined9); + // order.setUserDefined10("2");//成功 // for (OdsProcureOutOrder order2: // orderList2 ) { -// BigDecimal sapNumber= order1.getSapNumber(); -// order1.setSapNumber(sapNumber.add(order1.getOutNumber()));//成功..这个是否的outNumber是用已出库减去已经过账的数量 -// odsProcureOutOrderMapper.updateWMSOdsProcureOutOrdersapById(order1); + order1.setID(order.getID()); + order1.setSapNumber(order.getOutNumber());//成功..这个是否的outNumber是用已出库减去已经过账的数量 + order1.setUserDefined10("2");//1是未过账,2是成功,3是失败 + order1.setUserDefined9(userDefined9);//凭证 + order1.setUserDefined11(msg);//信息 + odsProcureOutOrderMapper.updateWMSOdsProcureOutOrdersapSpecialById(order1); // } + }else { + order1.setID(order.getID()); + // order1.setSapNumber(order.getOutNumber());//成功..这个是否的outNumber是用已出库减去已经过账的数量 + order1.setUserDefined10("3");//1是未过账,2是成功,3是失败 + // order1.setUserDefined9(userDefined9);//凭证 + order1.setUserDefined11(msg);//信息 + odsProcureOutOrderMapper.updateWMSOdsProcureOutOrdersapSpecialTWById(order1); } //这个地方需要对 }else { @@ -508,6 +532,7 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService paramMap.put("EXPIRYDATE", order.getUserDefined5());//货架寿命到期日 mapList.add(paramMap); // R result2 = remoteSapService.sapProductOutboundCostTWO(mapList); + R result2 = remoteSapService.sapProductOutboundCostTW(mapList); } } 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 d881910a..e26fbee0 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 @@ -1218,6 +1218,53 @@ ORDER BY Create_Date DESC + SELECT Site_code, @@ -1936,7 +1997,7 @@ wms_ods_procure_out_order_special where Order_Status='3' and Active='1' and User_Defined10='1' - + and ID=#{ID} update wms_ods_procure_out_order_special