首页 > 解决方案 > 如何在 AP 503000 屏幕中向进程按钮添加条件

问题描述

当我单击进程按钮时,我需要显示一条消息。如果选择的金额大于 700 并且低于,则不显示消息。

image01

但是通过单击确定。显示此消息

image02

我的代码是:

image03 image04

提前谢谢了!

标签: acumaticaacumatica-kb

解决方案


避免在 RowSelected 方法中显示对话框。每次获取记录时都会调用该方法,因此它将以无法控制的循环显示它。

还要检查对话框的返回值以了解按下了哪个按钮。

要在按下 Process 按钮时显示对话框,请覆盖 Process 方法。您可能必须根据上下文(PXGraph/PXGraphExtension)更改“Base”:

[PXProcessButton]
[PXUIField(DisplayName = "Process", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
protected override IEnumerable Process(PXAdapter adapter)
{
    if (Base.Ask("ConfirmationTitle", "ConfirmationMessage", MessageButtons.YesNo) != WebDialogResult.Yes)
    {
        // Click on No, don't execute the base Process action
        return adapter.Get();
    }

    // Click on Yes, execute the base Process action
    return Base.Process(adapter);               
}

推荐阅读