通过“自动化步骤”从“销售订单”创建发货时自动确认发货 [英] Auto confirm shipment when create shipment from Sales Order by Automation Step

查看:50
本文介绍了通过“自动化步骤”从“销售订单”创建发货时自动确认发货的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为标题,我想在通过自动化步骤从销售订单屏幕中创建货运时自动确认货运。

As title, i want to auto confirm shipment when I Create shipment from Sales Order screen by automation step.

谢谢。

推荐答案

    SOShipmentEntry docgraph = PXGraph.CreateInstance<SOShipmentEntry>();
    docgraph.Document.Current = docgraph.Document.Search<SOShipment.shipmentNbr>(ShipmentNbr);
    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);

                                                TimeSpan timespan;
                                                Exception ex;
                                                while (PXLongOperation.GetStatus(docgraph.UID, out timespan, out ex) == PXLongRunStatus.InProcess)
                                                { }
                                                break;
                                            }
                                        }



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;
            }
        }

上面的确认装运有问题代码有助于做到这一点。它从货件编号加载货件文件,并找到确认货件图表的菜单,然后单击它。

We had issues with 'confirm shipment' , the above code helped to do that. It loads the shipment document from the shipment number and finds the menu of the graph for 'confirm shipment' and clicks it.

这篇关于通过“自动化步骤”从“销售订单”创建发货时自动确认发货的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆