电脑桌面
添加蚂蚁七词文库到电脑桌面
安装后可以在桌面快捷访问

二开案例.表单插件.触发特定实体服务规则

来源:金蝶云社区作者:金蝶2024-09-238

二开案例.表单插件.触发特定实体服务规则

【应用场景】

通过表单插件,触发特定的实体服务规则(传说中的无脑触发)。


【案例演示】

采购订单,单据头上新增文本字段,设置实体服务规则,设置该文本字段的值等于当前时间,通过插件的方式,主动触发该实体服务规则执行。


【实现步骤】

<1>编写表单插件,代码如下。

using Kingdee.BOS.Core.DependencyRules;

using Kingdee.BOS.Core.DynamicForm.PlugIn;

using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;

using Kingdee.BOS.Util;

using System.ComponentModel;

using System.Linq;

using System.Reflection;


namespace Jac.XkDemo.BOS.Business.PlugIn

{

    /// <summary>

    /// 【表单插件】触发特定实体服务规则

    /// </summary>

    [Description("【表单插件】触发特定实体服务规则"), HotUpdate]

    public class ForceInvokeEntityServiceRuleFormPlugIn : AbstractDynamicFormPlugIn

    {

        public override void BarItemClick(BarItemClickEventArgs e)

        {

            base.BarItemClick(e);

            if (e.BarItemKey.EqualsIgnoreCase("InvokeEntityServiceRule"))

            {

                var ctx = new BOSActionExecuteContext(this.View);

                SetDataEntities(ctx, new object[] { this.Model.DataObject });

                var entityRule = this.View.RuleContainer.Rules.FirstOrDefault(o => o.ToString().Contains("1 == 1"));

                if (entityRule != null)

                {

                    entityRule.Execute(ctx);

                }

            }

        }


        private void SetDataEntities(BOSActionExecuteContext ctx, object value)

        {

   

二开案例.表单插件.触发特定实体服务规则

【应用场景】通过表单插件,触发特定的实体服务规则(传说中的无脑触发)。【案例演示】采购订单,单据头上新增文本字段,设置实体服务规则...
点击下载文档文档为doc格式

声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

已经是第一篇
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息
QQ群
  • 答案:my7c点击这里加入QQ群
支持邮箱
微信
  • 微信