From 8cca233a97b0b2bb4a60629bfa6b538af6a6bf79 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 10:38:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=8D=95=E5=85=B3?= =?UTF-8?q?=E8=81=94=E9=A2=86=E6=96=99=E7=94=B3=E8=AF=B7=E5=8D=95=E4=BA=8C?= =?UTF-8?q?=E5=BC=80=E4=BF=AE=E6=94=B9=E6=95=B0=E9=87=8F=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcdev/pr/plugin/form/MaterialOutApplyPluginExt.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutApplyPluginExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutApplyPluginExt.java index ca5a46b..5efdf9e 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutApplyPluginExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutApplyPluginExt.java @@ -142,7 +142,8 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef newEntry.set("assmeasureunit", applyEntry.get("assmeasureunit")); newEntry.set("assqty", applyEntry.get("assqty")); newEntry.set("measureunit", applyEntry.get("measureunit")); - newEntry.set("qty", applyEntry.get("restqty")); +// newEntry.set("qty", applyEntry.get("restqty"));//二开注释掉的 + newEntry.set("qty", applyEntry.get("qty"));//二开修改数量数值 newEntry.set("applyqty", applyEntry.get("qty")); newEntry.set("price", applyEntry.get("price")); newEntry.set("amount", applyEntry.get("amount")); @@ -180,7 +181,8 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef newEntry.set("assmeasureunit", applyEntry.get("assmeasureunit")); newEntry.set("assqty", applyEntry.get("assqty")); newEntry.set("measureunit", applyEntry.get("measureunit")); - newEntry.set("qty", applyEntry.get("restqty")); +// newEntry.set("qty", applyEntry.get("restqty"));//二开注释掉的 + newEntry.set("qty", applyEntry.get("qty"));//二开修改数量数值 newEntry.set("applyqty", applyEntry.get("qty")); newEntry.set("price", applyEntry.get("price")); newEntry.set("amount", applyEntry.get("amount")); From 01adcd8a8cfaf009d6d40623f2e2548db88bb529 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 11:22:21 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BA=8C=E5=BC=80=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PaymentApplyInvoiceValidateOpExt.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java new file mode 100644 index 0000000..c2b10e9 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java @@ -0,0 +1,28 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package zcgj.zcdev.zcdev.pr.plugin.form; + +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.plugin.PreparePropertysEventArgs; +import kd.ec.ecpf.opplugin.PaymentApplyInvoiceValidator; + +public class PaymentApplyInvoiceValidateOpExt extends AbstractOperationServicePlugIn { + public PaymentApplyInvoiceValidateOpExt() { + } + + public void onPreparePropertys(PreparePropertysEventArgs e) { + e.getFieldKeys().add("entryentity"); + e.getFieldKeys().add("applyoftaxamount"); + e.getFieldKeys().add("subentryentity"); + e.getFieldKeys().add("invoice"); + e.getFieldKeys().add("applyinvoftaxamt"); + } + + public void onAddValidators(AddValidatorsEventArgs e) { + e.addValidator(new PaymentApplyInvoiceValidator()); + } +} From fa4fb79d7e5e79820570d2b1fedfa53b1dce06b8 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 11:25:55 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=8D=95=E6=8F=90=E4=BA=A4=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ec/ecpf/opplugin/PaymentApplyInvoiceValidateOp.java | 3 ++- .../kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java | 4 ++-- .../pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java | 8 +++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidateOp.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidateOp.java index 8448258..ea3e518 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidateOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidateOp.java @@ -22,6 +22,7 @@ public class PaymentApplyInvoiceValidateOp extends AbstractOperationServicePlugI } public void onAddValidators(AddValidatorsEventArgs e) { - e.addValidator(new PaymentApplyInvoiceValidator()); +// e.addValidator(new PaymentApplyInvoiceValidator()); + e.getValidators().removeIf(validator -> validator instanceof PaymentApplyInvoiceValidator); } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java index f88cdfa..48d9551 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java @@ -23,9 +23,9 @@ import kd.bos.servicehelper.QueryServiceHelper; import kd.ec.basedata.common.enums.BillStatusEnum; import zcgj.zcdev.zcdev.pr.plugin.form.MaterialInbFinaceConfirmeInvoicePlugin; -class PaymentApplyInvoiceValidator extends AbstractValidator { +public class PaymentApplyInvoiceValidator extends AbstractValidator { private static final Log log = LogFactory.getLog(PaymentApplyInvoiceValidator.class); - PaymentApplyInvoiceValidator() { + public PaymentApplyInvoiceValidator() { } public void validate() { diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java index c2b10e9..5525e45 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java @@ -1,8 +1,3 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - package zcgj.zcdev.zcdev.pr.plugin.form; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; @@ -10,6 +5,9 @@ import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.ec.ecpf.opplugin.PaymentApplyInvoiceValidator; +/* + * 付款申请单提交操作校验更改 + */ public class PaymentApplyInvoiceValidateOpExt extends AbstractOperationServicePlugIn { public PaymentApplyInvoiceValidateOpExt() { } From 81165f2e07b130e85a430a2f2d776e8c7f2ad138 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 11:28:35 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=8D=95=E6=8F=90=E4=BA=A4=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ceValidator.java => PaymentApplyInvoiceValidatorExt.java} | 5 ++--- .../pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) rename code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/{PaymentApplyInvoiceValidator.java => PaymentApplyInvoiceValidatorExt.java} (98%) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidatorExt.java similarity index 98% rename from code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java rename to code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidatorExt.java index 48d9551..d574f96 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidatorExt.java @@ -21,11 +21,10 @@ import kd.bos.logging.LogFactory; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.QueryServiceHelper; import kd.ec.basedata.common.enums.BillStatusEnum; -import zcgj.zcdev.zcdev.pr.plugin.form.MaterialInbFinaceConfirmeInvoicePlugin; -public class PaymentApplyInvoiceValidator extends AbstractValidator { +public class PaymentApplyInvoiceValidatorExt extends AbstractValidator { private static final Log log = LogFactory.getLog(PaymentApplyInvoiceValidator.class); - public PaymentApplyInvoiceValidator() { + public PaymentApplyInvoiceValidatorExt() { } public void validate() { diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java index 5525e45..fbf7ca1 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentApplyInvoiceValidateOpExt.java @@ -3,7 +3,7 @@ package zcgj.zcdev.zcdev.pr.plugin.form; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs; -import kd.ec.ecpf.opplugin.PaymentApplyInvoiceValidator; +import kd.ec.ecpf.opplugin.PaymentApplyInvoiceValidatorExt; /* * 付款申请单提交操作校验更改 @@ -21,6 +21,6 @@ public class PaymentApplyInvoiceValidateOpExt extends AbstractOperationServicePl } public void onAddValidators(AddValidatorsEventArgs e) { - e.addValidator(new PaymentApplyInvoiceValidator()); + e.addValidator(new PaymentApplyInvoiceValidatorExt()); } } From fb120d58c80d2ea3397596ce02fd98c6566023b7 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 14:12:02 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BA=8C=E5=BC=80=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pr/plugin/operate/AimCostReviewOpExt.java | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostReviewOpExt.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostReviewOpExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostReviewOpExt.java new file mode 100644 index 0000000..4c3621d --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostReviewOpExt.java @@ -0,0 +1,236 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package zcgj.zcdev.zcdev.pr.plugin.operate; + +import ec.ecco.validators.AimCostReviewValidator; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.plugin.PreparePropertysEventArgs; +import kd.bos.entity.plugin.args.BeginOperationTransactionArgs; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.SaveServiceHelper; +import kd.ec.basedata.business.model.ecco.AimCostBoqSplitModelConstant; +import kd.ec.basedata.business.model.ecco.AimCostReviewConstant; +import kd.ec.basedata.business.model.ecco.AimcostcbsConstant; +import kd.ec.basedata.common.enums.DefaultEnum; +import kd.ec.cost.common.enums.CostReviewFromTypeEnum; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.StringUtils; + +public class AimCostReviewOpExt extends AbstractOperationServicePlugIn { + public AimCostReviewOpExt() { + } + + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + e.getValidators().add(new AimCostReviewValidator()); + } + + public void onPreparePropertys(PreparePropertysEventArgs e) { + e.getFieldKeys().add("project"); + e.getFieldKeys().add("vatentryentity"); + e.getFieldKeys().add("vatfromid"); + e.getFieldKeys().add("costfrom"); + e.getFieldKeys().add("costfromid"); + e.getFieldKeys().add("result"); + e.getFieldKeys().add("vatexecutable"); + e.getFieldKeys().add("costexecutable"); + } + + public void beginOperationTransaction(BeginOperationTransactionArgs e) { + String operationKey = e.getOperationKey(); + DynamicObject[] dataEntities = e.getDataEntities(); + if (StringUtils.equals(operationKey, "audit")) { + this.doAudit(dataEntities); + } + + } + + protected void doAudit(DynamicObject[] dataEntities) { + DynamicObject[] var2 = dataEntities; + int var3 = dataEntities.length; + + for(int var4 = 0; var4 < var3; ++var4) { + DynamicObject dataEntity = var2[var4]; + String result = dataEntity.getString("result"); + if (DefaultEnum.YES.getValue().equals(result)) { + this.rewriteVatCalBill(dataEntity); + DynamicObjectCollection costEntryEntity = dataEntity.getDynamicObjectCollection("costentryentity"); + Map> fromMap = (Map)costEntryEntity.stream().collect(Collectors.groupingBy((costEntryRow) -> { + return costEntryRow.getString("costfrom"); + })); + List cbsCostEntry = (List)fromMap.get(CostReviewFromTypeEnum.CBS.getValue()); + this.rewriteCBSCostBill(cbsCostEntry); + List boqCostEntry = (List)fromMap.get(CostReviewFromTypeEnum.BOQ.getValue()); + this.rewriteBOQCostBill(boqCostEntry); + } + } + + } + + protected void rewriteVatCalBill(DynamicObject dataEntity) { + DynamicObjectCollection vatEntryEntity = dataEntity.getDynamicObjectCollection("vatentryentity"); + if (!CollectionUtils.isEmpty(vatEntryEntity)) { + DynamicObject vatEntryRow = (DynamicObject)vatEntryEntity.get(0); + long pkId = vatEntryRow.getLong("vatfromid"); + if (pkId != 0L) { + DynamicObject vatEntity = BusinessDataServiceHelper.loadSingle(pkId, "ecco_vat_calculate"); + vatEntity.set("executable", true); + SaveServiceHelper.save(new DynamicObject[]{vatEntity}); + long preId = vatEntity.getLong("pre"); + if (preId != 0L) { + DynamicObject preVatEntity = BusinessDataServiceHelper.loadSingle(preId, "ecco_vat_calculate"); + preVatEntity.set("executable", false); + SaveServiceHelper.save(new DynamicObject[]{preVatEntity}); + } + } + } + } + + protected void rewriteCBSCostBill(List cbsCostEntry) { + if (!CollectionUtils.isEmpty(cbsCostEntry)) { + Set cbsCostIds = (Set)cbsCostEntry.stream().map((row) -> { + return row.getLong("costfromid"); + }).collect(Collectors.toSet()); + QFilter idFilter = new QFilter(AimcostcbsConstant.ID_ENTITY_PK, "in", cbsCostIds); + DynamicObject[] cbsCostEntities = BusinessDataServiceHelper.load("ecco_aimcostbillcbs", "project,unitproject,isenable,versionno", new QFilter[]{idFilter}); + this.invokeCbsCostAudit(cbsCostEntities); + } + } + + protected void invokeCbsCostAudit(DynamicObject[] cbsCostEntry) { + Set updateBills = new HashSet(); + DynamicObject[] var3 = cbsCostEntry; + int var4 = cbsCostEntry.length; + + for(int var5 = 0; var5 < var4; ++var5) { + DynamicObject bill = var3[var5]; + DynamicObject project = bill.getDynamicObject("project"); + boolean isNeedReview = project.getBoolean("istargetcost"); + if (isNeedReview) { + bill.set("isenable", true); + QFilter filter = new QFilter("versionno", "!=", bill.get("versionno")); + filter.and(new QFilter("project", "=", project.getPkValue())); + if (bill.get("unitproject") != null) { + filter.and(new QFilter("unitproject", "=", bill.getDynamicObject("unitproject").getPkValue())); + } else { + filter.and(new QFilter("unitproject", "=", 0)); + } + + filter.and(new QFilter("isenable", "=", true)); + filter.and(new QFilter(AimcostcbsConstant.ID_ENTITY_PK, "!=", bill.getPkValue())); + DynamicObject[] enableBills = BusinessDataServiceHelper.load("ecco_aimcostbillcbs", "id,isenable", new QFilter[]{filter}); + if (enableBills != null && enableBills.length > 0) { + for(int i = 0; i < enableBills.length; ++i) { + enableBills[i].set("isenable", false); + updateBills.add(enableBills[i]); + } + } + } + } + + if (!updateBills.isEmpty()) { + SaveServiceHelper.update((DynamicObject[])updateBills.toArray(new DynamicObject[0])); + } + + SaveServiceHelper.save(cbsCostEntry); + } + + protected void rewriteBOQCostBill(List boqCostEntry) { + if (!CollectionUtils.isEmpty(boqCostEntry)) { + Set boqCostIds = (Set)boqCostEntry.stream().map((row) -> { + return row.getLong("costfromid"); + }).collect(Collectors.toSet()); + QFilter idFilter = new QFilter(AimCostBoqSplitModelConstant.ID_ENTITY_PK, "in", boqCostIds); + DynamicObject[] boqCostEntities = BusinessDataServiceHelper.load("ecco_aimcostboqsplitmodel", "project,unitproject,iseffective", new QFilter[]{idFilter}); + this.invokeBOQCostAudit(boqCostEntities); + } + } + + protected void invokeBOQCostAudit(DynamicObject[] boqCostEntities) { + Set updateBills = new HashSet(); + DynamicObject[] var3 = boqCostEntities; + int var4 = boqCostEntities.length; + + for(int var5 = 0; var5 < var4; ++var5) { + DynamicObject bill = var3[var5]; + DynamicObject project = bill.getDynamicObject("project"); + boolean isNeedReview = project.getBoolean("istargetcost"); + if (isNeedReview) { + bill.set("iseffective", true); + DynamicObject unitProject = bill.getDynamicObject("unitproject"); + QFilter filter = new QFilter("project", "=", project.getPkValue()); + if (unitProject != null) { + filter.and(new QFilter("unitproject", "=", unitProject.getPkValue())); + } + + filter.and(new QFilter("iseffective", "=", "1")); + filter.and(new QFilter(AimCostBoqSplitModelConstant.ID_ENTITY_PK, "!=", bill.getPkValue())); + DynamicObject[] boqBills = BusinessDataServiceHelper.load("ecco_aimcostboqsplitmodel", AimCostReviewConstant.ID_ENTITY_PK + "," + "iseffective", new QFilter[]{filter}); + if (boqBills != null && boqBills.length > 0) { + DynamicObject[] var12 = boqBills; + int var13 = boqBills.length; + + for(int var14 = 0; var14 < var13; ++var14) { + DynamicObject boqBill = var12[var14]; + boqBill.set("iseffective", "0"); + updateBills.add(boqBill); + } + } + } + } + + if (!updateBills.isEmpty()) { + SaveServiceHelper.save((DynamicObject[])updateBills.toArray(new DynamicObject[0])); + } + + SaveServiceHelper.save(boqCostEntities); + } + + protected void rewriteResourceCostBill(List resourceCostEntry) { + if (!CollectionUtils.isEmpty(resourceCostEntry)) { + Set resourceCostIds = (Set)resourceCostEntry.stream().map((row) -> { + return row.getLong("costfromid"); + }).collect(Collectors.toSet()); + QFilter idFilter = new QFilter(AimCostBoqSplitModelConstant.ID_ENTITY_PK, "in", resourceCostIds); + DynamicObject[] resourceCostEntities = BusinessDataServiceHelper.load("ecma_totalrequireplan", "project,unitproject,isvalid,parentbill,version", new QFilter[]{idFilter}); + this.invokeResourceCostAudit(resourceCostEntities); + } + } + + protected void invokeResourceCostAudit(DynamicObject[] resourceCostEntities) { + ArrayList list = new ArrayList(); + ArrayList parentList = new ArrayList(); + DynamicObject[] var4 = resourceCostEntities; + int var5 = resourceCostEntities.length; + + for(int var6 = 0; var6 < var5; ++var6) { + DynamicObject bill = var4[var6]; + String version = (String)bill.get("version"); + String parentBillId = (String)bill.get("parentbill"); + if (!kd.bos.dataentity.utils.StringUtils.equalsIgnoreCase(version, "V1.0") && !parentBillId.trim().isEmpty()) { + DynamicObject parentDynamicObject = BusinessDataServiceHelper.loadSingle(parentBillId, "ecma_totalrequireplan"); + parentDynamicObject.set("isvalid", Boolean.FALSE); + parentList.add(parentDynamicObject); + } + + bill.set("isvalid", Boolean.TRUE); + list.add(bill); + } + + SaveServiceHelper.save((DynamicObject[])list.toArray(new DynamicObject[0])); + SaveServiceHelper.save((DynamicObject[])parentList.toArray(new DynamicObject[0])); + } +} From f60593547bdc90cf3a624a1783a11c9dab66ba11 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 15:12:46 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=9B=AE=E6=A0=87=E6=88=90=E6=9C=AC?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E5=AE=A1=E6=A0=B8=E6=93=8D=E4=BD=9C=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E7=B3=BB=E7=BB=9F=E4=BA=8C=E5=BC=80=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87=E5=90=8E?= =?UTF-8?q?=E5=8F=8D=E5=86=99=E5=B7=A5=E5=BA=8F=E6=88=90=E6=9C=AC=E6=B8=85?= =?UTF-8?q?=E5=8D=95=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8=E9=80=BB=E8=BE=91?= =?UTF-8?q?/=E5=B7=A5=E5=BA=8F=E6=88=90=E6=9C=AC=E9=A2=84=E7=AE=97?= =?UTF-8?q?=E5=8D=95=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87=E5=90=8E=E2=80=9C?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8=E2=80=9D=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pr/plugin/operate/AimCostBillAuditOp.java | 60 +++++++++++++++++++ .../pr/plugin/operate/AimCostReviewOpExt.java | 3 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostBillAuditOp.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostBillAuditOp.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostBillAuditOp.java new file mode 100644 index 0000000..e2a550b --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostBillAuditOp.java @@ -0,0 +1,60 @@ +package zcgj.zcdev.zcdev.pr.plugin.operate; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.operate.result.OperationResult; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.SaveServiceHelper; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +//工序成本预算单审核通过后“是否启用”赋值 +public class AimCostBillAuditOp extends AbstractOperationServicePlugIn { + public void afterExecuteOperationTransaction(AfterOperationArgs e) { + super.afterExecuteOperationTransaction(e); + String operationKey = e.getOperationKey();//操作标识 + DynamicObject[] dataEntities = e.getDataEntities(); + List modifiedEntities = new ArrayList<>(); + for (DynamicObject model : dataEntities) { + long id = model.getLong("id"); + QFilter f1 = new QFilter("id", "=", id); + DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("ecco_aimcostbillcbs", new QFilter[]{f1});//工序成本预算单 + if (dataEntity == null) { + continue; + } + if (dataEntity.getString("billstatus").equals("C") && operationKey.equals("audit")) { + //单据状态为已审核且操作标识为审核 + dataEntity.set("isenable", true);//是否启用 + BigDecimal versionno; + String zcgj_periodyear = dataEntity.getString("zcgj_periodyear");//年份 + DynamicObject project = dataEntity.getDynamicObject("project");//项目 + versionno = dataEntity.getBigDecimal("versionno");//版本号 + if (versionno != null && versionno.compareTo(BigDecimal.ONE) > 0) { + versionno = versionno.subtract(BigDecimal.ONE);//版本号减1 + } + QFilter filter = new QFilter("zcgj_periodyear", "=", zcgj_periodyear); + filter.and(new QFilter("project", "=", project.getPkValue())); + filter.and(new QFilter("versionno", "=", versionno)); + DynamicObject ecco_aimcostbillcbs = BusinessDataServiceHelper.loadSingle("ecco_aimcostbillcbs", new QFilter[]{filter}); + if (ecco_aimcostbillcbs != null) { + ecco_aimcostbillcbs.set("isenable", false);//是否启用 + modifiedEntities.add(ecco_aimcostbillcbs); + } + } else { + dataEntity.set("isenable", false);//是否启用 + } + modifiedEntities.add(dataEntity); + } + if (!modifiedEntities.isEmpty()) { + try { + SaveServiceHelper.save(modifiedEntities.toArray(new DynamicObject[0])); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + } +} diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostReviewOpExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostReviewOpExt.java index 4c3621d..7b6e41b 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostReviewOpExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/AimCostReviewOpExt.java @@ -29,6 +29,7 @@ import kd.ec.cost.common.enums.CostReviewFromTypeEnum; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; +//目标成本评审审核操作插件,系统二开,去除审核通过后反写工序成本清单是否启用逻辑 public class AimCostReviewOpExt extends AbstractOperationServicePlugIn { public AimCostReviewOpExt() { } @@ -106,7 +107,7 @@ public class AimCostReviewOpExt extends AbstractOperationServicePlugIn { }).collect(Collectors.toSet()); QFilter idFilter = new QFilter(AimcostcbsConstant.ID_ENTITY_PK, "in", cbsCostIds); DynamicObject[] cbsCostEntities = BusinessDataServiceHelper.load("ecco_aimcostbillcbs", "project,unitproject,isenable,versionno", new QFilter[]{idFilter}); - this.invokeCbsCostAudit(cbsCostEntities); +// this.invokeCbsCostAudit(cbsCostEntities); } }