二开案例.表单插件.树形单据体支持块粘贴

【应用场景】
树形单据体,默认不支持块粘贴,需要在插件中对块粘贴新增的数据行设置正确的行主键后,才能正常的显示。
【案例演示】
采购合同,新增树形单据体,对物料字段进行块粘贴后能正常显示数据行。
【实现步骤】
<1>编写表单插件,代码如下。
using Kingdee.BOS.App.Core.Utils;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using System.ComponentModel;
using System.Linq;
namespace Jac.XkDemo.BOS.Business.PlugIn
{
/// <summary>
/// 【表单插件】树形单据体支持块粘贴
/// </summary>
[Description("【表单插件】树形单据体支持块粘贴"), HotUpdate]
public class TreeEntryEntityBlockPastingFormPlugIn : AbstractDynamicFormPlugIn
{
#region var
/// <summary>
/// 树形单据体的Key
/// </summary>
private string TreeEntryEntityKey = "F_Jac_Entity";
#endregion
#region 插件事件
/// <summary>
/// 分录行创建后事件
/// </summary>
/// <param name="e"></param>
public override void AfterCreateNewEntryRow(CreateNewEntryEventArgs e)
{
base.AfterCreateNewEntryRow(e);
if (e.Entity.Key.EqualsIgnoreCase(TreeEntryEntityKey))
{
NewEntryRowSetRowIdFieldValue(this.View, TreeEntryEntityKey, e.Row);
}
}
/// <summary>
/// 分录行复制后事件
/// </summary>
/// <param name="e"></param>
public override void AfterCopyRow(AfterCopyRowEventArgs e)
{
base.AfterCopyRow(e);
if (e.EntityKey.EqualsIgnoreCase(TreeEntryEntityKey))
{
// 新行需要重新设置行标识
NewEntryRowSetRowIdFieldValue(this.View, TreeEntryEntityKey, e.NewRow);
return;
}
}
/// <summary>
/// 给新增分录行设置行标识
/// </summary>
/// <param name="view"></param>
/// <param name="key"></param>
/// <param name="rowIndex"></param>
private static void NewEntryRow
二开案例.表单插件.树形单据体支持块粘贴
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。



