private DataTable ImportarDatos(string _asPlanta, string _asArea, string _asGlobal) { DataTable dt = new DataTable(); try { bool bInicial = false; //lineas de seccion 3 de laser DataTable dtLine = new DataTable(); LineaLogica line = new LineaLogica(); line.Planta = _asPlanta; line.Area = _asArea; line.Global = _asGlobal; dtLine = LineaLogica.ConsultarArea(line); dt.Columns.Add("linea", typeof(string)); dt.Columns.Add("meta", typeof(string)); dt.Columns.Add("real", typeof(string)); dt.Columns.Add("cump", typeof(string)); //ultimo reporte cargado de cesapp MetadiaLogica met = new MetadiaLogica(); met.Planta = _asPlanta; met.Turno = Global.gsTurno; //CultureInfo en = new CultureInfo("en-US"); met.Fecha = DateTime.Today; if (DateTime.Now.Hour < 5) { met.Fecha = DateTime.Today.AddDays(-1); } long lFolio = MetadiaLogica.LastFolioDia(met); if (lFolio == 0) { if (_lsDiaAnt == "1") { lFolio = MetadiaLogica.LastFolio(met); } else { return(dt); } //cargar meta sin saldo //bInicial = true; } met.Folio = lFolio; DataTable dtHora = MetadiaLogica.Consultar(met); _lsHora = dtHora.Rows[0]["hora"].ToString(); if (_lsDiaAnt == "1") { _lsHora = dtHora.Rows[0]["f_id"].ToString(); } //cargar datos de daily processing DataTable dtDaily = new DataTable(); MetadetLogica med = new MetadetLogica(); med.Folio = lFolio; med.Global = _asGlobal; med.Area = _asArea; dtDaily = MetadetLogica.VistaGrafica(med); foreach (DataRow row in dtDaily.Rows) { DataRow r = dt.NewRow(); //string sUsuario = row[0].ToString(); string sMT = row[0].ToString(); double dMeta = Convert.ToDouble(row[1].ToString()); double dReal = Convert.ToDouble(row[2].ToString()); double dPorc = dReal / dMeta; dPorc = dPorc * 100; dPorc = Math.Round(dPorc, 2); r[0] = sMT; r[1] = dMeta.ToString(); r[2] = dReal.ToString(); r[3] = dPorc.ToString(); dt.Rows.Add(r); } return(dt); } catch (Exception ex) { MessageBox.Show("Favor de Notificar al Administrador" + Environment.NewLine + "Archivo sin formato Estandar" + Environment.NewLine + "ImportarDatosTxt.." + ex.ToString(), "ERROR " + Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(dt); }
private string ImportarDatos(string _asLinea) { string sReturn = string.Empty; try { //lineas de seccion 3 de laser DataTable dtLine = new DataTable(); LineaLogica line = new LineaLogica(); line.Linea = _asLinea; dtLine = LineaLogica.ConsultarLine(line); string sPlanta = dtLine.Rows[0]["planta"].ToString(); /****/ //Notifiaciones pendientes MetadetLogica med = new MetadetLogica(); med.Planta = sPlanta; med.Linea = _asLinea; long lFolio = 0; DataTable data = MetadetLogica.ConsultarNoti(med); for (int i = 0; i < data.Rows.Count; i++) { //enviar notificacion por carga pendiente lFolio = long.Parse(data.Rows[i]["folio"].ToString()); int iCons = int.Parse(data.Rows[i]["consec"].ToString()); string sHora = data.Rows[i]["hora"].ToString(); double dMta = double.Parse(data.Rows[i]["meta"].ToString()); double dRel = double.Parse(data.Rows[i]["real"].ToString()); double dPrc = (dMta / dRel) * 100; dPrc = Math.Round(dPrc, 2); string sPorc = dPrc.ToString() + " %"; MotrarNotifiacion(_asLinea, sHora, sPorc); } //ultimo reporte cargado de cesapp MetadiaLogica met = new MetadiaLogica(); met.Planta = sPlanta; met.Turno = Global.gsTurno; met.Fecha = DateTime.Today; lFolio = MetadiaLogica.LastFolio(met); if (lFolio == 0) { return(sReturn); } met.Folio = lFolio; //cargar datos de daily processing DataTable dtDaily = new DataTable(); MetadetLogica med2 = new MetadetLogica(); med2.Folio = lFolio; med2.Linea = _asLinea; dtDaily = MetadetLogica.VistaIndividual(med2); if (dtDaily.Rows.Count > 0) { double dMeta = Double.Parse(dtDaily.Rows[0]["meta"].ToString()); double dReal = Double.Parse(dtDaily.Rows[0]["real"].ToString()); double dPorc = dReal / dMeta; dPorc = dPorc * 100; dPorc = Math.Round(dPorc, 2); sReturn = dPorc.ToString(); } return(sReturn); } catch (Exception ex) { MessageBox.Show("Favor de Notificar al Administrador" + Environment.NewLine + "Archivo sin formato Estandar" + Environment.NewLine + "ImportarDatosTxt.." + ex.ToString(), "ERROR " + Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(sReturn); }