电脑桌面
添加蚂蚁七词文库到电脑桌面
安装后可以在桌面快捷访问

二开案例.套打.连续套打所选分录

来源:金蝶云社区作者:金蝶2024-09-235

二开案例.套打.连续套打所选分录

**【应用场景】** 在单据列表界面打印指定行逻辑。本案例模拟列表的[连续套打预览所选分录] **【案例演示】** <1>编写列表插件,代码如下。 ``` csharp using Kingdee.BOS.Core.CommonFilter; using Kingdee.BOS.Core.Const; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.List; using Kingdee.BOS.Core.List.PlugIn; using Kingdee.BOS.Core.NotePrint; using Kingdee.BOS.JSON; using Kingdee.BOS.Util; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace Kingdee.BOS.PlugInTest { /// <summary> /// 【列表插件】二开连续套打所选分录 /// </summary> [Description("【列表插件】二开连续套打所选分录"), HotUpdate] public class BatchSelectedEntityPrintListPlugIn : AbstractListPlugIn { /// <summary> /// 模板Id /// </summary> private const string TemplateId = "b1a2c803-da23-497a-91d1-dc864d80eee6"; /// <summary> /// 重写菜单点击事件 /// </summary> /// <param name="e"></param> public override void AfterBarItemClick(AfterBarItemClickEventArgs e) { base.AfterBarItemClick(e); if (e.BarItemKey.EqualsIgnoreCase("tbBatchSelectedEntityPrint")) { // 获取选中行 ListSelectedRowCollection selectedRows = this.ListView.SelectedRowsInfo; if (selectedRows == null || selectedRows.Count == 0) return; // 获取列表过滤选择的实体标识 string headEntityKey = string.Empty; string entryEntityKey = string.Empty; string subEntryEntityKey = string.Empty; List<FilterEntity> selectEntitnes = this.ListView.Model.FilterParameter.SelectedEntities; var headEntity = selectEntitnes.FirstOrDefault(x => x.EntityType == Core.Enums.BOSEnums.Enum_EntityType.Header); if (headEntity != null) { headEntityKey = headEntity.Key; } var entryEntity = selectEntitnes.FirstOrDefault(x => x.EntityType == Core.Enums.BOSEnums.Enum_EntityType.Entity); if (entryEntity != null) { entryEntityKey = entryEntity.Key; } var subEntryEntity = selectEntitnes.FirstOrDefault(x => x.EntityType == Core.Enums.BOSEnums.Enum_EntityType.SubEntity); if (subEntryEntity != null) { subEntryEntityKey = subEntryEntity.Key; } // 模板获取可以通过GetTemplatesByFormId方法获取 // 字典格式,key-套打模板ID,value-套打模板对应语言环境下的名称 // var templateDic = PrintServiceHelper.GetTemplatesByFormId(this.Context, this.View.BillBusinessInfo.GetForm().Id); // 构建打印任务 List<PrintJob> printJobs = new List<PrintJob>(); PrintJob pJob = new PrintJob(); pJob.Id = Guid.NewGuid().ToString(); pJob.FormId = this.View.BillBusinessInfo.GetForm().Id; List<PrintJobItem> printJobsItemList = new List<PrintJobItem>(); foreach (ListSelectedRow selectedRow in selectedRows) { var model = printJobsItemList.FirstOrDefault(x => x.BillId.Equals(selectedRow.PrimaryKeyValue)); if (model == null) { model = new PrintJobItem(selectedRow.PrimaryKeyValue, TemplateId); // 老版本选中分录集合 model.SelectedEtyIds = new List<string>(); // 新版本树形选中分录集合 model.RootNode = new PrintSelectNode(); // 单据头 model.RootNode.EntityKey = headEntityKey; model.RootNode.PrimaryKeyValue = selectedRow.PrimaryKeyValue; // 单据体 model.RootNode.SelectNode = new List<PrintSelectNode>(); if (string.IsNullOrWhiteSpace(selectedRow.EntryPrimaryKeyValue) == false) { // 老版本 model.SelectedEtyIds.Add(selectedRow.EntryPrimaryKeyValu

二开案例.套打.连续套打所选分录

**【应用场景】** 在单据列表界面打印指定行逻辑。本案例模拟列表的[连续套打预览所选分录]**【案例演示】** <1>编写列表插件,...
点击下载文档文档为doc格式

声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

已经是第一篇
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息
QQ群
  • 答案:my7c点击这里加入QQ群
支持邮箱
微信
  • 微信