在Acumatica 2017 R2中调用创建货件时确认货件 [英] Confirming Shipment when Create Shipment called in Acumatica 2017 R2

查看:40
本文介绍了在Acumatica 2017 R2中调用创建货件时确认货件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户单击版本6.x中的创建货件时,我使用了该问题的解决方案来确认货件。

I used the solution from this question to confirm shipments when the user clicked Create Shipment in version 6.x.

通过自动化步骤从销售订单中创建装运时自动确认装运

此后我已升级到最新版本,但是单击创建托运时,此逻辑似乎不再起作用。相反,当段<$ c时,调用行 while(PXLongOperation.GetStatus(Base.UID,out timepan,out ex)== PXLongRunStatus.InProcess){} $ c> PXLongOperation.GetStatus(Base.UID,超出时间范围,超出范围)在监视窗口中被观察到,它返回DoesNotExist。货件继续创建不再确认的正常货件。

I have since upgraded to the latest version, but this logic seems to no longer work when clicking Create Shipment. Instead when the line while (PXLongOperation.GetStatus(Base.UID, out timespan, out ex) == PXLongRunStatus.InProcess) { } is called, when the segment PXLongOperation.GetStatus(Base.UID, out timespan, out ex) is observed in the Watch window, it returns DoesNotExist. The shipment continues to create a normal shipment that is no longer confirmed.

推荐答案

这似乎对我有用(还包括执行更新IN操作):

This seems to have worked for me (also includes executing Update IN action):

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

这篇关于在Acumatica 2017 R2中调用创建货件时确认货件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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