Beispiel #1
0
 private void CheckForDequeue()
 {
     if (NeedRearrangeLocation.Count > 0)
     {
         FrameModel f = frames.Where(x => x.Location == NeedRearrangeLocation.Peek()).ElementAt(0);
         if (f.Times.Count > 0)
         {
             if (!string.IsNullOrEmpty(CurrentFlight))
             {
                 if (f.Times.Peek() == CurrentFlight)
                 {
                     NeedRearrangeLocation.Dequeue();
                     return;
                 }
             }
             for (int i = 1; i < f.Times.Count; i++)
             {
                 if (FlightTime[f.Times.ElementAt(i - 1)] > FlightTime[f.Times.ElementAt(i)])
                 {
                     return;
                 }
             }
         }
         NeedRearrangeLocation.Dequeue();
     }
 }
Beispiel #2
0
        public LogicLocation Pop(string flight, int shelf)
        {
            CurrentFlight = flight;
            if (string.IsNullOrEmpty(flight))
            {
                MessageBox.Show("航班号不存在!");
                return(null);
            }
            var frameNotEmpty = frames.Where(x => x.Times.Count > 0 && x.Location.Shelf == shelf);

            foreach (var frame in frameNotEmpty)
            {
                if (frame.Times.Peek() == flight)
                {
                    frame.Times.Dequeue();
                    return(frame.Location);
                }
            }
            FrameModel f = CheckForRest(frameNotEmpty.ToList(), flight);

            if (f != null)
            {
                NeedRearrangeLocation.Enqueue(f.Location);
                return(f.Location);
            }
            return(null);
        }