在 PXProcessing 中获取过滤器

问题描述 投票:0回答:1

我想在 void ProcessBatch 中获取当前的过滤器 取值 currentFilter.Usrdatefin ?

public PXProcessing<Customer,Where <Customer.bAccountID.IsEqual<atFilter.usrClient.FromCurrent>.
    Or<atFilter.usrClient.FromCurrent.IsNull>>> ListProcess;

public ATTGEN()
{
   atFilter currentFilter = this.filter.Current;
   ListProcess.SetProcessDelegate<PostGraph>(ProcessBatch);
   ListProcess.SetProcessCaption("Process");
   ListProcess.SetProcessAllCaption("Process All");
 }    

public static void ProcessBatch(PostGraph pg, Customer un_record)
 {
     try
     {
        PX.SM.Branch un_etab = PXSelect<PX.SM.Branch, Where<PX.SM.Branch.branchID, Equal<Current<AccessInfo.branchID>>>>.Select(pg);
       DateTime oDate = Convert.ToDateTime(currentFilter.Usrdatefin);
      ...
      }
}
acumatica
1个回答
0
投票

您需要将

SetProcessDelegate
移至
filter.RowSelected
,并将您的过滤器记录传递给委托人。

    public void _(Events.RowSelected<atFilter> e)
    {
        if (e.Row == null) return;
        var atFilter = e.Row;
        ListProcess.SetProcessCaption("Process");
        ListProcess.SetProcessAllCaption("Process All");
        ListProcess.SetProcessDelegate(list => ProcessBatch(list, atFilter));
    }

    public static void ProcessBatch(List<Customer> list, atFilter currentFilter)
    {
        var pg = PXGraph.CreateInstance<PostGraph>();
        try
        {
            foreach (var item in list)
            {
                PX.SM.Branch un_etab =
                    PXSelect<PX.SM.Branch, Where<PX.SM.Branch.branchID, Equal<Current<AccessInfo.branchID>>>>
                        .Select(pg);
                DateTime oDate = Convert.ToDateTime(currentFilter.Usrdatefin);
            }
        }
        catch
        {
            
        }
    }
© www.soinside.com 2019 - 2024. All rights reserved.