public static string DisplayStatus(this ConfirmationDetail value) { switch (value.ReasonNotShipped.Trim().ToUpper()) { case Constants.CONFIRMATION_DETAIL_FILLED_CODE: return(Constants.CONFIRMATION_DETAIL_FILLED_STATUS); case Constants.CONFIRMATION_DETAIL_PARTIAL_SHIP_CODE: // partial ship return(Constants.CONFIRMATION_DETAIL_PARTIAL_SHIP_STATUS); case Constants.CONFIRMATION_DETAIL_OUT_OF_STOCK_CODE: // out of stock return(Constants.CONFIRMATION_DETAIL_OUT_OF_STOCK_STATUS); case Constants.CONFIRMATION_DETAIL_ITEM_REPLACED_CODE: // item replaced return(Constants.CONFIRMATION_DETAIL_ITEM_REPLACED_STATUS); case Constants.CONFIRMATION_DETAIL_ITEM_REPLACED_OUT_OF_STOCK_CODE: // item replaced, but replacement currently out of stock return(Constants.CONFIRMATION_DETAIL_ITEM_REPLACED_OUT_OF_STOCK_STATUS); case Constants.CONFIRMATION_DETAIL_PARTIAL_SHIP_REPLACED_CODE: // Item replaced, partial fill return(Constants.CONFIRMATION_DETAIL_PARTIAL_SHIP_REPLACED_STATUS); case Constants.CONFIRMATION_DETAIL_ITEM_SUBBED_CODE: // item subbed return(Constants.CONFIRMATION_DETAIL_ITEM_SUBBED_STATUS); default: return(string.Empty); } }
public static ConfirmationFile ToConfirmationFile(this OrderHistoryFile historyFile) { ConfirmationFile confirmation = new ConfirmationFile(); foreach (OrderHistoryDetail historyDetail in historyFile.Details) { ConfirmationDetail detail = new ConfirmationDetail() { RecordNumber = historyDetail.LineNumber.ToString(), ItemNumber = historyDetail.ItemNumber, QuantityOrdered = historyDetail.OrderQuantity, BrokenCase = (historyDetail.UnitOfMeasure == UnitOfMeasure.Package ? "Y" : "N"), QuantityShipped = historyDetail.ShippedQuantity, ShipWeight = historyDetail.TotalShippedWeight, SalesGross = historyDetail.SellPrice * historyDetail.ShippedQuantity, SalesNet = historyDetail.SellPrice * historyDetail.ShippedQuantity, PriceNet = (historyDetail.UnitOfMeasure == UnitOfMeasure.Case ? historyDetail.SellPrice : 0.0), PriceGross = (historyDetail.UnitOfMeasure == UnitOfMeasure.Case ? historyDetail.SellPrice : 0.0), SplitPriceNet = (historyDetail.UnitOfMeasure == UnitOfMeasure.Case ? 0.0 : historyDetail.SellPrice), SplitPriceGross = (historyDetail.UnitOfMeasure == UnitOfMeasure.Case ? 0.0 : historyDetail.SellPrice), ReasonNotShipped = historyDetail.ItemStatus //CaseCube //CaseWeight }; detail.ConfirmationMessage = detail.DisplayStatus(); confirmation.Detail.Add(detail); } confirmation.Header.Branch = historyFile.Header.BranchId; confirmation.Header.ConfirmationNumber = historyFile.Header.ControlNumber; confirmation.Header.CustomerNumber = historyFile.Header.CustomerNumber; confirmation.Header.InvoiceNumber = historyFile.Header.InvoiceNumber; confirmation.Header.ConfirmationDate = DateTime.Now.ToLongDateFormatWithTime(); confirmation.Header.ShipDate = historyFile.Header.DeliveryDate; confirmation.Header.RemoteOrderNumber = historyFile.Header.ControlNumber; // a confirmation will never have this data, and it is coming back wrong now //confirmation.Header.RouteNumber = historyFile.Header.RouteNumber; //confirmation.Header.StopNumber = historyFile.Header.StopNumber; confirmation.Header.TotalQuantityOrdered = confirmation.Detail.Sum(d => d.QuantityOrdered); confirmation.Header.TotalQuantityShipped = confirmation.Detail.Sum(d => d.QuantityShipped); //confirmation.Header.TotalInvoice confirmation.Header.ConfirmationStatus = historyFile.Header.OrderStatus; confirmation.Header.ConfirmationMessage = confirmation.Header.GetDisplayStatus(); //confirmation.Header.SpecialInstructions //confirmation.Header.SpecialInstructionsExtended //confirmation.Header.TotalCube //confirmation.Header.TotalWeight return(confirmation); }
private double GetItemPrice(bool splitCase, ConfirmationDetail detail) { if (detail == null) { return(0); } else { //if (detail.SplitPriceNet == null) { detail.SplitPriceNet = 0; } //if (detail.PriceNet == null) { detail.PriceNet = 0; } return(splitCase ? detail.SplitPriceNet : detail.PriceNet); } }
public static string SubstitutedItemNumber(this ConfirmationDetail incomingDetail, CommerceServer.Core.Runtime.Orders.LineItem lineItem) { string confirmationStatus = incomingDetail.ReasonNotShipped.Trim().ToUpper(); if ((incomingDetail.ReasonNotShipped == Constants.CONFIRMATION_DETAIL_ITEM_REPLACED_CODE || incomingDetail.ReasonNotShipped == Constants.CONFIRMATION_DETAIL_ITEM_REPLACED_OUT_OF_STOCK_CODE || incomingDetail.ReasonNotShipped == Constants.CONFIRMATION_DETAIL_PARTIAL_SHIP_REPLACED_CODE || incomingDetail.ReasonNotShipped == Constants.CONFIRMATION_DETAIL_ITEM_SUBBED_CODE) // check incoming confirmation item number against current item number; // if current item number doesn't match incoming, then move current to substituted && !incomingDetail.ItemNumber.Trim().Equals(lineItem.ProductId.Trim(), StringComparison.InvariantCultureIgnoreCase)) { return(lineItem.ProductId); } return(string.Empty); }
/// <summary> /// Parse an array of strings as a file /// </summary> /// <param name="data"></param> /// <returns></returns> private ConfirmationFile ParseFile(string[] data) { ConfirmationFile confirmation = new ConfirmationFile(); confirmation.Header.Parse(data[0]); // Start loop at detail, skip header for (int i = 1; i <= data.Length - 1; i++) { if (data[i].Contains("END###") == false) { ConfirmationDetail theDeets = new ConfirmationDetail(); theDeets.Parse(data[i]); confirmation.Detail.Add(theDeets); } } return(confirmation); }
private void SetCsLineInfo(LineItem[] lineItems, ConfirmationFile confirmation) { List <LineItem> missingLineItems = new List <LineItem>(); foreach (LineItem orderFormLineItem in lineItems) { bool brokenCase = (bool)orderFormLineItem["Each"]; ConfirmationDetail detail = confirmation.Detail.Where(x => (x.ItemNumber == orderFormLineItem.ProductId || x.ConfirmationMessage.EndsWith(orderFormLineItem.ProductId)) && x.BrokenCase.Equals("y", StringComparison.InvariantCultureIgnoreCase) == brokenCase).FirstOrDefault(); if (detail == null) { // this adds the orderFormLineItem by reference and the ProcessMissingItems method updates the item and ultimately updates the original entry in the array missingLineItems.Add(orderFormLineItem); _log.WriteWarningLog(string.Format("Confirmation line not found for item {0}", orderFormLineItem.ProductId)); } else { SetCsLineItemInfo(orderFormLineItem, detail.QuantityOrdered, detail.QuantityShipped, detail.DisplayStatus(), detail.ItemNumber, detail.SubstitutedItemNumber(orderFormLineItem), GetItemPrice(brokenCase, detail), int.Parse(detail.RecordNumber)); } } if (missingLineItems.Count > 0) { ProcessMisingItems(missingLineItems, lineItems.Length); } }
public static void Parse(this ConfirmationDetail value, string Line) { value.RecordNumber = StringHelpers.GetField( CONFIRMATION_DETAIL_RECORD_NUMBER_INDEX, CONFIRMATION_DETAIL_RECORD_NUMBER_LENGTH, Line); value.ItemNumber = StringHelpers.GetField( CONFIRMATION_DETAIL_ITEM_NUMBER_INDEX, CONFIRMATION_DETAIL_ITEM_NUMBER_LENGTH, Line); value.QuantityOrdered = int.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_QUANTITY_ORDERED_INDEX, CONFIRMATION_DETAIL_QUANTITY_ORDERED_LENGTH, Line)); value.BrokenCase = StringHelpers.GetField( CONFIRMATION_DETAIL_BROKEN_CASE_INDEX, CONFIRMATION_DETAIL_BROKEN_CASE_LENGTH, Line); value.QuantityShipped = int.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_QUANTITY_SHIPPED_INDEX, CONFIRMATION_DETAIL_QUANTITY_SHIPPED_LENGTH, Line)); value.ReasonNotShipped = StringHelpers.GetField( CONFIRMATION_DETAIL_REASON_NOT_SHIPPED_INDEX, CONFIRMATION_DETAIL_REASON_NOT_SHIPPED_LENGTH, Line); value.ShipWeight = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_SHIP_WEIGHT_INDEX, CONFIRMATION_DETAIL_SHIP_WEIGHT_LENGTH, Line)); value.CaseCube = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_CASE_CUBE_INDEX, CONFIRMATION_DETAIL_CASE_CUBE_LENGTH, Line)); value.CaseWeight = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_CASE_WEIGHT_INDEX, CONFIRMATION_DETAIL_CASE_WEIGHT_LENGTH, Line)); value.SalesGross = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_SALES_GROSS_INDEX, CONFIRMATION_DETAIL_SALES_GROSS_LENGTH, Line)); value.SalesNet = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_SALES_NET_INDEX, CONFIRMATION_DETAIL_SALES_NET_LENGTH, Line)); value.PriceNet = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_PRICE_NET_INDEX, CONFIRMATION_DETAIL_PRICE_NET_LENGTH, Line)); value.SplitPriceNet = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_SPLIT_PRICE_NET_INDEX, CONFIRMATION_DETAIL_SPLIT_PRICE_NET_LENGTH, Line)); value.PriceGross = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_PRICE_GROSS_INDEX, CONFIRMATION_DETAIL_PRICE_GROSS_LENGTH, Line)); value.SplitPriceGross = double.Parse(StringHelpers.GetField( CONFIRMATION_DETAIL_SPLIT_PRICE_GROSS_INDEX, CONFIRMATION_DETAIL_SPLIT_PRICE_GROSS_LENGTH, Line)); value.ConfirmationMessage = StringHelpers.GetField( CONFIRMATION_DETAIL_CONFIRMATION_MESSAGE_INDEX, CONFIRMATION_DETAIL_CONFIRMATION_MESSAGE_LENGTH, Line); value.ItemStatus = StringHelpers.GetField( CONFIRMATION_DETAIL_ITEM_STATUS_INDEX, CONFIRMATION_DETAIL_ITEM_STATUS_LENGTH, Line); }