Esempio n. 1
0
        //private static Dictionary<int, string> tipo_carros;

        public static int ranking(int id_expediente, int id_area, int bloque)
        {
            e_expedientes expediente    = new e_expedientes();
            z_carros      zcarros       = new z_carros();
            z_orden       zorden        = new z_orden();
            ArrayList     puntero_final = new ArrayList();
            ArrayList     lista_carros  = new ArrayList();
            ArrayList     list_ranking  = new ArrayList();
            ArrayList     array_final   = new ArrayList();
            int           cant_carros   = 0;
            int           j             = 0;
            int           p             = 0;

            try
            {
                expediente = expediente.getObjecte_expedientes(id_expediente);
                string      punto_x            = expediente.puntoX.ToString();
                string      punto_y            = expediente.puntoY.ToString();
                string[]    carros_in          = expediente.recuperarDespachoHabil(expediente.codigo_llamado);
                ArrayList   alist_orden_grupo  = zorden.xOrdenGrupo(expediente.codigo_llamado);
                ArrayList[] array_lista_carros = new ArrayList[5];
                int[]       posicion           = new int[carros_in.Length];
                for (int a = 0; a < carros_in.Length; a++)
                {
                    string[] operacion_grupos = carros_in[a].Split('/');
                    for (int i = 0; i < alist_orden_grupo.Count; i++)
                    {
                        if (operacion_grupos[1].ToString() == alist_orden_grupo[i].ToString())
                        {
                            posicion[p] = j;
                            p++;
                            j++;
                        }
                    }
                }
                Array.Sort(posicion);
                int[] orden_final = new int[posicion.Length];
                for (int c = 0; c < posicion.Length; c++)
                {
                    int valor_posicion_array = Convert.ToInt32(posicion[c].ToString());
                    orden_final[c] = Convert.ToInt32(alist_orden_grupo[valor_posicion_array].ToString());
                }
                for (int f = 0; f < orden_final.Length; f++)
                {
                    string[] group = carros_in[f].Split('/');
                    for (int l = 0; l < carros_in.Length; l++)
                    {
                        if (group[1].ToString() == orden_final[f].ToString())
                        {
                            int int_r = Convert.ToInt32(group[2].ToString());
                            // Crear arraylist por cada campos.
                            array_lista_carros = zcarros.obtenerCarrosIN(group[0]);
                            //cant_carros = lista_carros.Count;
                            ArrayList list_id_carros = new ArrayList();
                            ArrayList list_carro_x   = new ArrayList();
                            ArrayList list_carro_y   = new ArrayList();
                            ArrayList list_compania  = new ArrayList();
                            //ArrayList list_ranking = new ArrayList();
                            // arreglo nuevo que creamos **************************
                            ArrayList list_carros_despacho = new ArrayList();
                            // ****************************************************

                            list_id_carros = array_lista_carros[0];
                            list_carro_x   = array_lista_carros[1];
                            list_carro_y   = array_lista_carros[2];
                            list_compania  = array_lista_carros[3];
                            list_ranking   = array_lista_carros[4];

                            string[] ccarro  = new string[list_id_carros.Count];
                            string[] px      = new string[list_carro_x.Count];
                            string[] py      = new string[list_carro_y.Count];
                            string[] comp    = new string[list_compania.Count];
                            string[] ranking = new string[list_ranking.Count];

                            for (int b = 0; b < list_id_carros.Count; b++)
                            {
                                ccarro[b] = list_id_carros[b].ToString();
                            }

                            for (int c = 0; c < list_carro_x.Count; c++)
                            {
                                px[c] = list_carro_x[c].ToString();
                            }

                            for (int d = 0; d < list_carro_y.Count; d++)
                            {
                                py[d] = list_carro_y[d].ToString();
                            }

                            for (int e = 0; e < list_compania.Count; e++)
                            {
                                comp[e] = list_compania[e].ToString();
                            }

                            for (int h = 0; h < list_ranking.Count; h++)
                            {
                                ranking[h] = list_ranking[h].ToString();
                            }

                            puntero_final = despacharGrupo(group[0], group[1], group[2], list_ranking);
                            string ret_final = ordenArreglo(puntero_final, list_id_carros, list_carro_x, list_carro_y, list_compania, list_ranking, group[0], group[1], group[2], expediente.codigo_llamado, list_compania);
                            array_final.Add(ret_final);
                            ArrayList aa_empty = new ArrayList();
                            companias_a_despachar = aa_empty;
                            l = l + 1;
                        }
                    }
                }
            }
            catch (Exception exe)
            {
            }

            return(1);
        }