调用BeforeF7Select事件
虽然论坛有很多示例,但是缺少引用的代码或截图,对于新手来说只能一知半解,我就是深感其中的痛苦,只能自己摸索,代码里面虽然不知道要引用哪些就全部引用了,有大佬知道的可以指点下,以下是代码和截图:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Data;
using Kingdee.BOS;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Util;
using Kingdee.BOS.App;
using Kingdee.BOS.Core;
using Kingdee.BOS.Contracts;
namespace SSCWGL.AbstractBill.PlugIn
{
[Description("BeforeF7Select事件")]
[Kingdee.BOS.Util.HotUpdate] //增加热启动,不用重启IIS
public class Class1 : AbstractBillPlugIn
{
//F7,事件
public override void BeforeF7Select(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BeforeF7SelectEventArgs e)
{
base.BeforeF7Select(e);
if (e.FieldKey.EqualsIgnoreCase("F_ora_Base")) //F_ora_Base为基础资料的字段名
{
HashSet<long> ids = new HashSet<long>();
int rowCount = this.Model.GetEntryRowCount("FEntity");
for (int i = 0; i < rowCount; i++)
{
DynamicObject fldValue = this.Model.GetValue("F_ora_Base", i) as DynamicObject;
if (fldValue == null) continue;
long id = Convert.ToInt64(fldValue[0]);
if (ids.Contains(id) == false)
{
ids.Add(id);
}
}
if (ids.Count > 0)
{
e.ListFilterParameter.Filter = string.Format(" FID NOT IN ({0}) ", string.Join(",", ids));
}
}
}
}
}
推荐阅读