付款申请单关联单据校验
This commit is contained in:
parent
9eadaadbbf
commit
8234d1f570
|
@ -0,0 +1,75 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款申请单关联单据校验
|
||||||
|
*/
|
||||||
|
public class PaymentapplyRelationalCkOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("entryentity");//
|
||||||
|
e.getFieldKeys().add("zcgj_maintenance");//设备维修申请单
|
||||||
|
e.getFieldKeys().add("zcgj_purchaseapply");//采购申请单
|
||||||
|
}
|
||||||
|
|
||||||
|
@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");
|
||||||
|
if(entryentity != null){
|
||||||
|
boolean isshowwxsq = false;
|
||||||
|
boolean isshowcgsq = false;
|
||||||
|
for (DynamicObject dynamicObject : entryentity) {
|
||||||
|
DynamicObject contract = dynamicObject.getDynamicObject("contract");
|
||||||
|
String paymenttype = dynamicObject.getString("paymenttype");
|
||||||
|
if(contract!=null){
|
||||||
|
DynamicObject contracttype = contract.getDynamicObject("contracttype");
|
||||||
|
System.out.println();
|
||||||
|
if("PREPAYMENT".equals(paymenttype)){
|
||||||
|
if("sbwbl".equals(contracttype.getString("number"))){//设备维保 sbwbl
|
||||||
|
isshowwxsq = true;
|
||||||
|
}else if("ZCHLX02".equals(contracttype.getString("number"))){//物资采购 ZCHLX02
|
||||||
|
isshowcgsq = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(isshowwxsq){
|
||||||
|
DynamicObjectCollection maintenance = dataEntity.getDynamicObjectCollection("zcgj_maintenance");
|
||||||
|
if((maintenance == null || maintenance.isEmpty())){
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, String.format("设备维修申请单分录不能为空!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(isshowcgsq){
|
||||||
|
DynamicObjectCollection purchaseapply = dataEntity.getDynamicObjectCollection("zcgj_purchaseapply");
|
||||||
|
if((purchaseapply == null || purchaseapply.isEmpty())){
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, String.format("设备维修申请单分录不能为空!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue