二开案例.单据插件.单据上查询基础资料时设置过滤条件
【应用场景】给单据上的基础资料查询设置过滤条件,简单的过滤条件可以通过BOSIDE完成设置(https://vip.kingdee.com/article/104902355959012352),更复杂的场景需使用插件的方式设置。
【案例演示】采购订单,编辑界面,给供应商和采购部门分别设置过滤条件。
【实现步骤】
<1>编写单据插件,代码如下。
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using System.ComponentModel;
namespace Jac.XkDemo.BOS.Business.PlugIn
{
/// <summary>
/// 【单据插件】单据上查询基础资料时设置过滤条件
/// </summary>
[Description("【单据插件】单据上查询基础资料时设置过滤条件"), HotUpdate]
public class SetBaseDataFilterBeforeF7SelectBillPlugIn : AbstractBillPlugIn
{
public override void BeforeF7Select(BeforeF7SelectEventArgs e)
{
base.BeforeF7Select(e);
// 给供应商查询附加过滤条件
if (e.FieldKey.EqualsIgnoreCase("FSupplierId"))
{
e.ListFilterParameter.Filter = e.ListFilterParameter.Filter.JoinFilterString(" FNumber like '%VE%' ");
return;
}
// 给采购部门查询附加过滤条件
if (e.FieldKey.EqualsIgnoreCase("FPurchaseDeptId"))
{
e.ListFilterParameter.Filter = e.ListFilterParameter.Filter.JoinFilterString(" FName like N'%总装%' ");
return;
}
// 未审核的基础资料也显示出来
//e.IsShowApproved = false;
// 已禁用的基础资料也显示出来
//e.IsShowUsed = false;
}
}
}
<2>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。
<3>BOSIDE扩展采购订单,注册表单插件,保存元数据,开发完毕。
现在可以登录业务站点,打开采购订单编辑界面,检验一下插件效果啦。
供应商查询效果:
供应商查询SQL:
SELECT TOP 5
t0.FNUMBER AS FNumber ,
t0_L.FNAME AS FName ,
t0.FSUPPLIERID AS FSupplierId
FROM T_BD_SUPPLIER t0
LEFT JOIN T_BD_SUPPLIERBASE t1 ON ( t0.FSUPPLIERID = t1.FSUPPLIERID )
LEFT JOIN T_BD_SUPPLIERBUSINESS t2 ON ( t0.FSUPPLIERID = t2.FSUPPLIERID )
LEFT JOIN T_BD_SUPPLIER_L t0_L ON ( t0.FSUPPLIERID = t0_L.FSUPPLIERID
AND t0_L.FLOCALEID = 2052
)
WHERE ( (( t2.FFREEZELIMIT NOT LIKE '%Order%' )
AND ( ( t1.FSUPPLYCLASSIFY <> 'WW' )
AND ( t0.FNUMBER LIKE '%VE%' )
))
)
AND t0.FUSEORGID = 100003
AND t0.FDOCUMENTSTATUS = 'C'
AND t0.FFORBIDSTATUS = 'A'
ORDER BY t0.FNUMBER;
采购部门查询效果:
采购部门查询SQL:
SELECT TOP 5
t0.FNUMBER AS FNumber ,
t0_L.FNAME AS FName ,
t0.FDEPTID AS FDEPTID
FROM T_BD_DEPARTMENT t0
LEFT JOIN T_BD_DEPARTMENT_L t0_L ON ( t0.FDEPTID = t0_L.FDEPTID
AND t0_L.FLOCALEID = 2052
)
WHERE ( (t0_L.FNAME LIKE N'%总装%') )
AND t0.FUSEORGID = 100003
AND t0.FDOCUMENTSTATUS = 'C'
AND t0.FFORBIDSTATUS = 'A'
ORDER BY t0.FNUMBER;
----------------------------------------------------------------------------------------
【金蝶云星空BOS二次开发案例演示】https://vip.kingdee.com/article/94751030918525696
二开案例.单据插件.单据上查询基础资料时设置过滤条件
本文2024-09-23 04:20:34发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-164689.html