打开Acumatica屏幕作为弹出窗口,没有右侧导航窗格

时间:2017-01-05 22:02:21

标签: acumatica

我有使用以下代码打开Acumatica屏幕的代码:

    mov     rax, QWORD [ptr1]
    mov     eax, DWORD [rax]
    mov     eax, eax
    test    rax, rax
    js      ?_001
    pxor    xmm0, xmm0
    cvtsi2ss xmm0, rax
    jmp     ?_002

?_001:
    mov     rdx, rax
    shr     rdx, 1
    and     eax, 01H
    or      rdx, rax
    pxor    xmm0, xmm0
    cvtsi2ss xmm0, rdx
    addss   xmm0, xmm0
?_002:
    mov     rax, QWORD [ptr2]

; ... for ptr2 pattern repeats

我通过Querystring传递参数。这样工作正常,但我希望它在没有左侧导航窗格的情况下打开,类似于从“业务帐户”案例选项卡中的案例列表中打开案例时发生的情况。

另外 - 有没有办法指定或检索我所在的当前Acumatica实例的网址?

1 个答案:

答案 0 :(得分:1)

Peter,PXRedirectToUrlException不打算打开Acumatica屏幕。正如Brendan之前建议的那样(How to open a screen as popup from Site Map location),你应该使用PXRedirectRequiredException,将Mode属性设置为NewWindow。

下面的代码片段显示了如何在“发票”屏幕上创建一个按钮,以便在没有左侧导航窗格的情况下在新窗口中打开为发票生成的批次:

public class SOInvoiceEntryExt : PXGraphExtension<SOInvoiceEntry>
{
    public void ARInvoice_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        ARInvoice doc = (ARInvoice)e.Row;
        if (doc == null) return;

        OpenBatch.SetEnabled(doc.BatchNbr != null);
    }

    public PXAction<ARInvoice> OpenBatch;
    [PXButton]
    [PXUIField(DisplayName = "Open Batch")]
    protected void openBatch()
    {
        ARInvoice doc = Base.Document.Current;
        if (doc != null && doc.BatchNbr != null)
        {
            JournalEntry entry = PXGraph.CreateInstance<JournalEntry>();
            entry.BatchModule.Current = entry.BatchModule.Search<Batch.batchNbr>(doc.BatchNbr, "AR");
            if (entry.BatchModule.Current != null)
            {
                throw new PXRedirectRequiredException(entry, "Open Invoice Batch")
                {
                    Mode = PXBaseRedirectException.WindowMode.NewWindow
                };
            }
        }
    }
}

enter image description here

切换到PXRedirectRequiredException后,您不必检索当前Acumatica实例的网址。

比方说,您开发了一个自定义屏幕,可以从导航窗格中打开:

namespace ActionMenuAddOn
{
    public class TaskTemplateMaint : PXGraph<TaskTemplateMaint, TaskTemplate>
    {
        public PXSelect<TaskTemplate> Templates;
    }
}

enter image description here

但是,抛出PXRedirectRequiredException以在新窗口中打开自定义屏幕时,我们收到错误“您没有足够的权限访问对象(TaskTemplateMaint)”:

using ActionMenuAddOn;
...

namespace PX.Objects.SO
{
    public class SOInvoiceEntryExt : PXGraphExtension<SOInvoiceEntry>
    {
        public void ARInvoice_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            ARInvoice doc = (ARInvoice)e.Row;
            if (doc == null) return;

            OpenTaskTemplate.SetEnabled(doc.BatchNbr != null);
        }

        ...

        public PXAction<ARInvoice> OpenTaskTemplate;
        [PXButton]
        [PXUIField(DisplayName = "Open Task Template")]
        protected void openTaskTemplate()
        {
            TaskTemplateMaint templateMaint = PXGraph.CreateInstance<TaskTemplateMaint>();
            templateMaint.Templates.Current = templateMaint.Templates.Search<TaskTemplate.templateCD>("000001");
            if (templateMaint.Templates.Current != null)
            {
                throw new PXRedirectRequiredException(templateMaint, "Open Task Template")
                {
                    Mode = PXBaseRedirectException.WindowMode.NewWindow
                };
            }
        }
    }
}

要克服错误,请打开按角色访问权限屏幕,并将自定义屏幕的访问权限授予至少管理员角色,如下面的屏幕截图所示:

enter image description here

enter image description here