Esempio n. 1
0
        public bool SetEntradaTarimaContenedor(Tarima AUbicacion, int ACamara, int AFolioTarima, string AUbicacionDestino, DateTime AFecha, string AUsuario, string AIp)
        {
            bool pResult = false;
            int pAffected = 0;
            string pSentencia = "UPDATE DRASTARM SET CONTENEDOR = @CONTENEDOR, UBICACION = @UBICACION, FECHAENTRADA = @FECHA, USUARIO = @USUARIO WHERE FOLIO = @FOLIO";
            FbConnection con = _Conexiones.ObtenerConexion();

            FbCommand com = new FbCommand(pSentencia, con);
            com.Parameters.Add("@CONTENEDOR", FbDbType.Integer).Value = ACamara;
            com.Parameters.Add("@UBICACION", FbDbType.VarChar).Value  = AUbicacionDestino;
            com.Parameters.Add("@FECHA", FbDbType.TimeStamp).Value    = AFecha;
            com.Parameters.Add("@USUARIO", FbDbType.VarChar).Value    = AUsuario;
            com.Parameters.Add("@FOLIO", FbDbType.Integer).Value      = AFolioTarima;

            try
            {
                con.Open();
                pAffected = com.ExecuteNonQuery();

            }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                    pResult = pAffected > 0;
                    if (pResult)
                    {
                        InsertaRastroTraspasos(AFolioTarima, AUbicacion.Ubicacion, AUbicacionDestino, AIp, AUsuario, AUbicacion.Contenedor, ACamara);
                    }

                }
            }

            return pResult;
        }
Esempio n. 2
0
        public List<Tarima> ObtenerTarimasLote(string AFechaIni, string AFechaFin, int ALoteIni, int ALoteFin)
        {
            List<Tarima> listaTarimas = new List<Tarima>();
            Tarima pResult = null;

            string pSentencia = "SELECT FOLIO, FECHA, CAJAS, KILOS, COALESCE(LOTE, 0) AS LOTE, CONTENEDOR, UBICACION "+
                                "FROM DRASTARM WHERE FECHA >= @FECHAINI AND FECHA <= @FECHAFIN AND LOTE >= @LOTEINI AND LOTE <= @LOTEFIN AND ESTATUS = 'C'";
            FbConnection con = _Conexiones.ObtenerConexion();

            FbCommand com = new FbCommand(pSentencia, con);
            com.Parameters.Add("@FECHAINI", FbDbType.TimeStamp).Value = AFechaIni;
            com.Parameters.Add("@FECHAFIN", FbDbType.TimeStamp).Value = AFechaFin;
            com.Parameters.Add("@LOTEINI", FbDbType.SmallInt).Value   = ALoteIni;
            com.Parameters.Add("@LOTEFIN", FbDbType.SmallInt).Value   = ALoteFin;

            try
            {
                con.Open();

                FbDataReader reader = com.ExecuteReader();
                while (reader.Read())
                {
                    pResult = new Tarima();
                    pResult.Folio      = reader["FOLIO"] != DBNull.Value ? (int)reader["FOLIO"] : -1;
                    pResult.Fecha      = (DateTime)reader["FECHA"];
                    pResult.Cajas      = reader["CAJAS"] != DBNull.Value ? (int)reader["CAJAS"] : 0;
                    pResult.Kilos      = reader["KILOS"] != DBNull.Value ? (float)reader["KILOS"] : 0;
                    pResult.Lote       = reader["LOTE"] != DBNull.Value ? (Int16)reader["LOTE"] : 0;
                    pResult.Ubicacion  = reader["UBICACION"] != DBNull.Value ? (string)reader["UBICACION"] : "";
                    pResult.Contenedor = reader["CONTENEDOR"] != DBNull.Value ? (int)reader["CONTENEDOR"] : 0;
                    listaTarimas.Add(pResult);
                }
            }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                }
            }

            return listaTarimas;
        }
Esempio n. 3
0
        public Tarima ObtenerTarima(int AFolio)
        {
            Tarima pResult = null;

            string pSentencia = "SELECT T0.FOLIO, T0.FECHA, T0.CAJAS, T0.KILOS, T0.IP, T0.ESTATUS, T0.LOTE, T0.CONTENEDOR, T1.DESCRIPCION AS CAMARA, " +
                                "T0.UBICACION, T0.FECHAENTRADA, T0.USUARIO, T0.ID_SALIDA, T0.FECHAHORASISTEMA FROM DRASTARM T0 " +
                                "JOIN DRASCAM T1 ON T0.CONTENEDOR = T1.ID " +
                                "WHERE T0.FOLIO = @FOLIO";
            FbConnection con = _Conexiones.ObtenerConexion();

            FbCommand com = new FbCommand(pSentencia, con);
            com.Parameters.Add("@FOLIO", FbDbType.Integer).Value = AFolio;

            try
            {
                con.Open();

                FbDataReader reader = com.ExecuteReader();
                while (reader.Read())
                {
                    pResult                       = new Tarima();
                    pResult.Folio                 = reader["FOLIO"] != DBNull.Value ? (int)reader["FOLIO"] : -1;
                    pResult.Fecha                 = (DateTime)reader["FECHA"];
                    pResult.Cajas                 = reader["CAJAS"] != DBNull.Value ? (int)reader["CAJAS"] : 0;
                    pResult.Kilos                 = reader["KILOS"] != DBNull.Value ? (float)reader["KILOS"] : 0;
                    pResult.Ip                    = reader["IP"] != DBNull.Value ? (string)reader["IP"] : "";
                    pResult.Estatus               = reader["ESTATUS"] != DBNull.Value ? (string)reader["ESTATUS"] : "";
                    pResult.Lote                  = reader["LOTE"] != DBNull.Value ? (Int16)reader["LOTE"] : 0;
                    pResult.Ubicacion             = reader["UBICACION"] != DBNull.Value ? (string)reader["UBICACION"] : "";
                    pResult.Contenedor            = reader["CONTENEDOR"] != DBNull.Value ? (int)reader["CONTENEDOR"] : 0;
                    pResult.ContenedorDescripcion = reader["CAMARA"] != DBNull.Value ? (string)reader["CAMARA"] : "";
                    pResult.FechaEntrada          = (DateTime)reader["FECHAENTRADA"];
                    pResult.Usuario               = reader["USUARIO"] != DBNull.Value ? (string)reader["USUARIO"] : "";
                    pResult.Id_Salida             = reader["ID_SALIDA"] != DBNull.Value ? (int)reader["ID_SALIDA"] : -1;
                    pResult.FechaHoraSistema      = (DateTime)reader["FECHAHORASISTEMA"];

                }
            }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                }
            }

            return pResult;
        }
Esempio n. 4
0
        public List<Tarima> ObtenerTarimasCamara(int ACamara)
        {
            List<Tarima> listaTarimas = new List<Tarima>();
            Tarima pResult = null;

            string pSentencia = "SELECT FOLIO, COALESCE(FECHAHORASISTEMA, FECHA) AS FECHA, COALESCE(CAJAS, 0) AS CAJAS, COALESCE(KILOS, 0) AS KILOS, COALESCE(LOTE, 0) AS LOTE, UBICACION, CONTENEDOR "+
                               "FROM DRASTARM WHERE CONTENEDOR IN(" + ACamara + ") AND ESTATUS = 'C' "+
                               "AND CAJAS > 0 "+
                               "UNION ALL "+
                               "SELECT 0 AS FOLIO, CURRENT_TIMESTAMP AS FECHA, COALESCE(COUNT(*), 0) AS CAJAS, COALESCE(SUM(PESO), 0) AS KILOS, "+
                               "0 AS LOTE, 'A0101' AS UBICACION, CAMARA  FROM DRASCORT WHERE CAMARA IN(" + ACamara + ") AND(TARIMA IS NULL OR TARIMA = 0) AND EMBARCADO = 'No' GROUP BY CAMARA";
            FbConnection con = _Conexiones.ObtenerConexion();

            FbCommand com = new FbCommand(pSentencia, con);

            try
            {
                con.Open();

                FbDataReader reader = com.ExecuteReader();
                while (reader.Read())
                {
                    pResult            = new Tarima();
                    pResult.Folio      = reader["FOLIO"] != DBNull.Value ? (int)reader["FOLIO"] : -1;
                    pResult.Fecha      = (DateTime)reader["FECHA"];
                    pResult.Cajas      = reader["CAJAS"] != DBNull.Value ? (int)reader["CAJAS"] : 0;
                    pResult.Kilos      = reader["KILOS"] != DBNull.Value ? (float)reader["KILOS"] : 0;
                    pResult.Lote       = reader["LOTE"] != DBNull.Value ? (Int16)reader["LOTE"] : 0;
                    pResult.Ubicacion  = reader["UBICACION"] != DBNull.Value ? (string)reader["UBICACION"] : "";
                    pResult.Contenedor = reader["CONTENEDOR"] != DBNull.Value ? (int)reader["CONTENEDOR"] : 0;
                    listaTarimas.Add(pResult);
                }
            }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                }
            }

            return listaTarimas;
        }
Esempio n. 5
0
        public List<Tarima> ObtenerTarimasDeSalida(int AIdSalida)
        {
            List<Tarima> pResult = new List<Tarima>();
            Tarima pTarima = null;

            string pSentencia = "SELECT FOLIO, CAJAS, KILOS, LOTE, CONTENEDOR FROM DRASTARM WHERE ID_SALIDA = @ID";
            FbConnection con = _Conexiones.ObtenerConexion();

            FbCommand com = new FbCommand(pSentencia, con);
            com.Parameters.Add("@ID", FbDbType.Integer).Value = AIdSalida;

            try
            {
                con.Open();
                FbDataReader reader = com.ExecuteReader();
                while (reader.Read())
                {
                    pTarima            = new Tarima();
                    pTarima.Folio      = (reader["FOLIO"] != DBNull.Value) ? (int)reader["FOLIO"] : -1;
                    pTarima.Cajas      = (reader["CAJAS"] != DBNull.Value) ? (int)reader["CAJAS"] : -1;
                    pTarima.Kilos      = (reader["KILOS"] != DBNull.Value) ? (float)reader["KILOS"] : 0;
                    pTarima.Lote       = (reader["LOTE"] != DBNull.Value) ? (Int16)reader["LOTE"] : -1;
                    pTarima.Contenedor = (reader["CONTENEDOR"] != DBNull.Value) ? (int)reader["CONTENEDOR"] : -1;
                    pResult.Add(pTarima);
                }
            }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return pResult;
        }