private void btAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.txCarro.Text))
                {
                    this.lbMensaje.Text = "Introduzca un Carro.";
                    this.txCarro.Focus();
                }
                else if (string.IsNullOrEmpty(this.txTiempoSecado.Text))
                {
                    this.lbMensaje.Text = "Introduzca un el Tiempo de Secado.";
                    this.txTiempoSecado.Focus();
                }
                else
                {
                    // Validar si existe el carro sino se crea.


                    Form frmObj = new a04_CapturaInicial(this.lu);
                    frmObj.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Пример #2
0
        private void btProcesar_Click(object sender, EventArgs e)
        {
            try
            {
                int    iCodPieza  = -1;
                string sCodZona   = string.Empty;
                int    iCodPrueba = -1;
                if ((this.lu.CodPlanta == 1 || this.lu.CodPlanta == 2 || this.lu.CodPlanta == 3))
                {
                    if (!this.ValidarCarroHornos(txCarro.Text))
                    {
                        txCarro.Focus();
                        return;
                    }
                }
                foreach (DataRow dr in this.dtPiezas.Rows)
                {
                    iCodPieza  = Convert.ToInt32(dr["CodPieza"]);
                    sCodZona   = Convert.ToString(dr["CodZona"]);
                    iCodPrueba = Convert.ToInt32(dr["CodPrueba"]);

                    long lCodPiezaTransaccion = this.oDA0.InsertarPiezaTransaccion(DA.eTipoConexion.Local,
                                                                                   this.lu.CodConfigHandHeld,
                                                                                   iCodPieza,
                                                                                   this.lu.Fecha);

                    this.oDA0.ActulizarUltimoProcesoPieza(DA.eTipoConexion.Local, iCodPieza, this.lu.CodProceso);

                    this.oDA.InsertarCarroZonaPieza(DA.eTipoConexion.Local, this.lu.CodPlanta, iCodPieza, this.lu.CodCarro, sCodZona);
                    if (iCodPrueba != -1)
                    {
                        this.oDA0.PruebaProcesoIns(this.lu.CodPlanta, iCodPrueba, this.oDA0.ObtenerCodProcesoHornos(),
                                                   iCodPieza, DateTime.Now);
                    }
                }

                this.EnviarDatosAlServidor();
                if ((this.lu.CodPlanta == 1 || this.lu.CodPlanta == 2 || this.lu.CodPlanta == 3))
                {
                    this.encabezado.Mensaje = String.Empty;
                    this.iCodPieza          = -1;
                    this.iCodPrueba         = -1;
                    this.cbxPrueba.Enabled  = false;
                    this.btAceptar.Enabled  = false;
                    this.btProcesar.Enabled = true;
                    this.txCarro.Text       = string.Empty;
                    this.txZona.Text        = string.Empty;
                    this.txEtiqueta.Text    = string.Empty;
                    this.txTipo.Text        = string.Empty;
                    this.txModelo.Text      = string.Empty;
                    this.txColor.Text       = string.Empty;
                    this.txCarro.Focus();
                    this.Form_Load(sender, e);
                    this.lu.CodConfigHandHeld = new c03_ConfiguracionInicial().InsertarConfigHandHeld(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);
                    this.oCI.ActualizarConfigHandHeld(DataAccess.eTipoConexion.Local,
                                                      this.lu.CodSupervisor,
                                                      this.lu.CodEmpleado,
                                                      this.lu.CodConfigBanco,
                                                      this.lu.CodConfigHandHeld);
                }
                else
                {
                    // Regresar a Configuracion Inicial.
                    //Limpiamos valores para volver a capturar configuracion para hornos
                    this.lu.CodCentroTrabajo = -1;
                    this.lu.CodMaquina       = -1;
                    a04_CapturaInicial frmObj = new a04_CapturaInicial(this.lu, true);
                    //a03_ConfiguracionInicial frmObj = new a03_ConfiguracionInicial(this.lu);
                    frmObj.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Пример #3
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);
            }
        }
        private void btContinuar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.lu.Fecha == DateTime.MinValue)
                {
                    this.lbMensaje.Text = "Seleccione Fecha valida";
                    this.dtpFecha.Focus();
                }
                else if (this.lu.CodTurno == -1)
                {
                    this.lbMensaje.Text = "Seleccione Turno";
                    this.cbxTurno.Focus();
                }
                else if (this.lu.CodProceso == -1)
                {
                    this.lbMensaje.Text = "Seleccione Proceso";
                    this.cbxProceso.Focus();
                }
                else if (this.lu.CodPantalla == -1)
                {
                    this.lbMensaje.Text = "Seleccione Opción";
                    this.cbxOpcion.Focus();
                }
                else
                {
                    DataTable dtObj = this.oDA.ObtenerSigCodConfigHandHeld();
                    this.lu.CodConfigHandHeld = Convert.ToInt64(dtObj.Rows[0]["CodConfigHandHeld"]);
                    this.oDA.InsertarConfigHandHeld(this.lu.CodConfigHandHeld,
                                                    this.lu.CodUsuario,
                                                    this.lu.CodEmpleado,
                                                    this.lu.CodSupervisor,
                                                    this.lu.Fecha,
                                                    this.lu.CodTurno,
                                                    this.lu.CodPlanta,
                                                    this.lu.CodProceso);

                    Form frmObj = null;
                    switch (this.lu.CodPantalla)
                    {
                    case 1:
                    case 4:
                    case 5:
                    case 6:
                        frmObj = new a04_CapturaInicial(this.lu);
                        break;

                    case 2:
                        frmObj = new a05_ArmadoCarroSecador(this.lu);
                        break;

                    case 3:
                        frmObj = new a06_EntradaCarroSecador(this.lu);
                        break;
                    }
                    frmObj.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }