Example #1
0
        public AGVUtil getAGVUtil()
        {
            if (agvUtil == null)
            {
                agvUtil = new AGVUtil();
            }

            return(agvUtil);
        }
        /// <summary>
        /// 点击后,注意查看主界面车子是否启动,如果没有启动,可以进来再次点击启动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pauseCtroButton_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            if (forklift.getPauseStr().Equals("暂停"))
            {
                AGVUtil.setForkCtrl(forklift, 0);
                forklift.getForkLift().shedulePause = 0;
                forklift.getPosition().calcPositionArea();
                button.Text    = "运行";
                button.Enabled = false;
            }
        }
Example #3
0
        private void confirm_Click(object sender, EventArgs e)
        {
            DialogResult dr;
            string       message = "确认禁用" + disableForkLiftNumber + "号车吗";

            dr = MessageBox.Show(message, "禁用单车确认", MessageBoxButtons.YesNo);

            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                AGVUtil.disableForklift(disableForkLiftNumber);
                this.Hide();
            }
        }
        private void addAllTaskRecordButton_Click(object sender, EventArgs e)
        {
            List <TaskRecord> listTaskRecords = TaskReordService.getInstance().getReadySendTaskRecordList();

            if (listTaskRecords.Count > 0)
            {
                DialogResult dr;
                dr = MessageBox.Show("有缓存任务,禁止一键添加", "提示", MessageBoxButtons.OK);
            }
            else
            {
                AGVUtil.addAllTaskRecord();
                updateFrm();
            }
        }
        private void shedulePause()          //用于系统暂停时,检测暂停是否发送成功,如果没有发送成功,则一直向该车发送暂停
        {
            while (currentPause > SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_TYPE_MIN && currentPause < SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_UP_MAX)
            {
                foreach (ForkLiftWrapper fl in AGVCacheData.getForkLiftWrapperList())
                {
                    if (currentPause == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_UP_WITH_START || currentPause == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_UP_WITHOUT_START)                     //楼上楼下都有货时,暂停楼上的车,露楼下的车不用检测20160929 破凉
                    {
                        if (fl.getForkLift().forklift_number == 3)
                        {
                            continue;
                        }
                    }
                    if (fl.getPauseStr().Equals("运行"))                      //如果该车返回的pauseStat没有被设置成1,则向该车发送暂停
                    {
                        AGVUtil.setForkCtrlWithPrompt(fl, 1);
                    }
                }

                Thread.Sleep(30000);
            }
        }
Example #6
0
        public void scheduleInstruction()
        {
            while (ScheduleFactory.getSchedule().getScheduleFlag())
            {
                Thread.Sleep(500);
                sheduleLift();

                if (AGVSystem.getSystem().getSystemPause())
                {
                    if (AGVSystem.getSystem().getLastPause() != SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_SYSTEM_WITH_START && AGVSystem.getSystem().getLastPause() != SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_SYSTEM_WITHOUT_START)                     //避免多次设置
                    {
                        foreach (ForkLiftWrapper fl in AGVCacheData.getForkLiftWrapperList())
                        {
                            if (fl.getForkLift().shedulePause == 0)
                            {
                                AGVUtil.setForkCtrl(fl, 1);                                  //向不是暂停的车发送暂停指令
                            }
                        }
                    }

                    AGVSystem.getSystem().setLastPause(AGVSystem.getSystem().getCurrentPause());
                    continue;                                                                                                                                                                                           //系统暂停后不需要调度
                }
                else if (AGVSystem.getSystem().getCurrentPause() == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_UP_WITH_START || AGVSystem.getSystem().getCurrentPause() == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_UP_WITHOUT_START) //暂停楼上的车,有时候卸货不及时
                {
                    if (AGVSystem.getSystem().getLastPause() != SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_UP_WITH_START && AGVSystem.getSystem().getLastPause() != SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_UP_WITHOUT_START)        //避免多次设置
                    {
                        foreach (ForkLiftWrapper fl in AGVCacheData.getForkLiftWrapperList())
                        {
                            if (fl.getForkLift().forklift_number != 3 && fl.getForkLift().shedulePause == 0)                              //只调度楼上的车
                            {
                                AGVUtil.setForkCtrl(fl, 1);
                            }
                        }
                    }

                    AGVSystem.getSystem().setLastPause(AGVSystem.getSystem().getCurrentPause());
                    continue;                      //楼上的车子被暂停后,不需要调度
                }
                else if (AGVSystem.getSystem().getCurrentPause() == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_DOWN_WITH_START || AGVSystem.getSystem().getCurrentPause() == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_DOWN_WITHOUT_START)
                {
                    if (AGVSystem.getSystem().getLastPause() != SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_DOWN_WITH_START && AGVSystem.getSystem().getLastPause() != SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_DOWN_WITHOUT_START)                     //避免多次设置
                    {
                        ForkLiftWrapper fl = ForkLiftWrappersService.getInstance().getForkLiftByNunber(3);
                        AGVUtil.setForkCtrl(fl, 1);
                    }

                    AGVSystem.getSystem().setLastPause(AGVSystem.getSystem().getCurrentPause());
                }
                else
                {
                    if (AGVSystem.getSystem().getLastPause() == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_SYSTEM_WITH_START)
                    {
                        foreach (ForkLiftWrapper fl in AGVCacheData.getForkLiftWrapperList())
                        {
                            if (fl.getForkLift().shedulePause == 0)
                            {
                                AGVUtil.setForkCtrl(fl, 0);                                  //之前不是暂停的车,发送启动指令
                            }
                        }
                    }

                    if (AGVSystem.getSystem().getLastPause() == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_UP_WITH_START)
                    {
                        foreach (ForkLiftWrapper fl in AGVCacheData.getForkLiftWrapperList())
                        {
                            if (fl.getForkLift().forklift_number != 3 && fl.getForkLift().shedulePause == 0)
                            {
                                AGVUtil.setForkCtrl(fl, 0);                                  //之前不是暂停的车,发送启动指令
                            }
                        }
                    }

                    if (AGVSystem.getSystem().getLastPause() == SHEDULE_PAUSE_TYPE_T.SHEDULE_PAUSE_DOWN_WITH_START)
                    {
                        ForkLiftWrapper fl = ForkLiftWrappersService.getInstance().getForkLiftByNunber(3);
                        AGVUtil.setForkCtrl(fl, 0);
                    }

                    AGVSystem.getSystem().setLastPause(AGVSystem.getSystem().getCurrentPause());
                }

                lock (LockController.getLockController().getLockForkLift())                  //加锁,避免车的状态不一致
                {
                    _sheduleRunning();
                }
            }
        }
Example #7
0
        private void _sheduleRunning()
        {
            ForkLiftWrapper fl_1         = null;
            ForkLiftWrapper fl_2         = null;
            SHEDULE_TYPE_T  shedule_type = SHEDULE_TYPE_T.SHEDULE_TYPE_MIN;

            foreach (ForkLiftWrapper fl in AGVCacheData.getForkLiftWrapperList())
            {
                if (fl.getForkLift().forklift_number != 3 && fl.getForkLift().isUsed == 1 && fl.getForkLift().taskStep != TASK_STEP.TASK_IDLE)                  //调度没有在使用的车 车子任务没有完成,只有当两辆车同时使用时,才调度
                {
                    if (fl_1 != null)
                    {
                        fl_2 = fl;
                    }
                    else
                    {
                        fl_1 = fl;
                    }
                }
            }

            if (fl_1 != null && fl_2 != null)              //两车同时运行时才需要调度
            {
                shedule_type = getForkSheduleType(fl_1);

                if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_1TO2)
                {
                    if (fl_2.getForkLift().shedulePause == 0 && fl_2.getPosition().getArea() == 2)                      //检测到另一辆车在区域2运行,需要暂停刚进入区域2的车
                    {
                        if (fl_1.getForkLift().shedulePause == 0)
                        {
                            AGVUtil.setForkCtrl(fl_1, 1);
                            fl_1.getForkLift().shedulePause = 1;
                        }
                    }
                    else                       //否则该车正常进入区域2,考虑到之前可能被暂停,没有车在区域2后,该车将被启动
                    {
                        fl_1.getPosition().setArea(2);
                        if (fl_1.getForkLift().shedulePause == 1)
                        {
                            //向1车发送启动
                            AGVUtil.setForkCtrl(fl_1, 0);
                            fl_1.getForkLift().shedulePause = 0;
                        }
                    }
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_2TO3)
                {
                    if (fl_2.getForkLift().shedulePause == 0 && fl_2.getPosition().getArea() == 3)
                    {
                        if (fl_1.getForkLift().shedulePause == 0)
                        {
                            AGVUtil.setForkCtrl(fl_1, 1);
                            fl_1.getForkLift().shedulePause = 1;
                        }
                    }
                    else
                    {
                        fl_1.getPosition().setArea(3);
                        if (fl_1.getForkLift().shedulePause == 1)
                        {
                            //向1车发送启动
                            AGVUtil.setForkCtrl(fl_1, 0);
                            fl_1.getForkLift().shedulePause = 0;
                        }
                    }
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_3TO2)
                {
                    if (fl_2.getForkLift().shedulePause == 0 && fl_2.getPosition().getArea() == 2)
                    {
                        if (fl_1.getForkLift().shedulePause == 0)
                        {
                            AGVUtil.setForkCtrl(fl_1, 1);
                            fl_1.getForkLift().shedulePause = 1;
                        }
                    }
                    else
                    {
                        fl_1.getPosition().setArea(2);
                        if (fl_1.getForkLift().shedulePause == 1)
                        {
                            //向1车发送启动
                            AGVUtil.setForkCtrl(fl_1, 0);
                            fl_1.getForkLift().shedulePause = 0;
                        }
                    }
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_2TO1)
                {
                    if (fl_2.getForkLift().shedulePause == 0 && fl_2.getPosition().getArea() == 1)
                    {
                        if (fl_1.getForkLift().shedulePause == 0)
                        {
                            AGVUtil.setForkCtrl(fl_1, 1);
                            fl_1.getForkLift().shedulePause = 1;
                        }
                    }
                    else
                    {
                        fl_1.getPosition().setArea(1);
                        if (fl_1.getForkLift().shedulePause == 1)
                        {
                            //向1车发送启动
                            AGVUtil.setForkCtrl(fl_1, 0);
                            fl_1.getForkLift().shedulePause = 0;
                        }
                    }
                }

                shedule_type = getForkSheduleType(fl_2);

                if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_1TO2)
                {
                    if (fl_1.getForkLift().shedulePause == 0 && fl_1.getPosition().getArea() == 2)                      //检测到另一辆车在区域2运行,需要暂停刚进入区域2的车
                    {
                        if (fl_2.getForkLift().shedulePause == 0)
                        {
                            AGVUtil.setForkCtrl(fl_2, 1);
                            fl_2.getForkLift().shedulePause = 1;
                        }
                    }
                    else                       //否则该车正常进入区域2,考虑到之前可能被暂停,没有车在区域2后,该车将被启动
                    {
                        fl_2.getPosition().setArea(2);
                        if (fl_2.getForkLift().shedulePause == 1)
                        {
                            //向1车发送启动
                            AGVUtil.setForkCtrl(fl_2, 0);
                            fl_2.getForkLift().shedulePause = 0;
                        }
                    }
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_2TO3)
                {
                    if (fl_1.getForkLift().shedulePause == 0 && fl_1.getPosition().getArea() == 3)
                    {
                        if (fl_2.getForkLift().shedulePause == 0)
                        {
                            AGVUtil.setForkCtrl(fl_2, 1);
                            fl_2.getForkLift().shedulePause = 1;
                        }
                    }
                    else
                    {
                        fl_2.getPosition().setArea(3);
                        if (fl_2.getForkLift().shedulePause == 1)
                        {
                            //向1车发送启动
                            AGVUtil.setForkCtrl(fl_2, 0);
                            fl_2.getForkLift().shedulePause = 0;
                        }
                    }
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_3TO2)
                {
                    if (fl_1.getForkLift().shedulePause == 0 && fl_1.getPosition().getArea() == 2)
                    {
                        if (fl_2.getForkLift().shedulePause == 0)
                        {
                            AGVUtil.setForkCtrl(fl_2, 1);
                            fl_2.getForkLift().shedulePause = 1;
                        }
                    }
                    else
                    {
                        fl_2.getPosition().setArea(2);
                        if (fl_2.getForkLift().shedulePause == 1)
                        {
                            //向1车发送启动
                            AGVUtil.setForkCtrl(fl_2, 0);
                            fl_2.getForkLift().shedulePause = 0;
                        }
                    }
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_2TO1)
                {
                    if (fl_1.getForkLift().shedulePause == 0 && fl_1.getPosition().getArea() == 1)
                    {
                        if (fl_2.getForkLift().shedulePause == 0)
                        {
                            AGVUtil.setForkCtrl(fl_2, 1);
                            fl_2.getForkLift().shedulePause = 1;
                        }
                    }
                    else
                    {
                        fl_2.getPosition().setArea(1);
                        if (fl_2.getForkLift().shedulePause == 1)
                        {
                            //向1车发送启动
                            AGVUtil.setForkCtrl(fl_2, 0);
                            fl_2.getForkLift().shedulePause = 0;
                        }
                    }
                }

                checkPausePosition(fl_1);
                checkPausePosition(fl_2);
            }
            else if (fl_1 != null && fl_2 == null)
            {
                shedule_type = getForkSheduleType(fl_1);
                if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_1TO2)
                {
                    fl_1.getPosition().setArea(2);
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_2TO3)
                {
                    fl_1.getPosition().setArea(3);
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_3TO2)
                {
                    fl_1.getPosition().setArea(2);
                }
                else if (shedule_type == SHEDULE_TYPE_T.SHEDULE_TYPE_2TO1)
                {
                    fl_1.getPosition().setArea(1);
                }

                if (fl_1.getForkLift().shedulePause == 1)                 //如果车子被暂停,启动该车
                {
                    AGVUtil.setForkCtrl(fl_1, 0);
                    fl_1.getForkLift().shedulePause = 0;
                }
            }
        }