在插件中根据条件取消表单打开过程
金蝶云社区-云小爱
云小爱
0人赞赏了该文章 1,247次浏览 未经作者许可,禁止转载编辑于2013年08月16日 13:46:33

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

///


/// 销售订单 单据维护界面插件
///

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);
}
}
}
}
}