package com.yem.wm.es.xsalesorder.op;

import com.yem.wm.es.xsalesorder.validator.XSalesOrderSubmitAuthorValidator;
import com.yem.wm.es.xsalesorder.validator.XSalesOrderSubmitValidator;
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/25 22:07
 * @className XSalesOrderSubmitOp
 * @description 外销合同变更单提交服务插件
 */
public class XSalesOrderSubmitOp extends AbstractOperationServicePlugIn {
    @Override
    public void onPreparePropertys(PreparePropertysEventArgs e) {
        super.onPreparePropertys(e);
        List<String> fieldKeys = e.getFieldKeys();
        fieldKeys.add("yem_billtype");
        fieldKeys.add("yem_es_materialinfo");
        fieldKeys.add("yem_qty");
        fieldKeys.add("yem_shippingqty");
        fieldKeys.add("yem_orderqty");
    }

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

    @Override
    public void endOperationTransaction(EndOperationTransactionArgs e) {
        super.endOperationTransaction(e);
        DynamicObject[] dataEntities = e.getDataEntities();
        for (DynamicObject dataEntitie : dataEntities) {

        }
    }
}
