Example #1
0
        private void txtODL_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    Cursor.Current   = Cursors.WaitCursor;
                    lblMessaggi.Text = string.Empty;
                    string barcode = txtODL.Text;
                    txtODL.Text = string.Empty;
                    ProduzioneDS.USR_PRD_MOVFASIRow movFase = VerificaBarcodeODL(barcode);
                    if (movFase == null)
                    {
                        return;
                    }

                    ProduzioneDS.USR_PRD_FASIRow faseGalvanica = EstraiFaseGalvanicaDaODL(movFase);
                    if (faseGalvanica == null)
                    {
                        return;
                    }
                    if (faseGalvanica.IsIDMAGAZZNull())
                    {
                        lblMessaggi.Text = "Nessun articolo associato alla fase galvanica";
                        return;
                    }
                    Articolo articolo = _anagrafica.GetArticolo(faseGalvanica.IDMAGAZZ);
                    if (articolo == null)
                    {
                        lblMessaggi.Text = "Errore nell'estrazione dei dati dell'articolo galvanica";
                        return;
                    }
                    txtDescrizione.Text = articolo.Descrizione;
                    txtModello.Text     = articolo.Modello;
                    txtSuperficie.Text  = articolo.Superficie.ToString();

                    txtOrdineLavoro.Text     = movFase.IsNUMMOVFASENull() ? string.Empty : movFase.NUMMOVFASE;
                    pbArticolo.ImageLocation = articolo.Immagine;
                    btnAvvia.Focus();
                }
            }
            catch (Exception ex)
            {
                MostraEccezione(ex, "Errore in elabora barcode ODL");
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }