Esempio n. 1
0
        private void btnToStock_Click(object sender, EventArgs e)
        {
            String msg             = "";
            bool   procedeCantidad = true;
            int    cantidadAStock  = 0;

            try {
                if (txtCantToStock.Text.Length == 0)
                {
                    msg             = "No se aceptan valores vacíos.";
                    procedeCantidad = false;
                }

                if (procedeCantidad)
                {
                    cantidadAStock = Int32.Parse(txtCantToStock.Text);//panelStock
                    if (cantidadAStock == 0)
                    {
                        msg = "La cantidad tiene que ser mayor a 0.";
                    }
                    else if (cantidadAStock > cantidadTotal)
                    {
                        msg = "La cantidad ingresada excede la cantidad total de la tarima.";
                    }

                    procedeCantidad = (msg.Equals("")) ? true : false;
                }
            } catch (Exception) {
                msg             = "Valor inválido para la cantidad.";
                procedeCantidad = false;
            }

            if (procedeCantidad)
            {
                cMetodos.Producto producto = new cMetodos.Producto();
                producto.epc           = dtProdTerminados.Rows[indexDG][COL_EPC].ToString();
                producto.cantidad      = cantidadAStock;
                producto.cantidadTotal = cantidadTotal;
                producto.tarimaParcial = true;
                listaEPCS.Add(producto);
                DataTable tabla = getTable();
                tabla.Rows.Add(producto.epc, producto.cantidad);
                eliminarDeListaTarimas(producto.epc);
                dgStock.DataSource = tabla;
                panelStock.Visible = false;
                panelStock.Enabled = false;
                dgTarimas.Enabled  = true;
            }

            if (!procedeCantidad)
            {
                txtCantToStock.Focus();
                MessageBox.Show(msg);
            }
        }
Esempio n. 2
0
        private Boolean buscarEnDG(ref cMetodos.Producto producto)
        {
            for (int index = 0; index < dtProdTerminadosAux.Rows.Count; index++)
            {
                if (tag.Equals(dtProdTerminadosAux.Rows[index][COL_EPC].ToString()))
                {
                    producto.cantidad      = Int32.Parse(dtProdTerminadosAux.Rows[index][COL_CANTIDAD].ToString());
                    producto.cantidadTotal = producto.cantidad;
                    producto.tarimaParcial = false;
                    producto.epc           = dtProdTerminadosAux.Rows[index][COL_EPC].ToString();
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 3
0
        private void btnMover_Click(object sender, EventArgs e)
        {
            string msg = null;

            if (tag != null && dtProdTerminados.Rows.Count > 0)
            {
                bool existeEnDG, estaEnListaStock = false;
                cMetodos.Producto producto = new cMetodos.Producto();
                // Validar si el EPC existe en el DG
                existeEnDG = (dtProdTerminados != null) ? buscarEnDG(ref producto) : false;
                // Mover a segundo DG (Stock)
                if (existeEnDG)
                {
                    DataTable tabla = getTable();
                    estaEnListaStock = existeEnListaStock(producto.epc);
                    if (!estaEnListaStock)
                    {
                        listaEPCS.Add(producto);
                        tabla.Rows.Add(producto.epc, producto.cantidad);
                        eliminarDeListaTarimas(producto.epc);
                    }
                    setStyle(dgStock, tabla);
                    dgStock.DataSource = tabla;
                }

                msg = (dtProdTerminados == null) ? "No se ha seleccionado ninguna Orden de Producción."
                                        : (existeEnDG) ?
                      (!estaEnListaStock) ? "Encontró el EPC en el DT: " + tag
                                                : "Este tag ya ha sido leído."
                                        : "Este tag no corresponde a esta Orden de Producción.";
            }
            else
            {
                msg = (dtProdTerminados == null) ? "Seleccione primero una Orden de Producción."
                                        : (dtProdTerminados.Rows.Count == 0) ? "No hay más Ordenes de Producción disponibles."
                                        : "No se ha leído ningún tag!";
            }
            MessageBox.Show(msg);
            tag         = null;
            txtEPC.Text = "";
        }
Esempio n. 4
0
        private void btnToStock_Click(object sender, EventArgs e)          //JLMQ AQUI AGREGAR CICLO QUE LLENA ESCUADRA ASIGNADA PARA ESTE PRODUCTO DE REMISION
        {
            Cursor.Current = Cursors.WaitCursor;
            String msg             = "";
            bool   procedeCantidad = true;
            int    pzaAdd          = 0;

            try {
                if (txtCantToStock.Text.Length == 0)
                {
                    Cursor.Current  = Cursors.Default;
                    msg             = "No se aceptan valores vacíos.";
                    procedeCantidad = false;
                }

                if (procedeCantidad)
                {
                    pzaAdd = Int32.Parse(txtCantToStock.Text);//panelStock
                    if (pzaAdd == 0)
                    {
                        Cursor.Current = Cursors.Default;
                        msg            = "La cantidad tiene que ser mayor a 0.";
                    }
                    else if (pzaAdd > pzaEsc)
                    {
                        Cursor.Current = Cursors.Default;
                        msg            = "La cantidad ingresada excede la cantidad de Piezas en la Escuadra leida.";
                    }

                    newid = met.escVirtualEPC(pedido, ProdRemi, remi);
                    cantidadCargadaEnEsc = met.pzasCargadasEsc(remi, ProdRemi, pzaRemi);//detremision filtrar por remision y producto
                    int cargada = Convert.ToInt32(cantidadCargadaEnEsc);
                    if ((pzaAdd + cargada) > pzaRemi)
                    {
                        Cursor.Current = Cursors.Default;
                        msg            = "LA CANTIDAD INGRESADA EXCEDE LA CANTIDAD DE PIEZAS A CARGAR, YA TIENES " + cantidadCargadaEnEsc + " PIEZAS DEL PRODUCTO " + ProdRemi + " CARGADAS EN EL CAMION";
                    }


                    procedeCantidad = (msg.Equals("")) ? true : false;
                }
            } catch (Exception) {
                Cursor.Current  = Cursors.Default;
                msg             = "Valor inválido para la cantidad.";
                procedeCantidad = false;
            }

            if (procedeCantidad)
            {
                cMetodos.Producto producto = new cMetodos.Producto();
                int pzaupdate;

                producto.epc           = dtProdTerminados.Rows[indexDG][COL_EPC].ToString();
                remi                   = producto.epc;
                producto.cantidad      = pzaAdd;
                producto.cantidadTotal = pzaEsc;
                producto.tarimaParcial = true;
                listaEPCS.Add(producto);

                difEscLeida = pzaEsc - pzaAdd;
                pedido      = met.pedidoRemi2(pzaRemi, remi, ProdRemi);
                newid       = met.escVirtualEPC(pedido, ProdRemi, remi);
                string getepc = met.getEscVirtual(remi, pedido);
                cantidadCargadaEnEsc = met.pzasCargadasEsc(remi, ProdRemi, pzaRemi);
                pzaupdate            = (pzaAdd) + (Convert.ToInt32(cantidadCargadaEnEsc));   //PZA CARGADA MAS LA AGREGADA

                string updatePzaCargada    = met.actualizaPzaEsc(remi, ProdRemi, pzaupdate); //AQUI ACTUALIZAR DETREMISION
                string updatePzaDescontada = met.updapzaRemi(tag, difEscLeida);              //ACTUALIZA LA ESCUADRA LEIDA

                cantidadCargadaEnEsc = met.pzasCargadasEsc(remi, ProdRemi, pzaRemi);
                pzaEscVirtual        = (Convert.ToInt32(cantidadCargadaEnEsc));

                if ((Convert.ToInt32(cantidadCargadaEnEsc)) == pzaRemi)
                {
                    string updatePzasRemiCompletas = met.pzaCargadaComplete(remi, ProdRemi);
                    string Embarcado = met.EmbarcaEscVirt(getepc);
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show("LAS PIEZAS DE EL PRODUCTO Y LA REMISION SELECCIONADA YA FUERON COMPLETADAS", "REVISAR");
                    this.Close();
                }
                else
                {
                    if (pzaEscVirtual == pzaRemi)
                    {
                        string updatePzasRemiCompletas = met.pzaCargadaComplete(remi, ProdRemi);
                        string Embarcado = met.EmbarcaEscVirt(getepc);
                    }

                    Cursor.Current = Cursors.Default;
                    MessageBox.Show("SE CARGARON '" + pzaAdd + "'PIEZAS DEL PRODUCTO Y REMISION SELECCIONADOS", "EXITO");
                    panelStock.Visible = false;
                    panelStock.Enabled = false;
                    dgTarimas.Enabled  = true;
                    dgTarimas.Visible  = false;
                    //meter aqui el hilo
                    hilo = new Thread(updateArticulo);
                    hilo.Start();
                }
            }

            if (!procedeCantidad)
            {
                Cursor.Current = Cursors.Default;
                txtCantToStock.Focus();
                MessageBox.Show(msg);
            }
        }