package com.yem.em.ass.cmmptable.op;

import com.yem.em.ass.cmmptable.validator.CMMPTableAuditvalidator;
import com.yem.em.ass.cmmptable.validator.CMMPTableUnAuditvalidator;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;

import java.util.List;

/**
 * @author zhouc
 * @date 2024/1/5 19:23
 * @className CMMPTableUnAuditEdit
 * @description CMMP部件明细表【反审核】服务插件
 */
public class CMMPTableUnAuditEdit extends AbstractOperationServicePlugIn {
    @Override
    public void onPreparePropertys(PreparePropertysEventArgs e) {
        super.onPreparePropertys(e);
        List<String> keys = e.getFieldKeys();
        keys.add("createorg");
        keys.add("number");
        keys.add("yem_isassequipment");
        keys.add("yem_entryentity.yem_isadd");
        keys.add("yem_entryentity.yem_isdelete");
        keys.add("yem_entryentity.yem_partisreplace");
        keys.add("yem_entryentity.yem_ccode");
    }

    @Override
    public void onAddValidators(AddValidatorsEventArgs e) {
        super.onAddValidators(e);
        e.addValidator(new CMMPTableUnAuditvalidator());
    }

    @Override
    public void endOperationTransaction(EndOperationTransactionArgs e) {
        super.endOperationTransaction(e);
        if (e.getDataEntities() != null && e.getDataEntities().length != 0) {
//            DynamicObject[] bills = e.getDataEntities();
//            for (DynamicObject bill : bills) {
//            }
        }
    }
}
