二开案例.点击明细行,显示附件列表

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

二开案例.点击明细行,显示附件列表

实现效果:点击单据体明细行,在右侧显示该行的附件列表。

image.webp

1、在单据上添加面板,ID为FPanelAttachmentList,用于显示附件列表



image.webp


2、插件代码

using Kingdee.BOS.Core;
using Kingdee.BOS.Core.Attachment;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Core.Metadata.FieldElement;
using Kingdee.BOS.Core.Metadata.FormElement;
using Kingdee.BOS.Resource;
using Kingdee.BOS.ServiceHelper;
using System;

namespace Test202408
{
    [Kingdee.BOS.Util.HotUpdate]
    public class 显示单据体附件列表 : AbstractBillPlugIn
    {
        string targetPanelKey = "FPanelAttachmentList";
        string attachmentPageId = Guid.NewGuid().ToString();
        public override void EntityRowClick(EntityRowClickEventArgs e)
        {
            var interId = this.View.Model.GetEntryPKValue(e.Key, e.Row).ToString();
            ShowEntityAttachmentList(e.Key, interId, targetPanelKey);
        }

        private void ShowEntityAttachmentList(string entityKey, string entryInterID, string targetPanelKey)
        {
            var view = this.View;
            try
            {
                var attachmentView = view.GetView(attachmentPageId);
                if (attachmentView != null)
                {
                    attachmentView.Close();
                    this.View.SendAynDynamicFormAction(attachmentView);
                    attachmentPageId = Guid.NewGuid().ToString();
                }
            }
            catch { }

            Form frm = this.View.BillBusinessInfo.GetForm();
            var pk = this.View.Model.GetPKValue().ToString();
            AttachmentKey attachmentKey = new AttachmentKey()
            {
                BillType = frm.Id,
                BillNo = "",
                BillInterID = pk,
                EntryKey = entityKey,
                EntryInterID = entryInterID,
                OperationStatus = OperationStatus.EDIT,
                ForceEnableAttachOperate = true
            };
            #region  获取附件数Key
            Entity ty = view.BillBusinessInfo.GetEntity(attachmentKey.EntryKey);
            foreach (Field f in ty.Fields)
            {
                if (f is AttachmentCountField)
                {
                    attachmentKey.AttachmentCountFieldKeys.Add(f.Key);
                }
            }
            #endregion

            string filter = BusinessDataServiceHelper.GetAttachmentListFilter(view.Context, attachmentKey, view.BillBusinessInfo);
            ListShowParameter listpara = new ListShowParameter();
            listpara.IsLookUp = false;
            listpara.CustomParams.Add(KeyConst.AttachmentKey, AttachmentKey.ConvertToString(attachmentKey));
            listpara.Caption = ResManager.LoadKDString("附件管理", "002012030003226", SubSystemType.BOS);
            listpara.FormId = FormIdConst.BOS_Attachment;
            listpara.MultiSelect = true;
            listpara.PageId = attachmentPageId;// string.Format("{0}_{1}_F7", view.PageId, listpara.FormId);
            listpara.OpenStyle.TagetKey = targetPanelKey;
            listpara.OpenStyle.ShowType = ShowType.InContainer;
            listpara.ListFilterParameter.Filter = filter;
            listpara.IsShowQuickFilter = false;

            view.ShowForm(listpara, delegate (FormResult result)
            {
                foreach (string key in attachmentKey.AttachmentCountFieldKeys)
                {
                    view.UpdateView(key, attachmentKey.RowIndex);
                }
            });
        }

    }
}


二开案例.点击明细行,显示附件列表

实现效果:点击单据体明细行,在右侧显示该行的附件列表。1、在单据上添加面板,ID为FPanelAttachmentList,用于显示附件列表2、插件代码us...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息