-->

确认装运创建装运称为Acumatica 2017年R2时(Confirming Shipment w

2019-10-29 08:00发布

我使用的解决方案,从这个问题,以确认发货,当用户点击创建6.x版出货

自动确认发货时通过自动化步骤从销售订单创建发货

因为我已经升级到最新的版本,但这个逻辑似乎单击创建装运时不再起作用。 代替当线while (PXLongOperation.GetStatus(Base.UID, out timespan, out ex) == PXLongRunStatus.InProcess) { }当段被调用时, PXLongOperation.GetStatus(Base.UID, out timespan, out ex) ,观察到在监视窗口,它返回DoesNotExist。 装运继续创造一个正常的货物是不再确认。

Answer 1:

这似乎已经为我工作(也包括执行更新操作):

    public delegate void CreateShipmentDelegate(SOOrder order, int? SiteID, DateTime? ShipDate, bool? useOptimalShipDate, string operation, DocumentList<SOShipment> list);
    [PXOverride]
    public virtual void CreateShipment(SOOrder order, int? SiteID, DateTime? ShipDate, bool? useOptimalShipDate, string operation, DocumentList<SOShipment> list, CreateShipmentDelegate baseMethod)
    {
        baseMethod(order, SiteID, ShipDate, useOptimalShipDate, operation, list);
        var shipment = Base.Document.Current;

        if (shipment.Hold == true)
        {
            shipment.Hold = false;
            //shipment Status must be set to null to apply 'New Open' Automation Step
            shipment.Status = null;
            shipment = Base.Document.Update(shipment);
            if (shipment.Hold == true || shipment.Status == SOShipmentStatus.Hold)
            {
                throw new PXException("Shipment {0} cannot be taken off Hold", shipment.ShipmentNbr);
            }
        }

        shipment.ShipDate = shipment.ShipDate.Value.AddDays(1);
        Base.Document.Update(shipment);
        Base.Actions.PressSave();


        //Here you can add your custom logic

        //Call Confirm Shipment
        foreach (var shipmentAction in (Base.action.GetState(shipment) as PXButtonState).Menus)
        {
            if (shipmentAction.Command == "Confirm Shipment")
            {
                PXAdapter shipmentAdapter = new PXAdapter(
                    new DummyView(Base, Base.Document.View.BqlSelect,
                        new List<object> { shipment }));
                shipmentAdapter.Menu = shipmentAction.Command;
                //to invoke Confirm Shipment action
                Base.action.Press(shipmentAdapter).RowCast<SOShipment>().ToList();
            }
        }

        //Execute UpdateIN
        Base.UpdateIN.Press();

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


文章来源: Confirming Shipment when Create Shipment called in Acumatica 2017 R2
标签: acumatica