diff --git a/ABAP_AS_WITH_POOL.jcoDestination b/ABAP_AS_WITH_POOL.jcoDestination index 5281aae..a60bbeb 100644 --- a/ABAP_AS_WITH_POOL.jcoDestination +++ b/ABAP_AS_WITH_POOL.jcoDestination @@ -1,5 +1,5 @@ #for tests only ! -#Tue Apr 30 14:23:52 CST 2024 +#Tue Apr 30 16:42:04 CST 2024 jco.destination.pool_capacity=10 jco.client.lang=ZH jco.client.ashost=172.19.0.125 @@ -7,5 +7,5 @@ jco.client.saprouter= jco.client.user=RFC jco.client.sysnr=00 jco.destination.peak_limit=10 -jco.client.passwd=dZ7%0^^S.BC9=76d+x^RaptI:lSr7*7(n*?L**;[-c`$qn-b +jco.client.passwd=uD8ely7MSR~%EjN[YVSQi{Uk(g)lY*X:C|ocMpezcUAU:e-g jco.client.client=800 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SapRfcController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SapRfcController.java index 9d02a3c..2f1c7ae 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SapRfcController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SapRfcController.java @@ -110,6 +110,116 @@ public class SapRfcController return ajax; } + /** + * 获取SAP 付款条件数据 + * @param customer + * @return + */ + @PreAuthorize("@ss.hasPermi('customer:customer:list')") + @GetMapping("/getPaymentTerms") + public AjaxResult getPaymentTerms(Customer customer) + { + AjaxResult ajax = AjaxResult.success(); + + List resCache = redisCache.getCacheObject(getSapCacheKey("paymentTerms")); + if(CollectionUtils.isEmpty(resCache)){ + resCache = SapRfcUtils.getPaymentTerms(null); + redisCache.setCacheObject(getSapCacheKey("paymentTerms"),resCache); + } + log.info("获取付款条件数据条数 - {}", resCache.size()); + ajax.put("paymentTermsDicts", resCache); + return ajax; + } + + /** + * 获取SAP 销售组织数据 + * @param customer + * @return + */ + @PreAuthorize("@ss.hasPermi('customer:customer:list')") + @GetMapping("/getSalesOrganization") + public AjaxResult getSalesOrganization(Customer customer) + { + AjaxResult ajax = AjaxResult.success(); + + List resCache = redisCache.getCacheObject(getSapCacheKey("salesOrganization")); + if(CollectionUtils.isEmpty(resCache)){ + resCache = SapRfcUtils.getSalesOrganization(null); + redisCache.setCacheObject(getSapCacheKey("salesOrganization"),resCache); + } + log.info("获取销售组织数据条数 - {}", resCache.size()); + ajax.put("salesOrganizationDicts", resCache); + return ajax; + } + + /** + * 获取SAP 分销渠道数据 + * @param customer + * @return + */ + @PreAuthorize("@ss.hasPermi('customer:customer:list')") + @GetMapping("/getDistributionChannel") + public AjaxResult getDistributionChannel(Customer customer) + { + AjaxResult ajax = AjaxResult.success(); + + List resCache = redisCache.getCacheObject(getSapCacheKey("distributionChannel")); + if(CollectionUtils.isEmpty(resCache)){ + resCache = SapRfcUtils.getDistributionChannel(null); + redisCache.setCacheObject(getSapCacheKey("distributionChannel"),resCache); + } + log.info("获取销售组织数据条数 - {}", resCache.size()); + ajax.put("distributionChannelDicts", resCache); + return ajax; + } + + /** + * 获取SAP 销售地区数据 + * @param customer + * @return + */ + @PreAuthorize("@ss.hasPermi('customer:customer:list')") + @GetMapping("/getSalesTerritory") + public AjaxResult getSalesTerritory(Customer customer) + { + AjaxResult ajax = AjaxResult.success(); + + List resCache = redisCache.getCacheObject(getSapCacheKey("salesTerritory")); + if(CollectionUtils.isEmpty(resCache)){ + resCache = SapRfcUtils.getSalesTerritory(null); + redisCache.setCacheObject(getSapCacheKey("salesTerritory"),resCache); + } + log.info("获取销售地区数据条数 - {}", resCache.size()); + ajax.put("salesTerritoryDicts", resCache); + return ajax; + } + + /** + * 获取SAP 销售办公室数据 + * @param customer + * @return + */ + @PreAuthorize("@ss.hasPermi('customer:customer:list')") + @GetMapping("/getSaleOffice") + public AjaxResult getSaleOffice(Customer customer) + { + AjaxResult ajax = AjaxResult.success(); + + List resCache = redisCache.getCacheObject(getSapCacheKey("saleOffice")); + if(CollectionUtils.isEmpty(resCache)){ + resCache = SapRfcUtils.getSaleOffice(null); + redisCache.setCacheObject(getSapCacheKey("saleOffice"),resCache); + } + log.info("获取销售办公室数据条数 - {}", resCache.size()); + ajax.put("saleOfficeDicts", resCache); + return ajax; + } + + /** + * 获取redis SAP公共数据 + * @param type + * @return + */ private String getSapCacheKey(String type) { return CacheConstants.SAP_COMMON + type; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SapFunction/SapRfcUtils.java b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SapFunction/SapRfcUtils.java index 4a40798..39bc3d6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SapFunction/SapRfcUtils.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SapFunction/SapRfcUtils.java @@ -105,4 +105,164 @@ public class SapRfcUtils { } return countrys; } + + /** + * 获取SAP付款条件数据 + * @param param 不传查询全部 + * @return + */ + public static List getPaymentTerms(String param){ + JCoFunction function = null; + RfcResult rfcResult = null; + List countrys = new ArrayList<>(); + + JCoDestination destination = ConnectToSAP.connect(); + try { + function = destination.getRepository().getFunctionTemplate("ZRFC_BASIC_DATA").getFunction(); + if (function == null) + throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP."); + JCoParameterList input = function.getImportParameterList(); + input.setValue("FALG22", StringUtils.isNotNull(param)?param:"X");//输入参数 + function.execute(destination); + JCoTable table = function.getTableParameterList().getTable("T_T052U"); + for(int i = 0; i getSalesOrganization(String param){ + JCoFunction function = null; + RfcResult rfcResult = null; + List countrys = new ArrayList<>(); + + JCoDestination destination = ConnectToSAP.connect(); + try { + function = destination.getRepository().getFunctionTemplate("ZRFC_BASIC_DATA").getFunction(); + if (function == null) + throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP."); + JCoParameterList input = function.getImportParameterList(); + input.setValue("FLAG29", StringUtils.isNotNull(param)?param:"X");//输入参数 + function.execute(destination); + JCoTable table = function.getTableParameterList().getTable("T_TVKOT"); + for(int i = 0; i getDistributionChannel(String param){ + JCoFunction function = null; + RfcResult rfcResult = null; + List countrys = new ArrayList<>(); + + JCoDestination destination = ConnectToSAP.connect(); + try { + function = destination.getRepository().getFunctionTemplate("ZRFC_BASIC_DATA").getFunction(); + if (function == null) + throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP."); + JCoParameterList input = function.getImportParameterList(); + input.setValue("FLAG30", StringUtils.isNotNull(param)?param:"X");//输入参数 + function.execute(destination); + JCoTable table = function.getTableParameterList().getTable("T_TVTWT"); + for(int i = 0; i getSalesTerritory(String param){ + JCoFunction function = null; + RfcResult rfcResult = null; + List countrys = new ArrayList<>(); + + JCoDestination destination = ConnectToSAP.connect(); + try { + function = destination.getRepository().getFunctionTemplate("ZRFC_BASIC_DATA").getFunction(); + if (function == null) + throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP."); + JCoParameterList input = function.getImportParameterList(); + input.setValue("FLAG32", StringUtils.isNotNull(param)?param:"X");//输入参数 + function.execute(destination); + JCoTable table = function.getTableParameterList().getTable("T_T171T"); + for(int i = 0; i getSaleOffice(String param){ + JCoFunction function = null; + RfcResult rfcResult = null; + List countrys = new ArrayList<>(); + + JCoDestination destination = ConnectToSAP.connect(); + try { + function = destination.getRepository().getFunctionTemplate("ZRFC_BASIC_DATA").getFunction(); + if (function == null) + throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP."); + JCoParameterList input = function.getImportParameterList(); + input.setValue("FLAG34", StringUtils.isNotNull(param)?param:"X");//输入参数 + function.execute(destination); + JCoTable table = function.getTableParameterList().getTable("T_TVKBT"); + for(int i = 0; i + + + + + @@ -52,7 +57,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select a.cus_id, a.cus_code, a.cus_name, a.cus_sap_code, a.cus_street, a.cus_payment_terms, a.cus_phone_number, a.cus_industry_code, a.cus_group, a.cus_vat_no, a.cus_type, a.cus_country, a.cus_language, a.cus_label, a.cus_classification, a.cus_receiving_email, a.cus_recipient, a.cus_recipient_phone, a.cus_remark, - a.cus_state, a.cus_approval_status,a.create_time,u.nick_name create_name + a.cus_state, a.cus_approval_status,a.create_time,u.nick_name create_name, + + a.cus_sales_organization,a.cus_distribution_channel,a.cus_sales_territory,a.cus_sale_office from customer a @@ -71,8 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"