package com.yem.wm.im.csrCreditLine.validator;

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.validate.AbstractValidator;

/**
 * @author xwudd
 * @Description
 * @date 11:49
 **/
public class CsrCreditLineDelValidator extends AbstractValidator {

    @Override
    public void validate() {
        ExtendedDataEntity[] dataEntities = this.getDataEntities();
        for(ExtendedDataEntity dataEntitie : dataEntities){
            DynamicObject dataEntity = dataEntitie.getDataEntity();
            String EntityTypeName = dataEntity.getDataEntityType().getName();
            if(EntityTypeName.equals("yem_im_csrcreditline")){
                DynamicObjectCollection info = dataEntity.getDynamicObjectCollection("yem_im_info");
                if(info.size() > 0){
                    this.addErrorMessage(dataEntitie,"客户对应信保额度申请已被使用，不能删除单据！");
                }
            }

        }
    }
}
