Пример #1
0
        public void startCheckIn4(DropOff dr)
        {
            UpdateComboBoxes();
            CreateCheckIn4(dr);
            airport.AssignTimerToBags(4, dr);
            //CheckIn checkIn4 = new CheckIn(dr, "checkIn4", 4);
            //airport.addCheckin(checkIn4);
            //Conveyor conveyor7 = new Conveyor(dr, "conv7");
            //Conveyor conveyor8 = new Conveyor(dr, "conv8");
            //checkIn4.Point = new Point(685, 0);
            //LinkedList link4 = new LinkedList();
            //C4 = new CreateLinkList(link4, checkIn4, conveyor7, conveyor8, mpa, dr);
            //btnCheckIn4.Enabled = false;
            //comboBox4.Enabled = false;
            //lbDrop4.Text = dr.Name;

            bool more50 = MoreThen50Bags(dr, 4);

            if (more50 == false)
            {
                CheckIn4Timer.Tag      = dr;
                CheckIn4Timer.Interval = 1;
                CheckIn4Timer.Start();
            }
        }
Пример #2
0
        private void btnBreak_Click(object sender, EventArgs e)
        {
            if (CheckIn1Timer.Enabled == false)
            {
                CheckIn1Timer.Interval = 1;
                CheckIn1Timer.Start();

                if (btnCheckIn2.Enabled == false)
                {
                    CheckIn2Timer.Interval = 1;
                    CheckIn2Timer.Start();
                }

                if (btnCheckIn3.Enabled == false)
                {
                    CheckIn3Timer.Interval = 1;
                    CheckIn3Timer.Start();
                }
                if (btnCheckIn4.Enabled == false)
                {
                    CheckIn4Timer.Interval = 1;
                    CheckIn4Timer.Start();
                }
            }
            else
            {
                CheckIn1Timer.Enabled = true;
                CheckIn1Timer.Stop();

                if (btnCheckIn2.Enabled == false)
                {
                    CheckIn2Timer.Enabled = true;
                    CheckIn2Timer.Stop();
                }

                if (btnCheckIn3.Enabled == false)
                {
                    CheckIn3Timer.Enabled = true;
                    CheckIn3Timer.Stop();
                }

                if (btnCheckIn4.Enabled == false)
                {
                    CheckIn4Timer.Enabled = true;
                    CheckIn4Timer.Stop();
                }
            }
        }
Пример #3
0
        private void btnCheckIn4_Click(object sender, EventArgs e)
        {
            UpdateComboBoxes();
            DropOff drop = GetDropSelected(4);

            if (drop.UsedBy != 0)
            {
                startCheckIn4(drop);
                airport.DevideBetween2Checks(drop, 4, drop.UsedBy);
                drop.UsedBy = 4;
                //comboBox4.Items.RemoveAt(drop.Number);
            }
            else
            {
                startCheckIn4(drop);
                drop.UsedBy            = 4;
                CheckIn4Timer.Interval = 1;
                CheckIn4Timer.Tag      = drop;
                CheckIn4Timer.Start();
            }

            btnCheckIn4.Enabled = false;
        }
Пример #4
0
        //if checkin has more then 50bags try to make use of another checkin
        public bool MoreThen50Bags(DropOff d, int checkInNum)
        {
            bool x    = false;
            int  bags = airport.getBagByDropOff(d).Count();

            //if bags are less then 10 then just return
            if (bags < 10)
            {
                return(x);
            }

            // check which checkin is not used
            if (btnCheckIn2.Enabled == true)
            {
                //use checkin2 as well
                if (MessageBox.Show("Make use of checkIn2 for " + d.Name, "Are you sure ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    // user clicked yes
                    x        = true;
                    d.UsedBy = 2;
                    //CheckIn maincheck = airport.GetCheckInById(checkInNum);
                    CreateCheckIn2(d);

                    //CheckIn checkIn2;
                    //checkIn2 = new CheckIn(d, "checkIn2", 2);
                    //airport.addCheckin(checkIn2);
                    //Conveyor conveyor3 = new Conveyor(d, "conv3");
                    //Conveyor conveyor4 = new Conveyor(d, "conv4");
                    //checkIn2.Point = new Point(365, 0);
                    //LinkedList link2 = new LinkedList();
                    //C2 = new CreateLinkList(link2, checkIn2, conveyor3, conveyor4, mpa, d);
                    //btnCheckIn2.Enabled = false;
                    //comboBox2.Enabled = false;
                    //lbDrop2.Text = d.Name;
                    //removeDropFromComboBoxs(d.Number);

                    airport.DevideBetween2Checks(d, checkInNum, 2);

                    CheckIn1Timer.Tag      = d;
                    CheckIn1Timer.Interval = 1;
                    CheckIn1Timer.Start();

                    CheckIn2Timer.Tag      = d;
                    CheckIn2Timer.Interval = 1;
                    CheckIn2Timer.Start();
                }
            }
            else if (btnCheckIn3.Enabled == true)
            {
                //use checkin2 as well
                if (MessageBox.Show("Make use of checkIn3 for " + d.Name, "Are you sure ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    // user clicked yes
                    x        = true;
                    d.UsedBy = 3;

                    CreateCheckIn3(d);

                    //CheckIn checkIn3 = new CheckIn(d, "checkIn3", 3);
                    //airport.addCheckin(checkIn3);

                    //Conveyor conveyor5 = new Conveyor(d, "conv5");
                    //Conveyor conveyor6 = new Conveyor(d, "conv6");
                    //checkIn3.Point = new Point(525, 0);
                    //LinkedList link3 = new LinkedList();
                    //C3 = new CreateLinkList(link3, checkIn3, conveyor5, conveyor6, mpa, d);
                    //btnCheckIn3.Enabled = false;
                    //comboBox3.Enabled = false;
                    //lbDrop3.Text = d.Name;


                    airport.DevideBetween2Checks(d, checkInNum, 3);
                    CheckIn3Timer.Tag      = d;
                    CheckIn3Timer.Interval = 1;
                    CheckIn3Timer.Start();
                }
            }
            else if (btnCheckIn4.Enabled == true)
            {
                //use checkin2 as well
                if (MessageBox.Show("Make use of checkIn4 for " + d.Name, "Are you sure ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    // user clicked yes
                    x        = true;
                    d.UsedBy = 4;
                    CreateCheckIn4(d);

                    //CheckIn checkIn4 = new CheckIn(d, "checkIn4", 4);
                    //airport.addCheckin(checkIn4);
                    //Conveyor conveyor7 = new Conveyor(d, "conv7");
                    //Conveyor conveyor8 = new Conveyor(d, "conv8");
                    //checkIn4.Point = new Point(685, 0);
                    //LinkedList link4 = new LinkedList();
                    //C4 = new CreateLinkList(link4, checkIn4, conveyor7, conveyor8, mpa, d);

                    //btnCheckIn4.Enabled = false;
                    //comboBox4.Enabled = false;
                    //lbDrop4.Text = d.Name;



                    airport.DevideBetween2Checks(d, checkInNum, 4);
                    CheckIn4Timer.Tag      = d;
                    CheckIn4Timer.Interval = 1;
                    CheckIn4Timer.Start();
                }
            }
            else
            {
                return(false);
            }


            return(x);
        }