金蝶云星空表单插件传递参数到服务插件

一、 业务需求
操作售后单行反关闭时将当前选中行的序号传递到服务端,然后在服务端接收序列号,根据序列号处理相关逻辑。

二、开发实现
2.1、传递参数
售后单表单插件的BeforeDoOperation事件

复制代码
public override void BeforeDoOperation(BeforeDoOperationEventArgs e)
{
    base.BeforeDoOperation(e);
    switch (e.Operation.FormOperation.Operation.ToUpperInvariant())
    {
        case "ROWUNCLOSE": //行反关闭
            if (this.Model.DataChanged)
            {
                this.View.ShowErrMessage("当前界面未保存,请先操作保存。");
                e.Cancel = true;
                return;
            }
            //获取当前选中行
            int rowIndexV = this.View.Model.GetEntryCurrentRowIndex("FEntity"); //获取当前明细选中行
            Entity entityV = this.View.BusinessInfo.GetEntity("FEntity");
            DynamicObject itemV = View.Model.GetEntityDataObject(entityV, rowIndexV) as DynamicObject;
            //获取序列号
            int unCloseSeq = Convert.ToInt32(itemV["Seq"]);
            e.Option.SetVariableValue("unCloseSeq", unCloseSeq);//给行反关闭添加自定义参数 表单插件传递参数到服务插件
            break;
    }
}
View Code
复制代码

 

 

2.2、接收参数
在行关闭的服务插件BeforeExecuteOperationTransaction事件

复制代码
public override void BeforeExecuteOperationTransaction(BeforeExecuteOperationTransaction e)
{
    base.BeforeExecuteOperationTransaction(e);
    var aa=this.FormOperation.Operation;
           
    if (this.Option.ContainsVariable("unCloseSeq"))//判断表单是否传递关键字
    {
        unCloseSeq = this.Option.GetVariables()["unCloseSeq"].ToString();//取出关键字的值
    }
}
View Code
复制代码

 

 

posted @   lanrenka  阅读(99)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示