//######################################## //### JSON APOLO Y PUBLICAR EVENTOS ### //######################################## public void ApoloHoraCarro(string ClaveCarro, string zUser, string zPw) { var ccarros = new z_carros(); ccarros = ccarros.getObjectz_carros(carroUsado.id_carro); string strCarro = ccarros.nombre; exp = exp.getObjecte_expedientes(carroUsado.id_expediente); string[] GetFechaHora = exp.fecha.ToString().Split(' '); string obj = "{"; obj += "'usuario':'" + zUser + "',"; obj += "'password':'******',"; obj += "'expediente':'" + carroUsado.id_expediente.ToString() + "',"; obj += "'fecha':'" + GetFechaHora[0].ToString() + "',"; obj += "'hora':'" + GetFechaHora[1].ToString() + "',"; obj += "'carro':'" + strCarro + "',"; obj += "'clave_hora':'" + ClaveCarro + "',"; obj += "'hora_evento':'" + System.DateTime.Now.ToString() + "'}"; string obj_v2 = obj.Replace(" ", "?"); if (ccarros.GetParametroPrioridad(2).Equals("TRUE")) { System.Diagnostics.Process proceso2 = new System.Diagnostics.Process(); proceso2.StartInfo.FileName = @"C:\ZEUS_CBMS\Apolo\emergencias_2.py"; proceso2.StartInfo.Arguments = obj_v2; proceso2.StartInfo.CreateNoWindow = true; proceso2.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proceso2.Start(); } }
public void OnAsignacionHandler(object sender, DataEventArgs e) { // cargar el nodo var exp = new e_expedientes(); var llam = new z_llamados(); try { exp = exp.getObjecte_expedientes(e.Id); llam = llam.getObjectz_llamados(exp.codigo_llamado); var tn = new LlamadoTreeNode(exp.seis2 + " / " + exp.cero5) { ImageKey = llam.clave, SelectedImageKey = llam.clave, NodeId = exp.id_expediente, NodeType = TipoElemento.Expediente }; // carros pedidos // agregar al árbol treeExpedientes.Nodes.Add(tn); treeExpedientes.SelectedNode = tn; } catch (Exception ex) { Log.Write(ex); MessageBox.Show("No se pudo completar la operación debido a un error de Base de Datos.", "Mensaje de ZEUS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } //CargarExpedientes(_id_operadora); }
private static bool CheckRestriccionIncendio(int id_expediente) { var exp = new e_expedientes(); exp = exp.getObjecte_expedientes(id_expediente); var llam = new z_llamados(); llam = llam.getObjectz_llamados(exp.codigo_principal); if (exp.EnIncendio() && llam.rest_incendio) { var vb = new VistoBueno { IdExpediente = id_expediente, Mensaje = "Este despacho requiere autorización de un oficial.", Text = "Despacho restringido en Incendio" }; if (vb.ShowDialog() == DialogResult.OK) { return(true); } return(false); } return(true); }
public static bool ConfirmarDespacho(List <int> id_carro, int id_expediente, int batallon) { // cambiar clave! // obtener codigo llamado batallon var llam = new z_llamados(); DataSet db = llam.Getz_llamados_incendio(); int codigo_llamado = (int)db.Tables[0].Rows[batallon - 1]["codigo_llamado"]; var exp = new e_expedientes(); exp = exp.getObjecte_expedientes(id_expediente); // actualizar expediente exp.codigo_principal = codigo_llamado; exp.batallon = batallon; // correlativo if (exp.correlativo_iioo == 0) { exp.correlativo_iioo = exp.GetNextCorrelativoIIOO(); } exp.Update(exp); var retValue = ConfirmarDespacho(id_carro, id_expediente, batallon, false); return(retValue); }
public ArrayList Un_Carro_X_Clave_All(int id_grupo, int bloque, int id_expediente) { Cursor.Current = Cursors.WaitCursor; var exp = new e_expedientes(); var llam = new z_llamados(); int id_carro_tip = 0; string sindesp = ""; ArrayList list_carros_alist = new ArrayList(); try { exp = exp.getObjecte_expedientes(id_expediente); llam = llam.getObjectz_llamados(exp.codigo_principal); } catch (Exception ex) { Log.ShowAndLog(ex); } if (exp.id_area != 0) { // Obtener el ID de Carro Según Grupo Solicitado list_carros_alist = Despacho.Ranking_x_Claves_All(exp.id_expediente, id_grupo.ToString(), bloque); // List<int> id_carros = llam.incendio ? Despacho.DespacharBatallon(id_expediente, id_area, llam.codigo_llamado - 50, out sindesp) : Despacho.Despachar(id_expediente, id_area); /* * var cd = new ConfirmarDespacho * { * IdCarros = id_carros, * IdExpediente = id_expediente, * IdArea = id_area * }; * cd.lblSinDesp.Text += "\n" + sindesp; * * // ****** * * // ****************** * * cd.ShowDialog(); * btnDespachar.Blink = false; * ZeusWin.Actualizar(); * * } * else * { * var id_carros = new List<int>(); * var cd = new CarroDisponible { IdCarros = id_carros }; * if (cd.ShowDialog() == DialogResult.OK) * { * Despacho.ConfirmarDespacho(id_carros, id_expediente); * } * } * Cursor.Current = Cursors.Default; */ } return(list_carros_alist); }
//public e_carros_usados CarroUsado //{ // get { return carroUsado; } //} //######################### //### JSON Gestión Carro ### //######################### public void ApoloHoraGestionCarro(int IdExp, int IdCarro, int intOp, int intIdGestion) { //# Objeto Expediente exp = exp.getObjecte_expedientes(IdExp); string[] GetFechaHora = exp.fecha.ToString().Split(' '); string[] GetHoraActual = System.DateTime.Now.ToString().Split(' '); JsonGstionCarro gestion = new JsonGstionCarro(); switch (IdExp) { case -1: gestion.acto = "6-13"; break; case -2: gestion.acto = "6-14"; break; case -3: gestion.acto = "6-15"; break; default: break; } gestion.fecha = GetHoraActual[0].ToString(); gestion.hora = GetHoraActual[1].ToString(); gestion.carro = IdCarro; gestion.operadora = intOp; gestion.idgestion = intIdGestion; string jsonBit = JsonConvert.SerializeObject(gestion); string jsonBit_2 = jsonBit.Replace("\"", "%"); string jsonBit_3 = jsonBit_2.Replace(" ", "?"); if (ccarros.GetParametroPrioridad(6).Equals("TRUE")) { System.Diagnostics.Process proceso2 = new System.Diagnostics.Process(); proceso2.StartInfo.FileName = @"C:\ZEUS_CBMS\Apolo\salidas.py"; proceso2.StartInfo.Arguments = jsonBit_3; proceso2.StartInfo.CreateNoWindow = true; proceso2.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proceso2.Start(); } //### Escribir JSON Salidas string fic = @"C:\ZEUS_CBMS\ZTablasApolo\JsonGestionCarro.txt"; StreamWriter sw = new StreamWriter(fic); sw.WriteLine("JSON Bitacora ZEUS"); sw.WriteLine(""); sw.WriteLine(jsonBit_3); sw.Close(); }
private static bool CheckRestriccionB(int id_expediente, IEnumerable <int> id_carros) { // 1: Cantidad de carros b var exp = new e_expedientes(); exp = exp.getObjecte_expedientes(id_expediente); var llam = new z_llamados(); llam = llam.getObjectz_llamados(exp.codigo_principal); if (llam.max_b == 0) { return(true); } var carros = new e_carros_usados(); int cant = 0; DataSet ds = carros.Gete_carros_exp(id_expediente); foreach (DataRow dr in ds.Tables[0].Rows) { var c = new z_carros(); c = c.getObjectz_carros((int)dr["id_carro"]); if (c.id_tipo_carro == 1) { cant++; } } // carros actuales foreach (int id in id_carros) { var c = new z_carros(); c = c.getObjectz_carros(id); if (c.id_tipo_carro == 1) { cant++; } } if (cant > llam.max_b) { var vb = new VistoBueno { IdExpediente = id_expediente, Mensaje = "La cantidad de carros permitida para esta clave ha sido superada." }; if (vb.ShowDialog() == DialogResult.OK) { return(true); } return(false); } return(true); }
private static void CheckBatallon(int id_expediente, IEnumerable <int> id_carros) { var exp = new e_expedientes(); exp = exp.getObjecte_expedientes(id_expediente); List <int> s; int id_mayor = 0; var cu = new e_carros_usados(); // no hay batallones para áreas if (exp.id_area == 0) { return; } // revisar si esta combinación de carros+los actuales superan un batallón var llam = new z_llamados(); DataSet ds = llam.Getz_llamados_incendio(); foreach (DataRow dr in ds.Tables[0].Rows) { // cantidad de carros CantidadCarros cc = ObtenerCantidadCarros(exp.id_area, (int)dr["codigo_llamado"], out s); var ca = new CantidadCarros(); // sumar DataSet de = cu.Gete_carros_exp(id_expediente); foreach (DataRow dw in de.Tables[0].Rows) { var carro = new z_carros(); carro = carro.getObjectz_carros((int)dw["id_carro"]); ca.Cantidad[carro.id_tipo_carro - 1]++; } // carros actuales foreach (int i in id_carros) { var carro = new z_carros(); carro = carro.getObjectz_carros(i); ca.Cantidad[carro.id_tipo_carro - 1]++; } // comparar if (ca >= cc) { id_mayor = (int)dr["codigo_llamado"]; } } if (id_mayor != 0) { // avisar MessageBox.Show("Se han superado los carros para un batallón. Se cambiará la clave."); // cambiar clave exp.codigo_principal = id_mayor; exp.Update(exp); } }
public static List <int> Despachar(int id_expediente, int id_area) { // 6 var sinDespacho = new List <int>(); var idDespacho = new List <int>(); var compañias_usadas = new List <int>(); // tipos de carro try { var exp = new e_expedientes(); exp = exp.getObjecte_expedientes(id_expediente); int codigo_llamado = exp.codigo_llamado; // id area CantidadCarros cantidad = ObtenerCantidadCarros(id_area, codigo_llamado, out idDespacho); OrdenarCarros(cantidad, codigo_llamado); for (int i = 0; i < cantidad.Cantidad.GetLength(0); i++) { while (cantidad.Cantidad[i] > 0) { // obtener carro #if CBMS z_carros carro = ObtenerCarro(cantidad.Id_tipo[i], id_area); #elif CBQN z_carros carro = ObtenerCarro(cantidad.Id_tipo[i], id_area, false, compañias_usadas); #endif if (carro.id_carro != 0) { idDespacho.Add(carro.id_carro); cantidad.Cantidad[i]--; compañias_usadas.Add(carro.id_compania); } else { sinDespacho.Add(cantidad.Id_tipo[i]); break; } } } // Ejecutar casos especiales de despacho CasosEspecialesDespacho.Ejecutar(exp, idDespacho); } catch (Exception e) { Log.ShowAndLog(e); } return(idDespacho); }
public void MostrarInfo(int idExpediente) { id_expediente = idExpediente; var exp = new e_expedientes(); try { exp = exp.getObjecte_expedientes(idExpediente); // expediente id_area = exp.id_area; informacionExpediente1.Expediente = exp; RecursosEstaticos.IdExpediente = exp.id_expediente; // oficial a cargo if (exp.id_voluntario != 0) { z_cargos cargo = new z_cargos().getObjectz_cargos(exp.id_voluntario); var vol = new z_voluntarios(); vol = vol.getObjectz_voluntarios(exp.id_voluntario); btnACargo.Text = cargo.id_voluntario != 0 ? cargo.llamado_oficial.ToString() : vol.num_llamado.ToString(); } else { btnACargo.Text = "Ninguno"; } // frecuencia e_frecuencias freq = new e_frecuencias().getObjecte_frecuencias(exp.id_frecuencia); btnFrecuencia.Text = freq.frecuencia; btnFrecuencia.BackColor = Color.FromArgb(freq.color); if (id_expediente_asignado == idExpediente) { btnDespachar.Blink = true; id_expediente_asignado = 0; } else { btnDespachar.Blink = false; } } catch (Exception ex) { Log.ShowAndLog(ex); } }
private void LlenarCamposIniciales() { e_expedientes exp = new e_expedientes(); exp = exp.getObjecte_expedientes(Zeus.Util.RecursosEstaticos.IdExpediente); txtDia.Text = exp.fecha.ToString("dd"); txtMes.Text = exp.fecha.ToString("MM"); txtAnio.Text = exp.fecha.ToString("yyyy"); txtHoraInicio.Text = exp.fecha.ToString("hh:MM"); txtDireccionServicio.Text = exp.cero5; txtEsquinaServicio.Text = exp.seis2; ddlComunaEmergencia.Text = exp.comuna; }
private void btnCerrar_Click(object sender, EventArgs e) { if ( MessageBox.Show("¿Desea cerrar este expediente?", "Confirmar Cierre", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } try { // liberar empresas var rec = new e_recursos_empresas(); e_expedientes expediente = new e_expedientes(); expediente.limpiarTablaZcarrosLlamado(id_expediente); rec.freee_recursos_empresas(id_expediente); // liberar carros var carros = new e_carros_usados(); DataSet ds = carros.Gete_carros_exp(id_expediente); foreach (DataRow dr in ds.Tables[0].Rows) { carros.freee_carros_usados((int)dr["id_carro"]); Carro.Liberar((int)dr["id_carro"]); BitacoraLlamado.NuevoEvento(id_expediente, (int)dr["id_carro"], BitacoraLlamado.Carro, "6-10"); } // cerrar var exp = new e_expedientes(); exp = exp.getObjecte_expedientes(id_expediente); exp.activo = false; exp.Update(exp); BitacoraLlamado.NuevoEvento(id_expediente, 0, BitacoraLlamado.Llamado, "Cierre de Expediente"); } catch (Exception ex) { Log.ShowAndLog(ex); } }
private void ConfirmarDespacho_Load(object sender, EventArgs e) { try { var exp = new e_expedientes(); exp = exp.getObjecte_expedientes(IdExpediente); z_carros carro = new z_carros(); // cargar datos var llam = new z_llamados(); llam = llam.getObjectz_llamados(exp.codigo_llamado); // formatear texto lblClave.Text = ""; // batallon? if (Batallon != 0) { switch (Batallon) { case 1: #if CBMS lblClave.Text = "Sale Primer Batallón de Incendio.\n"; #elif CBQN lblClave.Text = "Sale Incendio.\n"; #endif break; case 2: #if CBMS lblClave.Text = "Sale Segundo Batallón de Incendio.\n"; #elif CBQN lblClave.Text = "Sale Alarma General.\n"; #endif break; case 3: lblClave.Text = "Sale Tercer Batallón de Incendio.\n"; break; case 4: lblClave.Text = "Sale Cuarto Batallón de Incendio.\n"; break; } } if (AlarmaGeneral) { #if CBMS // TODO: poner texto para alarma #elif CBQN lblClave.Text = "Sale Alarma General.\n"; #endif } if (Agregando) { tableLayoutPanel1.SetRow(lblArea, 4); tableLayoutPanel1.SetRow(lbl05, 3); tableLayoutPanel1.SetRow(lblClave, 2); tableLayoutPanel1.SetRow(tableCarros, 1); tableLayoutPanel1.SetRow(lblExtra, 0); lblExtra.Text = "Sale:"; lblClave.Text = "A: "; } lblClave.Text += llam.clave; // +" " + llam.descripcion; lbl05.Text = ToLower(exp.seis2 + " Y " + exp.cero5); //### Motrar Sector del Despacho string StrSector = exp.comuna; string AsTitleCase = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(StrSector.ToLower()); lblArea.Text = "Área de Referencia " + exp.id_area + "\n\n" + AsTitleCase; MostrarCarros(exp.codigo_principal); #if CBMS // consola axShockwaveFlash1.LoadMovie(0, Application.StartupPath + "\\Consola\\Consola.swf"); #elif CBQN int width = axShockwaveFlash1.Width; axShockwaveFlash1.Dispose(); Width -= width; #endif } catch (Exception ex) { Log.ShowAndLog(ex); } }
private void btnDespachar_Click(object sender, EventArgs e) { DatosLogin.InvokeTwitter = "FT1"; Cursor.Current = Cursors.WaitCursor; var exp = new e_expedientes(); var llam = new z_llamados(); string sindesp = ""; try { exp = exp.getObjecte_expedientes(id_expediente); llam = llam.getObjectz_llamados(exp.codigo_principal); } catch (Exception ex) { Log.ShowAndLog(ex); } bloque_hora = recIDHORA(); string NuevoBloque = Convert.ToString(bloque_hora); // ################################ // ### Coordenadas para Twitter ### // ################################ string strTw_X = (Math.Truncate(exp.puntoX)).ToString(); string strTw_Y = (Math.Truncate(exp.puntoY)).ToString(); string strLatLong = exp.Utm_2_LatLong(strTw_X, strTw_Y); string strURL = "https://maps.google.cl/maps?q="; string strZOOM = "&t=m&z=17"; string strPlano = strURL + strLatLong + strZOOM; // ### Agregar en el expediente el link del Plano exp.AgregarPlanoTwitter(id_expediente, strPlano); // ### Agregar en el expediente las coordenadas Lat Long exp.AgregarLatLongWeb(id_expediente, strLatLong); if (exp.id_area != 0) { // verificar si es despacho normal o despacho de incendio List <int> id_carros = Despacho.ranking(id_expediente, id_area, bloque_hora); //List<int> id_carros = Despacho.Despachar(id_expediente, id_area); //################################## //### Módulo Agregar B en 10-3-1 ### //################################## var DxD = new DespachoPorDistancia(); int IdMM = DxD.LlamadoEnRadioDeCia(id_expediente); if (IdMM > 0) { //### Despachar Carro si esta Disponible int intCarro26 = DespachoPorDistancia.DespachoPorDosSeis(IdMM); if (intCarro26 > 0) { id_carros.Add(intCarro26); } } // ### Si no hay carros, no se muestra la ventana de preparar despacho. // ### Esto ocurre porque para la intersección ingresada, Commander no // ### entrego un Ranking valido (todos los carros tienen Ranking = 1). if (id_carros.Count > 0) { var cd = new ConfirmarDespacho { IdCarros = id_carros, IdExpediente = id_expediente, IdArea = id_area }; cd.lblSinDesp.Text += "\n" + sindesp; // ****** // ****************** cd.ShowDialog(); btnDespachar.Blink = false; ZeusWin.Actualizar(); } } else { var id_carros = new List <int>(); var cd = new CarroDisponible { IdCarros = id_carros }; if (cd.ShowDialog() == DialogResult.OK) { Despacho.ConfirmarDespacho(id_carros, id_expediente); } } Cursor.Current = Cursors.Default; }
private void MostrarCarros(int codigo_principal) { //-*- Asigna el ID de carro Cascada para pintar Amarillo. string val = ""; //-*- Asigna el ID de Bomba que Alimenta Mecanica para pintar Rojo. string val2 = ""; e_expedientes exp = new e_expedientes(); exp = exp.getObjecte_expedientes(RecursosEstaticos.IdExpediente); ArrayList arrGrupoCarros = new ArrayList(); arrGrupoCarros = StaticClass.ArrGrupoCarros; //-*- Para Ordenar los Carros List <z_carros>[] lista = OrdenarCarros(); // HACK: 10-3 y 10-4 muestran R al inicio if ((codigo_principal == 5 || codigo_principal == 4) && Batallon == 0) { // insertar R al principio List <z_carros> l = lista[6]; for (int i = 6; i > 0; i--) { lista[i] = lista[i - 1]; } lista[0] = l; } //-*- Pinta Color Amarillo Carros Con Cascada // 12 => H como Cascada // 20 => RH1 como Cascada // 21 => BX como Cascada // 22 => B como Cascada //### Pintar última Bomba si hay Mecánica string UltimaB = ""; var GruposList = new List <string>(); for (int x = 0; x < arrGrupoCarros.Count; x++) { string[] GrSplit = arrGrupoCarros[x].ToString().Split('/'); GruposList.Add(GrSplit[1].ToString()); } for (int a = 0; a < arrGrupoCarros.Count; a++) { string[] aaa = arrGrupoCarros[a].ToString().Split('/'); if (aaa[1].ToString() == "224" || aaa[1].ToString() == "117" || aaa[1].ToString() == "119") { val = aaa[0]; } //# Si el despacho tiene Mecánica, queda guardado el ID de la Última Bomba if (GruposList.Contains("3") && aaa[1].ToString() == "1") { UltimaB = aaa[0].ToString().ToString(); } } // mostrar tableCarros.Controls.Clear(); int contador = 1; for (int i = 0; i < lista.Length; i++) { if (vEstatica.Variable == 3) { if (contador == 1) { var fl_despachados = new FlowLayoutPanel { AutoSize = true, Dock = DockStyle.Fill }; fl_despachados.Controls.Add(new Label() { Text = exp.material_despachado, AutoSize = true, Dock = DockStyle.Fill }); tableCarros.Controls.Add(fl_despachados); contador = 0; } vEstatica.Variable = 1; } //# Pintar Carros con Distinto Color Boolean SinColor = true; if (lista[i] != null) { var fl = new FlowLayoutPanel { AutoSize = true, Dock = DockStyle.Fill }; foreach (z_carros c in lista[i]) { //# Pinta Cascada if (c.id_carro.ToString() == val) { var cb = new CheckBox { Text = c.nombre, AutoSize = true, Appearance = Appearance.Button, Tag = c.id_carro, Checked = true, BackColor = Color.Yellow }; cb.CheckedChanged += cb_CheckedChanged; fl.Controls.Add(cb); SinColor = false; } //# Pintar Última Bomba if (UltimaB == c.id_carro.ToString()) { var cb = new CheckBox { Text = c.nombre, AutoSize = true, Appearance = Appearance.Button, Tag = c.id_carro, Checked = true, BackColor = Color.Red }; cb.CheckedChanged += cb_CheckedChanged; fl.Controls.Add(cb); SinColor = false; } //# Si No se Debe Pintar el Carro if (SinColor) { var cb = new CheckBox { Text = c.nombre, AutoSize = true, Appearance = Appearance.Button, Tag = c.id_carro, Checked = true }; cb.CheckedChanged += cb_CheckedChanged; fl.Controls.Add(cb); } SinColor = true; } tableCarros.Controls.Add(fl); } } StaticClass.ArrGrupoCarros = new ArrayList(); }
private void btn_Click(object sender, EventArgs e) { var exp = new e_expedientes(); z_carros carro; PanelLlamado llamado = new PanelLlamado(); e_expedientes expediente = new e_expedientes(); int id_carro = 0; int bloque = expediente.recFechaExpediente(this.Id_expediente); ArrayList listado_carros_disponibles = new ArrayList(); DatosLogin.LoginExp = this.Id_expediente; // ################################ // ### Coordenadas para Twitter ### // ################################ exp = exp.getObjecte_expedientes(this.Id_expediente); string strTw_X = (Math.Truncate(exp.puntoX)).ToString(); string strTw_Y = (Math.Truncate(exp.puntoY)).ToString(); string strLatLong = exp.Utm_2_LatLong(strTw_X, strTw_Y); string strURL = "https://maps.google.cl/maps?q="; string strZOOM = "&t=m&z=17"; string strPlano = strURL + strLatLong + strZOOM; // ### Agregar en el expediente el link del Plano exp.AgregarPlanoTwitter(this.Id_expediente, strPlano); // ### Agregar en el expediente las coordenadas Lat Long exp.AgregarLatLongWeb(id_expediente, strLatLong); DatosLogin.InvokeTwitter = "FT2"; int arrra = 0; CarroDisponible2 cd2; //InformacionExpediente expe = new InformacionExpediente(); switch (((Button)sender).Name) { case "btn20": //carro = Despacho.ObtenerCarro(1, id_area); DatosLogin.LoginGrp = 1; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(1, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /*carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn21": //carro = Despacho.ObtenerCarro(5, id_area); //int arrra = id_area; DatosLogin.LoginGrp = 2; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(2, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /*id_carro = llamado.Un_Carro_X_Clave(2, bloque, Id_expediente); * carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn22": //carro = Despacho.ObtenerCarro(7, id_area); DatosLogin.LoginGrp = 4; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(4, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /*id_carro = llamado.Un_Carro_X_Clave(10, bloque, Id_expediente); * carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn23": //carro = Despacho.ObtenerCarro(13, id_area); //int arrra = id_area; DatosLogin.LoginGrp = 9; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(9, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /*id_carro = llamado.Un_Carro_X_Clave(7, bloque, Id_expediente); * carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn24": //carro = Despacho.ObtenerCarro(10, id_area); //int arrra = id_area; DatosLogin.LoginGrp = 6; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(6, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /* * id_carro = llamado.Un_Carro_X_Clave(4, bloque, Id_expediente); * carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn25": //carro = Despacho.ObtenerCarro(9, id_area); DatosLogin.LoginGrp = 5; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(5, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /* * id_carro = llamado.Un_Carro_X_Clave(6, bloque, Id_expediente); * carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn26": var cd = new CarroDisponible { IdCarros = idCarros }; cd.ShowDialog(); break; case "btn27": //carro = Despacho.ObtenerCarro(6, id_area); //int arrra = id_area; DatosLogin.LoginGrp = 3; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(3, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /* * id_carro = llamado.Un_Carro_X_Clave(15, bloque, Id_expediente); * carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn28": //carro = Despacho.ObtenerCarro(15, id_area); //int arrra = id_area; DatosLogin.LoginGrp = 10; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(10, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /*id_carro = llamado.Un_Carro_X_Clave(17, bloque, Id_expediente); * carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn29": //carro = Despacho.ObtenerCarro(15, id_area); //int arrra = id_area; DatosLogin.LoginGrp = 16; arrra = id_area; listado_carros_disponibles = llamado.Un_Carro_X_Clave_All(16, bloque, Id_expediente); cd2 = new CarroDisponible2(listado_carros_disponibles) { IdCarros = idCarros }; cd2.ShowDialog(); /* * id_carro = llamado.Un_Carro_X_Clave(16, bloque, Id_expediente); * carro = new z_carros().getObjectz_carros(id_carro); * if (carro.id_carro != 0) * { * idCarros.Add(carro.id_carro); * } * else * { * MessageBox.Show("No hay carros disponibles del tipo seleccionado"); * }*/ break; case "btn210": MessageBox.Show("Motobomba"); break; case "btn211": MessageBox.Show("Grupo Electrógeno"); break; case "btn212": MessageBox.Show("Equipo compresor"); break; case "btn213": carro = Despacho.ObtenerCarro(16, id_area); if (carro.id_carro != 0) { idCarros.Add(carro.id_carro); } else { MessageBox.Show("No hay carros disponibles del tipo seleccionado"); } break; case "btn214": carro = Despacho.ObtenerCarro(17, id_area); if (carro.id_carro != 0) { idCarros.Add(carro.id_carro); } else { MessageBox.Show("No hay carros disponibles del tipo seleccionado"); } break; case "btn215": carro = Despacho.ObtenerCarro(18, id_area); if (carro.id_carro != 0) { idCarros.Add(carro.id_carro); } else { MessageBox.Show("No hay carros disponibles del tipo seleccionado"); } break; default: break; } //if (idCarros.Count == 0) //{ // MessageBox.Show("No hay carros disponibles de este tipo."); //} Close(); }
//######################### //### JSON Salidas ### //######################### public void ApoloHoraCarro(int idgestion, string ClaveCarro, int iDcarro, string nomVoluntario, int CantTripulan, int IdExp) { //# Objeto Expediente exp = exp.getObjecte_expedientes(IdExp); string[] GetFechaHora = exp.fecha.ToString().Split(' '); string[] GetHoraActual = System.DateTime.Now.ToString().Split(' '); //# Objeto Carro var ccarros = new z_carros(); ccarros = ccarros.getObjectz_carros(iDcarro); string strNomConductor = new z_conductores().Getz_NombreConductor(ccarros.id_conductor).ToString().Replace("Ñ", "N"); string strCarro = ccarros.nombre.Replace("Ñ", "N"); //# Carro en Llamado //var cen = new CarroEnLlamado(iDcarro); //string aCargoVol = cen.id JsonSalida salida = new JsonSalida(); salida.idgestion = idgestion; switch (IdExp) { case -1: salida.acto = "6-13"; break; case -2: salida.acto = "6-14"; break; case -3: salida.acto = "6-15"; break; default: break; } salida.fecha = GetHoraActual[0].ToString(); salida.hora = GetHoraActual[1].ToString(); salida.clave = ClaveCarro; salida.carro = iDcarro; salida.conductor = strNomConductor; salida.a_cargo = nomVoluntario.Replace("Ñ", "N"); salida.tripulan = CantTripulan; string jsonBit = JsonConvert.SerializeObject(salida); string jsonBit_2 = jsonBit.Replace("\"", "%"); string jsonBit_3 = jsonBit_2.Replace(" ", "?"); if (ccarros.GetParametroPrioridad(6).Equals("TRUE")) { System.Diagnostics.Process proceso2 = new System.Diagnostics.Process(); proceso2.StartInfo.FileName = @"C:\ZEUS_CBMS\Apolo\salidas.py"; proceso2.StartInfo.Arguments = jsonBit_3; proceso2.StartInfo.CreateNoWindow = true; proceso2.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proceso2.Start(); } //### Escribir JSON Salidas string fic = @"C:\ZEUS_CBMS\ZTablasApolo\JsonSalidas.txt"; StreamWriter sw = new StreamWriter(fic); sw.WriteLine("JSON Bitacora ZEUS"); sw.WriteLine(""); sw.WriteLine(jsonBit_3); sw.Close(); }
//######################### //### JSON Bitacora ### //######################### public void ApoloHoraCarro(string ClaveCarro, int iDcarro, string nomVoluntario, int CantTripulan, int IdExp) { //# Objeto Expediente exp = exp.getObjecte_expedientes(IdExp); string[] GetFechaHora = exp.fecha.ToString().Split(' '); string[] GetHoraActual = System.DateTime.Now.ToString().Split(' '); //# Objeto Carro var ccarros = new z_carros(); ccarros = ccarros.getObjectz_carros(iDcarro); string strCarro = ccarros.nombre; string strNomConductor = new z_conductores().Getz_NombreConductor(ccarros.id_conductor).ToString(); strNomConductor = strNomConductor.Replace("Ñ", "N"); //# Carro en Llamado //var cen = new CarroEnLlamado(iDcarro); //string aCargoVol = cen.id JsonBitacora bitacora = new JsonBitacora(); bitacora.expediente = exp.id_expediente.ToString(); bitacora.fecha = GetFechaHora[0].ToString(); bitacora.hora = GetFechaHora[1].ToString(); bitacora.clave = ClaveCarro; bitacora.carro = iDcarro; if (ClaveCarro == "6-0") { bitacora.hora_clave = GetFechaHora[1].ToString(); } else { bitacora.hora_clave = GetHoraActual[1].ToString(); } bitacora.conductor = strNomConductor; nomVoluntario = nomVoluntario.Replace("Ñ", "N"); bitacora.a_cargo = nomVoluntario; bitacora.tripulan = CantTripulan; string jsonBit = JsonConvert.SerializeObject(bitacora); string jsonBit_2 = jsonBit.Replace("\"", "%"); string jsonBit_3 = jsonBit_2.Replace(" ", "?"); if (ccarros.GetParametroPrioridad(6).Equals("TRUE")) { System.Diagnostics.Process proceso2 = new System.Diagnostics.Process(); proceso2.StartInfo.FileName = @"C:\ZEUS_CBMS\Apolo\bitacoras.py"; proceso2.StartInfo.Arguments = jsonBit_3; proceso2.StartInfo.CreateNoWindow = true; proceso2.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proceso2.Start(); } //### Escribir JSON Bitacora string fic = @"C:\ZEUS_CBMS\ZTablasApolo\JsonBitacora_" + ClaveCarro + "_" + System.DateTime.Now.ToString("yyyyMMddhhmmss") + ".txt"; StreamWriter sw = new StreamWriter(fic); sw.WriteLine(" JSON Bitacora Claves: 6-0, 6-1, 6-3, 6-9 y 6-10 ZEUS"); sw.WriteLine(""); sw.WriteLine(jsonBit_3); sw.Close(); }
//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); }