二开案例.单据转换插件.全事件演示
【案例演示】演示单据转换插件所包含的全部事件及其触发顺序。
【实现步骤】
<1>编写单据转换插件,代码如下。
using Kingdee.BOS.Util;
using System;
using System.ComponentModel;
namespace Jac.XkDemo.BOS.App.PlugIn
{
/// <summary>
/// 【单据转换插件】全事件
/// </summary>
[Description("【单据转换插件】全事件"), HotUpdate]
public class AllEventConvertPlugIn : Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.AbstractConvertPlugIn
{
#region event
public override void OnInitVariable(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.InitVariableEventArgs e)
{
PrintEventInfo("OnInitVariable", e);
base.OnInitVariable(e);
}
public override void OnQueryBuilderParemeter(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.QueryBuilderParemeterEventArgs e)
{
PrintEventInfo("OnQueryBuilderParemeter", e);
base.OnQueryBuilderParemeter(e);
}
public override void OnBeforeGetSourceData(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.BeforeGetSourceDataEventArgs e)
{
PrintEventInfo("OnBeforeGetSourceData", e);
base.OnBeforeGetSourceData(e);
}
public override void OnInSelectedRow(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.InSelectedRowEventArgs e)
{
PrintEventInfo("OnInSelectedRow", e);
base.OnInSelectedRow(e);
}
public override void OnBeforeFieldMapping(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.BeforeFieldMappingEventArgs e)
{
PrintEventInfo("OnBeforeFieldMapping", e);
base.OnBeforeFieldMapping(e);
}
public override void OnFieldMapping(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.FieldMappingEventArgs e)
{
PrintEventInfo("OnFieldMapping", e);
base.OnFieldMapping(e);
}
public override void OnAfterFieldMapping(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.AfterFieldMappingEventArgs e)
{
PrintEventInfo("OnAfterFieldMapping", e);
base.OnAfterFieldMapping(e);
}
public override void OnCreateLink(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.CreateLinkEventArgs e)
{
PrintEventInfo("OnCreateLink", e);
base.OnCreateLink(e);
}
public override void OnSetLinkAmount(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.SetLinkAmountEventArgs e)
{
PrintEventInfo("OnSetLinkAmount", e);
base.OnSetLinkAmount(e);
}
public override void OnAfterCreateLink(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.CreateLinkEventArgs e)
{
PrintEventInfo("OnAfterCreateLink", e);
base.OnAfterCreateLink(e);
}
public override void OnGetSourceData(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.GetSourceDataEventArgs e)
{
PrintEventInfo("OnGetSourceData", e);
base.OnGetSourceData(e);
}
public override void OnCreateTarget(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.CreateTargetEventArgs e)
{
PrintEventInfo("OnCreateTarget", e);
base.OnCreateTarget(e);
}
public override void OnParseFilterOptions(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.ParseFilterOptionsEventArgs e)
{
PrintEventInfo("OnParseFilterOptions", e);
base.OnParseFilterOptions(e);
}
public override void OnGetDrawSourceData(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.GetDrawSourceDataEventArgs e)
{
PrintEventInfo("OnGetDrawSourceData", e);
base.OnGetDrawSourceData(e);
}
public override void OnCreateDrawTarget(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.CreateDrawTargetEventArgs e)
{
PrintEventInfo("OnCreateDrawTarget", e);
base.OnCreateDrawTarget(e);
}
public override void OnBeforeGroupBy(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.BeforeGroupByEventArgs e)
{
PrintEventInfo("OnBeforeGroupBy", e);
base.OnBeforeGroupBy(e);
}
public override void OnParseFilter(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.ParseFilterEventArgs e)
{
PrintEventInfo("OnParseFilter", e);
base.OnParseFilter(e);
}
public override void OnGetConvertBusinessService(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.ConvertBusinessServiceEventArgs e)
{
PrintEventInfo("OnGetConvertBusinessService", e);
base.OnGetConvertBusinessService(e);
}
public override void AfterConvert(Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args.AfterConvertEventArgs e)
{
PrintEventInfo("AfterConvert", e);
base.AfterConvert(e);
}
#endregion
#region private method
/// <summary>
/// 事件执行次数计数器
/// </summary>
private int counter;
/// <summary>
/// 事件执行次数计数器
/// </summary>
private int Counter
{
get { return ++counter; }
}
/// <summary>
/// 输出事件执行日志
/// </summary>
/// <param name="eventName">事件名称</param>
/// <param name="args">事件参数</param>
private void PrintEventInfo(string eventName, params object[] args)
{
var parameters = string.Empty;
try
{
//parameters = Newtonsoft.Json.JsonConvert.SerializeObject(args);// 性能较差,可能会导致页面假死
}
catch
{
}
var log = string.Format("序号:{0},执行时间:{1},事件名称:{2},事件参数:{3}", Counter, DateTime.Now.ToString("yyyy -MM-dd HH:mm:ss.fff"), eventName, parameters);
System.Diagnostics.Debug.Print(log);
Kingdee.BOS.Log.Logger.Error("EVENT", log, null);
}
#endregion
}
}
<2>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。
<3>BOSIDE打开单据转换主界面,找到采购申请单-采购订单的单据转换规则,扩展该规则,注册单据转换插件,保存元数据,开发完毕。
现在可以登录业务站点,打开采购申请单列表,执行下推采购订单操作,观察单据转换插件的事件的触发顺序啦。
【金蝶云星空BOS二次开发案例演示】https://vip.kingdee.com/article/94751030918525696
二开案例.单据转换插件.全事件演示
本文2024-09-23 04:21:28发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-164787.html