using Kingdee.BOS.Core.Bill;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Core.SqlBuilder;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace JC.Kingdee.BOS.POBillOpen
{
/// <summary>
/// 【列表插件】列表单元格打开超链接
/// </summary>
[Description("【列表插件】列表单元格打开超链接"),HotUpdate]
public class GridCellHyperlinkListPlugIn:AbstractListPlugIn
{
public override void EntryButtonCellClick(EntryButtonCellClickEventArgs e)
{
base.EntryButtonCellClick(e);
if (!e.FieldKey.EqualsIgnoreCase("F_TMMQ_Text"))
{
return;
}
if (e.Row < 0)
{
return;
}
var rowData = this.ListView.CurrentPageRowsInfo.FirstOrDefault(row => row.RowKey == e.Row);
if (rowData==null)
{
return;
}
var formId = "PUR_Requisition";//需要打开的单据标识,可以在BOS单据中查看,采购申请 单
var requisitionMetadata = (FormMetadata)MetaDataServiceHelper.Load(this.Context, formId);
var billNo = this.ListView.SelectedRowsInfo[0].DataRow["F_TMMQ_Text"].ToString();//取选中行的第一行中的F_TMMQ_Text字段值,即采购申请单单号
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);
}
}
}
推荐阅读