企业成本核算表单插件优化

This commit is contained in:
xuhaihui 2025-09-26 16:23:25 +08:00
parent 79de93c208
commit 206a9e7e47
1 changed files with 24 additions and 5 deletions

View File

@ -38,6 +38,7 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn {
this.getView().showTipNotification("请选择期间");
return;
}
this.getModel().beginInit();
DynamicObject org1 = (DynamicObject) org;//所属组织
DynamicObject period1 = (DynamicObject) period;//期间
DynamicObjectCollection entryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");//企业费用成本分摊明细分录
@ -67,16 +68,33 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn {
new QFilter[]{filter1});//会计科目与成本项目
QFilter[] qFilters = new QFilter[]{new QFilter("name", QCP.equals, rptAssistBalanceGx.get("zcgj_processname"))};//工序名称
DynamicObject ec_ecbd_pro_cbs = BusinessDataServiceHelper.loadSingle("ec_ecbd_pro_cbs", "id", qFilters);//项目工序
QFilter filter2 = new QFilter("fiaccountorg", QCP.equals, org1.getPkValue());//财务记账组织
filter2.and(new QFilter("billstatus", QCP.equals, "C"));//单据状态
DynamicObject[] ec_projects = BusinessDataServiceHelper.load("ec_project", "id,zcgj_init", new QFilter[]{filter2});// 项目
if (ec_ecbd_pro_cbs == null && zcgj_accountcost == null) {
if (ec_ecbd_pro_cbs == null && zcgj_accountcost == null && ec_projects.length == 0) {
continue;
}
DynamicObject newEntry = new DynamicObject(entryType);
// QFilter[] qFilters1 = new QFilter[]{new QFilter("number", QCP.equals, "10000000-XM014")};
// DynamicObject ec_project_f7 = BusinessDataServiceHelper.loadSingle("ec_project_f7", "id", qFilters1);
// newEntry.set("project", ec_project_f7);
if (ec_projects.length != 0) {
for (DynamicObject ec_project : ec_projects) {
boolean zcgj_init = ec_project.getBoolean("zcgj_init");//默认项目
if (zcgj_init) {
DynamicObject ec_project_f7 = BusinessDataServiceHelper.loadSingle("ec_project_f7", "id",
new QFilter[]{new QFilter("id", QCP.equals, ec_project.getPkValue())});//项目
newEntry.set("project", ec_project_f7);//项目
break;
}
}
Object project = newEntry.get("project");
if (project == null) {
DynamicObject ec_project_f7 = BusinessDataServiceHelper.loadSingle("ec_project_f7", "id",
new QFilter[]{new QFilter("id", QCP.equals, ec_projects[0].getPkValue())});//项目
newEntry.set("project", ec_project_f7);//项目
}
}
if (ec_ecbd_pro_cbs != null) {
newEntry.set("cbs", ec_ecbd_pro_cbs.getPkValue());//成本分解结构
newEntry.set("cbs", ec_ecbd_pro_cbs);//成本分解结构
}
if (zcgj_accountcost != null) {
newEntry.set("costtype", zcgj_accountcost.get("zcgj_acccostentry.zcgj_costtype"));//成本项
@ -85,6 +103,7 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn {
entryCollection.add(newEntry);
}
this.getView().updateView("entryentity");//刷新分录
this.getModel().endInit();
}
}
}