From f3efb933965b2fec4618af60c5e0842329e4bc87 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Fri, 19 Sep 2025 11:14:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BB=BC=E5=90=88=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E6=A0=B8=E7=AE=97=E8=A1=A8=E5=8D=95=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/form/ProCostSplitBillPlugin.java | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ProCostSplitBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ProCostSplitBillPlugin.java index 4bc32cb..be4a343 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ProCostSplitBillPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/ProCostSplitBillPlugin.java @@ -5,6 +5,7 @@ import kd.bos.bill.BillShowParameter; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType; +import kd.bos.dataentity.resource.ResManager; import kd.bos.dataentity.utils.StringUtils; import kd.bos.form.control.EntryGrid; import kd.bos.form.events.BeforeDoOperationEventArgs; @@ -37,7 +38,7 @@ public class ProCostSplitBillPlugin extends AbstractBillPlugIn implements HyperL super.beforeDoOperation(args); FormOperate formOperate = (FormOperate) args.getSource(); if ("autogetdata".equals(formOperate.getOperateKey())) { - //自动取数分摊 + //费用明细分录自动取数分摊按钮 Object org = this.getModel().getValue("org");//所属组织 if (org != null) { DynamicObject org1 = (DynamicObject) org; @@ -55,8 +56,8 @@ public class ProCostSplitBillPlugin extends AbstractBillPlugIn implements HyperL if (entryCollection.size() > 0) { entryCollection.clear(); } - QFilter filter = new QFilter("costcompany", QCP.equals, org1.getPkValue());//费用承担公司 - filter.and(new QFilter("billstatus", QCP.in, new String[]{"G"}));//单据状态 + QFilter filter = new QFilter("paycompany", QCP.equals, org1.getPkValue());//费用承担公司1111111111 + filter.and(new QFilter("billstatus", QCP.in, new String[]{"A"}));//单据状态1111111 filter.and(new QFilter("bizdate", QCP.less_equals, endDate));//申请日期 DynamicObjectCollection er_dailyReimburseBillCollection = QueryServiceHelper.query("er_dailyreimbursebill", "id,billno,applier,bizdate,costdept,costcompany,expenseentryentity.std_entrycostcenter,expenseentryentity.expenseitem," + @@ -72,6 +73,9 @@ public class ProCostSplitBillPlugin extends AbstractBillPlugIn implements HyperL continue; } DynamicObject newEntry = new DynamicObject(entryType); + DynamicObjectCollection subEntryEntityCollection = newEntry.getDynamicObjectCollection("zcgj_subentryentity");//成本分摊明细 + DynamicObjectType subEntryEntityType = subEntryEntityCollection.getDynamicObjectType(); + DynamicObject newEntrySubEntryEntity = new DynamicObject(subEntryEntityType); newEntry.set("zcgj_materialentryid", expenseentryentityId); newEntry.set("zcgj_dailyld", er_dailyReimburseBill.get("id"));//单据ID newEntry.set("zcgj_entrybillno", er_dailyReimburseBill.get("billno"));//单据编码 @@ -87,21 +91,39 @@ public class ProCostSplitBillPlugin extends AbstractBillPlugIn implements HyperL newEntry.set("zcgj_entrycostcenter", loadSingleData("bos_costcenter", std_entrycostcenter)); Object expenseitem = er_dailyReimburseBill.get("expenseentryentity.expenseitem");// 费用项目 newEntry.set("zcgj_expenseitem", loadSingleData("er_expenseitemedit", expenseitem)); + newEntrySubEntryEntity.set("zcgj_expenseitem2", loadSingleData("er_expenseitemedit", expenseitem)); Object zcgj_accounttype = er_dailyReimburseBill.get("expenseentryentity.zcgj_accounttype");// 科目属性 newEntry.set("zcgj_accounttype", loadSingleData("zcgj_accounttype", zcgj_accounttype)); + newEntrySubEntryEntity.set("zcgj_accounttype2", loadSingleData("zcgj_accounttype", zcgj_accounttype)); newEntry.set("zcgj_expenseamount", er_dailyReimburseBill.get("expenseentryentity.expenseamount")); + newEntrySubEntryEntity.set("zcgj_amount", er_dailyReimburseBill.get("expenseentryentity.expenseamount")); newEntry.set("zcgj_taxrate", er_dailyReimburseBill.get("expenseentryentity.taxrate")); newEntry.set("zcgj_taxamount", er_dailyReimburseBill.get("expenseentryentity.taxamount")); newEntry.set("zcgj_orientryamount", er_dailyReimburseBill.get("expenseentryentity.orientryamount")); newEntry.set("zcgj_remark", er_dailyReimburseBill.get("expenseentryentity.remark")); entryCollection.add(newEntry); + subEntryEntityCollection.add(newEntrySubEntryEntity); } this.getView().updateView("zcgj_entryentity");//刷新分录 + this.getView().updateView("zcgj_subentryentity");//刷新分录 } else { this.getView().showTipNotification("请先填写所属组织"); } + } else if ("newentry2".equals(formOperate.getOperateKey())) { + //成本核算维度明细子分录增行按钮 + int rowIndex = this.getModel().getEntryCurrentRowIndex("zcgj_entryentity");//费用明细分录行索引 + int rowCount = this.getModel().getEntryRowCount("zcgj_entryentity");//费用明细分录总行数 + if (rowCount > 0 && rowIndex >= 0) { + int subInd = this.getModel().createNewEntryRow("zcgj_subentryentity");//新增子分录行数 + this.getModel().setValue("zcgj_expenseitem2", this.getModel().getValue("zcgj_expenseitem", rowIndex), subInd); + this.getModel().setValue("zcgj_accounttype2", this.getModel().getValue("zcgj_accounttype", rowIndex), subInd); + args.setCancel(true); + } else { + this.getView().showTipNotification(ResManager.loadKDString("请先选中1行费用明细行数据。", "MaterialCostBillPlugin_1", "ec-ecco-formplugin", new Object[0])); + args.setCancel(true); + } } }