简体   繁体   English

从“账单和调整”屏幕上的按钮打开弹出的自定义Acumatica屏幕

[英]Open custom Acumatica screen as popup from button on Bills and Adjustments screen

I have a completely custom screen with its own BLC and DACs, and I want to open it as a popup from a button placed on the Bills and Adjustments screen. 我有一个完全自定义的屏幕,带有其自己的BLC和DAC,我想从“帐单和调整”屏幕上的按钮作为弹出窗口打开它。 I have coded it as follows: 我将其编码如下:

public class APInvoiceEntryExt : PXGraphExtension<APInvoiceEntry>
{

    public PXAction<APInvoice> LaunchOpenSource;
    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Open Source")]

    protected void launchOpenSource()
    {
        APInvoice apinvoice = (APInvoice)Base.Document.Current;

        if (apinvoice != null)
        {

            //var url = "http://localhost/AcumaticaDB2562/?ScreenId=AC302000&OpenSourceName=Bills+and+Adjustments&DataID=" + apinvoice.RefNbr;
            OpenSourceDataMaint graph = PXGraph.CreateInstance<OpenSourceDataMaint>();
            graph.OpenSourceDataHeader.Current = graph.OpenSourceDataHeader.Search<xTACOpenSourceHeader.openSourceName, xTACOpenSourceHeader.dataID>("Bills and Adjustments", apinvoice.RefNbr);

            if (graph.OpenSourceDataHeader.Current != null)
            {
                throw new PXRedirectRequiredException(graph, "Open Source")
                {
                    Mode = PXBaseRedirectException.WindowMode.NewWindow
                };
            }
        }
    }
}               

I've included all the relevant DACs and BLC for my custom screen in the Class Library project I'm using to customize the 'Bills and Adjustments' screen where I'm adding the button. 我已经在“类库”项目中为自定义屏幕包括了所有相关的DAC和BLC,该项目用于自定义“帐单和调整”屏幕,并在其中添加按钮。

The problem I'm having is that I get the following error message when launching the button: 我遇到的问题是,在启动按钮时收到以下错误消息:

在此处输入图片说明

I've set all the relevant permissions for the screen that uses the OpenSourceDataMaint BLC to 'Delete' in 'Access Right By Role', 'Access Rights By User', and 'Access Rights By Screen'. 我已将使用OpenSourceDataMaint BLC的屏幕的所有相关权限设置为“按角色访问权限”,“按用户访问权限”和“按屏幕访问权限”中的“删除”。 Nothing makes any difference. 没有任何区别。

Looks like DataSource is trying to find a node in SiteMap with GraphType equal to full name off your OpenSourceDataMaint class and fails: 看起来DataSource试图在SiteMap中找到GraphType等于您的OpenSourceDataMaint类的全名的节点,并且失败:

public class PXBaseDataSource : DataSourceControl, IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor, ICommandSource, IPXCallbackHandler, IPXScriptControl, IPXCallbackUpdatable, IPostBackDataHandler
{
    ...

    private static string getFormUrl(Type graphType)
    {
        PXSiteMapNode node = getSiteMapNode(graphType);
        if (node == null)
        {
            throw new PXException(string.Format(ErrorMessages.GetLocal(ErrorMessages.NotEnoughRightsToAccessObject), graphType.Name));
        }
        String url = node.Url;
        //if (url.Contains("unum=")) url = PXUrl.IgnoreQueryParameter(url, "unum");
        return PXUrl.TrimUrl(url);
    }

    ...
}

Could you please check if TypeName is properly defined for PXDataSource inside your custom Aspx page? 您能否检查自定义Aspx页内是否为PXDataSource正确定义了TypeName Also could you please check if your custom Aspx page also exists in Cst_Published folder and if values set for PXDataSource.TypeName property are identical inside Pages and Cst_Published folders? 还可以请检查Cst_Published文件夹中是否还存在您的自定义Aspx页面,以及Pages和Cst_Published文件夹内为PXDataSource.TypeName属性设置的值是否相同?

One more thing to check, does the Site Map screen show the right GraphName for your custom screen? 还有一件要检查的事情,“站点地图”屏幕是否为您的自定义屏幕显示了正确的GraphName? - would be beneficial if you can provide a screenshot for verification. -如果您可以提供屏幕截图进行验证,将非常有帮助。

If possible, please provide your customization package, that can be published locally (even with compiled assembly) - this would greatly speed up the investigation process. 如果可能的话,请提供您的自定义程序包,该程序包可以在本地发布(即使使用已编译的程序集),这将大大加快调查过程。

The solution, for me, was to put the code (shown below) in a customization window instead of a class library project in Visual Studio. 对我来说,解决方案是将代码(如下所示)放在自定义窗口中,而不是在Visual Studio中的类库项目中。 Since the code needs to have a reference to another published customization, putting it inside an Acumatica code window takes care of this. 由于代码需要引用另一个已发布的自定义,因此将其放在Acumatica代码窗口中即可解决此问题。 There is no reference to the published custom screen customization in my class library project, and this obviously causes issues - and I'm not sure how to handle that. 在我的类库项目中没有引用已发布的自定义屏幕自定义,这显然会导致问题-我不确定如何处理。

public class APInvoiceEntryExt:PXGraphExtension<APInvoiceEntry>
{

    public PXAction<APInvoice> LaunchOpenSource;
    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Open Source")]

    protected void launchOpenSource()
    {
        APInvoice apinvoice = (APInvoice)Base.Document.Current;

        if (apinvoice != null)
        {
            AssistantController.OpenSourceDataMaint graph = PXGraph.CreateInstance<AssistantController.OpenSourceDataMaint>();
            graph.OpenSourceDataHeader.Current = graph.OpenSourceDataHeader.Search<AssistantController.xTACOpenSourceHeader.openSourceName
                                                                                  ,AssistantController.xTACOpenSourceHeader.dataID>("Bills and Adjustments", apinvoice.RefNbr);

            throw new PXRedirectRequiredException(graph, "Open Source")
            {
                Mode = PXBaseRedirectException.WindowMode.NewWindow
            };
        }
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果要在Acumatica的Bills and Adjustments屏幕上的Application选项卡Menu中自定义,使用哪种方法或事件处理程序 - In which method or event handler if I would to customize in Application tab Menu in screen Bills And Adjustments of Acumatica 如何覆盖网格视图委托中的账单和调整屏幕 AddPOReceipt 按钮 - How do I override Bills & Adjustments screen AddPOReceipt button in grid view delegate 将自定义操作添加到账单和调整 (AP301000) 屏幕上操作菜单的特殊文件夹 - Adding custom action to Special Folders of action menu on Bills and Adjustments (AP301000) screen 如何从审批屏幕链接回账单和调整以获取记录? - How can I link back to Bills and Adjustments for a record from the Approvals screen? 在没有右侧导航窗格的情况下将Acumatica屏幕作为弹出窗口打开 - Open Acumatica screen as popup without righthand navigation pane Acumatica-自定义表格和屏幕 - Acumatica - Custom Table and Screen 单击自定义操作按钮时,在 Acumatica 屏幕中启用保存按钮 - Enable Save Button in Acumatica Screen upon Custom Action Button Click 如何强制启用帐单和调整屏幕的文档详细信息网格上的字段 - How can I force a field to be enabled on the Bills and Adjustments screen's Document Details grid 通过Web服务API在Acumatica ERP的AP302000屏幕中插入调整文档 - Insert adjustments document in screen AP302000 of acumatica erp through web services api Acumatica定制项目中缺少定制屏幕 - Missing custom screen in Acumatica customization project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM