在自定义按钮操作期间显示处理图标

时间:2017-03-03 18:33:06

标签: acumatica

我有一个由屏幕上的按钮激活的过程 - 但是我想知道如何让它像过程按钮那样工作,旋转轮发生在那里,绿色复选框出现在最后。我已经获得了以下代码,我将其包装在PXLongOperation.StartOperation(...)中,如下所示(PXLongOperation在这里被注释掉了,因为它似乎没有做任何事情):

 public PXAction<APInvoice> CreatePOBillings;
   // [PXButton(CommitChanges = true)]
    [PXProcessButton]
    [PXUIField(DisplayName = "Create PO Billings", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
    protected void createPOBillings()
    {
        int i = 0;
        try
        {
            //This wraps the whole process into a 'PXLongOperation' function that will create the spinning 'busy' wheel at the top toolbar...
            //PXLongOperation.StartOperation(this, delegate()
            //{

                var apinvoice = (APInvoice)Base.Document.Current;
                if (apinvoice == null) return;

                string RefNbr = apinvoice.RefNbr;

                //Run the stored procedure which will get the records to create the Project Transactions.  This will populate the table 'xCreatePOBilings':
                var pars = new PXSPParameter[] { new PXSPInParameter("@p_RefNbr", RefNbr) }; //, new PXSPOutParameter("p2", outp2) };
                var results = PXDatabase.Execute("xspMarketingPOBilling", pars);

                //Get the dataset from the xCreatePOBillings table which was populated from the stored procedure above:
                PXResultset<xCreatePOBillings> res = PXSelect<xCreatePOBillings,
                                                     Where<xCreatePOBillings.ponbr, Equal<Required<xCreatePOBillings.ponbr>>>
                                                    ,OrderBy<Asc<xCreatePOBillings.ponbr
                                                            ,Asc<xCreatePOBillings.destProject
                                                            ,Asc<xCreatePOBillings.startDate>>>>>.Select(Base, RefNbr);

                //Create the graph for the Project Transactions screen:
                RegisterEntry graph = PXGraph.CreateInstance<RegisterEntry>();

                //Create a new cache object for the header of Project Transactions:
                PMRegister pmreg = new PMRegister();
                pmreg.Module = "PM";
                graph.Document.Insert(pmreg);

                //Define the cache for the Project Transactions screen's grid records:
                PMTran pmtrn;

                foreach (PXResult<xCreatePOBillings> rec in res)
                {
                   ....

                   graph.Actions.PressSave();
             //});

如果有可能,最好的方法是什么?

1 个答案:

答案 0 :(得分:1)

在BLC扩展类中调用静态PXLongOperation.StartOperation方法时,作为第一个参数,它只能接受Base属性而不是this关键字:

PXLongOperation.StartOperation(Base, delegate()
{
   ...
}