【问题标题】:Unable to create a shipment all the SOLine Items to the Shipment Screen (SOShipLine-Manually we are bringing non-stock items to the shipment screen)无法将所有 SOLine 项目创建到装运屏幕(SOShipLine-手动我们将非库存项目带到装运屏幕)
【发布时间】:2019-08-08 13:50:28
【问题描述】:

当我们创建发货“Is-Component”字段时,当我们检查此字段时,我们在销售订单屏幕中新添加了并且当我们在发货屏幕中处理发货时,特定的库存数据项不仅仅通过检查“是组件” ”项目,“是组件”项目的未选中项目能够传递到发货屏幕。

[PXOverride]
        public IEnumerable Action(PXAdapter adapter, Nullable<Int32> actionID, Nullable<DateTime> shipDate, String siteCD, String operation, String ActionName, ActionDelegate baseMethod)
        {
            if (actionID == 1)
            {

            SOShipmentEntry ShipGraph = PXGraph.CreateInstance<SOShipmentEntry>();
            PXGraph.InstanceCreated.AddHandler<SOShipmentEntry>((graph) =>
        {
            ShipGraph.RowInserting.AddHandler<SOShipLine>((sender, e) =>
            {
                foreach (SOLine line in Base.Transactions.Select())
                {
                    ShipGraph.Transactions.Current = PXSelect<SOShipLine, Where<SOShipLine.shipmentNbr, Equal<Required<SOShipLine.shipmentNbr>>>>.Select(Base, line.InventoryID, line.OrderNbr);
                    SOShipLine ShipLine = new SOShipLine();

                    SOLineExt NonStklnExt = line.GetExtension<SOLineExt>();
                    if (ShipGraph.Transactions.Current == null)
                    {
                        //if (NonStklnExt.UsrIsComponent == true || NonStklnExt.UsrIsComponent == false || NonStklnExt.UsrInvFlag == true || NonStklnExt.UsrInvFlag == false || NonStklnExt.UsrStkInventoryID == null || NonStklnExt.UsrStkInventoryID != null)
                        //{
                        ShipLine.InventoryID = line.InventoryID;
                        ShipLine.TranDesc = line.TranDesc;
                        // }
                        ShipGraph.Transactions.Insert(ShipLine);
                    }



                }
                Base.Transactions.View.RequestRefresh();
            });
        });
        }
        return baseMethod(adapter, actionID, shipDate, siteCD, operation, ActionName);
    }

【问题讨论】:

    标签: acumatica acumatica-kb


    【解决方案1】:

    我可以假设这些项目是基于标志添加的,而不是总是基于项目添加的。如果是这种情况,我会检查 Non-Stock 项目上的 Require Shipment 标志以使其自动添加。

    我将通过覆盖 SOShipmentEntry CreateShipment 函数而不是 SOShipLine Insert 处理程序来解决此问题。确保覆盖具有 QuickProcessFlow 的那个。

    从那里,我会像您在创建发货后所做的那样搜索初始订单和订单行。您的逻辑是检查标志是否在线上被选中或未选中,并且应该更新。例如,如果您想查找未根据 NonStockShip 标志自动添加的未在货件上检查组件的所有物品,我会这样做:

    public delegate void CreateShipmentDelegate(SOOrder order, Nullable<Int32> SiteID, Nullable<DateTime> ShipDate, Nullable<Boolean> useOptimalShipDate, String operation, DocumentList<SOShipment> list, ActionFlow quickProcessFlow);
    [PXOverride]
    public void CreateShipment(SOOrder order, Nullable<Int32> SiteID, Nullable<DateTime> ShipDate, Nullable<Boolean> useOptimalShipDate, String operation, DocumentList<SOShipment> list, ActionFlow quickProcessFlow, CreateShipmentDelegate baseMethod)
    {
        baseMethod(order, SiteID, ShipDate, useOptimalShipDate, operation, list, quickProcessFlow);
    
        if (order == null)
            return; //do not process for shipments that did not have an order sent for some reason
    
        //get all lines for non-stockitems that are not flagged to be shipped that have the component checked
        var SalesOrderLines = PXSelectJoin<
            SOLine, 
            InnerJoin<InventoryItem, 
                On<SOLine.inventoryID, Equal<InventoryItem.inventoryID>>>,
            Where<SOLine.orderNbr, Equal<Required<SOLine.orderNbr>>, 
                And<SOLine.orderType, Equal<Required<SOLine.orderType>>,                     
                And<InventoryItem.nonStockShip, Equal<False>,
                And<InventoryItem.stkItem, Equal<False>,
                And<SOLineExt.usrIsComponent, Equal<True>>>>>>>
            .Select(Base, order.OrderNbr, order.OrderType);
    
        foreach(SOLine SalesOrderLine in SalesOrderLines)
        {
            //double check that they were not added.... and match the orig line nbr
            var ShipmentLinesForItem = PXSelect<
                SOShipLine, 
                Where<SOShipLine.shipmentNbr, Equal<Current<SOShipment.shipmentNbr>>,
                    And<SOShipLine.shipmentType, Equal<Current<SOShipment.shipmentType>>, 
                    And<SOShipLine.inventoryID, Equal<Required<SOShipLine.inventoryID>>, 
                    And<SOShipLine.origLineNbr, Equal<Required<SOShipLine.origLineNbr>>>>>>>
                .Select(Base, SalesOrderLine.InventoryID, SalesOrderLine.LineNbr);
            if (ShipmentLinesForItem.Count == 0)
            {
                //create your shipment lines for these items
                SOShipLine ShipmentLine = new SOShipLine();
                //set fields required. See function SOOrderEntry.CreateShipmentFromSchedules for examples of fields that should be set.
                Base.Transactions.Insert(ShipmentLine);
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-19
      • 1970-01-01
      • 2019-06-20
      • 1970-01-01
      相关资源
      最近更新 更多