gpt4 book ai didi

acumatica - 操作按钮未在屏幕上更新

转载 作者:行者123 更新时间:2023-12-02 22:57:51 27 4
gpt4 key购买 nike

我在 QuoteMaint 图表上有一个操作按钮。此操作位于 actions 文件夹中。我根据报价状态设置是否启用该按钮。当用户提交报价时,应启用操作按钮。我单步执行代码,它运行例程来启用按钮,但在屏幕上它未启用。当我刷新屏幕时,它已启用,没有任何问题。代码如下,感谢您的帮助!

    public PXAction<CRQuote> printQuoteSummary;

[PXButton(CommitChanges = true, SpecialType = PXSpecialButtonType.Report)]
[PXUIField(DisplayName = "Print Quote - Summary")]
public IEnumerable PrintQuoteSummary(PXAdapter adapter)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
string actualReportID = "CR604510";

foreach (CRQuote item in adapter.Get<CRQuote>())
{
parameters[nameof(CRQuote.OpportunityID)] = item.OpportunityID;
parameters[nameof(CRQuote.QuoteNbr)] = item.QuoteNbr;

throw new PXReportRequiredException(parameters, actualReportID, "Report " + actualReportID);
}
return adapter.Get();
}

public override void Initialize()
{
base.Initialize();
Base.actionsFolder.AddMenuAction(printQuoteSummary);
Base.Actions.Move("PrintQuote", "printQuoteSummary");
printQuoteSummary.SetEnabled(Base.Quote.Current?.Status == CRQuoteStatusAttribute.Approved || Base.Quote.Current?.Status == CRQuoteStatusAttribute.Sent);
}

protected virtual void CRQuote_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
CRQuote quote = e.Row as CRQuote;
if (quote == null) return;

using (new PXConnectionScope())
{
CalcTotals(quote);
}

printQuoteSummary.SetEnabled(quote.Status == CRQuoteStatusAttribute.Approved || quote.Status == CRQuoteStatusAttribute.Sent);
}

最佳答案

为事件委托(delegate)添加附加参数解决了测试中的问题,请参阅下面的示例。

    protected virtual void CRQuote_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
{
del?.Invoke(cache, e);
CRQuote quote = e.Row as CRQuote;
if (quote == null) return;

using (new PXConnectionScope())
{
CalcTotals(quote);
}
PrintQuoteSummary.SetEnabled(quote.Status == CRQuoteStatusAttribute.Approved || quote.Status == CRQuoteStatusAttribute.Sent);
}

这样,您还可以在初始化方法中删除对启用/禁用的引用,如下所示。

    public override void Initialize()
{
base.Initialize();
Base.actionsFolder.AddMenuAction(PrintQuoteSummary);
Base.Actions.Move("PrintQuote", "printQuoteSummary");
}

关于acumatica - 操作按钮未在屏幕上更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57557460/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com