From e82c6a7bc2c059bf7d8b1d609cb80137306ea6c9 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期四, 31 七月 2025 18:12:16 +0800 Subject: [PATCH] art:删除无用代码 --- src/main/java/org/jeecg/modules/sap/service/impl/ProductionOrderSyncImpl.java | 116 +++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 71 insertions(+), 45 deletions(-) diff --git a/src/main/java/org/jeecg/modules/sap/service/impl/ProductionOrderSyncImpl.java b/src/main/java/org/jeecg/modules/sap/service/impl/ProductionOrderSyncImpl.java index 9cb836b..002bb07 100644 --- a/src/main/java/org/jeecg/modules/sap/service/impl/ProductionOrderSyncImpl.java +++ b/src/main/java/org/jeecg/modules/sap/service/impl/ProductionOrderSyncImpl.java @@ -6,6 +6,7 @@ import com.sap.conn.jco.JCoRepository; import com.sap.conn.jco.JCoTable; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.jeecg.common.aspect.annotation.ApiLog; import org.jeecg.common.constant.ApiLogCategoryEnum; import org.jeecg.config.sap.SapRfcConnectionManager; @@ -26,25 +27,13 @@ @Service @Slf4j public class ProductionOrderSyncImpl implements ProductionOrderSync { - //鏂扮伀鐐伐鍘傜紪鐮� - private static final String factoryCode = "2301"; - //鏍囧噯鐢熶骇璁㈠崟 - private static final String orderTypeCode1 = "Z001"; - //杩斿伐璁㈠崟 鏆傛椂涓嶇敤 - private static final String orderTypeCode2 = "Z002"; - //鍏垎鍘傝皟搴﹀憳 -// private static final String productionManager = "012"; - private static final String productionManager = "010"; - //鐢熶骇璁㈠崟鐘舵�� CRTD 鏂板缓锛孯EL 涓嬭揪锛孴ECO 鍏抽棴 瀹為檯涓婏紝鍙湁REL鐘舵�佺殑宸ュ崟鎵嶅彲浠ヨ繘琛屾搷浣� - private static final String orderStatus = "REL"; @Autowired private SapRfcConnectionManager connectionManager; - @Override - @ApiLog(apiName = "鐢熶骇璁㈠崟鍚屾鎺ュ彛(ZPPF_033_1)", apiCategory = ApiLogCategoryEnum.SAP) - public Map<String, Object> syncProductionOrder() throws Exception { + @ApiLog(apiName = "鐢熶骇璁㈠崟鍚屾(ZPPF_033_1)", apiCategory = ApiLogCategoryEnum.SAP) + public Map<String, Object> syncProductionOrder(String factoryCode, String orderTypeCode, String productionManager, String orderStatus, String createTime, String updateTime) throws Exception { Map<String, Object> resultMap = new HashMap<>(); JCoDestination destination = connectionManager.getDestination(); JCoRepository repository = destination.getRepository(); @@ -57,37 +46,74 @@ // JCoTable AUFNRTable = function.getTableParameterList().getTable("ZTAB_AUFNR"); List<JSONObject> items = new ArrayList<>(); //璁㈠崟绫诲瀷 鏍囧噯鐢熶骇璁㈠崟 - JCoTable AUARTTable = function.getTableParameterList().getTable("ZTAB_AUART"); - AUARTTable.appendRow(); - AUARTTable.setValue("AUART", orderTypeCode1); - //缁勮璇锋眰鍙傛暟 - JSONObject item1 = new JSONObject(); - item1.put("AUART", orderTypeCode1); - items.add(item1); - //鍏垎鍘傝皟搴� - JCoTable FEVORTable = function.getTableParameterList().getTable("ZTAB_FEVOR"); - FEVORTable.appendRow(); - FEVORTable.setValue("FEVOR", productionManager); - //缁勮璇锋眰鍙傛暟 - JSONObject item2 = new JSONObject(); - item2.put("FEVOR", productionManager); - items.add(item2); - //鏂扮伀鐐� - JCoTable WERKSTable = function.getTableParameterList().getTable("ZTAB_WERKS"); - WERKSTable.appendRow(); - WERKSTable.setValue("WERKS", factoryCode); - //缁勮璇锋眰鍙傛暟 - JSONObject item3 = new JSONObject(); - item3.put("WERKS", factoryCode); - items.add(item3); - //璁㈠崟鐘舵�� - JCoTable TXT04Table = function.getTableParameterList().getTable("ZTAB_TXT04"); - TXT04Table.appendRow(); - TXT04Table.setValue("TXT04", orderStatus); - //缁勮璇锋眰鍙傛暟 - JSONObject item4 = new JSONObject(); - item4.put("TXT04", orderStatus); - items.add(item4); + if(StringUtils.isNotBlank(orderTypeCode)){ + JCoTable AUARTTable = function.getTableParameterList().getTable("ZTAB_AUART"); + String[] split = orderTypeCode.split(","); + for(String code : split){ + AUARTTable.appendRow(); + AUARTTable.setValue("AUART", code); + } + //缁勮璇锋眰鍙傛暟 + JSONObject item = new JSONObject(); + item.put("AUART", orderTypeCode); + items.add(item); + } + if(StringUtils.isNotBlank(productionManager)){ + JCoTable FEVORTable = function.getTableParameterList().getTable("ZTAB_FEVOR"); + String[] split = productionManager.split(","); + for(String code : split){ + FEVORTable.appendRow(); + FEVORTable.setValue("FEVOR", code); + } + //缁勮璇锋眰鍙傛暟 + JSONObject item = new JSONObject(); + item.put("FEVOR", productionManager); + items.add(item); + } + if(StringUtils.isNotBlank(factoryCode)){ + //鏂扮伀鐐� + JCoTable WERKSTable = function.getTableParameterList().getTable("ZTAB_WERKS"); + String[] split = factoryCode.split(","); + for(String code : split){ + WERKSTable.appendRow(); + WERKSTable.setValue("WERKS", code); + } + //缁勮璇锋眰鍙傛暟 + JSONObject item = new JSONObject(); + item.put("WERKS", factoryCode); + items.add(item); + } + if(StringUtils.isNotBlank(orderStatus)) { + //鏂扮伀鐐� + JCoTable TXT04Table = function.getTableParameterList().getTable("ZTAB_TXT04"); + String[] split = orderStatus.split(","); + for(String code : split){ + TXT04Table.appendRow(); + TXT04Table.setValue("TXT04", code); + } + //缁勮璇锋眰鍙傛暟 + JSONObject item = new JSONObject(); + item.put("TXT04", orderStatus); + items.add(item); + } + if(StringUtils.isNotBlank(createTime)){ + JCoTable UDATETable = function.getTableParameterList().getTable("ZTAB_UDATE"); + UDATETable.appendRow(); + UDATETable.setValue("LOW", createTime); + //缁勮璇锋眰鍙傛暟 + JSONObject item = new JSONObject(); + item.put("ZTAB_UDATE_LOW", createTime); + items.add(item); + } + if(StringUtils.isNotBlank(updateTime)){ + JCoTable LAEDATable = function.getTableParameterList().getTable("ZTAB_LAEDA"); + LAEDATable.appendRow(); + LAEDATable.setValue("LOW", updateTime); + //缁勮璇锋眰鍙傛暟 + JSONObject item = new JSONObject(); + item.put("ZTAB_LAEDA_LOW", updateTime); + items.add(item); + } // 鎵ц璋冪敤 function.execute(destination); //鑾峰彇杩斿洖缁撴灉 -- Gitblit v1.9.3