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

套打.二开案例.套打单据体的多个子单据体的方案

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

套打.二开案例.套打单据体的多个子单据体的方案

【场景】套打模板打印一个单据体的多个子单据体,且子单据体需要上下布局; 一般的客户的配置结构如下: ![image.webp](/download/01008a4e6e87e65c4f99a3e316d50f4a7555.webp) 但是系统不支持数据表格嵌套布局表格的行高自适应。 比如系统中的检验单 检测项目 + 使用决策 【变通方案1】单据逐分录打印,需要写二开代码 (0)说明:该方案适用于每一明细显示一页的场景 (1)将模板外层的数据表格去掉,仅保留布局表格的逻辑,布局表格的逻辑一般都是取当前行的明细和对应的子单据体的所有行 ![image.webp](/download/01002d1917d091f94844bb75dde4f512bbbb.webp) (2)验证连续套打所选分录,选中一个分录,能够使用该模板打印选中分录的子单据体 ![20240222 1119.webp](/download/01008bf605d9a430442eb58136b645ad6e3c.webp) (3)插件代码,本质就是模拟选中每一个分录单独打印的逻辑,所以每个分录单独放一页 ![image.webp](/download/0100448a614222b34b4ca3719a04bc76b913.webp) ```csharp using Kingdee.BOS; using Kingdee.BOS.App.Data; using Kingdee.BOS.Core.Bill.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.Metadata; using Kingdee.BOS.Core.Metadata.EntityElement; using Kingdee.BOS.Core.NotePrint; using System; using System.Collections.Generic; using System.Linq; namespace DynamicFormPlugIn.NotePrint { [Kingdee.BOS.Util.HotUpdate] [System.ComponentModel.Description("单据按照明细分录逐行打印")] public class NotePrintPlugIn_PrintByEachSingleRow : AbstractBillPlugIn { public override void OnInitialize(InitializeEventArgs e) { this.View.ConcurrentSession["PrintByEachSingleRow"] = new PrintByEachSingleRow(this.Context, this.View.BillBusinessInfo, "FEntity"); } public override void BarItemClick(BarItemClickEventArgs e) { (this.View.ConcurrentSession["PrintByEachSingleRow"] as PrintByEachSingleRow).Check(e); } public override void BeforeNotePrintCommand(BeforeNotePrintEventArgs e) { (this.View.ConcurrentSession["PrintByEachSingleRow"] as PrintByEachSingleRow).PreparePrintJob(e.PrintJobs); } } public class PrintByEachSingleRow { private readonly Context Ctx; private readonly BusinessInfo BillBusinessInfo; private readonly string EntityKey; private bool printByEachSingleRow; public PrintByEachSingleRow(Context ctx, BusinessInfo businessInfo, string entityKey) { Ctx = ctx; BillBusinessInfo = businessInfo; EntityKey = entityKey; } public void Check(BarItemClickEventArgs e) { printByEachSingleRow = false; if (string.Equals(e.BarItemKey, "tb_PrintByEachSingleRow", StringComparison.OrdinalIgnoreCase)) printByEachSingleRow = true; } /// <summary> /// 将打印任务替换为逐行分录执行的逻辑 /// </summary> /// <param name="printJobList"></param> public void PreparePrintJob(List<PrintJob> printJobList) { if (!printByEachSingleRow) return; List<PrintJob> newPrintJobList = new List<PrintJob>(); foreach (var printJob in printJobList) { if (printJob == null || printJob.PrintJobItems == null || !printJob.PrintJobItems.Any()) continue; foreach (var printJobItem in printJob.PrintJobItems) { if (printJobItem == null) continue; newPrintJobList.AddRange(GenerateSingleRowJob(printJob.FormId, printJobItem)); } } printJobList.Clear(); newPrintJobList.ForEach(x => printJobList.Add(x)); } /// <summary> /// 获取指定单据的所有分录内码,按照序号排序 /// </summary> /// <param name="billId"></param> /// <returns></returns> private List<string> GetAllEntityIdsOrderBySeq(string billId) { Entity entity = this.BillBusinessInfo.GetEntity(EntityKey); string strSql = string.Format("SELECT {0} FROM {1} WHERE {2}=@billId ORDER BY {3} ASC", entity.EntryPkFieldName, entity.TableName, this.BillBusinessInfo.GetForm().PkFieldName, entity.SeqFieldKey); KDDbType dbType = KDDbType.Int32; switch (this.BillBusinessInfo.GetForm().PkFieldTy

套打.二开案例.套打单据体的多个子单据体的方案

【场景】套打模板打印一个单据体的多个子单据体,且子单据体需要上下布局;一般的客户的配置结构如下:![image.webp](/download/01008a4e6e...
点击下载文档文档为doc格式

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

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