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; }