如何将操作和处理程序添加到“处理货件”屏幕?

时间:2016-08-23 16:12:18

标签: acumatica

如何在Process Shipments屏幕中添加操作和处理程序?我们想在屏幕SO503000上向Action组合框添加一个动作,然后在代码中添加一个处理程序来处理新动作。我们希望这样做而不必在SOShipmentEntry图中覆盖Action的巨大switch / case语句。

1 个答案:

答案 0 :(得分:1)

PXAutomationMenu属性从自动化步骤中拉出所有操作,这些操作将适当的处理屏幕设置为批量处理屏幕:enter image description here

要扩展“处理货件”屏幕上可用的操作列表,请按以下步骤操作:

  1. 在BLC扩展中声明自定义操作并在BLC初始化期间调用AddMenuAction方法,将其添加为“操作”按钮的下拉项

  2. 要将“自定义”操作添加到“处理货件”屏幕,请将自定义操作添加到相应的自动化步骤,并指定“批量处理屏幕ID”。当用户选择您的自定义操作时,可以在“处理货件”屏幕上选择包含自定义操作的所有自动化步骤中的货件:enter image description here

  3. 为SOShipmentEntry BLC声明的两个扩展(相同的第一级),如下面的代码片段所示,可用于扩展具有多个自定义项目的Actions下拉列表(两个彼此独立的自定义包;可以在特定站点上发布其中一个或两个。并且都在“处理发货”屏幕中添加操作: 要解决这种情况,请:

    public class SOShipmentEntryExt1 : PXGraphExtension<SOShipmentEntry>
    {
        public PXAction<SOShipment> Test1;
        [PXButton]
        [PXUIField(DisplayName = "Test Action 1")]
        protected void test1()
        {
            throw new PXException("Not implemented action: {0}", "Test Action 1");
        }
    
        public override void Initialize()
        {
            Base.action.AddMenuAction(Test1);
        }
    }
    
    public class SOShipmentEntryExt2 : PXGraphExtension<SOShipmentEntry>
    {
        public PXAction<SOShipment> Test2;
        [PXButton]
        [PXUIField(DisplayName = "Test Action 2")]
        protected void test2()
        {
            throw new PXException("Not implemented action: {0}", "Test Action 2");
        }
    
        public override void Initialize()
        {
            Base.action.AddMenuAction(Test2);
        }
    }