用款申请单表单费用承担部门

This commit is contained in:
zhangzhiguo 2025-08-25 11:10:09 +08:00
parent d439ec2aa2
commit 341315c187
1 changed files with 47 additions and 0 deletions

View File

@ -24,6 +24,8 @@ import kd.bos.org.utils.OrgTreeUtils;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import kd.fi.er.business.bean.CostDeptF7ChangePram;
import kd.fi.er.business.servicehelper.CoreBaseBillServiceHelper;
@ -52,6 +54,9 @@ public class PaymentApplicationPlugin extends AbstractBillPlugIn implements Atta
zcgj_org.addBeforeF7SelectListener(this);
AttachmentPanel panel = getControl("attachmentpanel");//附件
panel.addOperaClickListener(this);
BasedataEdit zcgj_costcompany = this.getView().getControl("zcgj_costcompany");//费用承担公司
zcgj_costcompany.addBeforeF7SelectListener(this);
}
@Override
@ -138,6 +143,16 @@ public class PaymentApplicationPlugin extends AbstractBillPlugIn implements Atta
formShowParameter.setCustomParam("isIncludeAllSub", "true");
}
}
}else if("zcgj_costcompany".equals(propertyName)){ //费用承担公司过滤
DynamicObject zcgjDepartment = (DynamicObject) this.getModel().getValue("zcgj_department");
if (zcgjDepartment != null) {
List<Long> id = findCostCompanysByCostDept(zcgjDepartment.getLong("id"));
if(id!=null && !id.isEmpty()){
List<QFilter> qFilter = new ArrayList<>();
qFilter.add(new QFilter("id", QCP.in, id));
formShowParameter.getListFilterParameter().setQFilters(qFilter);
}
}
}
}
@ -247,4 +262,36 @@ public class PaymentApplicationPlugin extends AbstractBillPlugIn implements Atta
}
}
public static List<Long> findCostCompanysByCostDept(Long deptID) {
ArrayList<Long> deptIDs = new ArrayList();
deptIDs.add(deptID);
List<Long> selectIds = OrgUnitServiceHelper.getAdminOrgRelation(deptIDs, false);
QFilter treeTypeFilter = new QFilter("view.treetype", "=", "10");
QFilter isDefaultViewFilter = new QFilter("view.isdefault", "=", Boolean.TRUE);
QFilter isbizunitFilter = new QFilter("isbizunit", "=", Boolean.TRUE);
QFilter orgFilter = null;
QFilter[] filters = null;
DynamicObject orgInfo = null;
Long costCompany = null;
List parents;
for(String orgFunction = "01"; costCompany == null; deptID = (Long)parents.get(0)) {
orgFilter = new QFilter("org", "=", deptID);
filters = new QFilter[]{treeTypeFilter, isDefaultViewFilter, orgFilter, isbizunitFilter};
orgInfo = QueryServiceHelper.queryOne("bos_org_structure", "org", filters);
if (orgInfo != null) {
costCompany = ErCommonUtils.getPk(orgInfo.get("org"));
selectIds.add(costCompany);
break;
}
parents = OrgUnitServiceHelper.getSuperiorOrgs(orgFunction, deptID);
if (parents == null || parents.isEmpty()) {
break;
}
}
return selectIds;
}
}