public static T GetSOPackageDetail <T>(KCAPIFulfillment fulfillment, T acumaticaPackage, SOShipment shipment, string boxID)
        {
            KCSiteMasterMaint graph     = PXGraph.CreateInstance <KCSiteMasterMaint>();
            decimal?          boxWeight = KCGeneralDataHelper.GetBoxWeight(graph, boxID);

            foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(acumaticaPackage))
            {
                switch (property.DisplayName)
                {
                case "Confirmed":
                    property.SetValue(acumaticaPackage, true);
                    break;

                case "Weight":
                    property.SetValue(acumaticaPackage, boxWeight + shipment.ShipmentWeight);
                    break;

                case "TrackNumber":
                    property.SetValue(acumaticaPackage, fulfillment.TrackingNumber);
                    break;

                case "ShipmentNbr":
                    property.SetValue(acumaticaPackage, shipment.ShipmentNbr);
                    break;
                }
            }

            return(acumaticaPackage);
        }
        public static SOShipment GetSOShipment(SOOrder acumaticaOrder, KCAPIFulfillment fulfillment,
                                               SOShipment acumaticaShipment)
        {
            SOOrderEntry      orderGraph  = PXGraph.CreateInstance <SOOrderEntry>();
            KCSiteMasterMaint masterGraph = PXGraph.CreateInstance <KCSiteMasterMaint>();

            acumaticaShipment.Operation          = INDocType.Issue;
            acumaticaShipment.CustomerID         = acumaticaOrder.CustomerID;
            acumaticaShipment.CustomerLocationID = acumaticaOrder.CustomerLocationID;
            acumaticaShipment.SiteID             = masterGraph.SiteMaster.SelectSingle().SiteID;
            acumaticaShipment.ShipDate           = fulfillment.UpdatedDateUtc.DateTime;

            acumaticaShipment.GetExtension <KCSOShipmentExt>().UsrKCCAFulfillmentID = fulfillment.ID;

            return(acumaticaShipment);
        }
Example #3
0
        public bool CheckFulfillmentItems(KCSOShipmentEntryExt graph, List <KCAPIFulfillmentItem> productsFromAllFulfillments, Dictionary <int?, List <int?> > compositeItems,
                                          KCAPIFulfillment currentFulfillment, List <KCAPIOrderItem> orderItems)
        {
            foreach (KCAPIFulfillmentItem item in currentFulfillment.Items)
            {
                double?orderedCountOfBundles = 0;

                KCAPIOrderItem orderItem = orderItems.Where(x => x.ID == item.OrderItemID).FirstOrDefault();
                if (orderItem.ProductID == item.ProductID)
                {
                    continue;
                }

                foreach (int productID in compositeItems[item.OrderItemID])
                {
                    int?itemQuantity = 0;
                    productsFromAllFulfillments.Where(x => x.ProductID == productID && x.OrderItemID == item.OrderItemID).ToList().ForEach(x => itemQuantity += x.Quantity);
                    double?qtyPerBundle = itemQuantity / orderItem.Quantity;

                    DAC.KNSIKCInventoryItem KCItem = graph.KCInventoryItem.SelectSingle(productID);
                    if (KCItem != null)
                    {
                        if (orderedCountOfBundles == 0)
                        {
                            orderedCountOfBundles = itemQuantity / qtyPerBundle;
                        }
                        if (currentFulfillment.Items.Any(x => x.ProductID == productID && x.OrderItemID == item.OrderItemID && x.Quantity / qtyPerBundle == orderedCountOfBundles) &&
                            (!productsFromAllFulfillments.Any(x => x.ProductID == productID && x.OrderItemID == item.OrderItemID && x.FulfillmentID != item.FulfillmentID) ||
                             (orderedCountOfBundles % 1 == 0 && itemQuantity / qtyPerBundle == orderedCountOfBundles)))
                        {
                            continue;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }