package com.yem.wm.bc.bill.op;

import com.yem.wm.bc.change.business.ChangeModelHelper;
import com.yem.wm.bc.change.op.common.ChangeOppluginUtils;
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.BeginOperationTransactionArgs;
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;

/**
 * @author 夜子
 * @ClassName YemBillSubmitOp
 * @description: 外贸基类提交操作插件
 * @date 2023年08月10日
 * @version: 1.0
 */
public class YemBillSubmitOp extends AbstractOperationServicePlugIn {

    @Override
    public void onPreparePropertys(PreparePropertysEventArgs e) {
        super.onPreparePropertys(e);
        if(ChangeModelHelper.getChangeModel5XBill(this.billEntityType.getName())!=null){
            ChangeOppluginUtils.XBillSubmitOpOnPreparePropertys(e,this);
        }
    }

    @Override
    public void onAddValidators(AddValidatorsEventArgs e) {
        super.onAddValidators(e);
        String opkey = (String) this.operateMeta.get("key");
        if(ChangeModelHelper.getChangeModel5XBill(this.billEntityType.getName())!=null){
            ChangeOppluginUtils.XBillOpOnAddValidators(e,this.billEntityType,opkey);
        }

    }

    @Override
    public void beginOperationTransaction(BeginOperationTransactionArgs e) {
        super.beginOperationTransaction(e);
        if(ChangeModelHelper.getChangeModel5XBill(this.billEntityType.getName())!=null){
            ChangeOppluginUtils.XBillSubmitOpBeginOperationTransaction(e,this);
        }
    }

    @Override
    public void endOperationTransaction(EndOperationTransactionArgs e) {
        super.endOperationTransaction(e);
        if(ChangeModelHelper.getChangeModel5XBill(this.billEntityType.getName())!=null){
            ChangeOppluginUtils.XBillSubmitOpEndOperationTransaction(e ,this);
        }
    }
}
