From a87f8845cf7800891f961973415f647b5ce1cf78 Mon Sep 17 00:00:00 2001 From: zhangzhiguo <421587375@qq.com> Date: Mon, 29 Sep 2025 13:48:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=AE=E6=97=85=E6=8A=A5=E9=94=80=E5=8D=95?= =?UTF-8?q?=E5=8F=91=E7=A5=A8=E6=97=A5=E6=9C=9F=E5=92=8C=E8=A1=8C=E7=A8=8B?= =?UTF-8?q?=E6=9C=9F=E9=97=B4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...TripreimbursebillIsInvoiceDateCheckOp.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillIsInvoiceDateCheckOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillIsInvoiceDateCheckOp.java index 895b96d..c04c97e 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillIsInvoiceDateCheckOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillIsInvoiceDateCheckOp.java @@ -3,13 +3,14 @@ package zcgj.zcdev.zcdev.fs.plugin.operate; import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; -import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.ExtendedDataEntity; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.validate.AbstractValidator; +import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper; +import kd.bos.util.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils; @@ -35,6 +36,7 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ e.getFieldKeys().add("enddate");//行程结束时间 e.getFieldKeys().add("invoiceentry");//发票信息 e.getFieldKeys().add("writeoffapply");//关联申请 + e.getFieldKeys().add("zcgjInvoiceremark");//特殊说明 } @Override @@ -68,6 +70,7 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ String number = costcompany.getString("number"); if(OrgCheckUtils.isKS(costcompanyId) && !number.equals("10006476")){ List errorList = new ArrayList<>(); + String zcgjInvoiceremark = dataEntity.getString("zcgj_invoiceremark");//特殊说明 //行程明细,会有多个明细 DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("tripentry"); //发票明细 @@ -75,8 +78,12 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ DynamicObjectCollection writeoffapply = dataEntity.getDynamicObjectCollection("writeoffapply");//关联的出差申请 Date earliestAuditDate = null; for (DynamicObject dynamicObject : writeoffapply) { + //er_tripreqbill + long sourceapplybillid = dynamicObject.getLong("sourceapplybillid"); + DynamicObject tripreqbill = BusinessDataServiceHelper.loadSingle(sourceapplybillid, "er_tripreqbill"); + boolean ischange = tripreqbill.getBoolean("ischange");//出差申请单发生过变更后,不进行校验 Date auditDate = dynamicObject.getDate("zcgj_glsq_auditdate"); - if (auditDate != null) { + if (auditDate != null && !ischange) { if (earliestAuditDate == null || auditDate.before(earliestAuditDate)) { earliestAuditDate = auditDate; // 保留最小审批日期 } @@ -103,15 +110,15 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ } } - if (!inTripRange) { + if (!inTripRange && StringUtils.isEmpty(zcgjInvoiceremark)) { //throw new RuntimeException("乘车日期【" + carrierDate + "】不在任何行程时间范围内!"); - this.addFatalErrorMessage(extendedDataEntity, String.format("发票信息中的第%d行,乘车/机日期不在任何行程时间范围内!",i)); + this.addFatalErrorMessage(extendedDataEntity, String.format("发票信息中的第%d行,乘车/机日期不在任何行程时间范围内,请填写特殊说明!",i)); } // 校验2: 必须在最早审批日期之后 - if (earliestAuditDate != null && carrierDate != null) { - if (carrierDate.before(earliestAuditDate)) { - this.addFatalErrorMessage(extendedDataEntity, String.format("发票信息中的第%d行,乘车/机日期早于关联申请最早审批日期!",i)); + if (earliestAuditDate != null && carrierDate != null && StringUtils.isEmpty(zcgjInvoiceremark)) { + if (carrierDate.compareTo(earliestAuditDate) != 0 && carrierDate.before(earliestAuditDate)) { + this.addFatalErrorMessage(extendedDataEntity, String.format("发票信息中的第%d行,乘车/机日期早于关联申请最早审批日期,请填写特殊说明!",i)); //throw new RuntimeException("乘车日期【" + carrierDate + "】早于出差申请最早审批日期【" + earliestAuditDate + "】!"); } } @@ -133,4 +140,6 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ .atZone(ZoneId.systemDefault()) .toLocalDate(); } + + }