目前审批路线处理人节点打印出来是“用户名称”,如果打印“用户账号”可以二开处理。
二开插件参考代码:
[code]using System;
using System.Collections.Generic;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Orm.Metadata.DataEntity;
using System.Data;
using Kingdee.BOS.App.Data;
namespace PrintPlugInTest
{
public class TestPrintPlugin1 : AbstractBillPlugIn
{
public override void OnPrepareNotePrintData(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.PreparePrintDataEventArgs e)
{
if (e.DataSourceId.Equals("workflow.approveLine", StringComparison.OrdinalIgnoreCase))
{
DynamicObject billObj = this.Model.DataObject;
string sql = "/*dialect*/select t.fuseraccount, t.fname from T_SEC_USER t";
DataSet dataset = DBUtils.ExecuteDataSet(this.Context, sql);
Dictionary
foreach (DataTable dtt in dataset.Tables)
{
for (int i = 0; i < dtt.Rows.Count; i++)
{
try
{
myDictionary.Add(dtt.Rows[i]["FNAME"].ToString(), dtt.Rows[i]["FUSERACCOUNT"].ToString());
}
catch (Exception ex)
{
//log
}
}
}
//注册临时字段
DynamicObjectType dt = e.DynamicObjectType;
dt.RegisterSimpleProperty(
"ac_approve_FReceiverAccount",
typeof(string),
attributes: new SimplePropertyAttribute() { Alias = "ac_approve_FReceiverAccount" }
);
List
foreach (DynamicObject obj in e.DataObjects)
{
DynamicObject doo = new DynamicObject(dt);
doo["ac_approve_FActivityName"] = obj["ac_approve_FActivityName"];
doo["ac_approve_FActivityStatu"] = obj["ac_approve_FActivityStatu"];
doo["ac_approve_FStartActivity"] = obj["ac_approve_FStartActivity"];
doo["ac_approve_FTargetActivity"] = obj["ac_approve_FTargetActivity"];
doo["ac_approve_FActionName"] = obj["ac_approve_FActionName"];
doo["ac_approve_FReceiverName"] = obj["ac_approve_FReceiverName"];
doo["ac_approve_FActionResult"] = obj["ac_approve_FActionResult"];
doo["ac_approve_FDisposition"] = obj["ac_approve_FDisposition"];
doo["ac_approve_FCompletedTime"] = obj["ac_approve_FCompletedTime"];
doo["ac_approve_FConsignNames"] = obj["ac_approve_FConsignNames"];
//修改一般字段值
if (obj.DynamicObjectType.Properties.ContainsKey("ac_approve_FReceiverName"))
{
string name = obj["ac_approve_FReceiverName"].ToString();
if (myDictionary.ContainsKey(name))
{
string account = myDictionary[name];
doo["ac_approve_FReceiverAccount"] = account;
}
}
notePrintEntryRows.Add(doo);
}
e.DataObjects = notePrintEntryRows.ToArray();
}
base.OnPrepareNotePrintData(e);
}
}
}
[/code]套打模板设置,通过GetValue取二开代码里面注册的动态字段的值:
打印预览效果:
推荐阅读