43 lines
1.7 KiB
Java
43 lines
1.7 KiB
Java
|
package shkd.repc.rebm.opplugin;
|
||
|
|
||
|
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.validate.AbstractValidator;
|
||
|
import kd.bos.logging.Log;
|
||
|
import kd.bos.logging.LogFactory;
|
||
|
|
||
|
public class PurPlanSubmitOPPlugin extends AbstractOperationServicePlugIn {
|
||
|
|
||
|
private static final Log logger = LogFactory.getLog(PurPlanSubmitOPPlugin.class);
|
||
|
|
||
|
@Override
|
||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||
|
super.onAddValidators(e);
|
||
|
e.addValidator(new AbstractValidator() {
|
||
|
@Override
|
||
|
public void validate() {
|
||
|
String operateKey = this.getOperateKey();
|
||
|
ExtendedDataEntity[] dataEntities1 = this.getDataEntities();
|
||
|
switch (operateKey) {
|
||
|
case "submit":
|
||
|
for (ExtendedDataEntity extendedDataEntity : dataEntities1) {
|
||
|
//采购需求明细
|
||
|
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||
|
DynamicObjectCollection cgxuentry = dataEntity.getDynamicObjectCollection("qeug_cgxuentryss");
|
||
|
if (cgxuentry.isEmpty()) {
|
||
|
this.addErrorMessage(extendedDataEntity, "采购需求明细不能为空,不允许提交。");
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|