44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
|
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
|
using Kingdee.BOS.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace CYG.CB_PROACNTGROUP
|
|
{
|
|
/// <summary>
|
|
/// 【表单插件】1.单据上查询辅助资料时设置过滤条件
|
|
/// </summary>
|
|
[Description("【表单插件】单据上查询基础资料时设置过滤条件"), HotUpdate]
|
|
public class BillEventPlugInEx : AbstractDynamicFormPlugIn
|
|
{
|
|
public override void BeforeF7Select(BeforeF7SelectEventArgs e)
|
|
{
|
|
base.BeforeF7Select(e);
|
|
|
|
// 给某个辅助资料字段的查询附加过滤条件
|
|
|
|
if (e.FieldKey.EqualsIgnoreCase("FPRODUCTID"))
|
|
{
|
|
var id = this.Model.DataObject["Id"].Long2Int();
|
|
|
|
var details = this.View.BusinessInfo.GetEntity("FEntity");
|
|
var entry = this.View.Model.GetEntityDataObject(details);
|
|
//var a = JsonUtil.Serialize(entry);
|
|
var idList = entry.Select(x => x["PRODUCTID_Id"].Long2Int()).Where(w => w != 0);
|
|
// 只显示编码0开头的辅助资料
|
|
|
|
if (idList.Any())
|
|
e.ListFilterParameter.Filter = e.ListFilterParameter.Filter.JoinFilterString($" FMATERIALID NOT IN ({string.Join(",", idList)})");
|
|
|
|
e.ListFilterParameter.Filter = e.ListFilterParameter.Filter.JoinFilterString($" FMATERIALID NOT IN (SELECT FPRODUCTID FROM T_CB_PROACNTENTRY WHERE FPRODUCTGROUPID != {id})");
|
|
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|