Example #1
0
        private Movimiento ParseSQLRow(DataRow row)
        {
            Movimiento mov = new Movimiento()
            {
                Articulo      = (string)row["ARTICULO"],
                Descripcion   = (string)row["TEXT"],
                BultoId       = (int)row["CODBULTO"],
                Cantidad      = Decimal.ToInt32((decimal)row["CANTIDAD"]),
                Fecha         = (System.DateTime)row["F_MOV"],
                Lote          = (string)row["LOTE"],
                Orden         = (row["OFS"] == System.DBNull.Value ? null : row["OFS"].ToString()),
                MovimientoId  = (int)row["CODMOV"],
                UserName      = (string)row["TERMINAL"],
                UbicacionCode = (string)row["CODUBI"]
            };

            dsAlmacen.UBICACIONESDataTable dtUbicacion = new dsAlmacen.UBICACIONESDataTable();
            dtUbicacion.FillByCODUBI(mov.UbicacionCode);

            if (dtUbicacion.Count == 1)
            {
                mov.Ubicacion = Ubicacion.Parse(dtUbicacion[0]);
            }

            if (mov.Orden != null)
            {
                dsOfs.OFSDataTable dtOfs = new dsOfs.OFSDataTable();
                dtOfs.FillByOfs(int.Parse(mov.Orden));

                if (dtOfs.Count == 1)
                {
                    mov.Ofs = Orden.Parse(dtOfs[0]);
                }
            }

            dsAlmacen.BULTOSDataTable dtBultos = new dsAlmacen.BULTOSDataTable();
            dtBultos.FillByCODBULTO(mov.BultoId);

            if (dtBultos.Count == 1)
            {
                mov.Bulto = ParseBulto(dtBultos[0]);

                mov.Bulto.Ubicacion = mov.Ubicacion;
            }


            return(mov);
        }
Example #2
0
        private Orden ParseOrden(dsOfs.OFSRow row)
        {
            string centro    = null;
            string ubicacion = null;
            Orden  ofs       = Orden.Parse(row);

            //Obtenemos maquina desde ESP Planning
            using (System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(Configuration.GetConnectionString("esp_data")))
            {
                sqlConnection.Open();
                using (System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand())
                {
                    command.Connection  = sqlConnection;
                    command.CommandText = @"SELECT [CENTRO] FROM [dbo].[OFS_PLANIFICACION_ACOND] WHERE ARTICULO=@ARTICULO AND LOTE=@LOTE";
                    command.Parameters.Add(new System.Data.SqlClient.SqlParameter("ARTICULO", SqlDbType.NVarChar, 50));
                    command.Parameters.Add(new System.Data.SqlClient.SqlParameter("LOTE", SqlDbType.NVarChar, 50));
                    command.Parameters["ARTICULO"].Value = ofs.Articulo;
                    command.Parameters["LOTE"].Value     = row.LOTE;

                    centro = (string)command.ExecuteScalar();
                }
            }

            //--Mapping entre ubicaciones y centros
            ubicacion = "M1";

            dsAlmacen.UBICACIONESDataTable dtUbicacion = new dsAlmacen.UBICACIONESDataTable();
            dtUbicacion.FillByCODUBI(ubicacion);

            if (dtUbicacion.Count == 1)
            {
                ofs.Ubicacion = Ubicacion.Parse(dtUbicacion[0]);
            }

            return(ofs);
        }