Acumatica:当数据更改时,消息 "leave site?" "Changes you made may not be saved" 不会出现以防止丢失更改

Acumatica: when the data changed, message "leave site?" "Changes you made may not be saved" doesn't appear to prevent loosing the changes

通常在所有 Acumatica 页面中,当您进行更改时,框架会向您抛出标准 javascript 消息:"Changes you made may not be saved" 以防止您丢失更改:

导致此行为的设置是什么? 我有一个没有此类对话框的屏幕,我不知道如何导致它发生。

这个有问题的页面是一个弹出窗口 window:

使用 PXRedirectRequiredException:

打开弹出窗口时不会出现此问题
throw new PXPopupRedirectException(currentPayCalendarMaint, true, string.Empty);

当你用PXRedirectRequiredException打开它时:

throw new PXRedirectRequiredException(currentPayCalendarMaint, true, string.Empty);

框架作为常规浏览器弹出窗口打开对话框,并按预期显示所需消息 ("Changes you made may not be saved"):

是否可以在不单独打开弹出窗口的情况下实现所需的行为window?

如有任何帮助或建议,我将不胜感激。

我相信在正常情况下,这直接与图形上的 IsDirty 标志或图形中的缓存相关联。当任何缓存中的值发生更改时,图形的 IsDirty 标志将设置为 true。我已经看到一些代码在特定缓存上手动将 IsDirty 设置为 false 以导致您所描述的问题。这可能已经发生,但也有可能您的代码实际上并未更新任何缓存中的任何值。没有你的代码,我只能推测。

来自源代码的注释,其中 IsDirty 在 PX.Data.PXGraph 中定义:

// Summary:
//     Gets the value that indicates whether there are modified data records not saved
//     to the database in the caches related to the graph data views. If the IsDirty
//     property of at least one cache object is true, the IsDirty property of the graph
//     is also true.
public virtual bool IsDirty { get; }

使用订单构造函数的 SOCreateShipment 摘录:

[PXFilterable]
public PXFilteredProcessing<SOOrder, SOOrderFilter> Orders;
...

public virtual IEnumerable orders()
{
    PXUIFieldAttribute.SetDisplayName<SOOrder.customerID>(Caches[typeof(SOOrder)], Messages.CustomerID);
    ...
    PXView.StartRow = 0;

    Orders.Cache.IsDirty = false;
}

目前解决该问题的唯一方法是在新的标准浏览器中打开 window,如下所示: 而不是 Aucmatica 对话框:

为此,我们需要打开对话框:

throw new PXRedirectRequiredException(currentPayCalendarMaint, true, string.Empty)
            {
                Mode = PXBaseRedirectException.WindowMode.NewWindow
            };

而不是这个:

throw new PXPopupRedirectException(currentPayCalendarMaint, string.Empty, true);