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

import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.operate.AbstractOperate;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;

/**
 * 处理报销付款、预付单关联合同时校验必录项
 * @author wanghaiwu_kd
 * @date 2025/07/10
 */
public class PayBotpUpCusEditPlugin extends AbstractBillPlugIn {
    private static final Log log = LogFactory.getLog(PayBotpUpCusEditPlugin.class);

    public void beforeDoOperation(BeforeDoOperationEventArgs args) {
        Object source = args.getSource();
        String opKey = ((AbstractOperate)source).getOperateKey();

        if("drawunframcontract".equals(opKey)) {
            String isrelapj = (String) this.getModel().getValue("nckd_isrelapj");
            if("1".equals(isrelapj) && this.getModel().getValue("nckd_project") == null){
                this.getView().showTipNotification(ResManager.loadKDString("请先选择项目", "PublicReimburseBotpUpPlugin_0", "fi-er-formplugin", new Object[0]));
                args.setCancelMessage("请先选择项目");
                args.setCancel(true);

                return;
            }
        }
    }
}
