예제 #1
0
        public CLSFatomCollection MostrarFatomBAL(string psCriterio)
        {
            CLSFatomCollection coleccion = new CLSFatomCollection();

            try
            {
                coleccion = base.ConsultarFatomCollection(psCriterio);
                return(coleccion);
            }
            catch
            {
                throw;
            }
        }
예제 #2
0
        /*
         * Autor: Enrique Santana
         * Fecha de creación: 02/05/2012
         * Fecha de liberación: 04/06/2012
         * Descripción: Revisa que exista el folio
         */

        private void RevisarFolios()
        {
            string hoy          = dtpFecha.Value.ToString("yyyy-MM-dd 00:00:00");
            string diaSiguiente = dtpFecha.Value.AddDays(1).ToString("yyyy-MM-dd 00:00:00");
            string criterio     = "WHERE (FECHA >= CONVERT(DATETIME, '" + hoy + "', 120)) ";

            criterio = criterio + "AND (FECHA <= CONVERT(DATETIME, '" + diaSiguiente + "', 120)) ";
            criterio = criterio + "AND (WERKS = '" + centro + "')";
            criterio = criterio + "AND (PESAR_CAB = 'X')";
            criterio = criterio + "AND (PESO_CAB <= 0)";
            fatCol   = new CLSFatomBAL().MostrarFatomBAL(criterio);
            IEnumerator lista = fatCol.GetEnumerator();

            try
            {
                if (fatCol.Count <= 0)
                {
                    btnGrabar.Enabled = false;
                    MessageBox.Show("Ya no hay folios para esta fecha!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtbxFolio.Text    = "";
                    txtbxFolio.Enabled = false;
                    throw new Exception("Ya no hay folios para esta fecha!");
                }
                else
                {
                    while (lista.MoveNext())
                    {
                        btnGrabar.Enabled  = true;
                        txtbxFolio.Enabled = true;
                        txtbxFolio.Text    = fatCol[0].Folio.ToString();
                        break;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #3
0
        protected CLSFatomCollection ConsultarFatomCollection(string psCriterio)
        {
            DataSet            ds = new DataSet();
            SqlDataAdapter     da = new SqlDataAdapter();
            CLSFatomCollection catCentroCollection = new CLSFatomCollection();
            CLSFatom           fatom;

            try
            {
                da.SelectCommand             = new SqlCommand(Procedimientos.sp_ConsFatom, this.Conexion);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                da.SelectCommand.Parameters.Add("@Criterio", SqlDbType.VarChar).Value = psCriterio;
                da.Fill(ds);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    int renglones = ds.Tables[0].Rows.Count;
                    int columnas  = ds.Tables[0].Columns.Count;

                    for (int contador = 0; contador < ds.Tables[0].Rows.Count; contador++)
                    {
                        fatom       = new CLSFatom();
                        fatom.Werks = ds.Tables[0].Rows[contador]["WERKS"].ToString().Trim().ToUpper();
                        try
                        {
                            fatom.Fecha = Convert.ToDateTime(ds.Tables[0].Rows[contador]["FECHA"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.Fecha = Convert.ToDateTime("1953-01-01 00:00:00");
                        }
                        fatom.Folio = Convert.ToInt32(ds.Tables[0].Rows[contador]["FOLIO"].ToString().Trim());
                        fatom.Charg = ds.Tables[0].Rows[contador]["CHARG"].ToString().Trim().ToUpper();
                        try
                        {
                            fatom.Erfmg = Convert.ToDouble(ds.Tables[0].Rows[contador]["ERFMG"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.Erfmg = 0.0;
                        }
                        fatom.Erfme = ds.Tables[0].Rows[contador]["ERFME"].ToString().Trim().ToUpper();
                        try
                        {
                            fatom.Tara = Convert.ToDouble(ds.Tables[0].Rows[contador]["TARA"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.Tara = 0.0;
                        }
                        fatom.Serie   = ds.Tables[0].Rows[contador]["SERIE"].ToString().Trim().ToUpper();
                        fatom.Tatuaje = ds.Tables[0].Rows[contador]["TATUAJE"].ToString().Trim().ToUpper();
                        try
                        {
                            fatom.PesoProm = Convert.ToDouble(ds.Tables[0].Rows[contador]["PESOPROM"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.PesoProm = 0.0;
                        }
                        fatom.Calidad    = ds.Tables[0].Rows[contador]["CALIDAD"].ToString().Trim().ToUpper();
                        fatom.CodDestino = ds.Tables[0].Rows[contador]["CODDESTINO"].ToString().Trim().ToUpper();
                        fatom.Destino    = ds.Tables[0].Rows[contador]["DESTINO"].ToString().Trim().ToUpper();
                        try
                        {
                            fatom.Musculo = Convert.ToDouble(ds.Tables[0].Rows[contador]["MUSCULO"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.Musculo = 0.0;
                        }
                        try
                        {
                            fatom.Grasa = Convert.ToDouble(ds.Tables[0].Rows[contador]["GRASA"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.Grasa = 0.0;
                        }
                        try
                        {
                            fatom.Chuleta = Convert.ToDouble(ds.Tables[0].Rows[contador]["CHULETA"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.Chuleta = 0.0;
                        }
                        try
                        {
                            fatom.FechaLote = Convert.ToDateTime(ds.Tables[0].Rows[contador]["FECHA_LOTE"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.FechaLote = Convert.ToDateTime("1953-01-01 00:00:00");
                        }
                        fatom.PesarCab = ds.Tables[0].Rows[contador]["PESAR_CAB"].ToString().Trim();
                        try
                        {
                            fatom.PesoCab = Convert.ToDouble(ds.Tables[0].Rows[contador]["PESO_CAB"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.PesoCab = 0.0;
                        }
                        fatom.Matnr          = ds.Tables[0].Rows[contador]["MATNR"].ToString().Trim().ToUpper();
                        fatom.MatnrProd      = ds.Tables[0].Rows[contador]["MATNR_PROD"].ToString().Trim().ToUpper();
                        fatom.MatnrProd2     = ds.Tables[0].Rows[contador]["MATNR_PROD2"].ToString().Trim().ToUpper();
                        fatom.Aufnr          = ds.Tables[0].Rows[contador]["AUFNR"].ToString().Trim().ToUpper();
                        fatom.Procesado      = ds.Tables[0].Rows[contador]["ESTADO"].ToString().ToUpper();
                        fatom.ChargProd      = ds.Tables[0].Rows[contador]["CHARG_PROD"].ToString().ToUpper();
                        fatom.EstadoMaq      = ds.Tables[0].Rows[contador]["ESTADO_MAQ"].ToString().ToUpper();
                        fatom.MatnrProd2Virt = ds.Tables[0].Rows[contador]["MATNR_PROD2_VIRT"].ToString().ToUpper();
                        try
                        {
                            fatom.Kg1 = Convert.ToDouble(ds.Tables[0].Rows[contador]["KG1"].ToString().Trim());
                        }
                        catch
                        {
                            fatom.Kg1 = 0.0;
                        }
                        try
                        {
                            fatom.Kg2 = Convert.ToDouble(ds.Tables[0].Rows[contador]["KG2"].ToString());
                        }
                        catch
                        {
                            fatom.Kg2 = 0.0;
                        }
                        catCentroCollection.Add(fatom);
                    }
                }

                return(catCentroCollection);
            }
            catch (Exception ex)
            {
                throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.ToString());
            }
            finally
            {
                this.Conexion.Close();
            }
        }