/* * Autor: Enrique Santana * Fecha de creación: 02/05/2012 * Fecha de liberación: 04/06/2012 * Descripción: Consigue la OP si existe */ private void ObtenerOrden() { txtbxOrdenesProd.Text = ""; CLSOrdenProdCollection orden; string criterio = ""; string lote = txtbxLote.Text; string matCons = txtbxMatCon.Text; string matProd = txtbxMatProd.Text; criterio = "WHERE (MATNR_COMP = '" + matCons + "') "; criterio = criterio + "AND (MATNR = '" + matProd + "')"; orden = new CLSOrdenProdBAL().MostrarOrdenProdBAL(criterio); IEnumerator lista = orden.GetEnumerator(); while (lista.MoveNext()) { CLSOrdenProd ordenProd = (CLSOrdenProd)lista.Current; //ClsResbCollection resb; /*string criterio2 = "WHERE (RSNUM = '" + "471729" + "') "; * criterio2 = criterio2 + "AND (MATNR = '" + matProd + "') "; * criterio2 = criterio2 + "AND (BWART = '261')"; * resb = new ClsResbBAL().ConsultarResbBAL(criterio2);*/ txtbxOrdenesProd.Text = ordenProd.Aufnr; charg2 = orden[0].Charg.ToString(); } if (orden.Count == 0) { throw new Exception("No se encuentra Orden de Producción"); } }
/* * Autor: Enrique Santana * Fecha de creación: 02/05/2012 * Fecha de liberación: 04/06/2012 * Descripción: Obtiene el número de orden */ private void ObtenerOrden(CLSFatom fatom) { CLSOrdenProdCollection orden; string criterio = ""; //string lote = txtbxLote.Text; string matCons = fatom.Matnr; string matProd = fatom.MatnrProd; criterio = "WHERE (MATNR_COMP = '" + matCons + "') "; criterio = criterio + "AND (WERKS = '" + centro + "')"; criterio = criterio + "AND (MATNR = '" + matProd + "')"; orden = new CLSOrdenProdBAL().MostrarOrdenProdBAL(criterio); if (orden.Count == 0) { throw new Exception("No se encuentra Orden de Producción en el folio: " + fatom.Folio); } IEnumerator lista = orden.GetEnumerator(); string criterioFatom = "WHERE (WERKS = '" + fatom.Werks + "') "; criterioFatom = criterioFatom + "AND (FECHA >= CONVERT(DATETIME, '" + fecha.ToString("yyyy-MM-dd 00:00:00") + "', 120)) "; criterioFatom = criterioFatom + "AND (FECHA <= CONVERT(DATETIME, '" + fecha.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "', 120)) "; criterioFatom = criterioFatom + "AND (FOLIO = '" + fatom.Folio + "') "; //ObtenerProductos(fatom, criterioFatom); while (lista.MoveNext()) { CLSOrdenProd ordenProd = (CLSOrdenProd)lista.Current; //ClsResbCollection resb; /*string criterio2 = "WHERE (RSNUM = '" + "471729" + "') "; //**************************************************** * criterio2 = criterio2 + "AND (MATNR = '" + matProd + "') "; * criterio2 = criterio2 + "AND (BWART = '261')"; * resb = new ClsResbBAL().ConsultarResbBAL(criterio2);*/ fatom.Aufnr = ordenProd.Aufnr; fatom.Charg = ordenProd.Charg; CLSFatomBAL fatomAgrega = new CLSFatomBAL(); fatomAgrega.ActualizarOrdenesZPPG02BAL(fatom, criterioFatom); } //if (orden.Count == 0) //{ // throw new Exception("No se encuentra Orden de Producción en el folio: " + fatom.Folio); //} /*txtbxOrdenesProd.Text = ordenProd.Aufnr; * charg2 = orden[0].Charg.ToString();*/ }
protected CLSOrdenProdCollection ConsultarOrdenProdCollection(string psCriterio) { DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(); CLSOrdenProdCollection ordenCollection = new CLSOrdenProdCollection(); CLSOrdenProd orden; try { da.SelectCommand = new SqlCommand(Procedimientos.sp_ConsOrdenProd, 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++) { orden = new CLSOrdenProd(); orden.Werks = ds.Tables[0].Rows[contador]["WERKS"].ToString().Trim(); orden.Aufnr = ds.Tables[0].Rows[contador]["AUFNR"].ToString().Trim(); orden.Charg = ds.Tables[0].Rows[contador]["CHARG"].ToString().Trim(); orden.Matnr = ds.Tables[0].Rows[contador]["MATNR"].ToString().Trim(); orden.MatnrComp = ds.Tables[0].Rows[contador]["MATNR_COMP"].ToString().Trim(); orden.Lgort = ds.Tables[0].Rows[contador]["LGORT"].ToString().Trim(); ordenCollection.Add(orden); } } return(ordenCollection); } catch (Exception ex) { throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.ToString()); } finally { this.Conexion.Close(); } }