费用项目及付款事项左侧树过滤

This commit is contained in:
zengweihai 2024-06-24 14:19:44 +08:00
parent 9cf1583006
commit f5b83b2574
2 changed files with 30 additions and 5 deletions

View File

@ -16,6 +16,7 @@ import shkd.cosmic.cxkg.task.HrmDepartmentTaskImpl;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.HashSet;
/**
* 单据界面插件
@ -80,6 +81,7 @@ public class CommonBillOsPaymentBillFormPlugin extends AbstractBillPlugIn implem
QF.and("enable",QCP.equals,"1");//使用状态为可用
logger.info("过滤条件单据类型为"+billType+",组织名称为:"+orgName);
ArrayList<Object> paymentNumbers = new ArrayList<>();
HashSet<Object> sets = new HashSet<Object>();
DynamicObject[] loads = BusinessDataServiceHelper.load("shkd_paymatter", "id,shkd_paymatterinfo.number", QF.toArray());
for (DynamicObject load : loads) {
String paymentNumber = load.getString("shkd_paymatterinfo.number");//由于辅助资料包含的付款事项可能存在非叶子节点的情况查询对象的下级叶子对象
@ -90,6 +92,10 @@ public class CommonBillOsPaymentBillFormPlugin extends AbstractBillPlugIn implem
DynamicObject[] datum = BusinessDataServiceHelper.load("bos_assistantdata_detail", "id,number,longnumber,level", QFSon.toArray());
for (DynamicObject data : datum) {
String longnumber = data.getString("longnumber");//长编码
String[] split = longnumber.split("!");
for (String str : split) {
sets.add(str);
}
logger.info("该付款事项长编码为"+longnumber);
if (data.getInt("level")>1){
int index = longnumber.indexOf("!");
@ -110,11 +116,21 @@ public class CommonBillOsPaymentBillFormPlugin extends AbstractBillPlugIn implem
logger.info("付款事项编码集合为"+paymentNumbers.toString());
QFilter qF = new QFilter("number", QCP.in,paymentNumbers);
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
QFilter Qf= new QFilter("number", QCP.in, sets);
ArrayList<QFilter> objects = new ArrayList<QFilter>();
objects.add(Qf);
formShowParameter.getTreeFilterParameter().setQFilters(objects);
formShowParameter.getListFilterParameter().setFilter(qF);
}else {
beforeF7SelectEvent.setCancel(true);
this.getView().showTipNotification("此类型单据无关联付款事项");
}
QFilter qFilter = new QFilter("number", QCP.equals, "CF0001");
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
ArrayList<QFilter> objects = new ArrayList<QFilter>();
objects.add(qFilter);
formShowParameter.getTreeFilterParameter().setQFilters(objects);
}
}

View File

@ -14,10 +14,7 @@ import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.util.StringUtils;
import kd.sdk.plugin.Plugin;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EventObject;
import java.util.List;
import java.util.*;
/**
* 单据界面插件
@ -83,23 +80,35 @@ public class CommonExpenseItemBillFormPlugin extends AbstractBillPlugIn implemen
}
ArrayList<Object> paymentIds = new ArrayList<>();
HashSet<Object> sets = new HashSet<Object>();
QFilter qFilter = new QFilter("shkd_paymatterinfo.number", QCP.equals, paymentNumber);
qFilter.and("enable",QCP.equals,"1");//使用状态为可用
DynamicObject[] loads = BusinessDataServiceHelper.load("shkd_accountlinkmatter","id,shkd_expenseitem.id",qFilter.toArray());
DynamicObject[] loads = BusinessDataServiceHelper.load("shkd_accountlinkmatter","id,shkd_expenseitem.id,shkd_expenseitem.longnumber",qFilter.toArray());
for (DynamicObject load : loads) {
long aLong = load.getLong("shkd_expenseitem.id");
paymentIds.add(aLong);
String longnumber = load.getString("shkd_expenseitem.longnumber");
String[] split = longnumber.split("!");
for (String str : split) {
sets.add(str);
}
}
if (!paymentIds.isEmpty()){
QFilter qF = new QFilter("id", QCP.in,paymentIds);
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
QFilter QF= new QFilter("number", QCP.in, sets);
ArrayList<QFilter> objects = new ArrayList<QFilter>();
objects.add(QF);
formShowParameter.getTreeFilterParameter().setQFilters(objects);
formShowParameter.getListFilterParameter().setFilter(qF);
}else {
beforeF7SelectEvent.setCancel(true);
this.getView().showTipNotification("该付款事项未关联费用项目");
}
}
}
}