package com.yem.em.bd.substitution.op;

import com.yem.em.bd.substitution.validator.SubstitutionSavevalidatorEdit;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs;

import java.util.List;

/**
 * @author zhouc
 * @date 2023/10/24 15:58
 * @className SubstitutionSaveEdit
 * @description 替换关系【保存】服务插件
 */
public class SubstitutionSaveEdit 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_pnumber");
        keys.add("yem_pname");
        keys.add("yem_penname");
        keys.add("yem_pqty");
        keys.add("yem_tnumber");
        keys.add("yem_tname");
        keys.add("yem_tenname");
        keys.add("yem_tqty");
        keys.add("yem_sourcetype");

        keys.add("yem_entryentity.yem_onumber");
        keys.add("yem_entryentity.yem_oname");
        keys.add("yem_entryentity.yem_oenname");
        keys.add("yem_entryentity.yem_oqty");

        keys.add("yem_entryentity.yem_repnumber");
        keys.add("yem_entryentity.yem_repname");
        keys.add("yem_entryentity.yem_repenname");
        keys.add("yem_entryentity.yem_repenqty");
    }
    @Override
    public void onAddValidators(AddValidatorsEventArgs e) {
        super.onAddValidators(e);
        e.addValidator(new SubstitutionSavevalidatorEdit());
    }
}
