电脑桌面
添加蚂蚁七词文库到电脑桌面
安装后可以在桌面快捷访问

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

来源:金蝶云社区作者:金蝶2024-09-233

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

【应用场景】

树形单据体,默认不支持块粘贴,需要在插件中对块粘贴新增的数据行设置正确的行主键后,才能正常的显示。


【案例演示】

采购合同,新增树形单据体,对物料字段进行块粘贴后能正常显示数据行。


【实现步骤】

<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

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

【应用场景】树形单据体,默认不支持块粘贴,需要在插件中对块粘贴新增的数据行设置正确的行主键后,才能正常的显示。【案例演示】采购合同...
点击下载文档文档为doc格式

声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

已经是第一篇
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息
QQ群
  • 答案:my7c点击这里加入QQ群
支持邮箱
微信
  • 微信