[K/3Cloud]在插件中根据条件取消表单打开过程

新建一个类,继承自动态表单抽象插件类AbstractBillPlugIn,重写PreOpenForm。

/// <summary>
    /// 销售订单 单据维护界面插件
    /// </summary>
    public class SaleOrderEdit : AbstractBillPlugIn
    {
        //
        // Summary:
        //     动态表单打开前事件
        //
        // Parameters:
        //   e:
        //     动态表单打开前事件参数
        public override void PreOpenForm(BOS.Core.DynamicForm.PlugIn.Args.PreOpenFormEventArgs e)
        {
            if (e.OpenParameter.Status == OperationStatus.ADDNEW)
            {
                long orgId = e.Context.CurrentOrganizationInfo.ID;
                Object objEqualSaler = CommonServiceHelper.GetSystemProfile(e.Context, orgId, Kingdee.K3.Core.SCM.SCMFormIdConst.SAL_SystemParameter, SCMConst.PARAM_SELLEREQUALCREATOR, false);
                para_EqualSaler = objEqualSaler == null ? false : Convert.ToBoolean(objEqualSaler);
                if (para_EqualSaler)
                {
                    long sellerId = SaleServiceHelper.GetSellerIdFromUserId(e.Context, orgId, e.Context.UserId);
                    if (sellerId == 0)
                    {
                        e.Cancel = true;
                        e.CancelMessage = Kingdee.BOS.Resource.ResManager.LoadKDString("当前用户不是销售员,不能录入订单!", "004019030003349", Kingdee.BOS.Resource.SubSystemType.SCM);
                    }
                }
            }
        }
    }


原文地址:https://www.cnblogs.com/fyq891014/p/3308532.html