Acumatica - 如何以编程方式在销售订单(类型RC)上调用创建收据操作

时间:2017-08-01 17:31:38

标签: acumatica

我试图处理Acumatica中的退货订单,为此我必须创建RC类型的销售订单,在销售订单上调用创建收货操作,创建一个类型为Receipt的货件,然后调用确认装运发货。但是,在销售订单上定义的操作列表中,我找不到与创建收据相对应的操作。任何人都可以像我们通过屏幕那样指导我如何以编程方式调用“创建收据”操作吗?

例如这就是我如何在货件上调用确认货件并查找类似于创建收货的内容:

var adapter = new PXAdapter(graph.CurrentDocument);
adapter.Arguments.Add("actionID", SOShipmentEntryActionsAttribute.ConfirmShipment);
PXLongOperation.StartOperation(graph, delegate () 
{ 
    foreach (SOShipment soShipment in graph.action.Press(adapter)) ; 
});

1 个答案:

答案 0 :(得分:3)

这是以前由Acumatica提供的解决方案,我在几个屏幕上尝试了这种方法并且它正在运行。在以下代码中尝试将图形更改为 SOOrderEntry ,并将命令更改为“创建收据”

docgraph.Document.Current = docgraph.Document.Search<SOShipment.shipmentNbr>("mYsHIPMENTnUMBER");
            docgraph.Cancel.Press();
            foreach (var action in (docgraph.action.GetState(null) as PXButtonState).Menus)
            {
                if (action.Command == "Confirm Shipment")
                {
                    PXAdapter adapter2 = new PXAdapter(new DummyView(docgraph, docgraph.Document.View.BqlSelect, new List<object> { docgraph.Document.Current }));
                    adapter2.Menu = action.Command;
                    docgraph.action.PressButton(adapter2);

                }
            }

 internal class DummyView : PXView
        {
            List<object> _Records;
            internal DummyView(PXGraph graph, BqlCommand command, List<object> records)
                : base(graph, true, command)
            {
                _Records = records;
            }
            public override List<object> Select(object[] currents, object[] parameters, object[] searches, string[] sortcolumns, bool[] descendings, PXFilterRow[] filters, ref int startRow, int maximumRows, ref int totalRows)
            {
                return _Records;
            }
        }