多类别基础资料过滤问题
金蝶云社区-马拴宝
马拴宝
0人赞赏了该文章 1,250次浏览 未经作者许可,禁止转载编辑于2017年10月10日 21:32:40

项目中需要根据某些条件来设置往来单位(为多类别基础资料)设置过滤条件。
插件处理参考如下:
[code] public override void BeforeF7Select(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BeforeF7SelectEventArgs e)
{
base.BeforeF7Select(e);
string key;
switch (key = e.FieldKey.ToUpperInvariant())
{
case "FPRODEPTNAME":
{
string filterStr;
if (this.SetProDeptFilter(out filterStr))
{
e.ListFilterParameter.Filter = filterStr;
}
break;
}
}
}

public override void BeforeSetItemValueByNumber(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BeforeSetItemValueByNumberArgs e)
{
base.BeforeSetItemValueByNumber(e);
string key = e.BaseDataFieldKey.ToUpper();
switch (key)
{
case "FPRODEPTNAME":
{
string filterStr;
if (this.SetProDeptFilter(out filterStr))
{
e.Filter = filterStr;
}
break;
}
default:
break;
}
}

///


/// 根据协议类型判断协议单位
///

private bool SetProDeptFilter(out string filterStr)
{
filterStr = "";
DynamicObject proType = this.View.Model.GetValue("FProType") as DynamicObject;
string deptType = this.View.Model.GetValue("FProDeptType").ToString();
if (proType != null && deptType != null)
{
if (proType["Number"].ToString().Equals("002") && deptType.Equals("BD_Supplier"))
{
filterStr = "FNumber IN(SELECT FNumber FROM T_BD_Supplier WHERE FDOCUMENTSTATUS='C' AND FFORBIDSTATUS='A' AND F_HK_AGENCY=1)";
}
}
return !string.IsNullOrWhiteSpace(filterStr);
}
}[/code]