设备维修确认单生成成本时工序必填校验
This commit is contained in:
parent
b3be09d148
commit
7e1608e0f4
|
|
@ -0,0 +1,64 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备维修确认单生成成本时工序必填校验
|
||||||
|
*/
|
||||||
|
public class MaintenanceackbillCBSCkOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("entryentity");
|
||||||
|
e.getFieldKeys().add("entryentity.zcgj_pa_process");//工序
|
||||||
|
e.getFieldKeys().add("entryentity.zcgj_accounttype");//科目属性
|
||||||
|
e.getFieldKeys().add("zcgj_maintype");//科目属性
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
e.getValidators().add(new ValidatorExt());
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValidatorExt extends AbstractValidator {
|
||||||
|
@Override
|
||||||
|
public void validate() {
|
||||||
|
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||||
|
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||||
|
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||||
|
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("entryentity");//设备维修信息
|
||||||
|
String zcgjMaintype = dataEntity.getString("zcgj_maintype");
|
||||||
|
if("20".equals(zcgjMaintype)) {
|
||||||
|
if(entryentity == null || entryentity.isEmpty()){
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, "设备维修信息分录不能为空!");
|
||||||
|
}else{
|
||||||
|
int i=0;
|
||||||
|
for (DynamicObject dynamicObject : entryentity) {
|
||||||
|
i++;
|
||||||
|
DynamicObject zcgjAccounttype = dynamicObject.getDynamicObject("zcgj_accounttype");
|
||||||
|
if(zcgjAccounttype == null){
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, String.format("设备维修信息,第%d行科目属性不能为空!",i));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean checkcbs = zcgjAccounttype.getBoolean("zcgj_checkcbs");
|
||||||
|
DynamicObject cbs = dynamicObject.getDynamicObject("zcgj_pa_process");
|
||||||
|
if(checkcbs && cbs == null ){ //生成成本时,工序必录
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, String.format("设备维修信息,第%d行工序不能为空!",i));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue