package com.yem.wm.es.framework.validator;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.validate.AbstractValidator;

/**
 * @author xwudd
 * @date 18:30
 * @Description
 **/
public class FrameworkContractDelValidator extends AbstractValidator {
    @Override
    public void validate() {
        ExtendedDataEntity[] dataEntities = this.getDataEntities();
        for(ExtendedDataEntity dataEntitie : dataEntities){
            DynamicObject dataEntity = dataEntitie.getDataEntity();
            DynamicObjectCollection entryEntity = dataEntity.getDynamicObjectCollection("yem_entryentitys");
            if(entryEntity.size() > 0){
                this.addErrorMessage(dataEntitie,"外销合同明细信息分录不为空，不可删除此框架合同！");
            }
        }
    }
}
