Example #1
0
 protected void EliminarTabTemZMasterDAL(ClsTabTemZMaster tabTemZMaster)
 {
     //try
     //{
     //    //Abrir la conexión
     //    this.Conexion.Open();
     //    //Insertar registro
     //    SqlCommand comando = this.Conexion.CreateCommand();
     //    comando.CommandType = CommandType.StoredProcedure;
     //    comando.CommandText = Procedimientos.sp_DelUsuario;
     //    //Inserción de parámetros
     //    comando.Parameters.Add("@IdUsuario", SqlDbType.Decimal).Direction = ParameterDirection.Output;
     //    EstablecerParametrosDAL("UPDATE", usuario, comando);
     //    comando.ExecuteNonQuery();
     //}
     //catch (Exception ex)
     //{
     //    //Regenerar la excepción pero ahora con un mensaje personalizado para el usuario
     //    throw new Exception(Errores.EliminarRegistro + Errores.MensajeOriginal + ex.Message.ToString());
     //}
     //finally
     //{
     //    this.Conexion.Close();
     //}
 }
Example #2
0
        public ArrayList CargarTabTemZMaster()
        {
            string criterio = Variables.Nulo;
            //Lista de clientes
            ClsTabTemZMasterCollection tabTemZMasterCollection;
            ClsTabTemZMasterBAL        tabTemZMasterBAL = new ClsTabTemZMasterBAL();
            ArrayList arrTabTemzMaster = new ArrayList();

            try
            {
                tabTemZMasterCollection = tabTemZMasterBAL.ConsultarTabTemZMasterBAL(criterio);
                IEnumerator listaRegistros = tabTemZMasterCollection.GetEnumerator();
                while (listaRegistros.MoveNext())
                {
                    ClsTabTemZMaster currTabTemZMaster = (ClsTabTemZMaster)listaRegistros.Current;

                    arrTabTemzMaster.Add(new AddValue(currTabTemZMaster.Werks, currTabTemZMaster.Werks));
                }
                return(arrTabTemzMaster);
            }
            catch
            {
                throw;
            }
        }
Example #3
0
 protected void ActualizarTabTemZMasterDAL(ClsTabTemZMaster tabTemZMaster)
 {
     try
     {
         //Abrir la conexión
         this.Conexion.Open();
         // Start a local transaction.
         SqlTransaction sqlTransaction = Conexion.BeginTransaction();
         //Insertar registro
         SqlCommand comando = this.Conexion.CreateCommand();
         comando.CommandType = CommandType.StoredProcedure;
         comando.CommandText = Procedimientos.sp_ModUsuarios;
         //Inserción de parámetros
         EstablecerParametrosDAL("UPDATE", tabTemZMaster, comando);
         comando.Transaction = sqlTransaction;
         comando.ExecuteNonQuery();
         comando.Transaction.Commit();
     }
     catch (Exception ex)
     {
         //Regenerar la excepción pero ahora con un mensaje personalizado para el usuario
         throw new Exception(Errores.ModificarRegistro + Errores.MensajeOriginal + ex.Message.ToString());
     }
     finally
     {
         this.Conexion.Close();
     }
 }
Example #4
0
 public void EliminarTabTemZMasterBAL(ClsTabTemZMaster TabTemZMaster)
 {
     try
     {
         base.EliminarTabTemZMasterDAL(TabTemZMaster);
     }
     catch
     {
         throw;
     }
 }
Example #5
0
 public void ActualizarTabTemZMasterBAL(ClsTabTemZMaster tabTemZMaster)
 {
     try
     {
         base.ActualizarTabTemZMasterDAL(tabTemZMaster);
     }
     catch
     {
         throw;
     }
 }
Example #6
0
 public void AgregarTabTemZMasterBAL(ClsTabTemZMaster tabTemZMaster)
 {
     try
     {
         base.AgregarTabTemZMasterDAL(tabTemZMaster);
     }
     catch
     {
         throw;
     }
 }
Example #7
0
 protected void EstablecerParametrosDAL(string tipoTran, ClsTabTemZMaster tabTemZMaster, SqlCommand comando)
 {
     try
     {
         comando.Parameters.Clear();
         //comando.Parameters.Add("@IdCajas", SqlDbType.Decimal).Value = tabTemZMaster.IdCaja;
         comando.Parameters.Add("@Werks", SqlDbType.VarChar).Value   = tabTemZMaster.Werks;
         comando.Parameters.Add("@Mantr", SqlDbType.VarChar).Value   = tabTemZMaster.Matnr;
         comando.Parameters.Add("Cantidad", SqlDbType.Decimal).Value = tabTemZMaster.Cantidad;
     }
     catch
     {
         throw;
     }
 }
Example #8
0
        protected ClsTabTemZMasterCollection ConsultaZMasterDAL(string psCriterio)
        {
            DataSet                    ds                = new DataSet();
            SqlDataAdapter             da                = new SqlDataAdapter();
            ClsTabTemZMaster           tabTemZMaster     = new ClsTabTemZMaster();
            ClsTabTemZMasterCollection tabTempZMasterCol = new ClsTabTemZMasterCollection();


            try
            {
                da.SelectCommand             = new SqlCommand(Procedimientos.sp_ConsCatZMaster, 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++)
                    {
                        tabTemZMaster = new ClsTabTemZMaster();

                        tabTemZMaster.Descripcion = ds.Tables[0].Rows[contador]["MAKTX"].ToString().Trim();
                        tabTemZMaster.Cantidad    = Convert.ToDouble(ds.Tables[0].Rows[contador]["CANTIDAD"].ToString().Trim());
                        tabTemZMaster.Matnr       = ds.Tables[0].Rows[contador]["MATNR"].ToString().Trim();
                        tabTempZMasterCol.Add(tabTemZMaster);
                    }
                }

                return(tabTempZMasterCol);
            }
            catch (Exception ex)
            {
                throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.Trim());
            }
            finally
            {
                this.Conexion.Close();
            }
        }
Example #9
0
        protected int ConsultarCantidadMaterialesZMasterDAL(ClsTabTemZMasterCollection tabTemZMasterColeccion, string psCriterio)
        {
            DataSet          ds            = new DataSet();
            SqlDataAdapter   da            = new SqlDataAdapter();
            ClsTabTemZMaster tabTemZMaster = new ClsTabTemZMaster();


            try
            {
                da.SelectCommand             = new SqlCommand(Procedimientos.sp_ConsMatZMaster, 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++)
                    {
                        tabTemZMaster       = new ClsTabTemZMaster();
                        tabTemZMaster.Cajas = Convert.ToInt32(ds.Tables[0].Rows[contador]["CAJAS"].ToString().Trim());
                    }
                }
                else
                {
                    tabTemZMaster.Cajas = 0;
                }

                return(tabTemZMaster.Cajas);
            }
            catch (Exception ex)
            {
                throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.Trim());
            }
            finally
            {
                this.Conexion.Close();
            }
        }
Example #10
0
        protected void AgregarTabTemZMasterDAL(ClsTabTemZMaster tabTemZMaster)
        {
            //string createdIdUsuario = "";
            //Abrir la conexión
            this.Conexion.Open();
            // Start a local transaction.
            SqlTransaction sqlTransaction = Conexion.BeginTransaction();
            //Insertar registro
            SqlCommand comando = this.Conexion.CreateCommand();

            try
            {
                comando.CommandType = CommandType.StoredProcedure;
                comando.CommandText = Procedimientos.sp_InsTabTemZMaster;
                //Inserción de parámetros para tranzacción de alta
                EstablecerParametrosDAL("ADD", tabTemZMaster, comando);
                comando.Transaction = sqlTransaction;
                comando.ExecuteNonQuery();
                comando.Transaction.Commit();
            }
            catch (Exception ex)
            {
                //Dar rollback a la transaccion
                comando.Transaction.Rollback();
                //Regenerar la excepción pero ahora con un mensaje personalizado para el usuario
                if (ex.ToString().IndexOf(Errores.LlavePrimariaExiste) >= 0)
                {
                    throw new Exception(Errores.ClaveExiste);
                }
                else
                {
                    throw new Exception(Errores.InsertarRegistro + Errores.MensajeOriginal + ex.Message.ToString());
                }
            }
            finally
            {
                this.Conexion.Close();
            }
        }
        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);
                    }
                }
            }
        }
Example #12
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();
        }