From e1e19e03d8dcec1694b34ba3dc3d54d7921e59c5 Mon Sep 17 00:00:00 2001 From: zhangzhiguo <421587375@qq.com> Date: Wed, 24 Sep 2025 10:46:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=A0=E5=90=88=E5=90=8C=E4=BB=98?= =?UTF-8?q?=E9=A2=84=E4=BB=98=E5=8D=95(=E9=A2=84=E4=BB=98=E5=8D=95)?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/PrepaybillNoContractCkOp.java | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/PrepaybillNoContractCkOp.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/PrepaybillNoContractCkOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/PrepaybillNoContractCkOp.java new file mode 100644 index 0000000..bb1b6bf --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/PrepaybillNoContractCkOp.java @@ -0,0 +1,91 @@ +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.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.user.UserServiceHelper; +import kd.bos.util.StringUtils; +import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils; + +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 无合同付预付单(预付单)校验插件 + */ +public class PrepaybillNoContractCkOp extends AbstractOperationServicePlugIn { + + @Override + public void onPreparePropertys(PreparePropertysEventArgs e) { + super.onPreparePropertys(e); + e.getFieldKeys().add("costcompany"); + e.getFieldKeys().add("zcgj_isec"); + e.getFieldKeys().add("zcgj_invoiceremark");//特殊说明 + e.getFieldKeys().add("zcgj_nocontract");//合同付款类型 无合同付款 NOCONTRACT , 合同付款 CONTRACT + e.getFieldKeys().add("contractentry");//关联合同 + e.getFieldKeys().add("zcgj_bizype");//业务类型 + e.getFieldKeys().add("zcgj_maintenanceackentry");//设备维修 + e.getFieldKeys().add("zcgj_materialinbillentry");//入库单 + } + + @Override + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 + //if(OrgCheckUtils.isKS(currentOrgId)){ + e.getValidators().add(new ValidatorExt()); + //} + } + + class ValidatorExt extends AbstractValidator { + @Override + public void validate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM"); + ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); + Map> allMap = new HashMap<>(); + //当前提交的探亲单据id集合 + Map> currentBillIdListMap = new HashMap<>(); + + for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { + DynamicObject dataEntity = extendedDataEntity.getDataEntity(); + Object costcompanyObj = dataEntity.get("costcompany"); + Object costdeptObj = dataEntity.get("costdept"); + if(costcompanyObj!=null && costdeptObj != null){ + DynamicObject costcompany = (DynamicObject)costcompanyObj; + long costcompanyId = costcompany.getLong("id"); + if(OrgCheckUtils.isKS(costcompanyId)){ + boolean isec = dataEntity.getBoolean("zcgj_isec"); + if(isec){ + String bisType = dataEntity.getString("zcgj_bizype"); + //物资采购 WZCG + if("WZCG".equals(bisType)){ + DynamicObjectCollection entry = dataEntity.getDynamicObjectCollection("zcgj_materialinbillentry"); //入库单 + if((entry == null || entry.isEmpty())){ + this.addFatalErrorMessage(extendedDataEntity, String.format("业务类型为物资采购时,入库单分录不能为空!")); + } + }else if("SBWX".equals(bisType)){//设备维修 SBWX + DynamicObjectCollection entry = dataEntity.getDynamicObjectCollection("zcgj_maintenanceackentry"); //入库单 + if((entry == null || entry.isEmpty())){ + this.addFatalErrorMessage(extendedDataEntity, String.format("业务类型为设备维修时,维修确认单分录不能为空!")); + } + } + //其他工程款 QTGCK 不交易 + } + } + } + } + } + } +} From f3453565e9d79f292389f0cabfff90e8d3a68f1d Mon Sep 17 00:00:00 2001 From: zhangzhiguo <421587375@qq.com> Date: Wed, 24 Sep 2025 10:47:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8A=A5=E9=94=80=E5=8D=95=E5=8F=91?= =?UTF-8?q?=E7=A5=A8=E4=B9=98=E8=BD=A6=E6=97=A5=E6=9C=9F=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/PublicBillContractCkOp.java | 4 ++- ...TripreimbursebillIsInvoiceDateCheckOp.java | 26 ++----------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/PublicBillContractCkOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/PublicBillContractCkOp.java index 22a39ec..5b05bdc 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/PublicBillContractCkOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/PublicBillContractCkOp.java @@ -18,7 +18,7 @@ import java.util.List; import java.util.Map; /** - * 无合同付款申请单(对公报销单)合同必录校验 + * 无合同付款申请单(对公报销单)入库单和 */ public class PublicBillContractCkOp extends AbstractOperationServicePlugIn { @@ -31,6 +31,8 @@ public class PublicBillContractCkOp extends AbstractOperationServicePlugIn { e.getFieldKeys().add("zcgj_nocontract");//合同付款类型 无合同付款 NOCONTRACT , 合同付款 CONTRACT e.getFieldKeys().add("contractentry");//关联合同 e.getFieldKeys().add("zcgj_bizype");//业务类型 + e.getFieldKeys().add("zcgj_maintenanceackentry");//设备维修 + e.getFieldKeys().add("zcgj_materialinbillentry");//入库单 } @Override 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 e4b8d6a..411a5f9 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 @@ -87,8 +87,8 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ for (DynamicObject invoice : invoiceentry) { i++; String invoicetype = invoice.getString("invoicetype"); - if("9".equals(invoicetype) || "10".equals(invoicetype)){ // 火车/飞机发票 - Date carrierDate = invoice.getDate("carrierdate"); // 乘车日期 + Date carrierDate = invoice.getDate("carrierdate"); // 乘车日期 + if(carrierDate != null){ // 校验1: 是否在行程时间范围内 boolean inTripRange = false; for (DynamicObject trip : tripentry) { @@ -116,28 +116,6 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ } } } - - /*if(writeoffapply!=null&&writeoffapply.size()==1){ - DynamicObject writeoffapplyObj = writeoffapply.get(0); - Date zcgjGlsqAuditdate = writeoffapplyObj.getDate("zcgj_glsq_auditdate"); - DynamicObjectCollection invoiceentry = dataEntity.getDynamicObjectCollection("invoiceentry"); - Map invoiceDateMap = new HashMap<>(); - for (DynamicObject invoiceentryObject : invoiceentry) { - if (invoiceentryObject.getDate("invoicedate") != null && invoiceentryObject.getString("invoiceno") != null && - !StringUtils.isEmpty(invoiceentryObject.getString("invoiceno"))) { - invoiceDateMap.put(invoiceentryObject.getString("invoiceno"),dateToLocalDate(invoiceentryObject.getDate("invoicedate"))); - } - } - for (String invoiceno : invoiceDateMap.keySet()) { - LocalDate invoiceDate = invoiceDateMap.get(invoiceno); - if (zcgjGlsqAuditdate!=null && invoiceDate.isBefore(dateToLocalDate(zcgjGlsqAuditdate))) { - // System.out.println("date1 比 date2 早"); - this.addFatalErrorMessage(extendedDataEntity, String.format("发票号码为:%s的发票,开票日期不能早于关联申请的审核时间!",invoiceno)); - - } - } - - }*/ } } }