From bfbb917ed4ec585748b3d07fdd25e3857858e49a Mon Sep 17 00:00:00 2001 From: weiyunlong Date: Thu, 31 Oct 2024 10:03:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=91=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formplugin/ReconPayreqFormPlugin.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/fi/fi/shkd-fi-fi-plugin/src/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java b/fi/fi/shkd-fi-fi-plugin/src/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java index 1865240..c8e3f80 100644 --- a/fi/fi/shkd-fi-fi-plugin/src/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java +++ b/fi/fi/shkd-fi-fi-plugin/src/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java @@ -20,6 +20,7 @@ import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.resource.ResManager; import kd.bos.entity.EntityMetadataCache; import kd.bos.entity.datamodel.ListSelectedRowCollection; +import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.operate.result.OperationResult; import kd.bos.fileservice.FileItem; @@ -146,6 +147,17 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF String name = e.getProperty().getName(); if ("qeug_attachmentcount".equals(name)){ this.getView().addClientCallBack("auto_save",0); + }else if ("qeug_isticket".equals(name)){//是否补单字段 + ChangeData[] changeSet = e.getChangeSet(); + boolean newValue = (boolean) changeSet[0].getNewValue();//新值 + if (newValue){//若新值为true,则表明需要补票,校验发票分录须为空 + DynamicObjectCollection invoiceentry = this.getModel().getEntryEntity("invoiceentry"); + if (invoiceentry.size() > 0){ + this.getModel().setValue("qeug_isticket",false); + this.getView().showTipNotification("进行补票时,不允许上传发票,请删除关联发票后重新勾选"); + } + + } } } @@ -551,7 +563,6 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF @Override public void beforeDoOperation(BeforeDoOperationEventArgs args) { super.beforeDoOperation(args); - FormOperate source = (FormOperate) args.getSource(); String operateKey = source.getOperateKey(); DynamicObject dataEntity = this.getModel().getDataEntity();//单据数据 @@ -665,6 +676,27 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF } } break; + case "submit": + boolean qeug_isticket = dataEntity.getBoolean("qeug_isticket");//查看是否补单状态 + DynamicObjectCollection invoiceEntrys = getModel().getEntryEntity("invoiceentry");//获取发票分录 + if (qeug_isticket){//若需要补单,则不允许发票分录存在数据 + if (invoiceEntrys.size() > 0){ + args.setCancel(true);//取消操作 + this.getView().showTipNotification("补票单据禁止关联发票,请删除后重新提交"); + } + }else {//无需补票的时候必须提交等额申请核销的发票 + BigDecimal applyamt = dataEntity.getBigDecimal("applyamt");//本期申请金额 + BigDecimal invoiceApplyAmt = BigDecimal.ZERO;//初始化申请核销金额之和 + for (DynamicObject invoiceEntry : invoiceEntrys) { + BigDecimal inventry_haswriteoffamt = invoiceEntry.getBigDecimal("inventry_haswriteoffamt");//发票申请核销金额 + invoiceApplyAmt = invoiceApplyAmt.add(inventry_haswriteoffamt);//汇总发票申请核销金额 + } + if (applyamt.compareTo(invoiceApplyAmt) != 0){ + args.setCancel(true);//取消操作 + this.getView().showTipNotification("本期申请金额须等于发票申请核销金额之和,请修改关联发票后重新提交"); + } + } + break; default: break; }