1.下单审批报错问题处理
This commit is contained in:
25655 2025-02-20 14:43:03 +08:00
parent 5c49f594cf
commit d6dd00f35e
2 changed files with 50 additions and 0 deletions

View File

@ -1,7 +1,10 @@
package com.yem.wm.im.placeexamine.op; package com.yem.wm.im.placeexamine.op;
import com.yem.wm.im.placeexamine.vaildator.AlaceexamineSubmitOpSubmitvalidatox;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; 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.entity.plugin.args.AfterOperationArgs;
import kd.bos.servicehelper.BusinessDataServiceHelper; 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 class AlaceexamineSubmitOp extends AbstractOperationServicePlugIn
{ {
public void onPreparePropertys(PreparePropertysEventArgs e) {
e.getFieldKeys().addAll(this.billEntityType.getAllFields().keySet());
}
@Override @Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) { public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(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());
}
} }

View File

@ -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提交失败!"));
}
}
}
}
}
}