Example #1
0
        private void btContinuar_Click(object sender, EventArgs e)
        {
            try
            {
                /*
                 * if (this.lu.Fecha == DateTime.MinValue)
                 * {
                 *  this.encabezado.Mensaje = "Seleccione Fecha valida";
                 *  this.dtpFecha.Focus();
                 *  return;
                 * }
                 */
                if (this.lu.CodTurno == -1)
                {
                    this.encabezado.Mensaje = "Seleccione Turno";
                    this.cbxTurno.Focus();
                    return;
                }
                if (this.lu.CodProceso == -1)
                {
                    this.encabezado.Mensaje = "Seleccione Proceso";
                    this.cbxProceso.Focus();
                    return;
                }
                if (this.lu.CodPantalla == -1)
                {
                    this.encabezado.Mensaje = "Seleccione Opción";
                    this.cbxOpcion.Focus();
                    return;
                }

                int inventarioProceso = this.oDA.ExisteInventarioProcesoActivo();
                if (inventarioProceso != -1 && this.lu.CodProceso != this.oDA0.ObtenerCodProcesoInventario())
                {
                    this.encabezado.Mensaje = "Existe Inventario en proceso";
                    this.cbxProceso.Focus();
                    return;
                }
                if (inventarioProceso == -1 && this.lu.CodProceso == this.oDA0.ObtenerCodProcesoInventario())
                {
                    this.encabezado.Mensaje = "No hay Inventario en proceso";
                    this.cbxProceso.Focus();
                    //return;
                }

                this.encabezado.Mensaje = String.Empty;

                //if (this.ExisteDatosPendienteEnviar(this.lu.CodProceso))
                //{
                //    if (MessageBox.Show("¿Desea enviarlos? ", "Existen datos pendientes por enviar.", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                //    {
                //        this.EnviarDatosProceso(this.lu.CodProceso);
                //    }
                //}

                // Si Tiene datos pendientes por enviar ó se eligio  'Enviar datos de Vaciado'.
                if (this.ExisteDatosPendienteEnviar(this.lu.CodProceso) || this.lu.CodPantalla == 500)
                {
                    if (MessageBox.Show("¿Desea enviarlos? ", "Existen datos pendientes por enviar.", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        this.encabezado.Mensaje = "Enviando datos " + cbxProceso.SelectedText + "...";
                        this.Refresh();
                        bool bEnvioExitoso = this.EnviarDatosProceso(this.lu.CodProceso);
                        if (bEnvioExitoso)
                        {
                            MessageBox.Show("Envio exitoso", "SCPP", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                        }
                        else
                        {
                            MessageBox.Show("Envio fallido, intentar nuevamente", "SCPP", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }

                        this.encabezado.Mensaje = String.Empty;
                        this.Refresh();
                    }
                    if (this.lu.CodPantalla == 500)
                    {
                        return;
                    }
                }
                // Insertar la Configuracion de la HandHeld.
                this.lu.CodConfigHandHeld = this.oDA.InsertarConfigHandHeld(DA.eTipoConexion.Local,
                                                                            this.lu.CodUsuario,
                                                                            this.lu.CodEmpleado,
                                                                            this.lu.CodSupervisor,
                                                                            this.lu.Fecha,
                                                                            this.lu.CodTurno,
                                                                            this.lu.CodPlanta,
                                                                            this.lu.CodProceso,
                                                                            null,
                                                                            null);


                //Inicia la actualizacion asincrona de tablas transaccionales
                try
                {
                    Thread tActualizacion = null;
                    tActualizacion = new Thread(new ThreadStart(ExecuteThread));
                    tActualizacion.Start();
                    isThreadActive = true;
                }
                catch { }



                // Abrir el formulario segun el proceso y opcion.
                Form frmObj = null;

                if (this.lu.CodPantalla == 8 || this.lu.CodPantalla == 10 || this.lu.CodPantalla == 11 ||
                    this.lu.CodPantalla == 12 || this.lu.CodPantalla == 13 || this.lu.CodPantalla == 15 ||
                    this.lu.CodPantalla == 17 || this.lu.CodPantalla == 18)
                {
                    frmObj = new a04_CapturaInicial(this.lu);
                }
                else if (this.lu.CodPantalla == 9)
                {
                    frmObj = new a05_ArmadoCarroSecador(this.lu);
                }
                else if (this.lu.CodPantalla == 16)
                {
                    //frmObj = new a11_ArmadoTarima(this.lu);
                    frmObj = new frmSetTarimaPieza(this.lu);
                    //(frmObj as frmSetTarimaPieza).CapturaConfiguracionInicial = this;
                    this.Hide();
                    (frmObj as frmSetTarimaPieza).ShowDialog();
                    this.Show();
                    return;
                }
                else if (this.lu.CodPantalla == 19)
                {
                    frmObj = new a13_CapturaInventario(this.lu);
                }
                else if (this.lu.CodPantalla == 7)
                {
                    frmObj = new a14_ReemplazoEtiqueta(this.lu);
                }
                else if (this.lu.CodPantalla == 20)
                {
                    frmObj = new a13_PiezaNuevaInventario(this.lu, false);
                }
                else if (this.lu.CodPantalla == 6) // Opcion de 'Baja de Pieza'
                {
                    frmObj = new a04_CapturaCodigoBarras(this.lu);
                }

                // Para proceso 'Auditoria'.
                if (this.lu.CodPantalla == 17)
                {
                    this.lu.TipoAuditoria = eTipoAuditoria.Al100PorCiento;
                }
                else if (this.lu.CodPantalla == 18)
                {
                    this.lu.TipoAuditoria = eTipoAuditoria.PorMuestreo;
                }
                /****************************************************************/
                else if (this.lu.CodPantalla == 501)
                {
                    frmObj = new frmKardex(lu);
                }
                else if (this.lu.CodPantalla == 502)
                {
                    frmObj = new frmCarroPendienteSecador(lu);
                }
                /****************************************************************/

                /*
                 * if (!bFechaServidor)
                 * {
                 *  if (MessageBox.Show("¿Esta es fecha con la que desea registrar las piezas: " + dtpFecha.Value.ToString("dd/MMM/yyyy") + "?", "Fecha Modificada.", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                 *  {
                 *      dtpFecha.Focus();
                 *      return;
                 *  }
                 * }
                 */
                frmObj.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Example #2
0
        private void txEtiqueta_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                // Validar ingreso del Enter.
                if (e.KeyChar == 13)
                {
                    this.txPlanta.Text  = String.Empty;
                    this.txProceso.Text = String.Empty;
                    this.txTipo.Text    = String.Empty;
                    this.txModelo.Text  = String.Empty;
                    this.txColor.Text   = String.Empty;
                    this.txCalidad.Text = String.Empty;

                    TextBox    txObj = (TextBox)sender;
                    Validacion val   = null;
                    DataTable  dtObj = null;

                    val = this.ValidarEtiqueta(txObj.Text);
                    this.encabezado.Mensaje = val.MensajeValidacion;
                    if (!val.ValidacionExitosa)
                    {
                        return;
                    }
                    else
                    {
                        // Obtener el CodPieza.
                        val = this.ValidarPieza(this.sCodBarras);
                        if (!val.ValidacionExitosa)
                        {
                            val = this.EstaEnInventarioPocesoPieza(this.sCodBarras);
                            if (val.ValidacionExitosa)
                            {
                                MessageBox.Show(val.MensajeValidacion, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            }
                            else
                            {
                                // Preguntar al usuario si desea agregar la pieza.
                                DialogResult drRes = MessageBox.Show("Pieza fuera de inventario ¿Desea registrarla?", "SCPP", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                                if (drRes == DialogResult.Yes)
                                {
                                    this.lu.CodBarras = this.txEtiqueta.Text;
                                    a13_PiezaNuevaInventario frmObj = new a13_PiezaNuevaInventario(this.lu);
                                    frmObj.Show();
                                }
                            }
                        }
                        else
                        {
                            // Obtener el proceso de la pieza en inventario.
                            DataTable dtUltProcesoPza = this.oDA0.ObtenerUltimoProcesoPieza(this.iCodPieza, false);
                            if (dtUltProcesoPza != null && dtUltProcesoPza.Rows.Count > 0)
                            {
                                this.iCodProceso    = Convert.ToInt32(dtUltProcesoPza.Rows[0][0]);
                                this.txProceso.Text = dtUltProcesoPza.Rows[0][1].ToString();
                            }
                            // Obtener la Planta de la pieza.
                            this.txPlanta.Text = this.lu.DesPlanta;
                            //this.txProceso.Text = this.oDA0.ObtenerDesProceso(this.iCodProceso);

                            // Obtener el Modelo y Tipo de la pieza.
                            this.iCodArticulo  = this.oDA0.ObtenerCodModeloPieza(this.iCodPieza);
                            dtObj              = this.oDA0.ObtenerModeloTipoPieza(this.iCodArticulo);
                            this.txTipo.Text   = Convert.ToString(dtObj.Rows[0]["DesTipoModelo"]);
                            this.txModelo.Text = Convert.ToString(dtObj.Rows[0]["DesModelo"]);

                            // Obtener el Color de la pieza.
                            dtObj = this.oDA0.ObtenerColorPieza(this.iCodPieza);
                            if (dtObj.Rows.Count > 0)
                            {
                                this.txColor.Text = Convert.ToString(dtObj.Rows[0]["DesColor"]);
                            }
                            else
                            {
                                this.txColor.Text = String.Empty;
                            }

                            // Obtener la Calidad de la pieza.
                            dtObj = this.oDA0.ObtenerCalidadPieza(this.iCodPieza);
                            if (dtObj.Rows.Count > 0)
                            {
                                this.txCalidad.Text = Convert.ToString(dtObj.Rows[0]["DesCalidad"]);
                            }
                            else
                            {
                                this.txCalidad.Text = String.Empty;
                            }

                            // Actualizar la pieza de inventario.
                            this.oDA.ActualizarPiezaInventario(this.iCodPieza);

                            txObj.Text = String.Empty;
                            txObj.Focus();
                        }
                    }
                }
                else
                {
                    // Validar ingreso de digitos y el retroceso.
                    if (((int)e.KeyChar) >= 48 && ((int)e.KeyChar) <= 57 || e.KeyChar == 8)
                    {
                        e.Handled = false;
                    }
                    else
                    {
                        e.Handled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }