代码简单,希望能够帮忙需要的人,如有更简洁的代码,欢迎分享。
第一步:生成表A表单插件,引用类包,继承AbstractSysReportPlugIn,添加CellDbClick方法
using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel; using System.Data; using Kingdee.BOS.Util; using Kingdee.BOS.Core.Report.PlugIn; using Kingdee.BOS.Core.Report.PlugIn.Args; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Model.Report; using Kingdee.BOS.Web.Report.SQLReport; using Kingdee.BOS.Core.DynamicForm; using Kingdee.BOS.Core.Report; |
[Description("双击行打开简单帐表")] public class KDVPriceListParameters : AbstractSysReportPlugIn { /// <summary> /// 帐表行双击事件 /// </summary> /// <param name="e"></param> public override void CellDbClick(CellEventArgs Args) { var showParam = new SysReportShowParameter(); showParam.FormId = "kb77d7d312de648e9a781a0e41119b747";//目标账表B的标识 showParam.ParentPageId = this.View.PageId; showParam.CustomComplexParams["KDVFCUSTID"] = ((ISysReportViewService)this.View).GetCurrentRowValue("FCUSTID").ToString();//要传递的参数 showParam.IsShowFilter = false; showParam.OpenStyle.ShowType = ShowType.MainNewTabPage; this.View.ShowForm(showParam); } } |
第二步:生成表B表单插件,引用类包,继承AbstractSysReportPlugIn,添加OnInitialize方法
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Kingdee.BOS; using Kingdee.BOS.Core.Bill.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Core.SqlBuilder; using Kingdee.BOS.Core.Metadata; using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; using Kingdee.BOS.Core.Report.PlugIn; using System.ComponentModel; using Kingdee.BOS.Core.Report; |
[Description("过滤器接收参数")] public class KDVPriceListDetailsFilter : AbstractSysReportPlugIn { public override void OnInitialize(InitializeEventArgs e) { //接收源单传递的参数"KDVFCUSTID" base.OnInitialize(e); string Fid = this.View.ParentFormView.OpenParameter.GetCustomParameter("KDVFCUSTID").ToString(); this.SysReportModel.RptParams.CustomParams["FCustomerID"] = Fid; } } |
第三步:服务插件帐表B中获取帐表A传递的值
接收方式一:
object FCUSTID = null; filter.CustomParams.TryGetValue("KDVFCUSTID", out FCUSTID); if (FCUSTID != null) { FCustomerID= FCUSTID.ToString(); } |
接收方式二:
Dictionary<string, object> fiterstrings = (Dictionary<string, object>)filter.CustomParams.FirstOrDefault().Value;//CustomParams中拿到传过来的参数 var fiterstring = (from p in fiterstrings where p.Key == "KDVFCUSTID" select p).ToList(); if (fiterstring != null) { FCustomerID= fiterstring[0].Value.ToString(); } |
宝,不要看了,没有第四步了,此外十分感谢金蝶开发 拿了你的糖 的友情指导~
推荐阅读