账表.二开案例.表头快捷搜索之基础资料

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

账表.二开案例.表头快捷搜索之基础资料

【场景】账表表头快捷搜索 文本的逻辑参考 [账表.二开案例.表头快捷搜索](https://wenku.my7c.com/article/530838391894642944?productLineId=1) 【案例】 ```csharp using Kingdee.BOS.App.Data; using Kingdee.BOS.Contracts.Report; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; using Kingdee.BOS.Core.Report; using Kingdee.BOS.Core.Report.PlugIn; using Kingdee.BOS.Web.DynamicForm; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DynamicFormPlugIn.Report { [Kingdee.BOS.Util.HotUpdate] [System.ComponentModel.Description("账表服务插件")] public class ReportServicePlugIn_QuickSearchForBase : SysReportBaseService { public override ReportHeader GetReportHeaders(IRptParams filter) { ReportHeader rptHeader = new ReportHeader(); rptHeader.AddChild("FIDENTITYID", new Kingdee.BOS.LocaleValue("序号")); rptHeader.AddChild("FBILLNO", new Kingdee.BOS.LocaleValue("单据编号")); rptHeader.AddChild("FMATERIALNUMBER", new Kingdee.BOS.LocaleValue("物料编码")); return rptHeader; } public override ReportTitles GetReportTitles(IRptParams filter) { var rptTitles = new ReportTitles(); if (filter == null || filter.FilterParameter == null || filter.FilterParameter.CustomFilter == null) return rptTitles; //获取过滤方案的基础资料内码 var bdPkVal = Kingdee.BOS.Util.ObjectUtils.Object2Int(filter.FilterParameter.CustomFilter["FMaterialId_Id"]); if (bdPkVal != 0) { rptTitles.Add(new ReportTitle("FMaterialId", bdPkVal.ToString())); } return rptTitles; } public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName) { StringBuilder stringBuilder = new StringBuilder(); KSQL_SEQ = string.Format(KSQL_SEQ, "FBILLNO"); stringBuilder.AppendFormat(@"select bill.FID, bill.FBillNo as FBILLNO, wl.fnumber as FMATERIALNUMBER, {0} into {1} from t_pur_poorder bill left join t_pur_poorderentry entry on bill.fid = entry.fid left join t_bd_material wl on entry.fmaterialid = wl.fmaterialid where fbillno <> ' ' and bill.FDOCUMENTSTATUS = 'C' ", KSQL_SEQ, tableName); //获取过滤方案的基础资料数据包 var bdDataObj = filter.FilterParameter.CustomFilter["FMaterialId"] as Kingdee.BOS.Orm.DataEntity.DynamicObject; if (bdDataObj != null && bdDataObj.DynamicObjectType.Properties.ContainsKey("Number")) { string number = bdDataObj["Number"].ToString(); stringBuilder.AppendFormat(" and wl.fnumber = '{0}'", number); } DBUtils.Execute(this.Context, stringBuilder.ToString()); } } [Kingdee.BOS.Util.HotUpdate] [System.ComponentModel.Description("账表表单插件")] public class ReportFormPlugIn_QuickSearchForBase : AbstractSysReportPlugIn { public override void ButtonClick(ButtonClickEventArgs e) { if (string.Equals(e.Key, "fbtnSearch", StringComparison.OrdinalIgnoreCase)) { var filter = (Model as ISysReportModel).FilterParameter.CustomFilter; var bdDataObj = Model.GetValue("FMaterialId") as Kingdee.BOS.Orm.DataEntity.DynamicObject; if (bdDataObj != null) { filter["FMaterialId_Id"] = bdDataObj[0]; filter["FMaterialId"] = bdDataObj; } else { filter["FMaterialId_Id"] = 0; filter["FMaterialId"] = null; } View.Refresh(); } } public override void AfterBindData(EventArgs e) { //查询完成后,默认会将表头上的控件设为只读。因此需重写AfterBindData事件,再将控件设为可编辑,否则无法修改查询条件 ReportTitles titles = (Model as ISysReportModel).ReportTitles; if (titles != null) { var wlTitle = titles.FirstOrDefault(x => x.TitleKey == "FMaterialId"); if (wlTitle == null) return; Control ctrl = ((AbstractDynamicWebFormView)this.View).TryGetControl("FMaterialId"); string strValue = wlTitle.TitleValue; //只读的表头控件设为可编辑 ctrl.Enabled = true; //过滤框中的查询条件同步到表头上, 基础资料处理逻辑 View.Model.SetItemValueByID("FMaterialId", strValue, 0); View.UpdateView("FMaterialId"); } } } } ``` 【效果】 ![20240116 1920.webp](/download/0100f3a70622d496434f87b3d586f36967c6.webp)

账表.二开案例.表头快捷搜索之基础资料

【场景】账表表头快捷搜索文本的逻辑参考 [账表.二开案例.表头快捷搜索](https://wenku.my7c.com/article/530838391894642944?productLine...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息