From 2ae8e62996a3ec1a5dda020edadcd0392f2cb1a6 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Tue, 17 Jun 2025 18:04:02 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=8D=95=E6=93=8D=E4=BD=9C=E6=8F=92=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PaymentApplyInvoiceValidator.java | 67 +++--- .../plugin/form/PaymentTypeValidatorExt.java | 223 ------------------ .../plugin/operate/PaymentApplyFundExtOp.java | 1 - .../plugin/operate/PaymentApplyFundOpExt.java | 13 +- .../operate/PaymentContSubmitOpExt.java | 13 +- 5 files changed, 58 insertions(+), 259 deletions(-) delete mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentTypeValidatorExt.java 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 4c985f3..79ccd35 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 @@ -9,6 +9,7 @@ import java.math.BigDecimal; import java.util.HashMap; import java.util.Iterator; import java.util.Map; + import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.resource.ResManager; @@ -38,14 +39,24 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { ExtendedDataEntity[] var2 = dataEntities; int var3 = dataEntities.length; - for(int var4 = 0; var4 < var3; ++var4) { + for (int var4 = 0; var4 < var3; ++var4) { ExtendedDataEntity dataEntity = var2[var4]; DynamicObject bill = dataEntity.getDataEntity(); + int a = 0; + String sourcetype = bill.getString("sourcetype");//付款类型 + if (StringUtils.equals(sourcetype, "01")) { + //非合同付款 + a++; + } DynamicObjectCollection entries = bill.getDynamicObjectCollection("entryentity"); - for(int i = 0; i < entries.size(); ++i) { - DynamicObject entry = (DynamicObject)entries.get(i); - DynamicObject contract = entry.getDynamicObject("contract"); + for (int i = 0; i < entries.size(); ++i) { + DynamicObject entry = entries.get(i); + DynamicObject contract = null; + if (a == 0) { + //合同付款 + contract = entry.getDynamicObject("contract"); + } DynamicObjectCollection subEntries = entry.getDynamicObjectCollection("subentryentity"); if (contract!=null && contract.getBoolean("ismultirate") && (subEntries == null || subEntries.isEmpty())) { this.addWarningMessage(dataEntity, String.format(ResManager.loadKDString("合同【%s】未添加发票,税额可能存在偏差,请确认。", "PaymentApplyInvoiceValidateOp_0", "ec-ecpf-opplugin", new Object[0]), contract.getString("name"))); @@ -60,13 +71,13 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { ExtendedDataEntity[] var2 = dataEntities; int var3 = dataEntities.length; - for(int var4 = 0; var4 < var3; ++var4) { + for (int var4 = 0; var4 < var3; ++var4) { ExtendedDataEntity dataEntity = var2[var4]; DynamicObject bill = dataEntity.getDataEntity(); DynamicObjectCollection entries = bill.getDynamicObjectCollection("entryentity"); - for(int i = 0; i < entries.size(); ++i) { - DynamicObject entry = (DynamicObject)entries.get(i); + for (int i = 0; i < entries.size(); ++i) { + DynamicObject entry = (DynamicObject) entries.get(i); BigDecimal shouldPayAmount = entry.getBigDecimal("applyoftaxamount"); DynamicObjectCollection subEntries = entry.getDynamicObjectCollection("subentryentity"); if (subEntries == null || subEntries.isEmpty()) { @@ -76,8 +87,8 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { BigDecimal amount = BigDecimal.ZERO; BigDecimal applyAmount; - for(Iterator var13 = subEntries.iterator(); var13.hasNext(); amount = amount.add(applyAmount)) { - DynamicObject object = (DynamicObject)var13.next(); + for (Iterator var13 = subEntries.iterator(); var13.hasNext(); amount = amount.add(applyAmount)) { + DynamicObject object = (DynamicObject) var13.next(); applyAmount = object.getBigDecimal("applyinvoftaxamt"); } @@ -97,14 +108,14 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { BigDecimal totalApplyAmount; label123: - for(int var5 = 0; var5 < var4; ++var5) { + for (int var5 = 0; var5 < var4; ++var5) { ExtendedDataEntity dataEntity = var3[var5]; DynamicObject bill = dataEntity.getDataEntity(); DynamicObjectCollection contractEntries = bill.getDynamicObjectCollection("entryentity"); if (contractEntries != null && !contractEntries.isEmpty()) { Iterator var9 = contractEntries.iterator(); - while(true) { + while (true) { DynamicObjectCollection invoiceEntries; do { do { @@ -112,21 +123,21 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { continue label123; } - DynamicObject contractEntry = (DynamicObject)var9.next(); + DynamicObject contractEntry = (DynamicObject) var9.next(); invoiceEntries = contractEntry.getDynamicObjectCollection("subentryentity"); - } while(invoiceEntries == null); - } while(invoiceEntries.isEmpty()); + } while (invoiceEntries == null); + } while (invoiceEntries.isEmpty()); Iterator var12 = invoiceEntries.iterator(); - while(var12.hasNext()) { - DynamicObject invoiceEntry = (DynamicObject)var12.next(); + while (var12.hasNext()) { + DynamicObject invoiceEntry = (DynamicObject) var12.next(); DynamicObject invoice = invoiceEntry.getDynamicObject("invoice"); if (invoice != null) { long invoiceId = invoice.getLong("id"); totalApplyAmount = invoiceEntry.getBigDecimal("applyinvoftaxamt"); totalApplyAmount = totalApplyAmount == null ? BigDecimal.ZERO : totalApplyAmount; - invoiceApplyAmounts.put(invoiceId, ((BigDecimal)invoiceApplyAmounts.getOrDefault(invoiceId, BigDecimal.ZERO)).add(totalApplyAmount)); + invoiceApplyAmounts.put(invoiceId, ((BigDecimal) invoiceApplyAmounts.getOrDefault(invoiceId, BigDecimal.ZERO)).add(totalApplyAmount)); } } } @@ -140,11 +151,11 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { if (existInvoices != null && !existInvoices.isEmpty()) { Iterator var21 = existInvoices.iterator(); - while(var21.hasNext()) { - DynamicObject existInvoice = (DynamicObject)var21.next(); + while (var21.hasNext()) { + DynamicObject existInvoice = (DynamicObject) var21.next(); long invoiceId = existInvoice.getLong("entryentity.subentryentity.invoice"); BigDecimal applyAmount = existInvoice.getBigDecimal("entryentity.subentryentity.applyinvoftaxamt"); - invoiceApplyAmounts.put(invoiceId, ((BigDecimal)invoiceApplyAmounts.getOrDefault(invoiceId, BigDecimal.ZERO)).add(applyAmount)); + invoiceApplyAmounts.put(invoiceId, ((BigDecimal) invoiceApplyAmounts.getOrDefault(invoiceId, BigDecimal.ZERO)).add(applyAmount)); } } @@ -152,14 +163,14 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { int var24 = dataEntities.length; label87: - for(int var26 = 0; var26 < var24; ++var26) { + for (int var26 = 0; var26 < var24; ++var26) { ExtendedDataEntity dataEntity = var22[var26]; DynamicObject bill = dataEntity.getDataEntity(); DynamicObjectCollection contractEntries = bill.getDynamicObjectCollection("entryentity"); if (contractEntries != null && !contractEntries.isEmpty()) { Iterator var31 = contractEntries.iterator(); - while(true) { + while (true) { DynamicObjectCollection invoiceEntries; do { do { @@ -167,18 +178,18 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { continue label87; } - DynamicObject contractEntry = (DynamicObject)var31.next(); + DynamicObject contractEntry = (DynamicObject) var31.next(); invoiceEntries = contractEntry.getDynamicObjectCollection("subentryentity"); - } while(invoiceEntries == null); - } while(invoiceEntries.isEmpty()); + } while (invoiceEntries == null); + } while (invoiceEntries.isEmpty()); Iterator var34 = invoiceEntries.iterator(); - while(var34.hasNext()) { - DynamicObject invoiceEntry = (DynamicObject)var34.next(); + while (var34.hasNext()) { + DynamicObject invoiceEntry = (DynamicObject) var34.next(); DynamicObject invoice = invoiceEntry.getDynamicObject("invoice"); if (invoice != null) { - totalApplyAmount = (BigDecimal)invoiceApplyAmounts.getOrDefault(invoice.getLong("id"), BigDecimal.ZERO); + totalApplyAmount = (BigDecimal) invoiceApplyAmounts.getOrDefault(invoice.getLong("id"), BigDecimal.ZERO); BigDecimal totalOfTax = invoice.getBigDecimal("totaloftaxamount"); totalOfTax = totalOfTax == null ? BigDecimal.ZERO : totalOfTax; if (totalApplyAmount.compareTo(totalOfTax) > 0) { diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentTypeValidatorExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentTypeValidatorExt.java deleted file mode 100644 index af41e73..0000000 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/PaymentTypeValidatorExt.java +++ /dev/null @@ -1,223 +0,0 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - -package zcgj.zcdev.zcdev.pr.plugin.form; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -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.entity.EntityMetadataCache; -import kd.bos.entity.ExtendedDataEntity; -import kd.bos.entity.MainEntityType; -import kd.bos.entity.ValueMapItem; -import kd.bos.entity.property.ComboProp; -import kd.bos.entity.validate.AbstractValidator; -import kd.bos.orm.query.QFilter; -import kd.bos.servicehelper.QueryServiceHelper; -import kd.ec.basedata.common.enums.BillStatusEnum; -import kd.ec.basedata.common.enums.ContractStatusEnum; -import kd.ec.basedata.common.enums.PlanAmtTypeEnum; - -public class PaymentTypeValidatorExt extends AbstractValidator { - public PaymentTypeValidatorExt() { - } - - public void validate() { - String operateKey = this.getOperateKey(); - if (StringUtils.equals("submit", operateKey)) { - this.validatePayType(); - } - - } - - protected void validatePayType() { - Set balanceContractIds = new HashSet(16); - Set bondContractIds = new HashSet(16); - Set otherSubmitContractIds = new HashSet(16); - Set submitBalanceContractIds = new HashSet(16); - Set contractIds = new HashSet(16); - Set paymentIds = new HashSet(16); - ExtendedDataEntity[] dataEntities = this.getDataEntities(); - ExtendedDataEntity[] var8 = dataEntities; - int var9 = dataEntities.length; - - for(int var10 = 0; var10 < var9; ++var10) { - ExtendedDataEntity dataEntity = var8[var10]; - DynamicObject bill = dataEntity.getDataEntity(); - paymentIds.add(bill.getLong("id")); - DynamicObjectCollection entries = bill.getDynamicObjectCollection("entryentity"); - Iterator var14 = entries.iterator(); - - while(var14.hasNext()) { - DynamicObject entry = (DynamicObject)var14.next(); - String payType = entry.getString("paymenttype"); - long contractId = entry.getDynamicObject("contract").getLong("id"); - contractIds.add(contractId); - if (StringUtils.equals(PlanAmtTypeEnum.BALANCE.getValue(), payType)) { - balanceContractIds.add(contractId); - submitBalanceContractIds.add(contractId); - } else if (StringUtils.equals(PlanAmtTypeEnum.BOND.getValue(), payType)) { - bondContractIds.add(contractId); - } else { - otherSubmitContractIds.add(contractId); - } - } - } - - QFilter filter = new QFilter("entryentity.contract", "in", contractIds); - filter.and("id", "not in", paymentIds); - filter.and("billstatus", "in", new String[]{BillStatusEnum.SUBMIT.getValue(), BillStatusEnum.AUDIT.getValue()}); - DynamicObjectCollection payments = QueryServiceHelper.query("ec_paymentapply", "billstatus,entryentity.contract,entryentity.paymenttype", new QFilter[]{filter}); - Iterator var24 = payments.iterator(); - - while(var24.hasNext()) { - DynamicObject payment = (DynamicObject)var24.next(); - String payType = payment.getString("entryentity.paymenttype"); - long contractId = payment.getLong("entryentity.contract"); - if (StringUtils.equals(PlanAmtTypeEnum.BALANCE.getValue(), payType)) { - balanceContractIds.add(contractId); - if (StringUtils.equals(BillStatusEnum.SUBMIT.getValue(), payment.getString("billstatus"))) { - submitBalanceContractIds.add(contractId); - } - } else if (StringUtils.equals(PlanAmtTypeEnum.BOND.getValue(), payType)) { - bondContractIds.add(contractId); - } else if (StringUtils.equals(BillStatusEnum.SUBMIT.getValue(), payment.getString("billstatus"))) { - otherSubmitContractIds.add(contractId); - } - } - - Map> contractPayPlanTypes = this.getContractPayPlanTypes(contractIds); - Map payTypeCombo = this.getPayTypeCombo(); - ExtendedDataEntity[] var29 = dataEntities; - int var31 = dataEntities.length; - - for(int var32 = 0; var32 < var31; ++var32) { - ExtendedDataEntity dataEntity = var29[var32]; - DynamicObject bill = dataEntity.getDataEntity(); - DynamicObjectCollection entries = bill.getDynamicObjectCollection("entryentity"); - Iterator var18 = entries.iterator(); - - while(var18.hasNext()) { - DynamicObject entry = (DynamicObject)var18.next(); - DynamicObject contract = entry.getDynamicObject("contract"); - String payType = entry.getString("paymenttype"); - this.contractPayPlanValidate(dataEntity, contract, payType, contractPayPlanTypes, payTypeCombo); - this.prePayTypeValidate(dataEntity, contract, payType); - this.payStageValidate(balanceContractIds, bondContractIds, payTypeCombo, dataEntity, contract, payType); - this.payMethodValidate(dataEntity, contract, payType); - this.balanceTypeValidate(otherSubmitContractIds, dataEntity, contract, payType); - this.bondTypeValidate(submitBalanceContractIds, otherSubmitContractIds, dataEntity, contract, payType); - } - } - - } - - protected void contractPayPlanValidate(ExtendedDataEntity dataEntity, DynamicObject contract, String payType, Map> contractPayPlanTypes, Map payTypeCombo) { - Set types = (Set)contractPayPlanTypes.get(contract.getLong("id")); - if (types != null && !types.contains(payType) && !StringUtils.equals(PlanAmtTypeEnum.BALANCE.getValue(), payType)) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1$s】付款条件中不包含付款类型【%2$s】,不允许付款。", "PaymentTypeValidator_8", "ec-contract-opplugin", new Object[0]), contract.getString("name"), payTypeCombo.getOrDefault(payType, ""))); - } - - } - - protected Map> getContractPayPlanTypes(Set contractIds) { - Map> payPlanTypeMap = new HashMap(contractIds.size()); - QFilter contractFilter = new QFilter("id", "in", contractIds); - DynamicObjectCollection contracts = QueryServiceHelper.query("ec_out_contract", "id,outcontpayplanentry.paytype", new QFilter[]{contractFilter}); - - Iterator var5; - long contractId; - Set payPlanTypes; - for(var5 = contracts.iterator(); var5.hasNext(); payPlanTypeMap.put(contractId, payPlanTypes)) { - DynamicObject contract = (DynamicObject)var5.next(); - contractId = contract.getLong("id"); - payPlanTypes = (Set)payPlanTypeMap.getOrDefault(contractId, new HashSet(4)); - String type = contract.getString("outcontpayplanentry.paytype"); - if (StringUtils.isNotEmpty(type)) { - payPlanTypes.add(type); - } - } - - var5 = payPlanTypeMap.values().iterator(); - - while(var5.hasNext()) { - Set planTypes = (Set)var5.next(); - if (planTypes.isEmpty()) { - planTypes.add(PlanAmtTypeEnum.PREPAYMENT.getValue()); - planTypes.add(PlanAmtTypeEnum.SETTLEPAYMENT.getValue()); - planTypes.add(PlanAmtTypeEnum.BALANCE.getValue()); - planTypes.add(PlanAmtTypeEnum.BOND.getValue()); - } - } - - return payPlanTypeMap; - } - - protected void bondTypeValidate(Set submitBalanceContractIds, Set otherSubmitContractIds, ExtendedDataEntity dataEntity, DynamicObject contract, String payType) { - long contractId = contract.getLong("id"); - if (StringUtils.equals(payType, PlanAmtTypeEnum.BOND.getValue()) && (otherSubmitContractIds.contains(contractId) || submitBalanceContractIds.contains(contractId))) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%s】存在其他在途付款申请,无法进行质保金支付。", "PaymentTypeValidator_1", "ec-contract-opplugin", new Object[0]), contract.getString("name"))); - } - - } - - protected void balanceTypeValidate(Set otherSubmitContractIds, ExtendedDataEntity dataEntity, DynamicObject contract, String payType) { - if (StringUtils.equals(payType, PlanAmtTypeEnum.BALANCE.getValue()) && otherSubmitContractIds.contains(contract.getLong("id"))) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%s】存在其他在途付款申请,无法进行尾款支付。", "PaymentTypeValidator_2", "ec-contract-opplugin", new Object[0]), contract.getString("name"))); - } - - } - - protected void payMethodValidate(ExtendedDataEntity dataEntity, DynamicObject contract, String payType) { - if (contract.getBoolean("ispaybytasknode") && StringUtils.equals(PlanAmtTypeEnum.SETTLEPAYMENT.getValue(), payType)) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%s】为按节点支付,无法进行结算款支付。", "PaymentTypeValidator_3", "ec-contract-opplugin", new Object[0]), contract.getString("name"))); - } else if (!contract.getBoolean("ispaybytasknode") && StringUtils.equals(PlanAmtTypeEnum.PROGRESSPAYMENT.getValue(), payType)) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%s】为按月支付,无法进行进度款支付。", "PaymentTypeValidator_4", "ec-contract-opplugin", new Object[0]), contract.getString("name"))); - } - - } - - protected void payStageValidate(Set balanceContractIds, Set bondContractIds, Map payTypeCombo, ExtendedDataEntity dataEntity, DynamicObject contract, String payType) { - if (bondContractIds.contains(contract.getLong("id")) && !StringUtils.equals(PlanAmtTypeEnum.BOND.getValue(), payType)) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1$s】已进入质保金支付阶段,无法进行%2$s支付。", "PaymentTypeValidator_9", "ec-contract-opplugin", new Object[0]), contract.getString("name"), payTypeCombo.get(payType))); - } else if (balanceContractIds.contains(contract.getLong("id")) && !StringUtils.equals(PlanAmtTypeEnum.BALANCE.getValue(), payType) && !StringUtils.equals(PlanAmtTypeEnum.BOND.getValue(), payType)) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%1$s】已进入尾款支付阶段,无法进行%2$s支付。", "PaymentTypeValidator_10", "ec-contract-opplugin", new Object[0]), contract.getString("name"), payTypeCombo.get(payType))); - } - - } - - protected void prePayTypeValidate(ExtendedDataEntity dataEntity, DynamicObject contract, String payType) { - String contStatus = contract.getString("contstatus"); - if (StringUtils.equals(contStatus, ContractStatusEnum.OVERSETTLE.getValue()) && StringUtils.equals(PlanAmtTypeEnum.PREPAYMENT.getValue(), payType)) { - this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("合同【%s】已决算,无法进行预付款支付。", "PaymentTypeValidator_7", "ec-contract-opplugin", new Object[0]), contract.getString("name"))); - } - - } - - protected Map getPayTypeCombo() { - MainEntityType paymentType = EntityMetadataCache.getDataEntityType("ec_paymentapply"); - DynamicObject paymentBill = new DynamicObject(paymentType); - DynamicObjectType entryType = paymentBill.getDynamicObjectCollection("entryentity").getDynamicObjectType(); - ComboProp payTypeCombo = (ComboProp)entryType.getProperty("paymenttype"); - List comboItems = payTypeCombo.getComboItems(); - Map payTypeComboMap = new HashMap(comboItems.size()); - Iterator var7 = comboItems.iterator(); - - while(var7.hasNext()) { - ValueMapItem comboItem = (ValueMapItem)var7.next(); - payTypeComboMap.put(comboItem.getValue(), comboItem.getName().getLocaleValue()); - } - - return payTypeComboMap; - } -} diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundExtOp.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundExtOp.java index 9dd5f0b..13c0072 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundExtOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundExtOp.java @@ -14,7 +14,6 @@ import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.ec.contract.opplugin.fund.PaymentApplyFundOp; import kd.ec.contract.opplugin.fund.validator.PaymentMaxAmountValidator; import kd.ec.contract.opplugin.fund.validator.PaymentTypeValidator; -import kd.ec.contract.opplugin.validator.ContractMeasureValidator; import java.math.BigDecimal; import java.util.HashMap; diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundOpExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundOpExt.java index 09592fc..6b798a6 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundOpExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundOpExt.java @@ -24,13 +24,9 @@ import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.DeleteServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.ec.basedata.common.enums.PlanAmtTypeEnum; -import kd.ec.contract.opplugin.fund.validator.PaymentDeductionValidator; -import kd.ec.contract.opplugin.fund.validator.PaymentMaxAmountValidator; -import kd.ec.contract.opplugin.fund.validator.PaymentPlanValidator; -import kd.ec.contract.opplugin.fund.validator.PaymentProgressValidator; -import kd.ec.contract.opplugin.fund.validator.PaymentReferenceValidator; -import kd.ec.contract.opplugin.fund.validator.PaymentTypeValidator; +import kd.ec.contract.opplugin.fund.validator.*; +//付款申请单二开系统插件:提交,审核,反审核操作注册的系统插件(暂废 public class PaymentApplyFundOpExt extends AbstractOperationServicePlugIn { public PaymentApplyFundOpExt() { } @@ -174,6 +170,11 @@ public class PaymentApplyFundOpExt extends AbstractOperationServicePlugIn { for(int var5 = 0; var5 < var4; ++var5) { DynamicObject paymentApply = var3[var5]; DynamicObjectCollection entryCol = paymentApply.getDynamicObjectCollection("entryentity"); + String sourcetype = paymentApply.getString("sourcetype");//付款类型 + if (StringUtils.equals(sourcetype, "01")) { + //非合同付款 + break; + } Iterator var8 = entryCol.iterator(); while(true) { diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentContSubmitOpExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentContSubmitOpExt.java index 1429d91..8e20452 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentContSubmitOpExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentContSubmitOpExt.java @@ -22,6 +22,7 @@ import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.QueryServiceHelper; import kd.ec.basedata.common.enums.ContractStatusEnum; +//付款申请单提交操作插件 public class PaymentContSubmitOpExt extends AbstractOperationServicePlugIn { public PaymentContSubmitOpExt() { } @@ -43,11 +44,21 @@ public class PaymentContSubmitOpExt extends AbstractOperationServicePlugIn { for(int var5 = 0; var5 < var4; ++var5) { ExtendedDataEntity dataEntity = var3[var5]; long newFormId = (Long)dataEntity.getDataEntity().getPkValue(); + int a = 0; + String sourcetype = dataEntity.getDataEntity().getString("sourcetype");//付款类型 + if (StringUtils.equals(sourcetype, "01")) { + //非合同付款 + a++; + } DynamicObjectCollection entryEntity = dataEntity.getDataEntity().getDynamicObjectCollection("entryentity"); for(int i = 0; i < entryEntity.size(); ++i) { DynamicObject row = (DynamicObject)entryEntity.get(i); - DynamicObject contract = row.getDynamicObject("contract"); + DynamicObject contract = null; + if (a == 0) { + //合同付款 + contract = row.getDynamicObject("contract"); + } if (contract != null) { String contStatus = contract.getString("contstatus"); String contName = contract.getString("name"); From d12eac307b5dcee64d7a253850c0c3e6e89fc562 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Tue, 17 Jun 2025 18:31:27 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidator.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 79ccd35..f88cdfa 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 @@ -16,17 +16,22 @@ import kd.bos.dataentity.resource.ResManager; import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.ExtendedDataEntity; import kd.bos.entity.validate.AbstractValidator; +import kd.bos.logging.Log; +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; class PaymentApplyInvoiceValidator extends AbstractValidator { + private static final Log log = LogFactory.getLog(PaymentApplyInvoiceValidator.class); PaymentApplyInvoiceValidator() { } public void validate() { String operateKey = this.getOperateKey(); if (StringUtils.equals(operateKey, "submit")) { + log.info("进入PaymentApplyInvoiceValidator插件,开始调用二开逻辑"); this.validateMultiRateContract(); this.validateInvoiceSumAmount(); this.validateInvoiceApplyAmount(); @@ -35,6 +40,7 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { } protected void validateMultiRateContract() { + log.info("PaymentApplyInvoiceValidator插件,调用validateMultiRateContract方法"); ExtendedDataEntity[] dataEntities = this.getDataEntities(); ExtendedDataEntity[] var2 = dataEntities; int var3 = dataEntities.length; @@ -44,6 +50,7 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { DynamicObject bill = dataEntity.getDataEntity(); int a = 0; String sourcetype = bill.getString("sourcetype");//付款类型 + log.info("调用PaymentApplyInvoiceValidator插件,判断付款类型值:" +sourcetype); if (StringUtils.equals(sourcetype, "01")) { //非合同付款 a++; @@ -53,6 +60,7 @@ class PaymentApplyInvoiceValidator extends AbstractValidator { for (int i = 0; i < entries.size(); ++i) { DynamicObject entry = entries.get(i); DynamicObject contract = null; + log.info("调用PaymentApplyInvoiceValidator插件,进行跳过合同内容"); if (a == 0) { //合同付款 contract = entry.getDynamicObject("contract"); From 08dcb2d4e4e9e9ad362ff3f3c256a5c9e5e58435 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 09:15:25 +0800 Subject: [PATCH 3/7] =?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=8A=A5=E9=94=99=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PaymentApplyInvoiceValidateOp.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidateOp.java 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 new file mode 100644 index 0000000..8448258 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/kd/ec/ecpf/opplugin/PaymentApplyInvoiceValidateOp.java @@ -0,0 +1,27 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package kd.ec.ecpf.opplugin; + +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.plugin.PreparePropertysEventArgs; + +public class PaymentApplyInvoiceValidateOp extends AbstractOperationServicePlugIn { + public PaymentApplyInvoiceValidateOp() { + } + + 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 bc497f295c82f09d86870256a1a57aa92e81aea7 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 09:33:10 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=8D=95=E5=AE=A1=E6=A0=B8=E6=8A=A5=E9=94=99=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/operate/PaymentApplyFundOpExt.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundOpExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundOpExt.java index 6b798a6..b8993dc 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundOpExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/PaymentApplyFundOpExt.java @@ -26,7 +26,7 @@ import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.ec.basedata.common.enums.PlanAmtTypeEnum; import kd.ec.contract.opplugin.fund.validator.*; -//付款申请单二开系统插件:提交,审核,反审核操作注册的系统插件(暂废 +//付款申请单二开系统插件:提交,审核,反审核操作注册的系统插件 public class PaymentApplyFundOpExt extends AbstractOperationServicePlugIn { public PaymentApplyFundOpExt() { } @@ -53,12 +53,12 @@ public class PaymentApplyFundOpExt extends AbstractOperationServicePlugIn { } public void onAddValidators(AddValidatorsEventArgs e) { - e.getValidators().add(new PaymentTypeValidator()); - e.getValidators().add(new PaymentPlanValidator()); - e.getValidators().add(new PaymentMaxAmountValidator()); - e.getValidators().add(new PaymentProgressValidator()); +// e.getValidators().add(new PaymentTypeValidator()); +// e.getValidators().add(new PaymentPlanValidator()); +// e.getValidators().add(new PaymentMaxAmountValidator()); +// e.getValidators().add(new PaymentProgressValidator()); e.getValidators().add(new PaymentDeductionValidator()); - e.getValidators().add(new PaymentReferenceValidator()); +// e.getValidators().add(new PaymentReferenceValidator()); } public void endOperationTransaction(EndOperationTransactionArgs e) { @@ -82,6 +82,11 @@ public class PaymentApplyFundOpExt extends AbstractOperationServicePlugIn { label50: for(int var5 = 0; var5 < var4; ++var5) { DynamicObject paymentApply = var3[var5]; + String sourcetype = paymentApply.getString("sourcetype");//付款类型 + if (StringUtils.equals(sourcetype, "01")) { + //非合同付款 + return; + } DynamicObjectCollection entryCol = paymentApply.getDynamicObjectCollection("entryentity"); Iterator var8 = entryCol.iterator(); From 077a42523fec4f5aaef7839df5ee5464b3983c0f Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 10:03:33 +0800 Subject: [PATCH 5/7] =?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=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/MaterialOutApplyPluginExt.java | 291 ++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutApplyPluginExt.java 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 new file mode 100644 index 0000000..7dd2f33 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutApplyPluginExt.java @@ -0,0 +1,291 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package zcgj.zcdev.zcdev.pr.plugin.form; + +import java.math.BigDecimal; +import java.util.EventObject; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.bill.OperationStatus; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.resource.ResManager; +import kd.bos.dataentity.utils.StringUtils; +import kd.bos.entity.datamodel.events.ChangeData; +import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.form.CloseCallBack; +import kd.bos.form.FormShowParameter; +import kd.bos.form.ShowType; +import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.events.ClosedCallBackEvent; +import kd.bos.form.field.BasedataEdit; +import kd.bos.form.field.events.BeforeF7SelectEvent; +import kd.bos.form.field.events.BeforeF7SelectListener; +import kd.bos.form.operate.FormOperate; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.ec.basedata.common.utils.OpenPageUtils; + +public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements BeforeF7SelectListener { + private static final String APPLYBILL = "applybill"; + private static final String MATERIAL_APPLY_ENTRY_FORM = "ecma_materialapplyentry"; + private static final String APPLY_ENTRY_CALLBACK = "applyEntryCallback"; + + public MaterialOutApplyPluginExt() { + } + + public void registerListener(EventObject e) { + super.registerListener(e); + BasedataEdit basedataEdit = (BasedataEdit)this.getControl("applybill"); + basedataEdit.addBeforeF7SelectListener(this); + basedataEdit.addBeforeF7ViewDetailListener((beforeF7ViewDetailEvent) -> { + beforeF7ViewDetailEvent.setCancel(true); + this.getView().showForm(OpenPageUtils.buildBillShowParam(beforeF7ViewDetailEvent.getPkId(), "ecma_materialapplybill")); + }); + } + + public void beforeF7Select(BeforeF7SelectEvent arg0) { + String name = arg0.getProperty().getName(); + if (StringUtils.equals(name, "applybill")) { + this.beforeApplyBillSelect(arg0); + } + + } + + public void beforeDoOperation(BeforeDoOperationEventArgs args) { + super.beforeDoOperation(args); + FormOperate operate = (FormOperate)args.getSource(); + String operateKey = operate.getOperateKey(); + DynamicObject applyBill = (DynamicObject)this.getModel().getValue("applybill"); + if (StringUtils.equals("addnewentry", operateKey)) { + if (applyBill != null) { + this.openApplyEntryForm(); + } else { + this.getModel().createNewEntryRow("entryentity"); + } + } + + } + + protected void beforeApplyBillSelect(BeforeF7SelectEvent arg0) { + DynamicObject project = (DynamicObject)this.getModel().getValue("project"); + DynamicObject warehouse = (DynamicObject)this.getModel().getValue("warehouse"); + if (warehouse == null) { + this.getView().showTipNotification(ResManager.loadKDString("请先选中仓库。", "MaterialOutApplyPlugin_1", "ec-ecma-formplugin", new Object[0]), 3000); + arg0.setCancel(true); + } else { + if (project == null) { + } + + QFilter warehouseFilter = new QFilter("warehouse", "=", warehouse.getPkValue()); + QFilter materialOutFilter = new QFilter("materialout", "=", "0"); + materialOutFilter = materialOutFilter.and(warehouseFilter); + if (project != null) { + materialOutFilter.and(new QFilter("project", "=", project.getPkValue())); + } + + arg0.getCustomQFilters().add(materialOutFilter); + } + } + + public void propertyChanged(PropertyChangedArgs e) { + super.propertyChanged(e); + String name = e.getProperty().getName(); + ChangeData changeData = e.getChangeSet()[0]; + if (StringUtils.equals(name, "applybill")) { + this.applyBillChanged(changeData); + } + + } + + protected void applyBillChanged(ChangeData changeData) { + DynamicObject newValue = (DynamicObject)changeData.getNewValue(); + if (newValue != null) { + newValue = BusinessDataServiceHelper.loadSingle(newValue.getPkValue(), "ecma_materialapplybill"); + this.carryHeadData(newValue); + this.carryEntryData(newValue); + this.getView().updateView(); + } else { + this.getModel().deleteEntryData("entryentity"); + this.getModel().setValue("outamt", 0); + } + + } + + protected void carryEntryData(DynamicObject applyBill) { + DynamicObjectCollection entries = this.getModel().getEntryEntity("entryentity"); + entries.clear(); + DynamicObjectCollection applyEntries = applyBill.getDynamicObjectCollection("entryentity"); + if (applyEntries != null && !applyEntries.isEmpty()) { + Iterator var4 = applyEntries.iterator(); + + while(var4.hasNext()) { + DynamicObject applyEntry = (DynamicObject)var4.next(); + BigDecimal restQty = applyEntry.getBigDecimal("restqty"); + if (restQty.compareTo(BigDecimal.ZERO) != 0) { + DynamicObject newEntry = new DynamicObject(entries.getDynamicObjectType()); + newEntry.set("applyentryid", applyEntry.getLong("id")); + newEntry.set("material", applyEntry.get("material")); + newEntry.set("modelnum", applyEntry.get("modelnum")); + newEntry.set("lotid", applyEntry.get("lotid")); + newEntry.set("lot", applyEntry.get("lot")); + 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("applyqty", applyEntry.get("qty")); + newEntry.set("price", applyEntry.get("price")); + newEntry.set("amount", applyEntry.get("amount")); + newEntry.set("ismainmaterial", applyEntry.get("ismainmaterial")); + newEntry.set("unitproject", applyEntry.get("unitprojectentry")); + newEntry.set("procbs", applyEntry.get("procbs")); + newEntry.set("ca", applyEntry.get("ca")); + newEntry.set("prowbs", applyEntry.get("prowbs")); + newEntry.set("proboq", applyEntry.get("proboq")); + newEntry.set("matinventory", applyEntry.get("matinventory")); + entries.add(newEntry); + } + } + } + + this.getModel().updateEntryCache(entries); + } + + protected void carryEntryDataFromReturnData(DynamicObject applyBill, List applyEntryIdList) { + DynamicObjectCollection entries = this.getModel().getEntryEntity("entryentity"); + DynamicObjectCollection applyEntries = applyBill.getDynamicObjectCollection("entryentity"); + if (applyEntries != null && !applyEntries.isEmpty()) { + Iterator var5 = applyEntries.iterator(); + + while(var5.hasNext()) { + DynamicObject applyEntry = (DynamicObject)var5.next(); + if (applyEntryIdList.contains(applyEntry.getPkValue())) { + DynamicObject newEntry = new DynamicObject(entries.getDynamicObjectType()); + newEntry.set("applyentryid", applyEntry.getLong("id")); + newEntry.set("material", applyEntry.get("material")); + newEntry.set("modelnum", applyEntry.get("modelnum")); + newEntry.set("lotid", applyEntry.get("lotid")); + newEntry.set("lot", applyEntry.get("lot")); + 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("applyqty", applyEntry.get("qty")); + newEntry.set("price", applyEntry.get("price")); + newEntry.set("amount", applyEntry.get("amount")); + newEntry.set("ismainmaterial", applyEntry.get("ismainmaterial")); + newEntry.set("unitproject", applyEntry.get("unitprojectentry")); + newEntry.set("procbs", applyEntry.get("procbs")); + newEntry.set("ca", applyEntry.get("ca")); + newEntry.set("prowbs", applyEntry.get("prowbs")); + newEntry.set("proboq", applyEntry.get("proboq")); + newEntry.set("matinventory", applyEntry.get("matinventory")); + entries.add(newEntry); + } + } + } + + this.getModel().updateEntryCache(entries); + this.getView().updateView("entryentity"); + } + + protected void carryHeadData(DynamicObject applyBill) { + this.getModel().beginInit(); + DynamicObject transType = applyBill.getDynamicObject("transtype"); + if (transType != null) { + this.getModel().setValue("transtype", transType.getPkValue()); + } + + DynamicObject supplier = applyBill.getDynamicObject("supplier"); + if (supplier != null) { + this.getModel().setValue("supplier", supplier.getPkValue()); + } + + DynamicObject labour = applyBill.getDynamicObject("labour"); + if (labour != null) { + this.getModel().setValue("labour", labour.getPkValue()); + } + + DynamicObject requestPerson = applyBill.getDynamicObject("requestperson"); + if (requestPerson != null) { + this.getModel().setValue("requestperson", requestPerson.getPkValue()); + } + + this.getModel().setValue("reqpersonname", applyBill.getString("reqpersonname")); + DynamicObject warehouse = applyBill.getDynamicObject("warehouse"); + if (warehouse != null) { + this.getModel().setValue("warehouse", warehouse.getPkValue()); + } + + this.getModel().setValue("ismulticurrency", applyBill.getString("ismulticurrency")); + DynamicObject currency = applyBill.getDynamicObject("currency"); + if (currency != null) { + this.getModel().setValue("currency", currency.getPkValue()); + } + + DynamicObject stdCurrency = applyBill.getDynamicObject("stdcurrency"); + if (stdCurrency != null) { + this.getModel().setValue("stdcurrency", stdCurrency.getPkValue()); + } + + DynamicObject exRateTable = applyBill.getDynamicObject("exratetable"); + if (exRateTable != null) { + this.getModel().setValue("exratetable", exRateTable.getPkValue()); + } + + DynamicObject cont = applyBill.getDynamicObject("contract"); + if (null != cont) { + this.getModel().setValue("contract", cont); + } + + this.getModel().setValue("exchangedate", applyBill.getString("exchangedate")); + this.getModel().setValue("exchangerate", applyBill.getString("exchangerate")); + this.getModel().setValue("outamt", applyBill.getString("totalapplyamount")); + this.getModel().setValue("stdoutamt", applyBill.getString("stdtotalapplyamount")); + this.getModel().endInit(); + } + + private void openApplyEntryForm() { + DynamicObject applyBill = (DynamicObject)this.getModel().getValue("applybill"); + DynamicObjectCollection entries = this.getModel().getEntryEntity("entryentity"); + StringBuffer selectedEntryIdBuff = new StringBuffer(); + Iterator var4 = entries.iterator(); + + while(var4.hasNext()) { + DynamicObject entry = (DynamicObject)var4.next(); + selectedEntryIdBuff.append(entry.get("applyentryid")).append(","); + } + + String selectedEntryId = selectedEntryIdBuff.toString(); + HashMap map = new HashMap(); + map.put("formId", "ecma_materialapplyentry"); + map.put("applyBillId", applyBill.getPkValue()); + map.put("selectedEntryId", selectedEntryId); + FormShowParameter showParameter = FormShowParameter.createFormShowParameter(map); + showParameter.getOpenStyle().setShowType(ShowType.Modal); + showParameter.setStatus(OperationStatus.ADDNEW); + showParameter.setCloseCallBack(new CloseCallBack(this, "applyEntryCallback")); + this.getView().showForm(showParameter); + } + + public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) { + String actionID = closedCallBackEvent.getActionId(); + Object returnData = closedCallBackEvent.getReturnData(); + DynamicObject applyBill = (DynamicObject)this.getModel().getValue("applybill"); + if (StringUtils.equals(actionID, "applyEntryCallback") && returnData != null) { + Map data = (Map)returnData; + List applyEntryIdList = (List)data.get("applyEntryIdList"); + if (applyBill != null) { + DynamicObject applyBillData = BusinessDataServiceHelper.loadSingle(applyBill.getPkValue(), "ecma_materialapplybill"); + this.carryEntryDataFromReturnData(applyBillData, applyEntryIdList); + } + } + + } +} From e9458c36d9fe44f1b5413493f7e004fb8ac58e3b Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 10:12:58 +0800 Subject: [PATCH 6/7] =?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=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/MaterialApplyEntryUIPluginExt.java | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialApplyEntryUIPluginExt.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialApplyEntryUIPluginExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialApplyEntryUIPluginExt.java new file mode 100644 index 0000000..fc83154 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialApplyEntryUIPluginExt.java @@ -0,0 +1,143 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package zcgj.zcdev.zcdev.pr.plugin.form; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.EventObject; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType; +import kd.bos.dataentity.utils.StringUtils; +import kd.bos.form.control.EntryGrid; +import kd.bos.form.control.Search; +import kd.bos.form.control.events.SearchEnterEvent; +import kd.bos.form.control.events.SearchEnterListener; +import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.operate.FormOperate; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.servicehelper.BusinessDataServiceHelper; + +/** + * 领料申请单物料列表,动态表单 + */ +public class MaterialApplyEntryUIPluginExt extends AbstractFormPlugin implements SearchEnterListener { + public MaterialApplyEntryUIPluginExt() { + } + + public void beforeBindData(EventObject e) { + super.beforeBindData(e); + this.refreshEntryEntity((String)null); + } + + public void registerListener(EventObject e) { + super.registerListener(e); + Search searchAp = (Search)this.getView().getControl("searchap"); + searchAp.addEnterListener(this); + } + + public void search(SearchEnterEvent paramSearchEnterEvent) { + Search search = (Search)paramSearchEnterEvent.getSource(); + String searchText = paramSearchEnterEvent.getText(); + if (StringUtils.equals("searchap", search.getKey())) { + this.refreshEntryEntity(searchText.trim()); + } + + } + + public void beforeDoOperation(BeforeDoOperationEventArgs args) { + FormOperate formOperate = (FormOperate)args.getSource(); + String operateName = formOperate.getOperateKey(); + EntryGrid entryGrid = (EntryGrid)this.getControl("entryentity"); + int[] selectRows = entryGrid.getSelectRows(); + switch (operateName) { + case "confirm": + List applyEntryIdList = new ArrayList(); + + for(int i = 0; i < selectRows.length; ++i) { + DynamicObject entry = this.getModel().getEntryRowEntity("entryentity", selectRows[i]); + applyEntryIdList.add((Long)entry.get("applyentryid")); + } + + Map returnData = new HashMap(); + returnData.put("applyEntryIdList", applyEntryIdList); + this.getView().returnDataToParent(returnData); + this.getView().invokeOperation("close"); + default: + } + } + + private void refreshEntryEntity(String searchText) { + Map params = this.getView().getFormShowParameter().getCustomParams(); + Object applyBillIdObject = params.get("applyBillId"); + Object selectedEntryIdObject = params.get("selectedEntryId"); + if (applyBillIdObject != null) { + Long applyBillId = (Long)applyBillIdObject; + List selectedApplyEntryIdList = new ArrayList(); + if (selectedEntryIdObject != null) { + String applyEntryIdString = (String)selectedEntryIdObject; + String[] applyEntryIdStringArr = applyEntryIdString.split(","); + String[] var9 = applyEntryIdStringArr; + int var10 = applyEntryIdStringArr.length; + + for(int var11 = 0; var11 < var10; ++var11) { + String item = var9[var11]; + if (StringUtils.isNotEmpty(item)) { + selectedApplyEntryIdList.add(Long.parseLong(item)); + } + } + } + + DynamicObject applyBill = BusinessDataServiceHelper.loadSingle(applyBillId, "ecma_materialapplybill"); + this.getModel().setValue("currency", applyBill.getDynamicObject("currency")); + DynamicObjectCollection applyEntries = applyBill.getDynamicObjectCollection("entryentity"); + DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entryentity"); + entryEntity.clear(); + DynamicObjectType entryDt = entryEntity.getDynamicObjectType(); + Iterator var23 = applyEntries.iterator(); + + while(true) { + Long id; + BigDecimal restQty; + String materialNumber; + String materialName; + DynamicObject entry; + do { + do { + do { + if (!var23.hasNext()) { + this.getModel().updateEntryCache(entryEntity); + this.getView().updateView("entryentity"); + return; + } + + entry = (DynamicObject)var23.next(); + id = (Long)entry.getPkValue(); + restQty = entry.getBigDecimal("restqty"); + DynamicObject material = entry.getDynamicObject("material"); + materialNumber = material.getString("number"); + materialName = material.getString("name"); + } while(selectedApplyEntryIdList.contains(id)); + } while(restQty.compareTo(BigDecimal.ZERO) == 0); + } while(StringUtils.isNotEmpty(searchText) && !materialNumber.contains(searchText) && !materialName.contains(searchText)); + + DynamicObject newEntry = new DynamicObject(entryDt); + newEntry.set("applyentryid", id); + newEntry.set("material", entry.get("material")); + newEntry.set("modelnum", entry.get("modelnum")); + newEntry.set("lotid", entry.get("lotid")); + newEntry.set("realoutqty", entry.get("realoutqty")); + newEntry.set("price", entry.get("price")); + newEntry.set("amount", entry.get("amount")); + entryEntity.add(newEntry); + } + } + } +} From 71d3d99d6d1e9fe27827605558144d6134d48984 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Wed, 18 Jun 2025 10:34:28 +0800 Subject: [PATCH 7/7] =?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=E6=B7=BB=E5=8A=A0=E4=BD=BF=E7=94=A8=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E8=B5=8B=E5=80=BC=EF=BC=8C=E9=A2=86=E6=96=99=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=88=97=E8=A1=A8=E5=8A=A8=E6=80=81=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=B7=BB=E5=8A=A0=E4=BD=BF=E7=94=A8=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/form/MaterialApplyEntryUIPluginExt.java | 11 ++++++----- .../pr/plugin/form/MaterialOutApplyPluginExt.java | 13 +++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialApplyEntryUIPluginExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialApplyEntryUIPluginExt.java index fc83154..a6268bc 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialApplyEntryUIPluginExt.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialApplyEntryUIPluginExt.java @@ -26,7 +26,7 @@ import kd.bos.form.plugin.AbstractFormPlugin; import kd.bos.servicehelper.BusinessDataServiceHelper; /** - * 领料申请单物料列表,动态表单 + * 领料申请单物料列表单:动态表单,出库单中新增行获取领料申请单的分录 */ public class MaterialApplyEntryUIPluginExt extends AbstractFormPlugin implements SearchEnterListener { public MaterialApplyEntryUIPluginExt() { @@ -76,8 +76,8 @@ public class MaterialApplyEntryUIPluginExt extends AbstractFormPlugin implements private void refreshEntryEntity(String searchText) { Map params = this.getView().getFormShowParameter().getCustomParams(); - Object applyBillIdObject = params.get("applyBillId"); - Object selectedEntryIdObject = params.get("selectedEntryId"); + Object applyBillIdObject = params.get("applyBillId");//出库单 领料申请单ID + Object selectedEntryIdObject = params.get("selectedEntryId");//出库单 申请单分录id if (applyBillIdObject != null) { Long applyBillId = (Long)applyBillIdObject; List selectedApplyEntryIdList = new ArrayList(); @@ -95,8 +95,8 @@ public class MaterialApplyEntryUIPluginExt extends AbstractFormPlugin implements } } - DynamicObject applyBill = BusinessDataServiceHelper.loadSingle(applyBillId, "ecma_materialapplybill"); - this.getModel().setValue("currency", applyBill.getDynamicObject("currency")); + DynamicObject applyBill = BusinessDataServiceHelper.loadSingle(applyBillId, "ecma_materialapplybill");//领料申请单 + this.getModel().setValue("currency", applyBill.getDynamicObject("currency"));//领料申请单 签约币别 DynamicObjectCollection applyEntries = applyBill.getDynamicObjectCollection("entryentity"); DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entryentity"); entryEntity.clear(); @@ -132,6 +132,7 @@ public class MaterialApplyEntryUIPluginExt extends AbstractFormPlugin implements newEntry.set("applyentryid", id); newEntry.set("material", entry.get("material")); newEntry.set("modelnum", entry.get("modelnum")); + newEntry.set("zcgj_shebei", entry.get("zcgj_shebei"));//使用设备(二开添加 newEntry.set("lotid", entry.get("lotid")); newEntry.set("realoutqty", entry.get("realoutqty")); newEntry.set("price", entry.get("price")); 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 7dd2f33..ca5a46b 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 @@ -32,6 +32,9 @@ import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.ec.basedata.common.utils.OpenPageUtils; +/** + * 出库单:领料出库与领料申请关联逻辑 + */ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements BeforeF7SelectListener { private static final String APPLYBILL = "applybill"; private static final String MATERIAL_APPLY_ENTRY_FORM = "ecma_materialapplyentry"; @@ -133,6 +136,7 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef newEntry.set("applyentryid", applyEntry.getLong("id")); newEntry.set("material", applyEntry.get("material")); newEntry.set("modelnum", applyEntry.get("modelnum")); + newEntry.set("zcgj_shebei", applyEntry.get("zcgj_shebei"));//使用设备(二开添加 newEntry.set("lotid", applyEntry.get("lotid")); newEntry.set("lot", applyEntry.get("lot")); newEntry.set("assmeasureunit", applyEntry.get("assmeasureunit")); @@ -170,6 +174,7 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef newEntry.set("applyentryid", applyEntry.getLong("id")); newEntry.set("material", applyEntry.get("material")); newEntry.set("modelnum", applyEntry.get("modelnum")); + newEntry.set("zcgj_shebei", applyEntry.get("zcgj_shebei"));//使用设备(二开添加 newEntry.set("lotid", applyEntry.get("lotid")); newEntry.set("lot", applyEntry.get("lot")); newEntry.set("assmeasureunit", applyEntry.get("assmeasureunit")); @@ -252,7 +257,7 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef } private void openApplyEntryForm() { - DynamicObject applyBill = (DynamicObject)this.getModel().getValue("applybill"); + DynamicObject applyBill = (DynamicObject)this.getModel().getValue("applybill");//领料申请单 DynamicObjectCollection entries = this.getModel().getEntryEntity("entryentity"); StringBuffer selectedEntryIdBuff = new StringBuffer(); Iterator var4 = entries.iterator(); @@ -264,9 +269,9 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef String selectedEntryId = selectedEntryIdBuff.toString(); HashMap map = new HashMap(); - map.put("formId", "ecma_materialapplyentry"); - map.put("applyBillId", applyBill.getPkValue()); - map.put("selectedEntryId", selectedEntryId); + map.put("formId", "ecma_materialapplyentry");//领料申请单物料列表动态表单标识 + map.put("applyBillId", applyBill.getPkValue());//领料申请单ID + map.put("selectedEntryId", selectedEntryId);//申请单分录id FormShowParameter showParameter = FormShowParameter.createFormShowParameter(map); showParameter.getOpenStyle().setShowType(ShowType.Modal); showParameter.setStatus(OperationStatus.ADDNEW);