public FrameModel(int shelf, int row, int col) { Location = new LogicLocation() { Shelf = shelf, Row = row, Column = col }; }
public void Pop(LogicLocation location) { var frameNotEmpty = frames.Where(x => x.Location == location); foreach (var frame in frameNotEmpty) { frame.Times.Dequeue(); break; } }
private void Station_CanCollect(object sender, BaggageEventArgs e) { int z; if (algo.FlightAtShelf.Keys.Contains(e.Baggage.Flight)) { z = algo.FlightAtShelf[e.Baggage.Flight]; } else { if (mistery) { z = 0; } else { z = 1; } mistery = !mistery; } if (inputStackerLeft.ReadyForCollecting && z == 0) { int x, y; x = shelf1.Location.X; y = shelf1.Location.Y; LogicLocation logic = algo.Push(e.Baggage.Flight, z); if (logic == null) { return; } inputStackerLeft.GrabBag(station.ReleaseBag()); inputStackerLeft.ReadyForCollecting = false; inputStackerLeft.TargetPoint = new Point(x + (logic.Column) * 43 + 20, y + (logic.Row) * 43 + 20); inputStackerLeft.TargetLocation = logic; shelf1.SetFrameHighlight(logic.Column, logic.Row, Color.Black); } else if (inputStackerRight.ReadyForCollecting && z == 1) { int x, y; x = shelf2.Location.X; y = shelf2.Location.Y; LogicLocation logic = algo.Push(e.Baggage.Flight, z); if (logic == null) { return; } inputStackerRight.GrabBag(station.ReleaseBag()); inputStackerRight.ReadyForCollecting = false; inputStackerRight.TargetPoint = new Point(x + (logic.Column) * 43 + 20, y + (logic.Row) * 43 + 20); inputStackerRight.TargetLocation = logic; shelf2.SetFrameHighlight(logic.Column, logic.Row, Color.Black); } }
private void RightConveyor_CollectBaggage(object sender, EventArgs e) { string flight = (sender as Conveyor).Flight; if (algo.NeedRearrangeLocation.Count == 0) { if (outputStackerRight.ReadyForCollecting) { if (algo.CanPop(flight, 0)) { LogicLocation l = algo.Peek(flight, 0); if (shelf2.OwnBaggage(l.Column, l.Row, flight)) { int x, y; x = shelf2.Location.X; y = shelf2.Location.Y; LogicLocation logic = algo.Pop(flight, 0); if (logic == null) { MessageBox.Show(string.Format("航班{0}已完成出库。", flight)); if (tbDepartureFlight1.Text == flight) { tbDepartureFlight1.Text = ""; } else if (tbDepartureFlight2.Text == flight) { tbDepartureFlight2.Text = ""; } return; } outputStackerRight.TargetPoint = new Point(x + (logic.Column) * 43 + 20, y + (logic.Row) * 43 + 20); outputStackerRight.TargetLocation = logic; outputStackerRight.ReadyForCollecting = false; outputStackerRight.Rearranging = false; shelf2.SetFrameHighlight(logic.Column, logic.Row, Color.Red); } } } } }
public LogicLocationEventArgs(LogicLocation location) : base() { Location = location; }