示例#1
0
        private ActionResult CreaListaSchedeDistinta(DistintaBC distinta)
        {
            distinta.CaricaDistintaCompleta();

            foreach (ComponenteBC componente in distinta.Componenti)
            {
                List <SpScheda> schede = SpScheda.EstraiSPScheda(componente.Anagrafica, true);
                if (schede.Count == 0)
                {
                    continue;
                }
                foreach (FaseCicloBC fase in componente.FasiCiclo)
                {
                    if (string.IsNullOrEmpty(fase.SchedaProcesso))
                    {
                        SpScheda scheda = schede.Where(x => x.AreaProduzione == fase.AreaProduzione && x.Task == fase.Task).FirstOrDefault();
                        if (scheda != null)
                        {
                            fase.SchedaProcesso = scheda.Codice;
                        }
                    }
                }
            }
            return(PartialView("MostraListaSchedeDistinta", distinta));
        }
        private void btnCercaDiBa_Click(object sender, EventArgs e)
        {
            this.Text = string.Empty;
            if (string.IsNullOrEmpty(txtArticolo.Text))
            {
                return;
            }
            txtArticolo.Text = txtArticolo.Text.ToUpper();

            SelezionaDistintaBCFrm form = new SelezionaDistintaBCFrm(txtArticolo.Text);

            form.ShowDialog();
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                _distinta      = form.DistintaSelezionata;

                if (_distinta == null)
                {
                    MessageBox.Show("Nessuna distinta BC selezionata.", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                this.Text = string.Format("{0} {1}", txtArticolo.Text, _distinta.ToString());

                _distinta.CaricaDistintaCompleta();
                _distinta.CaricaSchedeProcesso();

                creaAlbero();
                PopolaGrigliaComponenti();
            }
            catch (Exception ex)
            {
                MostraEccezione(ex, "Errore in cerca diba");
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }