Ejemplo n.º 1
0
        /// <summary>
        /// 获取行走后面的点
        /// </summary>
        static List <Motion> GetNextListMotion(STask sTask, PathPoint pathPoint, Agv agv)
        {
            List <Motion>    listMotion    = new List <Motion>();
            List <PathPoint> listPathPoint = sTask.pathList;

            //移除当前点之前的路径点
            sTask.pathList.RemoveAll(a => a.serialNo < pathPoint.serialNo);

            int i = 0;

            foreach (PathPoint pp in listPathPoint)
            {
                i++;
                if (i == 5)
                {
                    break;
                }

                Point nowPoint = pp.point;

                if (Commond.IsTest && nowPoint.barCode == "2280")
                {
                    listMotion.Add(GetObject.GetMotion(sTask, pp));
                    continue;
                }
                if (nowPoint.lockedAgv == agv)
                {
                    listMotion.Add(GetObject.GetMotion(sTask, pp));
                    continue;
                }

                if (nowPoint.lockedAgv != null)
                {
                    //找到占用此点的小车
                    //如果小车没任务且在低位,则让其回家

                    Agv nextAgv = nowPoint.lockedAgv;

                    if (nextAgv.sTaskList.Count == 0)
                    {
                        //创建一个回家任务
                    }
                    else
                    {
                        List <PathPoint> lpp = nextAgv.sTaskList[0].pathList;
                        if (lpp.Exists(a => a.point.barCode == agv.barcode))
                        {
                            //发送取消任务
                            //agv回复取消成果,则删除路径及更新任务状态
                            //Task.ResetPath(agv);
                        }
                    }

                    break;
                }

                if (IsLoop(nowPoint, new List <Agv>()
                {
                    agv
                }))
                {
                    break;
                }

                //如果当前点货架,且小车是顶升   不走
                Shelf shelf = App.ShelfList.FirstOrDefault(a => a.currentBarcode == nowPoint.barCode);
                if (agv.height != HeightEnum.Low && shelf != null)
                {
                    break;
                }

                nowPoint.lockedAgv = agv;
                listMotion.Add(GetObject.GetMotion(sTask, pp));

                if (pp.isCorner)
                {
                    break;
                }
            }

            return(listMotion);
        }