Esempio n. 1
0
        /// <summary>
        /// 设置单元格各个方向的点
        /// </summary>
        /// <param name="c">单元格</param>
        public void GetNextCells(Cell c, string cmdId)
        {

            string cellNum = c.CellNum;
            string spreadNum = string.Empty;
            int x, y;

            string[] num = cellNum.Split('.');
            x = Fn.ToInt(num[0]);
            y = Fn.ToInt(num[1]);

            GetDirection(cmdId, cellNum);

            ArrayList cells = new ArrayList();
            if (InThisWh(cellNum))
            {


                if (c.CellStatus == (int)Route.CellType.Aisle)  //如果是货道,只能有1个方向要么是X,要么是Y
                {
                    //货道为X方向
                    if (_rack == "x")
                    {
                        spreadNum = GetSpreadNum(x, y, 1, 0);
                        if (c.WhModeId == 2 && cell_xf == -1)
                        {                            
                            if (InThisWh(spreadNum))
                            {
                                c.RightCell = (Cell)_Cells[spreadNum];
                            }
                        }
                        else if (c.WhModeId != 2)
                        {
                            if (InThisWh(spreadNum))
                            {
                                c.RightCell = (Cell)_Cells[spreadNum];
                            }
                        }
                        else
                        {
                            c.RightCell = null;
                        }

                        spreadNum = GetSpreadNum(x, y, -1, 0);
                        if (c.WhModeId == 2 && cell_xb == -1)
                        {
                            if (InThisWh(spreadNum))
                            {
                                c.LeftCell = (Cell)_Cells[spreadNum];
                            }
                        }
                        else if (c.WhModeId != 2)
                        {
                            if (InThisWh(spreadNum))
                            {
                                c.LeftCell = (Cell)_Cells[spreadNum];
                            }
                        }
                        else
                        {
                            c.LeftCell = null;
                        }


                    }
                    //货道为Y方向
                    if (_rack == "y")
                    {
                        spreadNum = GetSpreadNum(x, y, 0, 1);
                        if (c.WhModeId == 2 && cell_yf == -1)
                        {
                            if (InThisWh(spreadNum))
                            {
                                c.DownCell = (Cell)_Cells[spreadNum];
                            }
                        }
                        else if (c.WhModeId != 2)
                        {
                            if (InThisWh(spreadNum))
                            {
                                c.DownCell = (Cell)_Cells[spreadNum];
                            }
                        }
                        else
                        {
                            c.DownCell = null;
                        }


                        spreadNum = GetSpreadNum(x, y, 0, -1);
                        if (c.WhModeId == 2 && cell_yb == -1)
                        {
                            if (InThisWh(spreadNum))
                            {
                                c.UpCell = (Cell)_Cells[spreadNum];
                            }
                        }
                        else if (c.WhModeId != 2)
                        {
                            if (InThisWh(spreadNum))
                            {
                                c.UpCell = (Cell)_Cells[spreadNum];
                            }
                        }
                        else
                        {
                            c.UpCell = null;
                        }


                    }
                }
                else if (c.CellStatus == (int)Route.CellType.Goods)//有货
                {
                    if (_taskType == 2) //1为卸货 0为存货,有货的时候只能是卸货,所以未讨论0为存货的情况
                    {
                        if (_rack == "x")
                        {
                            spreadNum = GetSpreadNum(x, y, 1, 0);
                            if (c.WhModeId == 2 && cell_xf == -1)
                            {
                                if (InThisWh(spreadNum))
                                {
                                    c.RightCell = (Cell)_Cells[spreadNum];
                                }
                            }
                            else if (c.WhModeId != 2)
                            {
                                if (InThisWh(spreadNum))
                                {
                                    c.RightCell = (Cell)_Cells[spreadNum];
                                }
                            }
                            else
                            {
                                c.RightCell = null;
                            }

                            spreadNum = GetSpreadNum(x, y, -1, 0);
                            if (c.WhModeId == 2 && cell_xb == -1)
                            {
                                if (InThisWh(spreadNum))
                                {
                                    c.LeftCell = (Cell)_Cells[spreadNum];
                                }
                            }
                            else if (c.WhModeId != 2)
                            {
                                if (InThisWh(spreadNum))
                                {
                                    c.LeftCell = (Cell)_Cells[spreadNum];
                                }
                            }
                            else
                            {
                                c.LeftCell = null;
                            }

                        }
                        //货道为Y方向
                        if (_rack == "y")
                        {
                            spreadNum = GetSpreadNum(x, y, 0, 1);
                            if (c.WhModeId == 2 && cell_yf == -1)
                            {
                                if (InThisWh(spreadNum))
                                {
                                    c.DownCell = (Cell)_Cells[spreadNum];
                                }
                            }
                            else if (c.WhModeId != 2)
                            {
                                if (InThisWh(spreadNum))
                                {
                                    c.DownCell = (Cell)_Cells[spreadNum];
                                }
                            }
                            else
                            {
                                c.DownCell = null;
                            }

                            spreadNum = GetSpreadNum(x, y, 0, -1);
                            if (c.WhModeId == 2 && cell_yb == -1)
                            {
                                if (InThisWh(spreadNum))
                                {
                                    c.UpCell = (Cell)_Cells[spreadNum];
                                }
                            }
                            else if (c.WhModeId != 2)
                            {
                                if (InThisWh(spreadNum))
                                {
                                    c.UpCell = (Cell)_Cells[spreadNum];
                                }
                            }
                            else
                            {
                                c.UpCell = null;
                            }

                        }
                    }
                }
                else if (c.CellStatus == (int)Route.CellType.Lift || c.CellStatus == (int)Route.CellType.RoadWay)
                {
                    spreadNum = GetSpreadNum(x, y, 1, 0);//return spreadNum=(x+1,y+0),即平行向右一步
                    if (c.WhModeId == 2 && cell_xf == -1)
                    {
                        if (InThisWh(spreadNum))
                        {
                            c.RightCell = (Cell)_Cells[spreadNum];
                        }
                    }
                    else if (c.WhModeId != 2)
                    {
                        if (InThisWh(spreadNum))
                        {
                            c.RightCell = (Cell)_Cells[spreadNum];
                        }
                    }
                    else
                    {
                        c.RightCell = null;
                    }

                    spreadNum = GetSpreadNum(x, y, -1, 0);
                    if (c.WhModeId == 2 && cell_xb == -1)
                    {
                        if (InThisWh(spreadNum))
                        {
                            c.LeftCell = (Cell)_Cells[spreadNum];
                        }
                    }
                    else if (c.WhModeId != 2)
                    {
                        if (InThisWh(spreadNum))
                        {
                            c.LeftCell = (Cell)_Cells[spreadNum];
                        }
                    }
                    else
                    {
                        c.LeftCell = null;
                    }


                    spreadNum = GetSpreadNum(x, y, 0, -1);
                    if (c.WhModeId == 2 && cell_yf == -1)
                    {
                        if (InThisWh(spreadNum))
                        {

                            c.DownCell = (Cell)_Cells[spreadNum];
                        }
                    }
                    else if (c.WhModeId != 2)
                    {
                        if (InThisWh(spreadNum))
                        {

                            c.DownCell = (Cell)_Cells[spreadNum];
                        }
                    }
                    else
                    {
                        c.DownCell = null;
                    }

                    spreadNum = GetSpreadNum(x, y, 0, 1);
                    if (c.WhModeId == 2 && cell_yb == -1)
                    {
                        if (InThisWh(spreadNum))
                        {
                            c.UpCell = (Cell)_Cells[spreadNum];
                        }
                    }
                    else if (c.WhModeId != 2)
                    {
                        if (InThisWh(spreadNum))
                        {
                            c.UpCell = (Cell)_Cells[spreadNum];
                        }
                    }
                    else
                    {
                        c.UpCell = null;
                    }



                }

               

            }


        }
Esempio n. 2
0
        public void InitParameter(string cmdId)
        {
            InitTaskParameter(cmdId);
            DataTable dtCell = GetWhCells(cmdId).Tables[0];
            _Cells = new Hashtable();


            for (int i = 0; i < dtCell.Rows.Count; i++)
            {
                //为每个单元格实例化一个类
                Cell c = new Cell();
                c.TargetNum = _toNum;
                c.CellNum = Fn.ToString(dtCell.Rows[i]["cell_num"]);
                c.Rack = _rack;
                c.CellStatus = Fn.ToInt(dtCell.Rows[i]["celltype_code"]);
                c.Route = "";
                c.CellXf = Fn.ToInt(dtCell.Rows[i]["cell_xf"]);
                c.CellXb = Fn.ToInt(dtCell.Rows[i]["cell_xb"]);
                c.CellYf = Fn.ToInt(dtCell.Rows[i]["cell_yf"]);
                c.CellYb = Fn.ToInt(dtCell.Rows[i]["cell_yb"]);
                c.WhModeId = Fn.ToInt(dtCell.Rows[i]["wh_mode_id"]);
                _Cells.Add(Fn.ToString(dtCell.Rows[i]["cell_num"]), c);
            }

            SetCellsNextCells(cmdId);
        }