套打预览打印共享中心封面的条码信息二开示例
套打打印,如果不是直接点击共享中心封面预览打印,如果模板中使用到了影像的条码等信息,则需要二开实现。
以表单插件为例,代码如下:
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.ShareCenter.Parameter;
using Kingdee.BOS.Workflow.ServiceHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kingdee.BOS.Printing.PlugIn.Test
{
public class ShareImagePrintBillPlugIn : AbstractDynamicFormPlugIn
{
/// <summary>
/// 条码动态字段标识
/// </summary>
public string BarcodeKey { get; set; }
/// <summary>
/// 打印时填充影像数据
/// </summary>
public override void OnPrepareNotePrintData(PreparePrintDataEventArgs e)
{
base.OnPrepareNotePrintData(e);
//建议只开启某个模版或者某些模版,否则会影响不需要影响数据的套打效率
//if (e.NotePrintTplId != "固定模版的ID")
// return;
var plugInProxy = this.View.GetService<DynamicFormViewPlugInProxy>();
//如果是列表插件FullName为Kingdee.BOS.Business.Bill.PlugIn.ShareCenter.ShareCenterListPlugIn
if (!plugInProxy.PlugIns.Any(i => i.GetType().FullName == "Kingdee.BOS.Business.Bill.PlugIn.ShareCenter.ShareCenterFormPlugIn"))
{
if (e.BillIds != null && e.BillIds.Count > 0)
{
if (string.IsNullOrEmpty(this.BarcodeKey))
{
//151:封面打印操作 152:封面预览操作
var oper = this.View.BillBusinessInfo.GetForm().FormOperations.FirstOrDefault(p => p.OperationId == 151 || p.OperationId == 152);
if (oper != null)
{
PrintCoverParameter printCoverParameter = oper.Parmeter as PrintCoverParameter;
if (printCoverParameter != null)
{
this.BarcodeKey = printCoverParameter.BarcodeKey;
}
}
}
if (string.IsNullOrEmpty(this.BarcodeKey))
{
string msg = Kingdee.BOS.Resource.ResManager.LoadKDString("打印封面操作参数配置错误,条码动态字段标识不能为空!",
"002012030032100", Kingdee.BOS.Resource.SubSystemType.BOS);
throw new Exception(msg);
}
string formId = this.View.BusinessInfo.GetForm().Id;
string keyValue = e.BillIds[0];
ShareCenterServiceHelper.FillPrintCoverData(this.Context, e, formId, keyValue, this.BarcodeKey);
}
}
}
}
}
?
套打预览打印共享中心封面的条码信息二开示例
本文2024-09-23 04:19:14发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-164553.html