From 574336b0f873f7c4aefea56990f69a7c206a5b04 Mon Sep 17 00:00:00 2001 From: weiyunlong Date: Sun, 27 Apr 2025 16:15:33 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=8B=89=E5=8F=96SAP=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E7=BB=84=E7=BB=87,=E4=BC=9A=E8=AE=A1?= =?UTF-8?q?=E7=A7=91=E7=9B=AE=E5=8F=98=E6=88=90=E5=A4=9A=E9=80=89,?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2&&=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=20--s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fi/fi/plugin/form/SappzFormPlugin.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/form/SappzFormPlugin.java b/main/java/shjh/jhzj7/fi/fi/plugin/form/SappzFormPlugin.java index cd9885e..4c199c1 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/form/SappzFormPlugin.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/form/SappzFormPlugin.java @@ -50,9 +50,9 @@ public class SappzFormPlugin extends AbstractFormPlugin { //调用SAP查询凭证接口 case "querysappz": //过滤条件 - DynamicObject[] shjhOrgfield = (DynamicObject[]) this.getModel().getValue("shjh_org");//公司 + DynamicObjectCollection shjhOrgfields = (DynamicObjectCollection) this.getModel().getValue("shjh_orgs");//公司 String payablevouchernumber = (String) this.getModel().getValue("shjh_payablevouchernumber");//SAP应付凭证号 - String accountingsubjects = (String) this.getModel().getValue("shjh_accountingsubjects");//会计科目编号 + DynamicObjectCollection accountingsubjects = (DynamicObjectCollection) this.getModel().getValue("shjh_accountingsubjectss");//会计科目编号 Date postingdate_start = (Date) this.getModel().getValue("shjh_postingdate_start");//SAP应付凭过账日期(开始) Date postingdate_endda = (Date) this.getModel().getValue("shjh_postingdate_endda");//SAP应付凭过账日期(结束) Date duedate_start = (Date) this.getModel().getValue("shjh_duedate_start");//SAP应付凭到期日(开始) @@ -66,19 +66,17 @@ public class SappzFormPlugin extends AbstractFormPlugin { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); JSONArray IT_LIST = new JSONArray(); // 添加公司过滤条件--改成多选 - if (shjhOrgfield != null) { - for (DynamicObject doinfo : shjhOrgfield) { - addFilterDumpCondition(IT_LIST, "BUKRS", doinfo.getString("number"), doinfo.getString("number")); - } - + for (DynamicObject doinfo : shjhOrgfields) { + addFilterDumpCondition(IT_LIST, "BUKRS", doinfo.getString("number"), doinfo.getString("number")); } + // 添加SAP应付凭证号过滤条件 if (StringUtils.isNotEmpty(payablevouchernumber)) { addFilterCondition(IT_LIST, "BELNR", payablevouchernumber, payablevouchernumber); } // 添加会计科目编号过滤条件--改成多选 - if (StringUtils.isNotEmpty(accountingsubjects)) { - addFilterDumpCondition(IT_LIST, "HKONT", accountingsubjects, accountingsubjects); + for (DynamicObject accountingsubject : accountingsubjects) { + addFilterDumpCondition(IT_LIST, "HKONT",accountingsubject .getString("number"), accountingsubject.getString("number")); } // 添加SAP应付凭过账日期过滤条件 if (postingdate_start != null || postingdate_endda != null) { @@ -787,24 +785,29 @@ public class SappzFormPlugin extends AbstractFormPlugin { JhzjUtils.saveLog(apimenthod, moduleName, inputParam, errorMessage, false, "API"); } - // 添加过滤条件到IT_LIST的方法 + /** + * 添加过滤条件到IT_LIST的方法(单组织/单会计科目) + */ public static void addFilterCondition(JSONArray IT_LIST, String field, String low, String high) { JSONObject jsonObject = new JSONObject(); jsonObject.put("FIELD", field); // 字段 jsonObject.put("SIGN", "I"); // I:包含 E:排除 jsonObject.put("LOW", low); // LOW ,枚举字段所代表值的区间开始值 jsonObject.put("HIGH", high); // HIGH,枚举字段所代表值的区间结束值 - jsonObject.put("OPTION", "BT"); // 默认BT-EQ + jsonObject.put("OPTION", "BT"); // 默认BT:单条 IT_LIST.add(jsonObject); } + /** + * 添加过滤条件到IT_LIST的方法(多组织/多会计科目) + */ public static void addFilterDumpCondition(JSONArray IT_LIST, String field, String low, String high) { JSONObject jsonObject = new JSONObject(); jsonObject.put("FIELD", field); // 字段 jsonObject.put("SIGN", "I"); // I:包含 E:排除 jsonObject.put("LOW", low); // LOW ,枚举字段所代表值的区间开始值 jsonObject.put("HIGH", high); // HIGH,枚举字段所代表值的区间结束值 - jsonObject.put("OPTION", "EQ"); // 默认EQ + jsonObject.put("OPTION", "EQ"); // 默认EQ:多条 IT_LIST.add(jsonObject); }