package nckd.jimin.jyyy.fi.plugin.form;

import kd.bos.entity.operate.result.OperationResult;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.operate.FormOperate;
import kd.bos.form.plugin.AbstractFormPlugin;
import nckd.jimin.jyyy.fi.common.constant.ErReimBurseBillConstant;

public class ErTicketMailPlugin extends AbstractFormPlugin {

    private static final String CONFIRM = "confirm";
    @Override
    public void beforeDoOperation(BeforeDoOperationEventArgs args) {
        super.beforeDoOperation(args);
        FormOperate operateKey = (FormOperate) args.getSource();
        if(CONFIRM.equals(operateKey.getOperateKey())){

        }
    }

    @Override
    public void afterDoOperation(AfterDoOperationEventArgs args) {
        super.afterDoOperation(args);

        String operateKey = args.getOperateKey();
        OperationResult operationResult = args.getOperationResult();
        if(operationResult != null && operationResult.isSuccess()){

            if(CONFIRM.equals(operateKey)){
                String trackingNumber = (String)this.getModel().getValue(ErReimBurseBillConstant.KEY_NCKD_TRACKING_NUMBER);
                getView().returnDataToParent(trackingNumber);
                getView().close();
            }
        }
    }

    protected void updateBill(){

    }
}
