using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Core.Bill;
namespace JC.Kingdee.BOS.POBillOpen
{
/// <summary>
/// [单据插件]表格单元格超链接点击事件
/// </summary>
[Description("[单据插件]表格单元格超链接点击事件"),HotUpdate]
public class GridCellHyperlinkBillPlugIn: AbstractBillPlugIn
{
/// <summary>
/// 单元格单击事件超连接
/// </summary>
/// <param name="e"></param>
public override void EntryButtonCellClick(EntryButtonCellClickEventArgs e)
{
base.EntryButtonCellClick(e);
if (!e.FieldKey.EqualsIgnoreCase("F_TMMQ_Text"))
{
return;
}
if (e.Row<0)
{
return;
}
var formId = "PUR_Requisition";//需要打开的单据标识,可以在BOS单据中查看,采购申请 单
var requisitionMetadata = (FormMetadata)MetaDataServiceHelper.Load(this.Context, formId);
var billNo = this.Model.GetValue(e.FieldKey, e.Row);//获取选中行中的采购申请单号
var objs = BusinessDataServiceHelper.Load(this.Context, requisitionMetadata.BusinessInfo, new List<SelectorItemInfo>(new[] { new SelectorItemInfo("FID") }), OQLFilter.CreateHeadEntityFilter($"FBillNo='{billNo}'"));
if (objs==null || objs.Length==0)
{
return;
}
var pkId = objs[0]["Id"].ToString();
var showParameter = new BillShowParameter
{
FormId = formId,//业务对象标识
PKey = pkId,
Status = OperationStatus.VIEW,//查看模式打开(EDIT编辑模式)
};
this.View.ShowForm(showParameter);
}
}
}
推荐阅读