From d6dd00f35e0b0da206ecb5580b85af2da6a171d5 Mon Sep 17 00:00:00 2001 From: 25655 <2565550274@qq.com> Date: Thu, 20 Feb 2025 14:43:03 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=201.=E4=B8=8B=E5=8D=95=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placeexamine/op/AlaceexamineSubmitOp.java | 12 ++++++ .../AlaceexamineSubmitOpSubmitvalidatox.java | 38 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/main/java/com/yem/wm/im/placeexamine/vaildator/AlaceexamineSubmitOpSubmitvalidatox.java diff --git a/src/main/java/com/yem/wm/im/placeexamine/op/AlaceexamineSubmitOp.java b/src/main/java/com/yem/wm/im/placeexamine/op/AlaceexamineSubmitOp.java index 06983cec..0bd0027c 100644 --- a/src/main/java/com/yem/wm/im/placeexamine/op/AlaceexamineSubmitOp.java +++ b/src/main/java/com/yem/wm/im/placeexamine/op/AlaceexamineSubmitOp.java @@ -1,7 +1,10 @@ package com.yem.wm.im.placeexamine.op; +import com.yem.wm.im.placeexamine.vaildator.AlaceexamineSubmitOpSubmitvalidatox; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.servicehelper.BusinessDataServiceHelper; @@ -9,6 +12,9 @@ import static com.yem.wm.im.placeexamine.op.AlaceexamineAuditOp.back_placeexamin public class AlaceexamineSubmitOp extends AbstractOperationServicePlugIn { + public void onPreparePropertys(PreparePropertysEventArgs e) { + e.getFieldKeys().addAll(this.billEntityType.getAllFields().keySet()); + } @Override public void afterExecuteOperationTransaction(AfterOperationArgs e) { super.afterExecuteOperationTransaction(e); @@ -25,4 +31,10 @@ public class AlaceexamineSubmitOp extends AbstractOperationServicePlugIn } } } + + @Override + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + e.addValidator(new AlaceexamineSubmitOpSubmitvalidatox()); + } } diff --git a/src/main/java/com/yem/wm/im/placeexamine/vaildator/AlaceexamineSubmitOpSubmitvalidatox.java b/src/main/java/com/yem/wm/im/placeexamine/vaildator/AlaceexamineSubmitOpSubmitvalidatox.java new file mode 100644 index 00000000..f9cbf9f1 --- /dev/null +++ b/src/main/java/com/yem/wm/im/placeexamine/vaildator/AlaceexamineSubmitOpSubmitvalidatox.java @@ -0,0 +1,38 @@ +package com.yem.wm.im.placeexamine.vaildator; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.ExtendedDataEntity; +import kd.bos.entity.validate.AbstractValidator; + +public class AlaceexamineSubmitOpSubmitvalidatox extends AbstractValidator { + @Override + public void validate() { + ExtendedDataEntity[] dataEntities = this.getDataEntities(); + for (ExtendedDataEntity dataEntitie : dataEntities) { + DynamicObject dataEntity = dataEntitie.getDataEntity(); + DynamicObjectCollection yem_es_materialinfo = dataEntity.getDynamicObjectCollection("yem_es_materialinfo"); + for (int i = 0; i < yem_es_materialinfo.size(); i++) { + DynamicObject materialinfo = yem_es_materialinfo.get(i); + int yem_nqty = materialinfo.getInt("yem_nqty"); + //商品信息第**行[**物料编码] 末备料数量[*]大于0,请执行备料! + if (yem_nqty > 0) { + DynamicObject yem_materiel = materialinfo.getDynamicObject("yem_materiel"); + if (yem_materiel != null) { + int seq = i + 1; + String materiel = yem_materiel.getString("number"); + this.addErrorMessage(dataEntitie, String.format("商品信息第" + seq + "行[" + materiel + "] 末备料数量[" + yem_nqty + "]大于0,请执行备料!")); + } + } + if (yem_nqty < 0) { + DynamicObject yem_materiel = materialinfo.getDynamicObject("yem_materiel"); + if (yem_materiel != null) { + int seq = i + 1; + String materiel = yem_materiel.getString("number"); + this.addErrorMessage(dataEntitie, String.format("商品信息第" + seq + "行[" + materiel + "] 末备料数量[" + yem_nqty + "]小于0,提交失败!")); + } + } + } + } + } +}