public static void AddItemsToShipment(Shipment shipmentToCreate, IGrouping <string, ItemFulfillmentLine> itemFulfillmentGroupToImport) { foreach (var itemFulfillmentToImport in itemFulfillmentGroupToImport) { // Skip the line if it has already been added via a kit bundle if (itemFulfillmentToImport.AddedToKit) { continue; } bool isKit = itemFulfillmentToImport.KitId == null ? false : true; string sku; // For kits with different types of items, such as promo kits, the skus can't be parsed if (promoBundleKitIds.Contains(itemFulfillmentToImport.KitId)) { sku = NetSuiteController.GetSKUOfParentKit(itemFulfillmentToImport.KitId); } else { sku = itemFulfillmentToImport.SKU.Split('_')[0]; } bool isPersonal = itemFulfillmentToImport.IsPersonal; int orderProductId = GetOrderProductId(sku, isKit, isPersonal, bigCommerceOrderId); int itemQuantity = GetItemQuantity(itemFulfillmentToImport); Item item = new Item(orderProductId, itemQuantity); shipmentToCreate.Items.Add(item); } }
public static int GetKitShippedQuantity(Kit kit) { int sumOfKitItems = NetSuiteController.GetSumOfKitMembers(kit.ID); // Divide the # of items in the shipped kit on the item fulfillment by the # of items that are in that kit int kitShippedQuantity = kit.TotalItemQuantity / sumOfKitItems; return(kitShippedQuantity); }
public static string GetTrackingNumbers(string itemFulfillmentId) { List <string> trackingNumbers = NetSuiteController.GetTrackingNumbersByItemFulfillment(itemFulfillmentId); string trackingNumber = ""; if (trackingNumbers.Count() == 1) { trackingNumber = trackingNumbers[0]; } // Handles if an item fulfillment has multiple tracking numbers else if (trackingNumbers.Count() > 1) { // Big Commerce has a character limit on tracking numbers, so we can only send the first two trackingNumber = trackingNumbers[0] + " " + trackingNumbers[1]; } return(trackingNumber); }