/*
         * 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");
            }
        }
Exemple #2
0
        /*
         * 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();*/
        }