【问题标题】:PXException is throwing error instead of error message in the gridPXException 在网格中抛出错误而不是错误消息
【发布时间】:2015-07-16 04:19:57
【问题描述】:

我正在使用 PXException,但是它没有在网格中显示错误消息,而是引发了未处理的异常。

throw new PXException("Error message");

错误信息--

我得到以下错误--

错误:错误 #145:一项或多项尚未处理。发送 提出时间:2015 年 4 月 24 日下午 2:38:55 屏幕:ES.60.60.60 命令:进程
细节: 2015 年 4 月 24 日下午 2:38:55 错误: 错误 #145:一项或多项尚未处理。

在 PX.Data.PXProcessingBase1.<>c__DisplayClass131.b__11(List1 list) at PX.Data.PXProcessing1.Process(PXAdapter 适配器) 在 PX.Data.PXAction1.a(PXAdapter A_0) at PX.Data.PXAction1.d__c.MoveNext() 在 PX.Data.PXAction`1.d__c.MoveNext() 在 PX.Web.UI.PXBaseDataSource.tryExecutePendingCommand(String viewName, String[] sortcolumns, Boolean[] descendings, Object[] 搜索, Object[] 参数, PXFilterRow[] 过滤器, DataSourceSelectArguments 参数, Boolean& closeWindowRequired, Int32& adapterStartRow, Int32& adapterTotalRows ) 在 PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)

【问题讨论】:

    标签: acumatica


    【解决方案1】:

    你可以用这个

    throw new PXSetPropertyException("Message", PXErrorLevel.RowError);
    

    编辑语法:

    sender.RaiseExceptionHandling("fieldName", row, null, new PXSetPropertyException("Message", PXErrorLevel.RowError))
    

    在挖掘 Acumatica 源代码后,我发现了这个:

    PXProcessing<APRegister>.SetError(i, e);
    

    i - 您当前处理记录的索引; e - 例外

    【讨论】:

    • 它仍然会抛出异常而不是在网格中显示(行首的小红叉)。
    • 这是一个带有网格的流程页面。当我检查其中一行时,如果出现问题,我想在行的开头显示一条错误消息(与其他屏幕中的 Acumatica 显示相同)
    • 哦,先生。我这里没有 IDE,所以我不记得正确的语法。我相信你可以使用 [sender].RaiseExceptionHandling("fieldname", yourValue, yourRow, new PXSetPropertyException("message", PXErrorLevel.RowError))。哪个是发件人是您要显示错误的当前网格的缓存,您的值可以保留为空,您的行是您要引发错误的行。我不记得哪个论点首先出现。希望它会有所帮助
    • 上面的第三个选项应该可以用于处理页面。就在前几天,我能够通过稍微变体的语法来完成这项工作。我确实必须跟踪行索引,否则所有成功/错误图标最终都在错误的行上。 PXProcessing.SetError(idx, PXMessages.Localize("错误信息。"));以类似的方式,以下显示成功消息 PXProcessing.SetProcessed();
    • PXProcessing.SetCurrentItem(obj); PXProcessing.SetProcessed();将行设置为“已处理”时请注意,您还必须设置当前项目。
    【解决方案2】:

    我遇到了同样的问题,问题是我的 Grid 指向我的 PXSelect&lt;...&gt; 数据视图,而不是 PXProcessing&lt;...&gt; 数据视图。
    我还在网格上设置了以下属性(与现有的工作处理窗口相同)。 AllowPaging = true
    BatchUpdate = true
    ID = grid
    SkinID = PrimaryInquire
    AllowSearch = True
    NoteIndicator = True

    现在像其他屏幕一样工作。

    【讨论】:

      猜你喜欢
      • 2018-04-12
      • 2017-11-13
      • 1970-01-01
      • 2016-03-04
      • 1970-01-01
      • 2017-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多