- 拉取SAP过滤条件组织,会计科目变成多选,页面&&代码优化

--s
This commit is contained in:
weiyunlong 2025-04-27 16:15:33 +08:00
parent 9e8091b9c9
commit 574336b0f8
1 changed files with 15 additions and 12 deletions

View File

@ -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);
}