账表开发-直接sql账表中打开简单账表原创
8人赞赏了该文章
3,470次浏览
编辑于2022年01月19日 09:58:16
示例说明:
在直接sql账表aa中双击行弹出简单账表
把双击行的创建时间传入到简单账表
简单账表,取到传入的条件,对数据进行过滤,显示创建时间大于等于条件的数据
直接sql账表aa,表单插件代码:
using System; 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; namespace Kingdee.BOS.TestPlugIn.BillFormPlugin { [HotUpdate] [Description("在直接sql账表aa表单插件")] public class BillASqlReportPlugIn : AbstractSysReportPlugIn { /// <summary> /// 帐表行双击事件 /// </summary> /// <param name="e"></param> public override void EntityRowDoubleClick(EntityRowClickEventArgs e) { base.EntityRowDoubleClick(e); var columnName = "创建时间"; //列名创建日期 var reportModel = this.Model as SQLReportModel; var reportView = this.View as SQLReportView; var columnValue =ObjectUtils.Object2String(reportView.GetCurrentRowValue(columnName)); if (!columnValue.IsNullOrEmptyOrWhiteSpace()) { //直接sql帐表显示参数 SysReportShowParameter sqlParameter = new SysReportShowParameter(); sqlParameter.FormId = "k7825d2cf319d464fae95b3ea7d8fc544"; sqlParameter.CustomParams.Add("SqlFilter", columnValue); sqlParameter.OpenStyle.ShowType = ShowType.Modal; this.View.ShowForm(sqlParameter); } } } }
简单账表表单服务插件代码:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel; using Kingdee.BOS.Contracts.Report; using Kingdee.BOS.Core.Report; using Kingdee.BOS.App.Data; using Kingdee.BOS.Util; using Kingdee.BOS.Core.Metadata.ControlElement; namespace Kingdee.BOS.TestPlugIn.BillFormPlugin { [HotUpdate] [Description("单据A简单帐表")] public class BillAReportPlugIn : SysReportBaseService { /// <summary> /// 通过存储过程把数据灌入临时表中 /// </summary> /// <param name="filter"></param> /// <param name="tableName"></param> public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName) { //得到传入的创建时间过滤条件 object openObj; var createDateFilter = string.Empty; if (filter.CustomParams.TryGetValue("OpenParameter", out openObj)) { var openParam = (Dictionary<string, object>)openObj; object sqlFilter; openParam.TryGetValue("SqlFilter", out sqlFilter); createDateFilter = ObjectUtils.Object2String(sqlFilter); } //把所有数据放入到临时表中 var sql =string.Format(@"select tb.*,ROW_NUMBER() OVER( ORDER BY tb.FCREATEDATE) FIDENTITYID into {0} FROM( select t0.FBILLNO , t0.FDOCUMENTSTATUS, t0.FCREATEDATE , t0.F_PAEZ_TEXT , t1.FEntryID , t2.FName as F_PAEZ_Material_FName, t1.F_PAEZ_PRICE , t1.F_PAEZ_QTY , t1.F_PAEZ_AMOUNT , t1.F_PAEZ_REMARK1 from PAEZ_t_Cust100029 t0 left join PAEZ_t_Cust_Entry100189 t1 on t0.FID = t1.FID left join T_BD_MATERIAL_L t2 on t2.FMATERIALID = t1.F_PAEZ_MATERIAL and t2.FLOCALEID=2052 where 1=1) tb", tableName); if (!createDateFilter.IsNullOrEmptyOrWhiteSpace()) { sql = sql.Replace("1=1", string.Format("t0.FCREATEDATE >='{0}'", createDateFilter)); } DBUtils.Execute(this.Context, sql); } } }
运行效果图:
赞 8
8人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读