套打.二开案例.审批路线横向打印

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

套打.二开案例.审批路线横向打印

【场景】审批路线横向打印 【方案】数据表格动态列+套打插件二开 ![image.webp](/download/0100c15fffbf6cdb46709666ab7baa2ced99.webp) ![image.webp](/download/0100835dcd5c64404f5bb88cec8a4ed4b530.webp) ```csharp using Kingdee.BOS.Core.Bill.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.NotePrint; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Util; using System.Collections.Generic; namespace Fk.PlugInSample.FormPlugIn { [Kingdee.BOS.Util.HotUpdate] public class NotePrintPlugIn_ApproveLine : AbstractBillPlugIn { private static readonly string WorkFlowTitleKey = "approve_WorkFlowTitle"; private static readonly string WorkFlowTitle = "ac_approve_WorkFlowTitle"; private static readonly string WorkFlowFieldKey = "approve_WorkFlowValue"; private static readonly string WorkFlowValue = "ac_approve_WorkFlowValue"; private static readonly string DataSourceId = "workflow.approveLine"; private static readonly string TemplateId = "2c799e1a-3cdd-4aad-9666-7a249d497fc7"; /// <summary> /// 动态列接口 /// </summary> /// <param name="e"></param> public override void OnQueryDynamicColumns(QueryDynamicColumnsEventArgs e) { if(e.DataSourceId.EqualsIgnoreCase(DataSourceId) && e.DataGridId.EqualsIgnoreCase("dataGrid3") && e.DynamicColumnId.EqualsIgnoreCase("column24")) { List<DynamicColumn> lineDynamicCols = new List<DynamicColumn>(); var titleCol = new DynamicColumn() { Caption = "标题", FieldKey = WorkFlowTitleKey, }; lineDynamicCols.Add(titleCol); for (int i = 0; i < 5; ++i) { var valCol = new DynamicColumn() { Caption = string.Format("动态内容列_{0}", i), FieldKey = string.Format("{0}_{1}", WorkFlowFieldKey, i), }; lineDynamicCols.Add(valCol); } e.DynamicColumns = lineDynamicCols; } } private Dictionary<string, int> dict = new Dictionary<string, int>() { { "ac_approve_FActivityName",0}, { "ac_approve_FReceiverName",1}, { "ac_approve_FCompletedTime",2}, { "ac_approve_FDisposition",3}, }; private List<string> fields = new List<string>() { "节点名称","处理人","处理时间","意见" }; /// <summary> /// 套打干预数据包 /// </summary> /// <param name="e"></param> public override void OnPrepareNotePrintData(PreparePrintDataEventArgs e) { if (!e.NotePrintTplId.EqualsIgnoreCase(TemplateId)) return; if (!e.DataSourceId.EqualsIgnoreCase(DataSourceId)) return; var objType = e.DynamicObjectType; objType.RegisterProperty(WorkFlowTitle, typeof(object)); for (int i = 0; i < 5; ++i) { var key = string.Format("{0}_{1}", WorkFlowValue, i); objType.RegisterProperty(key, typeof(object)); } List<DynamicObject> displayData = new List<DynamicObject>(); int displayDataIdx = 0; // 5个1行 for (int i = 0; i < e.DataObjects.Length; i += 5) { for (int cnt = 0; cnt < fields.Count; ++cnt) { var newObj = new DynamicObject(objType); newObj[WorkFlowTitle] = fields[cnt]; displayData.Add(newObj); } for (int j = 0; j < 5; ++j) { int idx = i + j; if (idx >= e.DataObjects.Length) break; var rowObj = e.DataObjects[idx]; foreach (var keyValPair in dict) { var key = keyValPair.Key; var newRowDif = keyValPair.Value; var newRowIdx = displayDataIdx + newRowDif; var prop = string.Format("{0}_{1}", WorkFlowValue, j); displayData[newRowIdx][prop] = rowObj[key]; } } displayDataIdx += 4; } e.DataObjects = displayData.ToArray(); } } } ``` 【效果】 ![20240618 1642.webp](/download/0100e3fc0475cce14fd1a2434dda9de6540e.webp)

套打.二开案例.审批路线横向打印

【场景】审批路线横向打印【方案】数据表格动态列+套打插件二开![image.webp](/download/0100c15fffbf6cdb46709666ab7baa2ced99.webp)![ima...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息