Example #1
0
        private static void OrdenarCarros(CantidadCarros cantidad, int codigo_llamado)
        {
            // 5
            var     orden = new z_orden();
            DataSet ds    = orden.Getz_orden(codigo_llamado);

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                cantidad.Orden[i] = (int)ds.Tables[0].Rows[i]["orden_numero"];
            }
            cantidad.Ordenar();
        }
Example #2
0
 protected override void Mostrar(int id)
 {
     try
     {
         var orden = new z_orden();
         reorderListBox1.DisplayMember = "tipo_carro_letra";
         reorderListBox1.ValueMember   = "id_orden";
         reorderListBox1.DataSource    = orden.Getz_orden_tipo((int)listActuales.SelectedValue).Tables[0];
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
Example #3
0
        protected override void Actualizar()
        {
            try
            {
                int[] items = reorderListBox1.Items;
                var   o     = new z_orden();

                for (int i = 0; i < items.Length; i++)
                {
                    o = o.getObjectz_orden(items[i]);
                    o.orden_numero = i + 1;
                    o.modifyz_orden(o);
                }
                BitacoraGestion.NuevoEvento(zeusWin.IdOperadora, zeusWin.IdAval,
                                            "Modificación Tabla Orden de Solicitud de Carros");

                MessageBox.Show("Operación realizada correctamente.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
Example #4
0
        public static string ordenArreglo(ArrayList puntero_final, ArrayList list_id_carros, ArrayList list_carro_x, ArrayList list_carro_y, ArrayList list_compania, ArrayList list_ranking, string idcarros, string idgrupos, string recu, int cod_llamado, ArrayList list_comp)
        {
            List <int> despGrupo = new List <int>();
            var        ccarros   = new z_carros();
            var        cczorden  = new z_orden();

            string[] arr       = new string[puntero_final.Count];
            string[] arr_split = new string[puntero_final.Count];
            string[] arr_uso   = new string[puntero_final.Count];
            int      r         = Convert.ToInt32(recu);
            string   valores_finales_retorno = "";

            for (int a = 0; a < puntero_final.Count; a++)
            {
                arr[a] = puntero_final[a].ToString();
            }
            while (r != 0)
            {
                for (int b = 0; b < arr.Length; b++)
                {
                    string valor_envio = arr[b].ToString();
                    if (carrosPorRanking(valor_envio, list_id_carros) == 1)
                    {
                        ccarros = ccarros.getObjectz_carros(id_carro_puntero);
                        if (Carro.EstaDisponible(ccarros) && r != 0)
                        {
                            //despGrupo.Add(ccarros.id_carro);
                            if (companias_a_despachar.Count != 0)
                            {
                                if (verificarCandidatosDespacho(ccarros.id_compania, companias_a_despachar))
                                {
                                    companias_a_despachar.Add(ccarros.id_compania);
                                    valores_finales_retorno += ccarros.id_carro + ",";
                                    r--;
                                }
                            }
                            else
                            {
                                companias_a_despachar.Add(ccarros.id_compania);
                                valores_finales_retorno += ccarros.id_carro + ",";
                                r--;
                            }
                        }
                    }
                    else
                    {
                        int[]  t_carro     = new int[carros_compuesto.Length];
                        string tc_string   = "";
                        string tc_string_2 = "";
                        string tc_usar     = "";
                        string tc_usar_2   = "";
                        for (int c = 0; c < carros_compuesto.Length; c++)
                        {
                            tc_string_2 += carros_compuesto[c].ToString() + ",";
                            tc_string   += ccarros.recuperarValorTipoCarro(Convert.ToInt32(carros_compuesto[c])) + ",";
                        }
                        tc_string   += "#";
                        tc_string_2 += "#";

                        tc_usar   = tc_string.Replace(",#", "");
                        tc_usar_2 = tc_string_2.Replace(",#", "");

                        int[] tc_recuperado = cczorden.recuperarTipoCarroOrdenTipo(cod_llamado, tc_usar);
                        for (int d = 0; d < tc_recuperado.Length; d++)
                        {
                            int id_carro_final = cczorden.despachoPorTipo(Convert.ToInt32(tc_recuperado[d].ToString()), tc_usar_2);
                            ccarros = ccarros.getObjectz_carros(id_carro_final);
                            if (Carro.EstaDisponible(ccarros) && r != 0)
                            {
                                //despGrupo.Add(ccarros.id_carro);
                                if (companias_a_despachar.Count != 0)
                                {
                                    if (verificarCandidatosDespacho(ccarros.id_compania, companias_a_despachar))
                                    {
                                        companias_a_despachar.Add(ccarros.id_compania);
                                        valores_finales_retorno += ccarros.id_carro + ",";
                                        r--;
                                    }
                                }
                                else
                                {
                                    companias_a_despachar.Add(ccarros.id_compania);
                                    valores_finales_retorno += ccarros.id_carro + ",";
                                    r--;
                                }
                            }
                        }
                    }
                }
                r = 0;
            }
            valores_finales_retorno += "#";
            return(valores_finales_retorno);
        }
Example #5
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);
        }