Exemple #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));
        }
Exemple #2
0
        public void CaricaSchedeProcesso()
        {
            foreach (ComponenteBC componente in Componenti)
            {
                if (!string.IsNullOrEmpty(componente.Anagrafica))
                {
                    List <SpScheda> schede = SpScheda.EstraiSPScheda(componente.Anagrafica, true);
                    if (schede.Count > 0)
                    {
                        foreach (FaseCicloBC fase in componente.FasiCiclo)
                        {
                            SpScheda scheda = schede.Where(x => x.AreaProduzione == fase.AreaProduzione && x.Task == fase.Task).FirstOrDefault();
                            if (scheda != null)
                            {
                                fase.SchedaProcesso = scheda.Codice;
                                foreach (SPValoreScheda valore in scheda.ValoriScheda)
                                {
                                    switch (valore.IdSPControllo)
                                    {
                                    case 145:
                                    {
                                        decimal v;
                                        if (decimal.TryParse(valore.Valore, out v))
                                        {
                                            fase.PezziPeriodo = v;
                                        }
                                    }
                                    break;

                                    case 147:
                                    {
                                        decimal v;
                                        if (decimal.TryParse(valore.Valore, out v))
                                        {
                                            fase.Periodo = v;
                                        }
                                    }
                                    break;

                                    case 15:
                                    {
                                        decimal v;
                                        if (decimal.TryParse(valore.Valore, out v))
                                        {
                                            fase.PezziPeriodo = v;
                                            fase.Periodo      = 1;
                                        }
                                    }
                                    break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #3
0
        private ActionResult MostraScheda(SpScheda scheda)
        {
            if (scheda.ValoriScheda.Count == 0)
            {
                return(Content("SCHEDA NON TROVATA"));
            }

            List <SpScheda> schedeAlternative = SpScheda.TrovaSchedePerAreaProduzione(scheda.AreaProduzione, scheda.Task, scheda.Anagrafica, true);

            schedeAlternative = schedeAlternative.Where(x => x.Codice != scheda.Codice).ToList();
            ViewData.Add("schedeAlternative", schedeAlternative);
            return(PartialView("MostraSchedaPartial", scheda));
        }
Exemple #4
0
        public ActionResult TrovaScheda(string Codice, string Descrizione, string Anagrafica)
        {
            List <SpScheda> schede = SpScheda.TrovaSchede(Codice, Descrizione, Anagrafica, true);

            if (schede.Count == 0)
            {
                return(Content("Nessuna scheda trovata"));
            }
            if (schede.Count == 1)
            {
                return(MostraScheda(schede[0]));
            }
            else
            {
                return(PartialView("MostraSchedeTrovatePartial", schede));
            }
        }
Exemple #5
0
        public ActionResult AggiornaSchedaProcesso(int IdSPScheda, int IdSPMaster, string Codice, string Descrizione, string Task, string AreaProduzione, string Anagrafica, string Controlli, string Obbligatori)
        {
            Codice         = Codice.ToUpper();
            Descrizione    = Descrizione.ToUpper();
            Task           = Task.ToUpper();
            AreaProduzione = AreaProduzione.ToUpper();
            Anagrafica     = Anagrafica.ToUpper();

            ElementoScheda[] elementiScheda            = JSonSerializer.Deserialize <ElementoScheda[]>(Controlli);
            ElementoScheda[] elementiObbligatoriScheda = JSonSerializer.Deserialize <ElementoScheda[]>(Obbligatori);
            //if (!Item.VerificaEsistenzaItem(Anagrafica))
            //    return Content("Scheda non salvata - Anagrafica non presente in Business Central");

            string messaggio = SpScheda.SalvaScheda(IdSPScheda, IdSPMaster, Anagrafica, Codice, Descrizione, AreaProduzione, Task, elementiScheda.ToList(), elementiObbligatoriScheda.ToList(), ConnectedUser.ToUpper());

            return(Content(messaggio));
        }
Exemple #6
0
        public ActionResult LeggiSchedApriSchedaDaCodice(string Codice)
        {
            List <AreaProduzione>     aree           = MPIntranet.Business.AreaProduzione.EstraiListaAreeProduzione();
            List <MPIntranetListItem> areeProduzione = aree.Select(x => new MPIntranetListItem(x.ToString(), x.Codice)).ToList();

            areeProduzione.Insert(0, new MPIntranetListItem(string.Empty, string.Empty));
            ViewData.Add("ddlAreaProduzione", areeProduzione);

            List <SpScheda> schede = SpScheda.TrovaSchede(Codice, string.Empty, string.Empty, true);

            if (schede.Count > 0)
            {
                ViewData.Add("IdSPScheda", schede[0].IdSPScheda);

                return(View("LeggiScheda"));
            }
            return(null);
        }
Exemple #7
0
        public ActionResult GetSchedaProcesso(int Master)
        {
            SpScheda scheda = SpScheda.CreaSchedaVuota(Master);

            return(PartialView("SchedaProcessoPartial", scheda));
        }
Exemple #8
0
        public ActionResult MostraScheda(int IdSPScheda)
        {
            SpScheda scheda = SpScheda.EstraiSPScheda(IdSPScheda);

            return(MostraScheda(scheda));
        }
Exemple #9
0
        public ActionResult EstraiScheda(int IdSPScheda)
        {
            SpScheda scheda = SpScheda.EstraiSPScheda(IdSPScheda);

            return(PartialView("SchedaProcessoPartial", scheda));
        }