Пример #1
0
        /// <summary>
        /// 自动更新AGV位置线程
        /// </summary>
        /// <param name="Number">AGV编号</param>
        public static void threadUpdataPath(object Number)
        {
            int AGVnum;

            int[] order;
            AGVnum = int.Parse(Number.ToString());
            while (true)
            {
                order = ListClass.ListPathCol(AGVnum);
                if (order != null)
                {
                    UpdataAGV(AGVnum, order[0], order[1]);
                }
                else if (Config.AGVMoveFlag[Config.AGVNum1[AGVnum]] == true)
                {
                    if (Config.PathList[Config.AGVPath1[AGVnum]] != null)
                    {
                        Thread.Sleep(Config.PathList[Config.AGVPath1[AGVnum]].Interval);
                        UpdataPath(AGVnum);
                    }
                    else
                    {
                        Thread.Sleep(200);
                    }
                }
                else
                {
                    Thread.Sleep(200);
                }

                if (Config.AGVMoveFlag[Config.AGVNum1[AGVnum]] == false)
                {
                    Config.autoEvent.WaitOne(); //阻塞当前线程,等待通知以继续执行
                }
            }
        }