Esempio n. 1
0
        /// <summary>
        /// 取消任务
        /// </summary>
        /// <param name="index"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool DoCancelIndex(int index, out string result)
        {
            if (index == 0 || index == 0)
            {
                result = "任务ID,车ID不能为零";
                return(false);
            }

            NDCItem item = Items.Find(c => { return(c._mTask.NDCINDEX == index); });

            if (item == null)
            {
                item = TempItems.Find(c => { return(c._mTask.NDCINDEX == index); });
            }

            if (item == null)
            {
                result = "找不到任务Index:" + index + "任务.";
                return(false);
            }
            item.CancleFromSystem = true;

            DoDeleteOrder(index + "");
            result = "取消成功";
            return(true);
        }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Removes a key value pair from the list mapping
 /// </summary>
 /// <param name="key">Key to remove</param>
 /// <param name="values">The values to remove.</param>
 /// <returns>True if it is removed, false otherwise</returns>
 public bool Remove(TKey key, params TValue[] values)
 {
     values ??= Array.Empty <TValue>();
     if (values.Length == 0)
     {
         return(false);
     }
     lock (LockObject)
     {
         if (!Items.TryGetValue(key, out var TempItems))
         {
             return(false);
         }
         var ReturnValue = false;
         for (var x = 0; x < values.Length; ++x)
         {
             ReturnValue |= TempItems.Remove(values[x]);
         }
         if (TempItems.Count == 0)
         {
             Items.Remove(key);
         }
         return(ReturnValue);
     }
 }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        public string POCreate([FromBody] PurchaseOrderCreateDTO input)
        {
            var newPo = new PO();

            string iString = input.OrderDate;

            newPo.OrderDate = DateTime.ParseExact(iString, "yyyy-MM-dd", null);

            var supplier = _context.Suppliers.FirstOrDefault(s => s.Name == input.SupplierName);

            newPo.Supplier = supplier;
            int      supplierId = supplier.Id;
            DateTime orderDate  = DateTime.ParseExact(iString, "yyyy-MM-dd", null);

            var temp = new TempItems();

            temp.orderDate  = orderDate;
            temp.supplierId = supplierId;

            _context.Add(temp);

            _context.Add(newPo);

            _context.SaveChanges();

            var response = new ResponseDTO();

            response.Message = "Going Next Step";

            return(JsonSerializer.Serialize(new
            {
                result = response
            }));
        }
Esempio n. 6
0
 public async Task Update()
 {
     if (CurrentEditItem == null || !TempItems.Any())
     {
         TempItems = DataFactory.GetData(Items, ResetPage);
         await Refresh();
     }
 }
Esempio n. 7
0
        /// <summary>
        /// 绑定临时任务和最终任务信息
        /// </summary>
        /// <param name="item"></param>
        private void MatchTempInfo(NDCItem item)
        {
            try
            {
                if (item._mTask.TASKID == 0 && item._mTask.NDCINDEX != -1)
                {
                    NDCItem tempItem = TempItems.Find(c =>
                    {
                        return(c._mTask.IKEY == item._mTask.IKEY &&
                               c._mTask.NDCLOADSITE == item._mTask.NDCLOADSITE &&
                               c._mTask.NDCUNLOADSITE == item._mTask.NDCUNLOADSITE);
                    });
                    if (tempItem != null)
                    {
                        NDCItem i = Items.Find(c => c._mTask.IKEY == tempItem._mTask.IKEY);
                        if (i != null)
                        {
                            i._mTask.NDCINDEX = tempItem._mTask.NDCINDEX;
                            i.CARRIERID       = tempItem.CARRIERID;
                            i.DirectStatus    = tempItem.DirectStatus;
                            i.Magic           = tempItem.Magic;
                            i.Status          = tempItem.Status;
                            TempItems.Remove(tempItem);
                            item = i;
                        }
                    }
                }

                if (item._mTask.TASKID != 0 && item._mTask.NDCINDEX != 0)
                {
                    try
                    {
                        if (item.PLCStatus != NDCPlcStatus.Unloaded && item._mTask.PAUSE &&
                            item.Magic == 11)
                        {
                            //不做操作,挂起的任务异常结束就不通知WCS了
                        }
                        else
                        {
                            _NoticeWcsMagic(item._mTask.TASKID, item.CARRIERID + "", item.Magic);
                        }
                        _sqlControl.UpdateNdcItem(item);
                        return;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
                _sqlControl.UpdateNdcItem(item);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Esempio n. 8
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);
            }
        }
Esempio n. 9
0
 public override void OnSearch(object param)
 {
     if (string.IsNullOrEmpty(SearchText))
     {
         Items = TempItems.Select(x => x).ToList();
     }
     else
     {
         Logger.Debug(string.Format("Search prescription with text- {0}", SearchText));
         Items = TempItems.Where(x => ((PrescriptionModel)x).Comments.Contains(SearchText.Trim())).ToList();
     }
 }
Esempio n. 10
0
 public override void OnSearch(object param)
 {
     if (string.IsNullOrEmpty(SearchText))
     {
         Items = TempItems.Select(x => x).ToList();
     }
     else
     {
         Logger.Debug(string.Format("Search user with text- {0}", SearchText));
         Items = TempItems.Where(x => ((UserModel)x).UserName.Contains(SearchText.Trim())).ToList();
     }
 }
Esempio n. 11
0
 /// <summary>
 /// Removes a key value pair from the list mapping
 /// </summary>
 /// <param name="key">Key to remove</param>
 /// <param name="value">Value to remove</param>
 /// <returns>True if it is removed, false otherwise</returns>
 public bool Remove(T1 key, T2 value)
 {
     _ToString = null;
     lock (LockObject)
     {
         if (!Items.TryGetValue(key, out var TempItems))
         {
             return(false);
         }
         var ReturnValue = TempItems.Remove(value);
         if (TempItems.Count == 0)
         {
             Items.Remove(key);
         }
         return(ReturnValue);
     }
 }
Esempio n. 12
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);
            }
        }
Esempio n. 13
0
 /// <summary>
 /// Removes a key value pair from the list mapping
 /// </summary>
 /// <param name="key">Key to remove</param>
 /// <param name="value">Value to remove</param>
 /// <returns>True if it is removed, false otherwise</returns>
 public bool Remove(T1 key, IEnumerable <T2> value)
 {
     _ToString = null;
     lock (LockObject)
     {
         if (!Items.TryGetValue(key, out var TempItems))
         {
             return(false);
         }
         var NewValue    = TempItems.Except(value).ToList();
         var ReturnValue = TempItems.Count != NewValue.Count;
         if (NewValue.Count == 0)
         {
             Items.Remove(key);
         }
         else if (ReturnValue)
         {
             Items[key] = NewValue;
         }
         return(ReturnValue);
     }
 }
Esempio n. 14
0
 /// <summary>
 /// Checks whether the player has the specified item in the specified quantity in their temporary inventory.
 /// </summary>
 /// <param name="item">The name of the item to check for.</param>
 /// <param name="quantity">The quantity of the item to check for.</param>
 /// <returns>Whether the player's temporary inventory contains the specified item stack.</returns>
 public bool ContainsTempItem(string item, int quantity = 1) => quantity == 0 || TempItems.Contains(i => i.Name.Equals(item, StringComparison.OrdinalIgnoreCase) && i.Quantity >= quantity);
Esempio n. 15
0
 /// <summary>
 /// Gets a reference to the specified item in the player's temporary inventory. This can be used to access other information about the item.
 /// </summary>
 /// <param name="name">The name of the item.</param>
 /// <returns>A reference to the specified temporary item.</returns>
 public ItemBase GetTempItemByName(string name) => TempItems.Find(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
Esempio n. 16
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);
            }
        }