注意: 如果需要在列表打印时生效,就要写在列表插件(继承自AbstractListPlugin)里面; 单据打印生效就写在单据插件(AbstractBillPlugin)里面, 建议都写,保持一致
/// <summary>
/// 通过重载此方法实现对查询参数的修改
/// 需求: 仅打印数量大于 100 的分录
/// </summary>
/// <param name="e"></param>
public override void OnPrepareNotePrintQueryParam(Core.DynamicForm.PlugIn.Args.PrepareNotePrintQueryParamEventArgs e)
{
if (e.DataSourceId.Equals("单据体Key", StringComparison.OrdinalIgnoreCase))
{
QueryBuilderParemeter parameter = e.QueryParameter;
parameter.FilterClauseWihtKey = "FQty > 100";
}
base.OnPrepareNotePrintQueryParam(e);
}
/// <summary>
/// 需求:合并套打时,将单据编号合并显示,并用’,‘分隔
/// </summary>
/// <param name="e"></param>
public override void OnPrepareNotePrintData(Core.DynamicForm.PlugIn.Args.PreparePrintDataEventArgs e)
{
if (e.DataSourceId.Equals("单据头Key", StringComparison.OrdinalIgnoreCase))
{
if (e.IsMergedPrint)
{
DynamicObject[] qureyObjs = e.DataObjects;
foreach (var obj in qureyObjs)
{
obj["BillNo"] = string.Join(",", e.BillIds);
}
}
}
base.OnPrepareNotePrintData(e);
}