コード例 #1
0
        public ArrayList CargarZMaster()
        {
            string criterio = Variables.Nulo;
            //Lista de clientes
            ClsCatZMasterCollection zMasterCollection;
            ClsCatZMasterBAL        zMasterBAL = new ClsCatZMasterBAL();
            ArrayList arrzMaster = new ArrayList();

            try
            {
                zMasterCollection = zMasterBAL.ConsultarZMasterBAL(criterio);
                IEnumerator listaRegistros = zMasterCollection.GetEnumerator();
                while (listaRegistros.MoveNext())
                {
                    ClsCatZMaster currZMaster = (ClsCatZMaster)listaRegistros.Current;
                    // arrAlmacenes.Add(new AddValue(currAlmacen.Lgort, currAlmacen.Lgort));

                    arrzMaster.Add(new AddValue(currZMaster.CreadoPor, currZMaster.CreadoPor));
                }
                return(arrzMaster);
            }
            catch
            {
                throw;
            }
        }
コード例 #2
0
        public void Valida2()
        {
            string      lsCriterio     = "";
            ClsDividirC dividirCodCaja = new ClsDividirC();

            string[] formatoC  = { "H", "P", "L", "D", "Q", "W" };
            string   lsMensaje = "";

            if (dividirCodCaja.DividirC(codigoCaja, formatoC))
            {
                lsCriterio = "WHERE WERKS = '" + dividirCodCaja.Centro + "'";
                CLSCatCentroCollection colCentros = new CLSCatCentroBAL().MostrarCatCentroBAL(lsCriterio);
                if (colCentros.Count > 0)
                {
                    CLSCatCentro centro = colCentros[0];
                    if ((centro.TipoCentro).Equals("0G00"))
                    {
                        centroC    = dividirCodCaja.Centro;
                        lsCriterio = "WHERE IDTarima = '" + tarima + "' AND WERKS = '" + centroC + "' ";
                        ClsCatZMasterCollection zMasColl = new ClsCatZMasterBAL().ConsultarZMasterBAL(lsCriterio);
                        if (zMasColl.Count > 0)
                        {
                            ClsCatZMaster zMaz = zMasColl[0];

                            if (!((zMaz.CentroDestino).Equals("")))
                            {
                                textTarima.SelectAll();
                                lsMensaje = "La tarima se encuentra en centro " + zMaz.CentroDestino;
                                textTarima.Focus();
                                throw new Exception(lsMensaje);
                            }

                            if (!((zMaz.AlmacenDestino).Equals("")))
                            {
                                textTarima.SelectAll();
                                lsMensaje = "La tarima se encuentra en almacen " + zMaz.AlmacenDestino;
                                textTarima.Focus();
                                throw new Exception(lsMensaje);
                            }

                            if (!((zMaz.UbicacionDestino).Equals("")))
                            {
                                textTarima.SelectAll();
                                lsMensaje = "La tarima se encuentra en ubicacion " + zMaz.UbicacionDestino;
                                textTarima.Focus();
                                throw new Exception(lsMensaje);
                            }
                        }
                    }
                }
            }
            else
            {
                textTarima.SelectAll();
                lsMensaje = "Codigo no valido";
                textTarima.Focus();
                throw new Exception(lsMensaje);
            }
        }
コード例 #3
0
        private int ObtenerCajas()
        {
            ClsCatZMasterBAL agregaZMaster = new ClsCatZMasterBAL();
            DateTime         ahora         = DateTime.Now;
            string           horaC         = ahora.Hour.ToString() + ":" + ahora.Minute.ToString() + ":" + ahora.Second.ToString();

            string[] cajas = txtbxTarima.Text.Split('@');

            int i = 0;

            foreach (string elem in cajas)
            {
                ClsCatZMaster zMaster   = new ClsCatZMaster();
                ClsNumCaja    numCaja   = new ClsNumCaja();
                string[]      elementos = elem.Split('|');
                zMaster.IdTarima        = elementos[0].Remove(0, 1);
                zMaster.IdCaja          = Convert.ToInt64(elementos[1].Remove(0, 1));
                zMaster.Matnr           = elementos[2].Remove(0, 1);
                zMaster.Charg           = elementos[3].Remove(0, 1);
                zMaster.FechaProduccion = Convert.ToDateTime(elementos[4].Remove(0, 1).ToString());
                zMaster.Cantidad        = Convert.ToDouble(elementos[5].Remove(0, 1));
                zMaster.Werks           = elementos[6].Remove(0, 1);
                zMaster.CreadoPor       = "SAP";
                zMaster.Desembalada     = " ";
                zMaster.Borrado         = " ";
                zMaster.AsignadaEntrega = " ";
                zMaster.FechaCaducidad  = numCaja.regresaFecha(zMaster.Matnr, zMaster.FechaProduccion, zMaster.Werks);
                zMaster.FechaCreacion   = ahora;
                zMaster.HoraCreacion    = ahora;

                if (i == 0)
                {
                    ClsCatZMasterCollection revisaZMaster;
                    string criterio = "WHERE (WERKS = '" + zMaster.Werks + "') ";
                    criterio      = criterio + "AND (IDTARIMA = '" + zMaster.IdTarima + "')";
                    revisaZMaster = new ClsCatZMasterBAL().ConsultarNumCajasTarimaBAL(criterio);
                    if (revisaZMaster.Count > 0)
                    {
                        throw new Exception("La Tarima " + zMaster.IdTarima + " ya se encuentra en la tabla ZMASTER ");
                    }
                }

                i++;
                txtbxTarima.Text = zMaster.IdTarima;
                agregaZMaster.AgregarZMasterBAL(zMaster);
            }
            return(i);
        }
コード例 #4
0
        private void GuardarRegistro()
        {
            try
            {
                //Crear el objeto con la info de la forma
                ClsZCAT zCat = new ClsZCAT();
                zCat.TARIMA      = Convert.ToDecimal(textTarima.Text);
                zCat.Werks       = textCentro.Text.Trim();
                zCat.Lgort       = textAlmacen.Text.Trim();
                zCat.Ubicacion   = textUbicacionDestino.Text.Trim();
                zCat.TipoAlmacen = txtbxTipoAlmacen.Text.Trim();

                ClsZCATBAL zCATBAL = new ClsZCATBAL();
                zCATBAL.AgregarZCATBAL(zCat);

                String                  lsCriterio = "WHERE IDTarima = '" + tarima + "' AND WERKS = '" + centroC + "' ";
                ClsCatZMasterBAL        zMasBal    = new ClsCatZMasterBAL();
                ClsCatZMasterCollection zMasColl   = zMasBal.ConsultarZMasterBAL(lsCriterio);

                if (zMasColl.Count > 0)
                {
                    ClsCatZMaster zMast = zMasColl[0];
                    zMast.CentroDestino    = textCentro.Text;
                    zMast.AlmacenDestino   = textAlmacen.Text;
                    zMast.UbicacionDestino = textUbicacionDestino.Text;
                    zMasBal.ActualizarZMasterDestinosBAL(zMast);
                }

                base.MostrarMensaje("Pedido de traslado creado...");
                PerformLayout();
                Application.DoEvents();
                System.Threading.Thread.Sleep(2000);


                textUbicacionDestino.Text = "";
                textTarima.Text           = "";
                textCentro.Text           = "";
                textAlmacen.Text          = "";
                textTarima.Focus();
            }
            catch
            {
                throw;
            }
        }
コード例 #5
0
        private void ValidaCaja(string codigoCaja)
        {
            string[] elemetosCaja = codigoCaja.Split(']');
            string   cajaUnica    = " ";
            string   centro       = " ";
            string   criterio     = "";

            try
            {
                cajaUnica = elemetosCaja[0].Remove(0, 1);
                centro    = elemetosCaja[5].Remove(0, 1);

                criterio = "WHERE (IDCaja = '" + cajaUnica + "') ";
                criterio = criterio + "AND (WERKS = '" + centro + "') ";
                criterio = criterio + "AND (DESEMBALADA = '' OR DESEMBALADA = ' ') ";
                criterio = criterio + "AND (BORRADO = '' OR BORRADO = ' ')";

                ClsCatZMasterCollection validaZMaster = new ClsCatZMasterBAL().ConsultarZMasterBAL(criterio);

                if (validaZMaster.Count > 0)
                {
                    throw new Exception("La caja " + cajaUnica + " ya se encuentra asignada a una tarima");
                }

                foreach (string registroCaja in arregloTarima)
                {
                    if (registroCaja.Equals(txtbxCaja.Text))
                    {
                        throw new Exception("Caja ya ingresada");
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #6
0
        public void Desembalar()
        {
            if (txtbxTarimas.Text.Substring(0, 1).Equals("T"))
            {
                char[]   arraySep = { ']' };
                String[] cad      = txtbxTarimas.Text.Trim().Split(arraySep);
                lsTarima = cad[0].ToString().Remove(0, 1);
            }
            else
            {
                lsTarima = txtbxTarimas.Text;
            }
            string criterio = "";

            criterio = "where IdTarima = " + lsTarima;

            ClsCatZMasterCollection coleccionZMaster;

            coleccionZMaster = (new ClsCatZMasterBAL()).ConsultarZMasterBAL(criterio);

            if (coleccionZMaster.Count != 0)
            {
                ClsCatZMaster    tabZmaster = new ClsCatZMaster();
                ClsCatZMasterBAL bal        = new ClsCatZMasterBAL();

                tabZmaster = coleccionZMaster[0];

                tabZmaster.Desembalada = "X";
                bal.ActualizarZMasterBAL(tabZmaster);
                base.MostrarMensaje("Tarima Desemabalada!!");
            }
            else
            {
                base.MostrarError("No existe Tarima!!");
            }
        }
コード例 #7
0
        private void ValidarDatos()
        {
            ClsNumCaja numCaja = new ClsNumCaja();

            //datos llenos
            if (textHu.Text.Trim().Length == 0 && textTarima.Text.Trim().Length == 0)
            {
                lsMensaje = "Ingresar al menos un campo";
                textHu.Focus();
                throw new Exception(lsMensaje);
            }

            //Datos de tarima llenos
            if (textTarima.Text.ToString().Trim().Length != 0)
            {
                nuevosRenglones = 39;

                if (textTarima.Text.Trim().Length < 10)
                {
                    lsMensaje = "Código incorrrecto";
                    base.MostrarError(lsMensaje);
                }
                else
                {
                    //comprueba que tenga un tamaño 10
                    if (textTarima.Text.Trim().Length == 10)
                    {
                        //comprueba que sea numerico char x char
                        for (int x = 0; x <= textTarima.Text.Length - 1; x++)
                        {
                            if (!char.IsDigit(textTarima.Text[x]))
                            {
                                lsMensaje = "Código incorrrecto";
                                base.MostrarError(lsMensaje);
                            }
                        }
                        lsCodTarima = textTarima.Text;
                    }


                    lsCriterio = "where IDTarima=" + lsCodTarima + "order by MATNR";

                    ClsCatZMasterCollection zMasterCollection;

                    zMasterCollection = (new ClsCatZMasterBAL().ConsultarZMasterBAL(lsCriterio));

                    if (zMasterCollection.Count != 0)
                    {
                        lsMensaje = "Tarima Encontrada";
                        base.MostrarMensaje(lsMensaje);

                        IEnumerator lista = zMasterCollection.GetEnumerator();

                        //ClsCatZMaster zMaster = (ClsCatZMaster)lista.Current;

                        while (lista.MoveNext())
                        {
                            ClsCatZMaster zMaster = (ClsCatZMaster)lista.Current;

                            lsFechaArmado = zMaster.FechaCreacion.ToString();
                            lsTotalCajas  = zMasterCollection.Count.ToString();
                            //lsMatnrTarima = zMaster.Matnr.ToString();
                            lsCentroCo = zMaster.Werks.ToString();
                        }

                        lsFechaArmado = lsFechaArmado.Substring(0, 10).ToString();
                        ClsTabTemZMasterCollection tablaTempCol = new ClsTabTemZMasterCollection();

                        aValoresTotales = new string[nuevosRenglones, 2];

                        #region Blancos
                        aValoresTotales[6, 0] = "&G_MATNR01&";
                        aValoresTotales[6, 1] = " ";

                        aValoresTotales[7, 0] = "&G_MAKTX01&";
                        aValoresTotales[7, 1] = " ";

                        aValoresTotales[8, 0] = "&GV_PESO01&";
                        aValoresTotales[8, 1] = " ";

                        aValoresTotales[9, 0] = "&GV_CAJA01&";
                        aValoresTotales[9, 1] = " ";

                        aValoresTotales[10, 0] = "&G_MATNR02&";
                        aValoresTotales[10, 1] = " ";

                        aValoresTotales[11, 0] = "&G_MAKTX02&";
                        aValoresTotales[11, 1] = " ";

                        aValoresTotales[12, 0] = "&GV_PESO02&";
                        aValoresTotales[12, 1] = " ";

                        aValoresTotales[13, 0] = "&GV_CAJA02&";
                        aValoresTotales[13, 1] = " ";

                        aValoresTotales[14, 0] = "&G_MATNR03&";
                        aValoresTotales[14, 1] = " ";

                        aValoresTotales[15, 0] = "&G_MAKTX03&";
                        aValoresTotales[15, 1] = " ";

                        aValoresTotales[16, 0] = "&GV_PESO03&";
                        aValoresTotales[16, 1] = " ";

                        aValoresTotales[17, 0] = "&GV_CAJA03&";
                        aValoresTotales[17, 1] = " ";

                        aValoresTotales[18, 0] = "&G_MATNR04&";
                        aValoresTotales[18, 1] = " ";

                        aValoresTotales[19, 0] = "&G_MAKTX04&";
                        aValoresTotales[19, 1] = " ";

                        aValoresTotales[20, 0] = "&GV_PESO04&";
                        aValoresTotales[20, 1] = " ";

                        aValoresTotales[21, 0] = "&GV_CAJA04&";
                        aValoresTotales[21, 1] = " ";

                        aValoresTotales[22, 0] = "&G_MATNR05&";
                        aValoresTotales[22, 1] = " ";

                        aValoresTotales[23, 0] = "&G_MAKTX05&";
                        aValoresTotales[23, 1] = " ";

                        aValoresTotales[24, 0] = "&GV_PESO05&";
                        aValoresTotales[24, 1] = " ";

                        aValoresTotales[25, 0] = "&GV_CAJA05&";
                        aValoresTotales[25, 1] = " ";

                        aValoresTotales[26, 0] = "&G_MATNR06&";
                        aValoresTotales[26, 1] = " ";

                        aValoresTotales[27, 0] = "&G_MAKTX06&";
                        aValoresTotales[27, 1] = " ";

                        aValoresTotales[28, 0] = "&GV_PESO06&";
                        aValoresTotales[28, 1] = " ";

                        aValoresTotales[29, 0] = "&GV_CAJA06&";
                        aValoresTotales[29, 1] = " ";

                        aValoresTotales[30, 0] = "&G_MATNR07&";
                        aValoresTotales[30, 1] = " ";

                        aValoresTotales[31, 0] = "&G_MAKTX07&";
                        aValoresTotales[31, 1] = " ";

                        aValoresTotales[32, 0] = "&GV_PESO07&";
                        aValoresTotales[32, 1] = " ";

                        aValoresTotales[33, 0] = "&GV_CAJA07&";
                        aValoresTotales[33, 1] = " ";

                        aValoresTotales[34, 0] = "&G_MATNR08&";
                        aValoresTotales[34, 1] = " ";

                        aValoresTotales[35, 0] = "&G_MAKTX08&";
                        aValoresTotales[35, 1] = " ";

                        aValoresTotales[36, 0] = "&GV_PESO08&";
                        aValoresTotales[36, 1] = " ";

                        aValoresTotales[37, 0] = "&GV_CAJA08&";
                        aValoresTotales[37, 1] = " ";
                        #endregion

                        /*for (int i = 0; i < zMasterCollection.Count; i++ )
                         * {*/
                        ClsTabTemZMasterCollection tabTempCol = new ClsTabTemZMasterCollection();

                        tarima2D = lsCodTarima;

                        string criterio0 = "WHERE (ZMASTER.WERKS = '" + lsCentroCo + "') AND (IDTarima = '" + lsCodTarima + "')";

                        ClsCatZMasterCollection etiquetaMaster = new ClsCatZMasterBAL().ConsultarZMasterBAL(criterio0);
                        IEnumerator             recorredor     = etiquetaMaster.GetEnumerator();
                        while (recorredor.MoveNext())
                        {
                            ClsCatZMaster claseTarima = (ClsCatZMaster)recorredor.Current;
                            cajasTarima = cajasTarima + "|H" + claseTarima.IdCaja + "|P" + claseTarima.Matnr + "|L" + claseTarima.Charg + "|D" +
                                          String.Format("{0:d}", claseTarima.FechaProduccion) + "|Q" + claseTarima.Cantidad + "|W" + claseTarima.Werks + "@";
                        }

                        tabTempCol = new ClsTabTemZMasterBAL().ConsultarMaterialesZMasterBAL(criterio0);
                        IEnumerator lista1  = tabTempCol.GetEnumerator();
                        int         valores = 5;
                        int         caja    = 1;

                        while (lista1.MoveNext())
                        {
                            ClsTabTemZMaster mastersilla = new ClsTabTemZMaster();
                            mastersilla = (ClsTabTemZMaster)lista1.Current;

                            lsMatnr = mastersilla.Matnr;
                            ClsTabTemZMasterCollection ZMaster;

                            string criterio = "INNER JOIN MARA ON ZMASTER.MATNR = MARA.MATNR ";
                            criterio = criterio + "WHERE (IDTarima = '" + lsCodTarima + "') ";
                            criterio = criterio + "AND (ZMASTER.MATNR = '" + lsMatnr + "')";
                            criterio = criterio + "AND (MARA.WERKS = '" + lsCentroCo + "')";
                            criterio = criterio + "AND (ZMASTER.WERKS = '" + lsCentroCo + "')";

                            ZMaster = new ClsTabTemZMasterBAL().ConsultaZMasterBAL(criterio);
                            IEnumerator lista2 = ZMaster.GetEnumerator();
                            int         cajas  = 0;
                            double      peso   = 0.0;
                            while (lista2.MoveNext())
                            {
                                ClsTabTemZMaster clase = (ClsTabTemZMaster)lista2.Current;
                                lsMatnr01   = clase.Matnr;
                                lsDescMatnr = clase.Descripcion;
                                cajas++;
                                peso = peso + clase.Cantidad;
                            }

                            liTotalCajasMatnr01 = cajas;
                            liTotalKilos        = peso;
                            totalKilosGral      = totalKilosGral + liTotalKilos;

                            valores++;
                            aValoresTotales[valores, 0] = "&G_MATNR0" + caja + "&";
                            aValoresTotales[valores, 1] = lsMatnr01;
                            valores++;
                            aValoresTotales[valores, 0] = "&G_MAKTX0" + caja + "&";
                            aValoresTotales[valores, 1] = lsDescMatnr;
                            valores++;
                            aValoresTotales[valores, 0] = "&GV_PESO0" + caja + "&";
                            aValoresTotales[valores, 1] = liTotalKilos.ToString();
                            valores++;
                            aValoresTotales[valores, 0] = "&GV_CAJA0" + caja + "&";
                            aValoresTotales[valores, 1] = liTotalCajasMatnr01.ToString();
                            caja++;
                        }

                        //liTotalKilos = Convert.ToDecimal(liTotalKilos) + Convert.ToDecimal(zMasterCollection[i].Cantidad.ToString());
                        //int x = 1;

                        //if (zMasterCollection[i].Matnr.ToString() != zMasterCollection[1].Matnr.ToString())
                        //{
                        //    liTotalKilosMatnr02 = Convert.ToDecimal(liTotalKilosMatnr02) + Convert.ToDecimal(zMasterCollection[i].Cantidad.ToString());
                        //    liTotalCajasMatnr02 = liTotalCajasMatnr02 + x;
                        //    lsMatnr02 = zMasterCollection[i].Matnr;
                        //}
                        //else
                        //{
                        //    tablaTemp.Matnr = zMasterCollection[i].Matnr;
                        //    liTotalKilosMatnr01 = Convert.ToDecimal(liTotalKilosMatnr01) + Convert.ToDecimal(zMasterCollection[i].Cantidad.ToString());
                        //    liTotalCajasMatnr01 = liTotalCajasMatnr01 + x;


                        //    ClsMARACollection maraCollection;
                        //    maraCollection = (new ClsMARABAL().ConsultarMARABAL("where MATNR ='" + lsMatnr01 + "'"));
                        //    if (maraCollection.Count != 0)
                        //    {
                        //        IEnumerator lista1 = maraCollection.GetEnumerator();
                        //        while (lista1.MoveNext())
                        //        {
                        //            ClsMARA mara = (ClsMARA)lista1.Current;
                        //            lsDescMatnrTarima01 = mara.Maktx.ToString();
                        //        }
                        //    }
                        //}
                        //}


                        //       DialogResult result = MessageBox.Show("Los Datos a Imprimir son :  Num Tarima: " + lsCodTarima +
                        //", Fecha Armado: " + lsFechaArmado + ",\n Total Cajas: " + lsTotalCajas +
                        //", Total Kilos: " + liTotalKilos + ",\n " +
                        // " Cajas Ma: " + liTotalCajasMatnr01 + "****** Material: " + lsMatnr01 +
                        //"****** Descripcion: " + lsDescMatnrTarima01 + "****** kilos: " + liTotalKilosMatnr01 +"\n" +
                        // " Cajas Ma: " + liTotalCajasMatnr02 + "****** Material: " + lsMatnr02 +
                        //"****** Descripcion: " + lsDescMatnrTarima02 + "****** kilos: " + liTotalKilosMatnr02
                        //, "Tarima", MessageBoxButtons.YesNo);

                        /*if (result == DialogResult.YeS)
                         * {*/
                        MessageBox.Show("Imprimiendo Etiqueta");

                        string ruta          = ClsFunciones.ObtenerValorEntorno(Variables.SistemaOperativo);
                        string nombreArchivo = ruta + "Tarima.zpl";

                        ImprimirEtiquetaGenericaTarimas(nombreArchivo, GetImpresoraDefecto());

                        /*}
                         * else if (result == DialogResult.No)
                         * {
                         *
                         * }*/
                    }
                    else
                    {
                        lsMensaje = "No se encuentra la Tarima";
                        base.MostrarError(lsMensaje);
                    }
                }
            }
            // Caja
            else if (textHu.Text.ToString().Trim().Length != 0)
            {
                if (textHu.Text.Trim().Length < 10)
                {
                    lsMensaje = "Código incorrrecto";
                    base.MostrarError(lsMensaje);
                }
                else
                {
                    //comprueba que tenga un tamaño 10
                    if (textHu.Text.Trim().Length == 10)
                    {
                        //comprueba que sea numerico char x char
                        for (int x = 0; x <= textHu.Text.Length - 1; x++)
                        {
                            if (!char.IsDigit(textHu.Text[x]))
                            {
                                //  lbCajaCorrecto = false;
                                lsMensaje = "Código incorrrecto";
                                //break;
                                base.MostrarError(lsMensaje);
                            }
                        }

                        lsCodHU = textHu.Text;
                    }
                    else
                    {
                        //si no tiene 10 digitos es un codigo se comprueba que sea codigo 2d
                        if (textHu.Text.Substring(0, 1).Equals("H"))
                        {
                            ClsDividirC divCodigo = new ClsDividirC();
                            //H1001009875|P134303C1|L0014399446|D24/04/2012|Q     30.0 |W0R00
                            string[] formatoC = { "H", "P", "L", "D", "Q", "W" };
                            if (divCodigo.DividirC(textHu.Text, formatoC))
                            {
                                lsCodHU        = divCodigo.NumCaja;
                                lsLote         = divCodigo.NumLoteProd;
                                lsMatnr        = divCodigo.NumParete;
                                lsFechaCaja    = Convert.ToDateTime(divCodigo.FechProd);
                                lsPesoNetoCaja = divCodigo.Cant;
                                lsCentroCo     = divCodigo.Centro;
                            }
                        }
                    }

                    lsCriterio = "where EXIDV= '" + lsCodHU + "' and MOV_HU='X'";

                    ClsZTPPLogsCollection zLogsCollection;
                    zLogsCollection = (new ClsZTPPLogsBAL().ConsultarZTPPLogsBAL(lsCriterio));

                    if (zLogsCollection.Count != 0)
                    {
                        IEnumerator lista = zLogsCollection.GetEnumerator();

                        while (lista.MoveNext())
                        {
                            ClsZTPPLogs zLogs = (ClsZTPPLogs)lista.Current;

                            lsCentroCo     = zLogs.Werks.ToString();
                            lsMatnr        = zLogs.Matnr.ToString();
                            lsFechaCaja    = zLogs.Fecha;
                            lsAufnr        = zLogs.Aufnr.ToString();
                            lsPesoNetoCaja = zLogs.Vemng.ToString();
                        }

                        lsTipo = lsMatnr.Substring(0, 2);


                        switch (lsTipo)
                        {
                        case "11":
                            textoTipo = "VACIO";
                            break;

                        case "12":
                            textoTipo = "CONGELADO";
                            break;

                        case "13":
                            textoTipo = "FRESCO";
                            break;

                        default:
                            string lsMensaje1;
                            lsMensaje1 = "Tipo de producto no valido";
                            throw new Exception(lsMensaje1);
                        }

                        lsCriterio = "as zt inner join OPCS as o on zt.AUFNR = o.AUFNR where zt.AUFNR ='" + lsAufnr + "' and zt.MOV_HU='X' AND (zt.WERKS = '" +
                                     lsCentroCo + "') AND (EXIDV = '" + lsCodHU + "')";

                        zLogsCollection = new ClsZTPPLogsBAL().ObtenerChargReimpresionBAL(lsCriterio);

                        if (zLogsCollection.Count != 0)
                        {
                            lsLote = zLogsCollection[0].Charg;
                        }

                        ClsMARACollection maraCollection;
                        maraCollection = (new ClsMARABAL().ConsultarMARABAL("where MATNR ='" + lsMatnr + "' and WERKS = '" + lsCentroCo + "'"));
                        if (maraCollection.Count != 0)
                        {
                            IEnumerator lista1 = maraCollection.GetEnumerator();
                            while (lista1.MoveNext())
                            {
                                ClsMARA mara = (ClsMARA)lista1.Current;
                                lsDescMatnr = mara.Maktx.ToString();
                                lsEtiar     = mara.Etiar;
                                lsEtifo     = mara.Etifo;
                            }
                        }

                        fechaCad = numCaja.regresaFecha(lsMatnr, Convert.ToDateTime(lsFechaCaja), lsCentroCo);

                        lsMensaje = "Caja Encontrada";
                        base.MostrarMensaje(lsMensaje);
                    }
                    else
                    {
                        lsMensaje = "No se encontra la Caja";
                        base.MostrarError(lsMensaje);
                    }
                }
            }
        }
コード例 #8
0
        private void imprimeDatos()
        {
            //ImprimirEtiquetaGenericaTarimas("C:\\NuevasEtiquetas\\Tarima.zpl", GetImpresoraDefecto());

            numCaja = new ClsNumCaja();

            /*if (banFo)
             * {*/
            GenerarFolio();
            //}

            #region Blancos
            aValoresTotales[6, 0] = "&G_MATNR01&";
            aValoresTotales[6, 1] = " ";

            aValoresTotales[7, 0] = "&G_MAKTX01&";
            aValoresTotales[7, 1] = " ";

            aValoresTotales[8, 0] = "&GV_PESO01&";
            aValoresTotales[8, 1] = " ";

            aValoresTotales[9, 0] = "&GV_CAJA01&";
            aValoresTotales[9, 1] = " ";

            aValoresTotales[10, 0] = "&G_MATNR02&";
            aValoresTotales[10, 1] = " ";

            aValoresTotales[11, 0] = "&G_MAKTX02&";
            aValoresTotales[11, 1] = " ";

            aValoresTotales[12, 0] = "&GV_PESO02&";
            aValoresTotales[12, 1] = " ";

            aValoresTotales[13, 0] = "&GV_CAJA02&";
            aValoresTotales[13, 1] = " ";

            aValoresTotales[14, 0] = "&G_MATNR03&";
            aValoresTotales[14, 1] = " ";

            aValoresTotales[15, 0] = "&G_MAKTX03&";
            aValoresTotales[15, 1] = " ";

            aValoresTotales[16, 0] = "&GV_PESO03&";
            aValoresTotales[16, 1] = " ";

            aValoresTotales[17, 0] = "&GV_CAJA03&";
            aValoresTotales[17, 1] = " ";

            aValoresTotales[18, 0] = "&G_MATNR04&";
            aValoresTotales[18, 1] = " ";

            aValoresTotales[19, 0] = "&G_MAKTX04&";
            aValoresTotales[19, 1] = " ";

            aValoresTotales[20, 0] = "&GV_PESO04&";
            aValoresTotales[20, 1] = " ";

            aValoresTotales[21, 0] = "&GV_CAJA04&";
            aValoresTotales[21, 1] = " ";

            aValoresTotales[22, 0] = "&G_MATNR05&";
            aValoresTotales[22, 1] = " ";

            aValoresTotales[23, 0] = "&G_MAKTX05&";
            aValoresTotales[23, 1] = " ";

            aValoresTotales[24, 0] = "&GV_PESO05&";
            aValoresTotales[24, 1] = " ";

            aValoresTotales[25, 0] = "&GV_CAJA05&";
            aValoresTotales[25, 1] = " ";

            aValoresTotales[26, 0] = "&G_MATNR06&";
            aValoresTotales[26, 1] = " ";

            aValoresTotales[27, 0] = "&G_MAKTX06&";
            aValoresTotales[27, 1] = " ";

            aValoresTotales[28, 0] = "&GV_PESO06&";
            aValoresTotales[28, 1] = " ";

            aValoresTotales[29, 0] = "&GV_CAJA06&";
            aValoresTotales[29, 1] = " ";

            aValoresTotales[30, 0] = "&G_MATNR07&";
            aValoresTotales[30, 1] = " ";

            aValoresTotales[31, 0] = "&G_MAKTX07&";
            aValoresTotales[31, 1] = " ";

            aValoresTotales[32, 0] = "&GV_PESO07&";
            aValoresTotales[32, 1] = " ";

            aValoresTotales[33, 0] = "&GV_CAJA07&";
            aValoresTotales[33, 1] = " ";

            aValoresTotales[34, 0] = "&G_MATNR08&";
            aValoresTotales[34, 1] = " ";

            aValoresTotales[35, 0] = "&G_MAKTX08&";
            aValoresTotales[35, 1] = " ";

            aValoresTotales[36, 0] = "&GV_PESO08&";
            aValoresTotales[36, 1] = " ";

            aValoresTotales[37, 0] = "&GV_CAJA08&";
            aValoresTotales[37, 1] = " ";
            #endregion

            ClsTabTemZMasterCollection tabTempCol = new ClsTabTemZMasterCollection();

            numCaja.NumFolio = glfolio;
            tarima2D         = "T" + glfolio;
            numCaja.coleccionDatos(arrayCantidaItems);

            string criterio0 = "WHERE (ZMASTER.WERKS = '" + lsWerks + "') AND (IDTarima = '" + glfolio + "')";

            ClsCatZMasterCollection etiquetaMaster = new ClsCatZMasterBAL().ConsultarZMasterBAL(criterio0);
            IEnumerator             recorredor     = etiquetaMaster.GetEnumerator();
            while (recorredor.MoveNext())
            {
                ClsCatZMaster claseTarima = (ClsCatZMaster)recorredor.Current;
                cajasTarima = cajasTarima + "|H" + claseTarima.IdCaja + "|P" + claseTarima.Matnr + "|L" + claseTarima.Charg + "|D" +
                              String.Format("{0:d}", claseTarima.FechaProduccion) + "|Q" + claseTarima.Cantidad + "|W" + claseTarima.Werks + "@";
            }

            tabTempCol = new ClsTabTemZMasterBAL().ConsultarMaterialesZMasterBAL(criterio0);
            IEnumerator lista1  = tabTempCol.GetEnumerator();
            int         valores = 5;
            int         caja    = 1;

            while (lista1.MoveNext())
            {
                ClsTabTemZMaster mastersilla = new ClsTabTemZMaster();
                mastersilla = (ClsTabTemZMaster)lista1.Current;

                lsMatnr = mastersilla.Matnr;
                ClsTabTemZMasterCollection ZMaster;

                string criterio = "INNER JOIN MARA ON ZMASTER.MATNR = MARA.MATNR ";
                criterio = criterio + "WHERE (IDTarima = '" + glfolio + "') ";
                criterio = criterio + "AND (ZMASTER.WERKS = '" + lsWerks + "')";
                criterio = criterio + "AND (MARA.WERKS = '" + lsWerks + "')";
                criterio = criterio + "AND (ZMASTER.MATNR = '" + lsMatnr + "')";

                ZMaster = new ClsTabTemZMasterBAL().ConsultaZMasterBAL(criterio);
                IEnumerator lista2 = ZMaster.GetEnumerator();
                int         cajas  = 0;
                double      peso   = 0.0;
                while (lista2.MoveNext())
                {
                    ClsTabTemZMaster clase = (ClsTabTemZMaster)lista2.Current;
                    lsDescMatnr = clase.Descripcion;
                    cajas++;
                    peso = peso + clase.Cantidad;
                }
                liTotalCajasMatnr = cajas;
                liTotalKilos      = peso;
                totalKilosGral    = totalKilosGral + liTotalKilos;
                lsTotalCajas      = (Convert.ToInt32(lsTotalCajas) + cajas).ToString();

                valores++;
                aValoresTotales[valores, 0] = "&G_MATNR0" + caja + "&";
                aValoresTotales[valores, 1] = lsMatnr;
                valores++;
                aValoresTotales[valores, 0] = "&G_MAKTX0" + caja + "&";
                aValoresTotales[valores, 1] = lsDescMatnr;
                valores++;
                aValoresTotales[valores, 0] = "&GV_PESO0" + caja + "&";
                aValoresTotales[valores, 1] = liTotalKilos.ToString();
                valores++;
                aValoresTotales[valores, 0] = "&GV_CAJA0" + caja + "&";
                aValoresTotales[valores, 1] = liTotalCajasMatnr.ToString();
                caja++;
            }

            //DialogResult result = MessageBox.Show("Los Datos a Imprimir son :  Num Tarima: " + lsCodTarima +
            //", Fecha Armado: " + lsFechaArmado + ",\n Total Cajas: " + lsTotalCajas +
            //", Total Kilos: " + liTotalKilos + ",\n " +
            //" Cajas Ma: " + liTotalCajasMatnr + "****** Material: " + lsMatnr +
            //"****** Descripcion: " + lsDescMatnrTarima + "****** kilos: " + liTotalKilosMatnr +"\n" +
            //" Cajas Ma: " + liTotalCajasMatnr + "****** Material: " + lsMatnr +
            //"****** Descripcion: " + lsDescMatnrTarima + "****** kilos: " + liTotalKilosMatnr
            //, "Tarima", MessageBoxButtons.YesNo);

            /*if (result == DialogResult.Yes)
             * {*/
            MessageBox.Show("Imprimiendo Etiqueta");
            string ruta          = ClsFunciones.ObtenerValorEntorno(Variables.SistemaOperativo);
            string nombreArchivo = ruta + "Tarima.zpl";
            //ImprimirEtiquetaGenericaTarimas("\\\\CELBKS02\\EtiquetasContingencia\\Tarima.zpl", GetImpresoraDefecto());
            ImprimirEtiquetaGenericaTarimas(nombreArchivo, GetImpresoraDefecto());

            /*}
             * else if (result == DialogResult.No)
             * {
             *
             * }*/

            txtbxCaja.Text      = "";
            txtbxAlmacen.Text   = "";
            txtbxDenom.Text     = "";
            txtbxEmbalada.Text  = "0.00";
            txtbxLote.Text      = "";
            txtbxCont.Text      = "";
            txtbxMaterial.Text  = "";
            txtbxKilosAcum.Text = "0.000";
            txtbxCajasAcum.Text = "0.000";
            txtbxCaja.Focus();
        }
コード例 #9
0
        private void textTarima_KeyPress(object sender, KeyPressEventArgs e)
        {
            MensajeApagar();
            bool   tarimaProcesada = false;
            string mensajeTarima   = "";

            //Validar la tecla "Enter"
            if (e.KeyChar == (char)13)
            {
                //Valida que la tarima no haya sido seleccionada previamente
                foreach (DataRow row in tablaTemporal.Rows)
                {
                    if (row["idTarima"].ToString() == textTarima.Text)
                    {
                        tarimaProcesada = true;
                    }
                }

                //Si la tarimga ya fue seleccionada salir del proceso
                if (tarimaProcesada)
                {
                    MostrarError("La tarima " + textTarima.Text + " ya fue seleccionada");
                    return;
                }

                //Validar que la tarima proporcionada este en la BD
                string criterio = "where idTarima = '" + textTarima.Text + "'";
                ClsCatZMasterCollection zMasterCollection = new ClsCatZMasterBAL().ConsultarZMasterBAL(criterio);
                IEnumerator             listaZMaster      = zMasterCollection.GetEnumerator();
                bool tarimaValida   = true;
                bool relacionValida = false;

                if (zMasterCollection.Count > 0)
                {
                    //Validar si la tarima ya fue asignada o existe inconsistenia en datos
                    while (listaZMaster.MoveNext())
                    {
                        var zMasterObt = (ClsCatZMaster)listaZMaster.Current;

                        if (!string.IsNullOrEmpty(zMasterObt.AsignadaEntrega))
                        {
                            tarimaValida  = false;
                            mensajeTarima = "La tarima ya fue asignada a una entrega";
                            break;
                        }
                        if (!string.IsNullOrEmpty(zMasterObt.Desembalada))
                        {
                            tarimaValida  = false;
                            mensajeTarima = "La tarima esta desembalada y no puede ser asignada a entrega";
                            break;
                        }
                        if (!string.IsNullOrEmpty(zMasterObt.Borrado))
                        {
                            tarimaValida  = false;
                            mensajeTarima = "La tarima no existe";
                            break;
                        }
                    }

                    if (tarimaValida)
                    {
                        //Validar si los elementos de la tarima son validos
                        ClsDetalleCollection detalleCollection = new ClsEntregasBAL().ConsultarDetalleBAL(IdEntrega, IdCentro);
                        IEnumerator          listaDetalle      = detalleCollection.GetEnumerator();

                        listaZMaster.Reset();
                        while (listaZMaster.MoveNext())
                        {
                            var zMasterObt = (ClsCatZMaster)listaZMaster.Current;

                            listaDetalle.Reset();
                            while (listaDetalle.MoveNext())
                            {
                                var detalleObt = (ClsDetalle)listaDetalle.Current;

                                if ((zMasterObt.Matnr).Equals((detalleObt.NumMaterial).ToUpper()))
                                {
                                    relacionValida = true;
                                    break;
                                }
                                else
                                {
                                    relacionValida = false;
                                }
                            }

                            if (relacionValida == false)
                            {
                                break;
                            }
                        }

                        if (relacionValida)
                        {
                            tarimaAgregada++;
                            lblAcumuladas.Text = tarimaAgregada.ToString();

                            MostrarMensaje("Tarima " + textTarima.Text + " agregada");

                            //Grabar registro temporal: idTarima, idEntrega, pedido, fecha
                            tablaTemporal.Rows.Add(textTarima.Text, IdEntrega, IdEntrega, DateTime.Now);

                            //Hacer suma en las celdas correspondientes
                            listaZMaster.Reset();
                            while (listaZMaster.MoveNext())
                            {
                                var zMasterObt = (ClsCatZMaster)listaZMaster.Current;

                                foreach (DataGridViewRow r in dgvLista.Rows)
                                {
                                    if (r.Cells["Material"].Value.ToString() == zMasterObt.Matnr)
                                    {
                                        //Sumar en picking
                                        r.Cells["Picking"].Value = String.Format("{0:0.000}",
                                                                                 Convert.ToDouble(
                                                                                     r.Cells["Picking"].Value) +
                                                                                 zMasterObt.Cantidad);

                                        //Restar en diferencia
                                        r.Cells["Diferencia"].Value = String.Format("{0:0.000}",
                                                                                    Convert.ToDouble(
                                                                                        r.Cells["Cantidad"].Value) -
                                                                                    Convert.ToDouble(
                                                                                        r.Cells["Picking"].Value)
                                                                                    );

                                        r.Cells["UniEmp"].Value = Convert.ToInt16(r.Cells["UniEmp"].Value) + 1;
                                    }
                                }

                                //Sumar peso de la tarima
                                lblPesoTarima.Text = String.Format("{0:0.000}",
                                                                   Convert.ToDouble(lblPesoTarima.Text) +
                                                                   zMasterObt.Cantidad);
                            }
                            //Limpiar campo captura
                            textTarima.Text = "";
                            textTarima.Focus();
                        }
                        else
                        {
                            MostrarError("La tarima contiene material invalido");
                        }
                    }
                    else
                    {
                        textTarima.Text = "";
                        //base.MostrarError("La tarima ya fue asignada");
                        MostrarError(mensajeTarima);
                    }
                }
                else
                {
                    //La tarima no existe en la BD
                    textTarima.Text = "";
                    MostrarError("La tarima no es existe");
                }
            }
        }