二开案例.账表.过滤条件框动态设置分组汇总

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

二开案例.账表.过滤条件框动态设置分组汇总

**【应用场景】** 在账表的过滤条件框上,按照快捷页签中的字段选择,动态设置分组汇总页签。 **【案例演示】** <1>编写过滤界面插件,代码如下。 ``` csharp using Kingdee.BOS.Core.CommonFilter; using Kingdee.BOS.Core.CommonFilter.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; using Kingdee.BOS.Util; using System.Collections.Generic; using System.ComponentModel; namespace Kingdee.BOS.PlugInTest { [Description("【过滤插件】动态调整分组合计选中"), HotUpdate] public class SummaryFilterPlugIn : AbstractCommonFilterPlugIn { public override void DataChanged(DataChangedEventArgs e) { base.DataChanged(e); // 动态构建汇总字段 // 动态构建选中的汇总字段 SummaryObject sumobj = ((ICommonFilterModelService)this.Model).SummaryObject; if (e.Field.Key.EqualsIgnoreCase("FCheckBoxA")) { // 物料相关 Dictionary<string, string> kv = new Dictionary<string, string>(); kv["FMaterialName"] = "物料"; kv["FQty"] = "数量"; kv["FUnitName"] = "单位"; this.SummaryObjectHandler(e, sumobj, kv); this.SummaryFieldHandler(e, sumobj, "FMaterialName"); } else if (e.Field.Key.EqualsIgnoreCase("FCheckBoxB")) { // 单据相关 Dictionary<string, string> kv = new Dictionary<string, string>(); kv["FBillNo"] = "单据编号"; kv["FDocumentStatus"] = "状态"; this.SummaryObjectHandler(e, sumobj, kv); this.SummaryFieldHandler(e, sumobj, "FBillNo"); } SummarySet summary = this.View.GetControl<SummarySet>("FSummarySet"); summary.SetSummaryFields(sumobj.GetAllSummaryFields()); summary.SetSummaryRows(sumobj.GetSummaryFields()); } private void SummaryObjectHandler(DataChangedEventArgs e, SummaryObject sumobj, Dictionary<string, string> kv) { bool flag = false; if (bool.TryParse(e.NewValue.GetString(), out flag)) { } foreach (var item in kv) { SummaryField selectSummaryField = ((ICommonFilterModelService)this.Model).SummaryObject.GetField(item.Key); if (selectSummaryField == null) { selectSummaryField = new SummaryField(new LocaleValue(item.Value), item.Key); selectSummaryField.Key = item.Key; selectSummaryField.EntityKey = string.Empty; if (flag) { sumobj.AddSummaryFieldList(selectSummaryField); } } if (flag == false && selectSummaryField != null) { sumobj.SummaryFieldList.Remove(selectSummaryField); sumobj.DeleteSelectRow(selectSummaryField); } } } private void SummaryFieldHandler(DataChangedEventArgs e, SummaryObject sumobj, string key) { bool flag = false; if (bool.TryParse(e.NewValue.GetString(), out flag)) { } SummaryField selectSummaryField = ((ICommonFilterModelService)this.Model).SummaryObject.GetField(key); if (flag) { sumobj.AddSelectRow(selectSummaryField); } else { sumobj.DeleteSelectRow(selectSummaryField); } } } } ``` <2>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。 <3>快捷页签中的字段设置触发值更新事件。 ![设置触发值更新事件](/download/01003decdee57ac34f1c95820e3ba12929c8.webp) <3>注册插件。 ![注册插件](/download/0100d0e44fdecf96436fa225871c9bb97804.webp) <4>现在可以登业务站点,验证一下结果。 ![过滤条件框动态设置分组汇总](/download/01009d84a7f1c1d74238a74ff3e5f089dac6.webp)

二开案例.账表.过滤条件框动态设置分组汇总

**【应用场景】** 在账表的过滤条件框上,按照快捷页签中的字段选择,动态设置分组汇总页签。**【案例演示】** <1>编写过滤界面...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息