[Description(" 采购入库单模糊查询")]
public class PROBusinessListMy : AbstractListPlugIn
{
//过滤条件
public override void PrepareFilterParameter(Kingdee.BOS.Core.List.PlugIn.Args.FilterArgs e)
{
base.PrepareFilterParameter(e);
// "( F_PROFILTER Like '%轴承 R12%' )"
string quickFilter = this.ListModel.FilterParameter.QuickFilterString;
if (string.IsNullOrWhiteSpace(quickFilter))
{// 快捷条件为空白,无需处理
return;
}
if (quickFilter.IndexOf("F_PROFILTER") < 0)
{// 快捷条件不含模糊查询字段,
return;
}
string quickFilterNew = quickFilter.Replace("F_PROFILTER", " ").Replace("Like", "").Replace("%", "").Replace("N", "").Replace("'", "").Replace("(", "").Replace(")", "");
// 去掉首尾的括号:从第2个字符开始截取,直到倒数第2个字符
//quickFilter = quickFilter.Substring(1, quickFilter.Length - 2);
// 把过滤条件中的and,替换为大写
string[] splits = { "," };
string[] oldFilters = quickFilterNew.Split(splits, StringSplitOptions.None);
List<string> newFilters = new List<string>();
foreach (string oldFilter in oldFilters)
{
if (quickFilter.IndexOf("F_PROFILTER") < 0)
{// 此段条件中,未包含模糊查询字段,略过
newFilters.Add(oldFilter);
}
else
{
string fldValueNoSpace = oldFilter.Trim();
string fldFilter = string.Format("(" +
"FID like '%{0}%' OR FBillNo like '%{0}%' OR FStockDeptId.FNumber like '%{0}%' OR FStockDeptId.FName like '%{0}%' OR FDate like '%{0}%' " +
"OR FStockerGroupId.FName like '%{0}%' OR FStockerGroupId.FNumber like '%{0}%' OR FStockOrgId.FName like '%{0}%' OR FStockOrgId.FNumber like '%{0}%' " +
"OR FPurchaseDeptId.FName like '%{0}%' OR FPurchaseDeptId.FNumber like '%{0}%' OR FSupplierId.FName like '%{0}%' OR FSupplierId.FNumber like '%{0}%' " +
"OR FPurchaseOrgId.FName like '%{0}%' OR FPurchaseOrgId.FNumber like '%{0}%' OR FPurchaserId.FName like '%{0}%' OR FPurchaserId.FNumber like '%{0}%'" +
"OR FDemandOrgId.FName like '%{0}%'OR FDemandOrgId.FNumber like '%{0}%' OR FSupplyId.FName like '%{0}%' OR FSupplyId.FNumber like '%{0}%'" +
" OR FMaterialId.FNumber like '%{0}%' OR FMaterialName like '%{0}%'" +
" OR FStockId.FNumber like '%{0}%' OR FStockId.FName like '%{0}%'" +
")", fldValueNoSpace);
string newFilter = string.Join(" or ", fldFilter);
newFilters.Add(newFilter);
}
}
// 重新填写快捷过滤条件
//this.ListModel.FilterParameter.QuickFilterString = "(" + string.Join(" AND ", newFilters) + ")";
e.QuickFilterString = "(" + string.Join(" AND ", newFilters) + ")";
}
}
推荐阅读