Exemple #1
0
        private void SearchEnter()
        {
            if (SearchText == "")
            {
                AllItemListVisibility      = Constants.Visible;
                SearchedItemListVisibility = Constants.Collapsed;
                foreach (var item in Items)
                {
                    TempItems.Add(item);
                }
            }
            else
            {
                AllItemListVisibility      = Constants.Collapsed;
                SearchedItemListVisibility = Constants.Visible;

                var query = Items.Where(x => x.Name.StartsWith(SearchText)).OrderBy(x => x.Name);

                TempItems.Clear();

                foreach (var item in query)
                {
                    TempItems.Add(item);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 更新B消息
        /// </summary>
        /// <param name="message"></param>
        internal override void UpdateItem(Message_b message)
        {
            try
            {
                NDCItem ndcItem = Items.Find(c => { return c._mTask.NDCINDEX == message.Index; });
                if (ndcItem == null)
                {
                    ndcItem = TempItems.Find(c => { return c._mTask.NDCINDEX == message.Index; });
                    if (ndcItem != null)
                    {
                        ndcItem._mTask.IKEY = message.IKEY;
                    }else
                    {
                        ndcItem = new NDCItem();
                        ndcItem._mTask.IKEY = message.IKEY;
                        ndcItem._mTask.NDCINDEX = message.Index;
                        TempItems.Add(ndcItem);
                    }
                }
                ndcItem.SetBMessage(message);
                if (ndcItem.TaskInfo != "")
                {
                    //Console.WriteLine(ndcItem.TaskInfo);
                    log.LOG(ndcItem.TaskInfo);
                }
                CheckStatus(ndcItem, message);

                _NoticeUpdate(ndcItem);
            }
            catch (Exception e)
            {
                //Console.WriteLine(e.Message);
                log.LOG(e.Message);
            }
        }
Exemple #3
0
        /// <summary>
        /// 重新读取装货点,卸货点对应NDC实际使用信息
        /// </summary>
        public void DoReadSQL()
        {
            try
            {
                _sqlControl.ReadWcsNdcSite(out loadStaDic, out unLoadStaDic);

                _sqlControl.ReadNDCServerAndIKEY(out IPaddress, out Port, out Ikey);

                if (_sqlControl.ReadUnFinishTask(out List <WCS_NDC_TASK> list))
                {
                    foreach (var i in list)
                    {
                        NDCItem item = Items.Find(c => { return(c._mTask.TASKID == i.TASKID && c._mTask.IKEY == i.IKEY); });
                        if (item == null)
                        {
                            item = new NDCItem()
                            {
                                _mTask = i
                            };

                            Items.Add(item);

                            _NoticeUpdate(item);
                        }
                    }
                }

                if (_sqlControl.ReadTempTask(out List <WCS_NDC_TASK_TEMP> tlist))
                {
                    foreach (WCS_NDC_TASK_TEMP t in tlist)
                    {
                        NDCItem item = TempItems.Find(c =>
                        {
                            return(c._mTask.IKEY == t.IKEY && c._mTask.NDCINDEX == t.NDCINDEX);
                        });
                        if (item != null)
                        {
                            item.CARRIERID = t.CARRIERID;
                        }
                        else
                        {
                            item                 = new NDCItem();
                            item.CARRIERID       = t.CARRIERID;
                            item._mTask.NDCINDEX = t.NDCINDEX;
                            item._mTask.IKEY     = t.IKEY;
                            TempItems.Add(item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #4
0
        /// <summary>
        /// 更新S消息
        /// </summary>
        /// <param name="message"></param>
        internal override void UpdateItem(Message_s message)
        {
            try
            {
                //找出被挂起的任务的重定向站点,重新重定向任务
                if (message.Magic == 32) //32  Carwash sends this request
                {                        //TODO Carwash 重定向
                    DoCarWashReDirect(message);
                    return;
                }
                NDCItem ndcItem = Items.Find(c => { return(c._mTask.NDCINDEX == message.Index); });
                if (ndcItem == null)
                {
                    ndcItem = TempItems.Find(c => { return(c._mTask.NDCINDEX == message.Index); });

                    if (ndcItem != null)
                    {
                        ndcItem.CARRIERID = message.CarrierNumber;
                    }
                    else
                    {
                        ndcItem                 = new NDCItem();
                        ndcItem.CARRIERID       = message.CarrierNumber;
                        ndcItem._mTask.NDCINDEX = message.Index;
                        TempItems.Add(ndcItem);
                    }
                }
                ndcItem.SetSMessage(message);
                if (ndcItem.StatusInfo != "")
                {
                    Console.WriteLine(ndcItem.StatusInfo);
                    log.LOG(ndcItem.StatusInfo);
                }
                CheckMagic(ndcItem, message);

                _NoticeUpdate(ndcItem);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                log.LOG(e.Message);
            }
        }
Exemple #5
0
        /// <summary>
        /// Gets at least a week back for displaying on the chart. Keeps searching back week by week if there is still data to find
        /// </summary>
        /// <returns></returns>
        private async Task UpdateExpenseChart()
        {
            // Update if the chart is scrolled all the way back
            if (ChartScroll.HorizontalOffset == ChartScroll.ScrollableWidth)
            {
                // Display the progress wheel when getting data
                ProgressRing LoginProgress = new ProgressRing();
                LoginProgress.HorizontalAlignment = HorizontalAlignment.Center;
                LoginProgress.VerticalAlignment   = VerticalAlignment.Center;
                ContentRoot.Children.Add(LoginProgress);
                LoginProgress.IsActive = true;

                List <Expense> TempExpenses = new List <Expense>();

                // Query the database to see how many expenses there are in the database
                IMobileServiceTable <Expense> ExpenseTable = App.alltheairgeadClient.GetTable <Expense>();
                var TotalCount = (await ExpenseTable.Take(0).IncludeTotalCount().ToListAsync() as IQueryResultEnumerable <Expense>).TotalCount;
                // If all the expense  have been found, don't searchfor more
                if (Expenses.Count >= TotalCount)
                {
                    // Disable the progress wheel and exit
                    LoginProgress.IsActive = false;
                    ContentRoot.Children.Remove(LoginProgress);
                    return;
                }

                // Keep track of how many weeks have been checked in this update
                int weekssearched = 0;
                do
                {
                    // Query for the next week back of expenses
                    MinExpenseDate = MinExpenseDate.AddDays(-7);
                    TempExpenses   = await ExpenseTable.Where(a => (a.Date > MinExpenseDate)& (a.Date <= MinExpenseDate.AddDays(7))).OrderByDescending(a => a.Date).ToListAsync();

                    weekssearched++;
                } while (TempExpenses.Count == 0);

                // If some are found, add them to the list of expenses
                if (TempExpenses.Count != 0)
                {
                    // Add the found expenses to the list of total expenses
                    Expenses.AddRange(TempExpenses);

                    // Expand the chart by a fixed amount for every week
                    ExpenseChart.Width += 750 * ChartXScale * weekssearched;

                    // Go through each series of data and update them with the latest data
                    foreach (LineSeries i in ExpenseChart.Series)
                    {
                        // Create temporary series to hold new data for series
                        List <Expense>       SeriesExpenses = new List <Expense>();
                        List <DateValueItem> TempItems      = new List <DateValueItem>();
                        // Take only the data relevent to the current series
                        if (i.Name == "TotalExpenses")
                        {
                            SeriesExpenses = TempExpenses;
                        }
                        else
                        {
                            SeriesExpenses = TempExpenses.FindAll(a => a.Category == (string)i.Title);
                        }

                        // Get the current list of items in the series
                        TempItems = (List <DateValueItem>)i.ItemsSource;
                        if (TempItems == null)
                        {
                            TempItems = new List <DateValueItem>();
                        }

                        // Add the expenses to the current list
                        foreach (Expense j in SeriesExpenses)
                        {
                            TempItems.Add(new DateValueItem {
                                Date = (j.Date + j.Time.TimeOfDay), Value = (int)j.Price, Id = j.Id
                            });
                        }

                        // Set the source of the series to the updated list
                        i.ItemsSource = TempItems;

                        // If the series is the total expenses series, update the axis
                        if (ExpenseChart.Series.IndexOf(i) == 0)
                        {
                            i.IndependentAxis =
                                new DateTimeAxis
                            {
                                Minimum      = MinExpenseDate,
                                Maximum      = DateTime.Now.AddHours(6),
                                Location     = AxisLocation.Bottom,
                                Orientation  = AxisOrientation.X,
                                IntervalType = (ChartXScale > ChartXScaleIntervalThresh ? DateTimeIntervalType.Hours : DateTimeIntervalType.Days),
                            };
                            i.DependentRangeAxis =
                                new LinearAxis
                            {
                                Orientation   = AxisOrientation.Y,
                                ShowGridLines = true,
                                Location      = AxisLocation.Right,
                                Minimum       = 0,
                            };
                        }
                        // Otherwise update the others to the match the total expenses one
                        else
                        {
                            i.IndependentAxis    = ((ExpenseChart.Series[0] as LineSeries).IndependentAxis as DateTimeAxis);
                            i.DependentRangeAxis = ((ExpenseChart.Series[0] as LineSeries).DependentRangeAxis as LinearAxis);
                        }
                        i.Refresh();
                    }
                }
                // Disable the progress wheel
                LoginProgress.IsActive = false;
                ContentRoot.Children.Remove(LoginProgress);
            }
        }