如何获得自定义处理状态屏幕以显示进度或处理的记录

How can I get a custom processing status screen to show progress or records processed

我有一个自定义流程屏幕,它的工作原理与预期的差不多,只是在处理过程中弹出的状态/监控屏幕不显示进度,或者像在其他库存处理屏幕上那样处理的记录.

库存处理弹出窗口如下所示:

这是我的自定义弹出窗口的样子。它没有显示 'Remaining' 并且在完成之前几乎看起来像这样:

完成后显示:

是否需要在我的处理屏幕中添加一些东西才能获得此功能?

非常感谢...

你的处理方法是用PXProcessing.SetCurrentItem(object)设置当前处理项然后用PXProcessing.SetProcessed()或PXProcessing.SetError(ExceptionObject)设置状态当前处理项。

示例:

public PXProcessing<SOLine> linesToBeProcessed;

protected virtual void ProcessOrderLines(List<SOLines> lines)
{
    foreach (SOLine line in lines)
    {
        PXProcessing<SOLine>.SetCurrentItem(line);
        try
        {
            //logic

            PXProcessing<SOLine>.SetProcessed();
        }
        catch (Exception ex)
        {
            PXProcessing<SOLine>.SetError(ex);
        } 
    }
}

注意:在这些方法中使用的 DACNAME 是声明的 PXProcessing 视图中使用的主要 DAC。

这是我们 Acumatica Surveys 项目中的一段代码,描述了我们如何控制各种类型的消息传递。 注意 SetInfo、SetWarning 和 SetError 让我知道这是否有帮助?

/// <summary>
    /// This method will create a new collector record and invoke a notification on it.
    /// </summary>
    /// <param name="surveyUser"></param>
    /// <param name="graph"></param>
    /// <param name="surveyCurrent"></param>
    /// <param name="surveyUserList"></param>
    /// <param name="filter"></param>
    /// <remarks>
    /// </remarks>
    /// <returns>
    ///     Whether or not an error has occured within the process which is used by the main calling process to throw a final exception at the end of the process
    /// </returns>
    private static bool SendNew(SurveyUser surveyUser, SurveyCollectorMaint graph, Survey surveyCurrent, List<SurveyUser> surveyUserList, SurveyFilter filter) {
        bool errorOccurred = false;
        try {
            string sCollectorStatus = (surveyUser.UsingMobileApp.GetValueOrDefault(false)) ?
                                       SurveyResponseStatus.CollectorSent : SurveyResponseStatus.CollectorNew;
            graph.Clear();
            SurveyCollector surveyCollector = new SurveyCollector {
                CollectorName =
                    $"{surveyCurrent.SurveyName} {PXTimeZoneInfo.Now:yyyy-MM-dd hh:mm:ss}",
                SurveyID = surveyUser.SurveyID,
                UserID = surveyUser.UserID,
                CollectedDate = null,
                ExpirationDate = CalculateExpirationDate(filter.DurationTimeSpan),
                CollectorStatus = sCollectorStatus
            };
            surveyCollector = graph.Collector.Insert(surveyCollector);
            graph.Persist();
            SendNotification(surveyUser, surveyCollector);
            if (sCollectorStatus == SurveyResponseStatus.CollectorSent) {
                PXProcessing<SurveyUser>.SetInfo(surveyUserList.IndexOf(surveyUser), Messages.SurveySent);
            } else {
                PXProcessing<SurveyUser>.SetWarning(surveyUserList.IndexOf(surveyUser), Messages.NoDeviceError);
            }
        } catch (AggregateException ex) {
            errorOccurred = true;
            var message = string.Join(";", ex.InnerExceptions.Select(e => e.Message));
            PXProcessing<SurveyUser>.SetError(surveyUserList.IndexOf(surveyUser), message);
        } catch (Exception e) {
            errorOccurred = true;
            PXProcessing<SurveyUser>.SetError(surveyUserList.IndexOf(surveyUser), e);
        }
        return errorOccurred;
    }