예제 #1
0
        public bool AddLineItem(ExportLineItem item, string orderNumber, int orderQty, string batchItemName, string currentProduct)
        {
            try
            {
                XmlFileName = (AppSettings.Get("ExportFilePath").ToString()) + (AppSettings.Get("DailyScheduleData").ToString());

                string batchName = orderNumber;
                // are we processing an order or a batch?
                bool isBatch = false;
                if (orderNumber.IndexOf("batch", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    isBatch     = true;
                    orderNumber = batchItemName;
                }

                if (item.PlantID == "")
                {
                    item.PlantID = AppSettings.Get("LocalPlantName").ToString();
                }

                AggregateLineItem searchLineItem = AggregateLineItemList.Find(i => i.Number == item.Number && i.IsStock == item.IsStock && i.PlantID == item.PlantID);
                if (searchLineItem == null)
                {
                    // add a new line to the list
                    AggregateLineItem newAggregateLineItem = new AggregateLineItem(item, orderNumber, orderQty);
                    AggregateLineItemList.Add(newAggregateLineItem);
                    PrintLineItem(newAggregateLineItem, isBatch, batchItemName, currentProduct, batchName);
                }
                else
                {
                    // add a new order record to associated orders of the existing line
                    OrderData newOrder = new OrderData(orderNumber, item.Qty, orderQty);

                    //update existing info
                    searchLineItem.Category          = item.Category;
                    searchLineItem.Number            = item.Number;
                    searchLineItem.HasPdf            = item.HasPdf;
                    searchLineItem.ItemDescription   = item.ItemDescription;
                    searchLineItem.Material          = item.Material;
                    searchLineItem.MaterialThickness = item.MaterialThickness;
                    searchLineItem.Parent            = item.Parent;
                    searchLineItem.Title             = item.Title;
                    searchLineItem.Operations        = item.Operations;

                    // add new order information
                    searchLineItem.AssociatedOrders.Add(newOrder);
                    PrintLineItem(searchLineItem, isBatch, batchItemName, currentProduct, batchName);
                }


                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public AggregateLineItem(ExportLineItem exportedLineItem, string orderNumber, int orderQty)
        {
            Parent            = exportedLineItem.Parent;
            Number            = exportedLineItem.Number;
            Title             = exportedLineItem.Title;
            ItemDescription   = exportedLineItem.ItemDescription;
            Category          = exportedLineItem.Category;
            Material          = exportedLineItem.Material;
            MaterialThickness = exportedLineItem.MaterialThickness;
            StructCode        = exportedLineItem.StructCode;
            Operations        = exportedLineItem.Operations;
            HasPdf            = exportedLineItem.HasPdf;
            PlantID           = exportedLineItem.PlantID;
            IsStock           = exportedLineItem.IsStock;
            Keywords          = exportedLineItem.Keywords;
            Notes             = exportedLineItem.Notes;
            OrderData order = new OrderData(orderNumber, exportedLineItem.Qty, orderQty);

            AssociatedOrders = new List <OrderData>();
            AssociatedOrders.Add(order);
        }