/** * @fn public void eliminarImportacion(int pCantidad) * * @brief Elimina la imporacion de inconsert. * * @author WINMACROS * @date 17/07/2017 * * @param pCantidad La cantidad de intentos que tomo * para eliminar la imporacion. */ public void eliminarImportacion(int pCantidad) { Sistema s = Sistema.Sis; int ban = eliminarImporacionAux(); s.accionesCodigo("Intento n." + pCantidad + " de eliminacion de lote:" + Nombre, ban.ToString()); baseDatos bd = baseDatos.Bd; if (pCantidad < 2) { if (ban == 0) { eliminarImportacion(pCantidad + 1); } else { s.ejecutarMacro(s.m_app, "WAIT SECONDS=10", "Esperar 10s" + false); Estado = Lote.tipoEstado.Eliminado; } } else { Estado = Lote.tipoEstado.ErrorEliminacion; } bd.cambiarEstadoLote(this); }
/** * @fn public void cargarLotesAlMarcador() * * @brief Crea los lotes dentro del motor. * * @author WINMACROS * @date 17/07/2017 */ public void cargarLotesAlMarcador() { Sistema s = Sistema.Sis; baseDatos bd = baseDatos.Bd; int pos = irAlMotorYDetener(); entrarAlMotor(pos); LotesParaCargar.Sort(); foreach (LoteMarcador lM in LotesParaCargar) { lM.cargarVariables(); s.ejecutarMacro(s.m_app, s.direccion + "Cargar lote/CargarLoteAMotor.iim", "Cargar el lote: " + lM.Lot.Nombre + " Al motor", true); esperarQueElMotorCarge(); lM.cargarVariables(); s.ejecutarMacro(s.m_app, s.direccion + "Cargar lote/CrearLoteDentroMotor.iim", "Crear un nuevo lote dentro del motor", true); esperarQueElMotorCarge(); s.ejecutarMacro(s.m_app, "TAG POS=1 TYPE=BUTTON:BUTTON ATTR=ID:btnSave CONTENT=Guardar", "Guardar cambios en el motor", false); esperarQueElMotorCarge(); lM.Lot.Estado = Lote.tipoEstado.Activo; LotesActivos.Add(lM); bd.cambiarEstadoLote(lM.Lot); s.accionesCodigo("Cargar el lote: " + lM.Lot.Nombre + " En el motor", "Completo"); bd.agregarLoteEnMarcador(lM); } LotesParaCargar = LotesParaCargar.Where(l => !LotesActivos.Contains(l)).ToList(); darlePLayMotor(); }
/** * @fn public void crearNuevaImportacion() * * @brief Carga el lote a inconsert. * * @author WINMACROS * @date 17/07/2017 */ public void crearNuevaImportacion() { Sistema s = Sistema.Sis; s.accionesCodigo("Inicio crear nueva importacion"); int ban = 0; baseDatos bd = baseDatos.Bd; do { s.ejecutarMacro(s.m_app, "nombreLoteC", Nombre); s.ejecutarMacro(s.m_app, s.direccion + "Cargar lote/NuevaImportacion1.iim" , "Crear nueva imporatcion1", true); s.ejecutarMacro(s.m_app, "urlLoteC", Exc.Direccion.ToString()); s.ejecutarMacro(s.m_app, "TAG POS=1 TYPE=INPUT:FILE ATTR=ID:btnAddFile CONTENT= {{urlLoteC}}" , "Poner la url en el inpur file", false); s.ejecutarMacro(s.m_app, s.direccion + "Cargar lote/NuevaImportacion2.iim" , "Crear nueva imporatcion2", true); do { ban = comprobarEstadoImportacion(); } while (ban != 1 && ban != -1); } while (ban != 1); bd.cambiarEstadoLote(this); }
public void activosSms() { baseDatos bd = baseDatos.Bd; List <string[]> lote = bd.smsDelBigFish(); Excel.crearExcel(lote); tolls.T.EjecutarMacro(0); }
/** * @fn public void darlePLayMotor() * * @brief Da play al motor. * * @author WINMACROS * @date 17/07/2017 */ public void darlePLayMotor() { Sistema s = Sistema.Sis; baseDatos bd = baseDatos.Bd; s.ejecutarMacro(s.m_app, "Datos", Nombre); s.ejecutarMacro(s.m_app, s.direccion + "Cargar lote/PlayLote.iim", "Darle play al motor", true); Estado = estadoMotor.activo; bd.cambiarEstadoMotor(this); }
/** * @fn private Lote elLoteNoExiste(string pNombre) * * @brief Si el lote no existe en el sistema crea un lote * con solo el nombre y el estado para eliminar. * * @author WINMACROS * @date 14/07/2017 * * @param Nombre del lote. * * @return Un lote nuevo el cual se va a eliminar. */ private Lote elLoteNoExiste(string pNombre) { baseDatos bd = baseDatos.Bd; Lote l = new Lote(pNombre); l.Marc = this; bd.eliminarLoteMotor(l); l.Estado = Lote.tipoEstado.paraEliminar; return(l); }
/** * @fn private void detenerMotor(string pEstado, int pos) * * @brief Detiene el motor en inconsert * * @author WINMACROS * @date 17/07/2017 * * @param pEstado Estado actual del motor. * @param pos Pos del motor en la tabla. */ private void detenerMotor(string pEstado, int pos) { baseDatos bd = baseDatos.Bd; Sistema s = Sistema.Sis; if (pEstado == "RUNNING")//si el estado acutal del motor es en andando se lo frena { s.ejecutarMacro(s.m_app, "TAG POS=" + pos + " TYPE=td ATTR=IDX:9", "Detener el motor si esta en running", false); irAlMortor(); } Estado = estadoMotor.denenido; bd.cambiarEstadoMotor(this); }
/** * @fn private void precarga() * * @brief Precarga las listas del sistema. * * @author WINMACROS * @date 17/07/2017 */ private void precarga() { baseDatos bd = baseDatos.Bd; Automatizaciones a = Automatizaciones.A; // bd.Prueba(); //a.activosSms(); List <Marcador> mar = bd.cargarMarcadores(); Marcadores.AddRange(mar); List <Lote> lotess = bd.cargaLotesUnaSemana(); Lotes.AddRange(lotess); accionesCodigo("Precarga la fecha del Score", bd.precargaFecha().ToString()); tolls.FechaScore = bd.precargaFecha(); }
/** * @fn public void asignarFrec() * * @brief Es el encargado de agarrar todos los lotes que se van a cargar * y crear en base a la frecuencia de cada lote su base de * contactavilidad y la frecuencia. * Busca el minimo comuin multiplo entre los n frecuencias distintas que agrege * y en base a eso calgula la frecuencia * * @author WINMACROS * @date 14/07/2017 */ public void asignarFrec() { baseDatos bd = baseDatos.Bd; if (LotesParaCargar.Count > 1) { Sistema s = Sistema.Sis; s.accionesCodigo("Asignar frecuencia"); int[] numeros = new int[LotesParaCargar.Count]; for (int i = 0; i < LotesParaCargar.Count; i++) { numeros[i] = LotesParaCargar.ElementAt(i).Lot.Frec.Id; } int numMultiplo = minimoComunMultiplo(numeros); s.accionesCodigo("El minimo comun multiplo de las frecuencias ingresadas es=" + numMultiplo); int numMax = 50000 * numMultiplo; int aux = 0; s.accionesCodigo("Numero maximo", numMax.ToString()); foreach (loteMarcador lM in LotesParaCargar) { aux = numMultiplo / lM.Lot.Frec.Id; s.accionesCodigo("Prioridad de lote = " + aux); lM.Lot.Frec.PrioridadLote = aux; lM.Lot.Frec.BaseContactacion = (numMax / aux) - lM.Lot.Exc.leerExcel().Count; s.accionesCodigo("Base de contactacion = " + lM.Lot.Frec.BaseContactacion); s.accionesCodigo("Asignar frecuencia al lote = " + lM.Lot.Nombre, lM.Lot.Frec.ToString()); } } else { LotesParaCargar.ElementAt(0).Lot.Frec = new Frecuencia(100, 10, 1); } }
/** * @fn private int lotesParaEliminar() * * @brief Cuenta cuantos lotes estan incluidos en el motor. * Si el motor es de recursos guarda los nombre de los * lotes en una lista para sacar reporte * * @author WINMACROS * @date 14/07/2017 * * @return Cantidad de lotes dentro del motor (Int). */ private int lotesParaEliminar() { Sistema s = Sistema.Sis; baseDatos bd = baseDatos.Bd; bool bandera = false; int pos = 2; // Arranca de la pocicion 2 ya que la primera es el cabezal de la tabla do { Status sta = s.ejecutarMacro(s.m_app, "TAG SELECTOR=HTML>BODY>DIV:nth-of-type(4)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>FORM>DIV:nth-of-type(2)>FIELDSET:nth-of-type(3)>DIV:nth-of-type(2)>DIV>TABLE>TBODY>TR:nth-of-type(2)>TD>DIV>DIV>TABLE>TBODY>TR:nth-of-type(" + pos.ToString() + ")>TD:nth-of-type(2) EXTRACT=TXT", "Reccore todos los lotes del motor", false); if (sta != iMacros.Status.sOk) { bandera = false; //si el statis de imacros no es ok es porque llego al final de los lotes del motor } else { string extract = s.ejecutarMacroExtract(s.m_app, 0, "Nombre del lote dentro del motor"); if (!extract.Contains("#EANF#"))//si no contiene vasura el extract { bandera = true; if (this.Tipo == tipoMarcador.mvp || this.Tipo == tipoMarcador.vb) { LotesParaSacarReporte.Add(extract);// agrega a lotes para sacar reporte } if (!eliminarLoteAnterior(extract)) { s.Lotes.Add(elLoteNoExiste(extract)); } //si no encuentra el lote dentro de la lista de lotes //activos crea un nevo lote solo con el nombre y el estado //para eliminar pos++; } else { return(pos - 2); } } } while (bandera); return(pos - 2); }
/** * @fn public void cargarScore() * * @brief Funcion utilizada para insertarle el score a un lote * antes de ser cargado a inconsert. * * @author WINMACROS * @date 14/07/2017 */ public void cargarScore() { tolls t = tolls.T; t.matarProceso("EXCEL"); string nuevaUrl = @"\\CGMSERVER\Archivos\DOCUMENTOS C+G\CGM & ASOC\AREA ESTRATEGIA Y COBRANZAS\Allyson\Cargas inConcert\Automaticos\lotesConScore\"; StreamWriter file = new StreamWriter(nuevaUrl + Exc.Direccion.Nombre + Exc.Direccion.Extencion, false); List <string[]> excel = Exc.leerExcel(); if (excel.ElementAt(0)[8] == "Score") { baseDatos bd = baseDatos.Bd; int cantCamp = 0; int id = 0; OrdenarBigFish(excel); foreach (string[] f in excel) { cantCamp = f.Count(); int.TryParse(f[0].Substring(3), out id); for (int i = 0; i < cantCamp; i++) { if (i == 8 && id != 0) { file.Write(bd.buscarScore(id) + ";"); } else { file.Write(f[i] + ";"); } } file.WriteLine(""); } file.Close(); Exc = new Excel { Direccion = new URL(Exc.Direccion.Nombre + Exc.Direccion.Extencion, nuevaUrl) }; } }
/** * @fn private bool eliminarLoteAnterior(string pNombre) * * @brief Elimina el lote dentro del sistema y la base de datos. * * @author WINMACROS * @date 14/07/2017 * * @param pNombre Nombre del lote. * * @return Ture si existe el lote en el sitema false de loc ontrario. */ private bool eliminarLoteAnterior(string pNombre) { bool bandera = false; int cont = 0; while (!bandera && this.LotesActivos.Count > cont) { LoteMarcador lActual = LotesActivos[cont]; if (pNombre == lActual.Lot.Nombre) { baseDatos bd = baseDatos.Bd; LotesActivos.RemoveAt(cont); //saco el lote de los lotes activos del marcador HistorialLotes.Add(lActual); lActual.Hasta = DateTime.Today; //cambio el hasta porque se elimino hoy bd.eliminarLoteMotor(lActual); // marco en la base cuando se elimino lActual.Lot.Estado = Lote.tipoEstado.paraEliminar; bandera = true; } cont++; } return(bandera); }
private void iniciarSubidaAux(List <Marcador> pCampanasDisitntas, List <Marcador> pCampanasParaEliminar, List <Lote> pLotesParaCargar) { accionesCodigo("Iniciar subida"); accionesCodigo("------------------"); accionesCodigo("------------------"); accionesCodigo("------------------"); /* try { * foreach (Lote lo in pLotesParaCargar) * lo.cargarScore(); * } * catch (Exception) { }*/ tolls t = tolls.T; baseDatos bd = baseDatos.Bd; Marcador.cargarLoteAMotor(); foreach (Marcador m in pCampanasDisitntas) { m.asignarFrec();//Asigna las frecuencias separando todos los lotes por campaña que existan } foreach (Lote l in pLotesParaCargar) { bd.agregarLote(l);//Agrega el lote a la base de datos } iniciarYLogear(Sistema.navegadores.fx.ToString()); foreach (Marcador m in pCampanasParaEliminar) { m.eliminarLotes(); } List <Lote> lotesParaEliminar = t.lotesPara(Lote.tipoEstado.paraEliminar); foreach (Lote l in lotesParaEliminar) { l.eliminarImportacion(0); } m_app.iimClose(); iniciarYLogear(Sistema.navegadores.silent.ToString()); foreach (Lote l in pLotesParaCargar) { l.crearNuevaImportacion(); } m_app.iimClose(); iniciarYLogear(Sistema.navegadores.fx.ToString()); foreach (Marcador m in pCampanasDisitntas) { m.cargarLotesAlMarcador(); } m_app.iimClose(); accionesCodigo("------------------"); accionesCodigo("------------------"); accionesCodigo("Finalizo la carga de los lotes solicitados"); accionesCodigo("------------------"); accionesCodigo("------------------"); }