Exemple #1
0
        private void metroTile_SELECT_Click(object sender, EventArgs e)//-------------------------------------------------------------------------------------------------------------
        {
            if (MetroFramework.MetroMessageBox.Show(this, " Vous valider ? ", "Message", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                if (dataGridViewlistearret.Visible == true && dataGridViewlistearret_prevu.Visible == false) // arret non plannifié
                {
                    model_non_identifie.arret      = model.arret;
                    model_non_identifie.type_arret = "arret non plannifie";
                }

                else if (dataGridViewlistearret_prevu.Visible == true && dataGridViewlistearret.Visible == false) // arret planniifié
                {
                    model_non_identifie.arret      = model2.arret;
                    model_non_identifie.type_arret = "arret plannifie";
                }

                using (arrets_non_identifiés db = new arrets_non_identifiés())
                {
                    db.Entry(model_non_identifie).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            Clear();
            PopulateDataGridView_arret_non_identifie();
            metroPanelarret.Visible  = false;
            metroTilearret.Visible   = false;
            metroTilepause.Visible   = false;
            metroTile_SELECT.Visible = false;

            dataGridViewlistearret.Visible       = false;
            dataGridViewlistearret_prevu.Visible = false;
            Calcul_TRS.verif_arret--;

            if (model2.arret == "changement _equipe") // calculer les 2 SMED
            {
                Calcul_TRS.changement_equipe = 1;
            }


            if (model2.arret == "changement serie") // calculer les 2 SMED
            {
                Calcul_TRS.SMED();
            }


            if (Calcul_TRS.verif_arret == 0)
            {
                // retrun to dashboard
                if (!Formmain.Instance.MetroContainer.Controls.ContainsKey("UCdashboard")) // // return to dashboard if there is any other breakdown
                {
                    UCdashboard uc = new UCdashboard();
                    uc.Dock = DockStyle.Fill;
                    Formmain.Instance.MetroContainer.Controls.Add(uc);
                }
                Formmain.Instance.MetroContainer.Controls["UCdashboard"].BringToFront();
                Formmain.Instance.MetroBack.Visible = true;
            }
        }
Exemple #2
0
 void PopulateDataGridView_arret_non_identifie() // charger les arrets non identifiés
 {
     dataGridViewnonidentifie.AutoGenerateColumns = false;
     using (arrets_non_identifiés db = new arrets_non_identifiés())
     {
         string today = DateTime.Today.ToShortDateString();
         dataGridViewnonidentifie.DataSource = db.machine_1_arrets.
                                               Where(x => x.date == today && x.of_1 == Calcul_TRS.OF_1 && x.of_2 == Calcul_TRS.OF_2 && x.arret == "arret non identifié" && DateTime.Compare((DateTime)x.debut, Calcul_TRS.date_debut) > 0).//meme date meme OF
                                               ToList <machine_1_arrets>();
         // pas de fin travail si dgv n'est pas vide !!
     }
 }
Exemple #3
0
 public void selection_arret()
 {
     if (dataGridViewnonidentifie.CurrentRow.Index != -1)
     {
         model_non_identifie.id = Convert.ToInt32(dataGridViewnonidentifie.CurrentRow.Cells["id_non_identifié"].Value);
         using (arrets_non_identifiés db = new arrets_non_identifiés())
         {
             model_non_identifie  = db.machine_1_arrets.Where(x => x.id == model_non_identifie.id).FirstOrDefault();
             selected_arret       = model_non_identifie.arret;
             selected_arret_duree = (int)model_non_identifie.duree;
         }
         metroTilepause.Visible = true;
         metroTilearret.Visible = true;
     }
 }
Exemple #4
0
        public static void update_db_arret()
        {
            var context = new arrets_non_identifiés();
            var duree   = from c in context.machine_1_arrets
                          where c.id == last_id
                          select c;
            var beakdown = duree.FirstOrDefault();

            if (etat_arret == 1 && etat_pause == 0)
            {
                beakdown.duree = count_arret;
            }
            else if (etat_arret == 1 && etat_pause == 1)
            {
                beakdown.duree = count_pause;
            }

            beakdown.fin = DateTime.Now;
            if (changement_de_serie == 1) // ucproduit : insertion automatique du changement de serie
            {
                beakdown.type_arret = "arret plannifie";
                beakdown.arret      = "changement_serie";
            }
            if (beakdown.arret == "changement_serie")
            {
                current_SMED = (int)beakdown.duree;

                etat_changement_de_serie = 1;
                if (last_etat_changement_de_serie != etat_changement_de_serie)
                {
                    SMED();
                }
            }
            else
            {
                etat_changement_de_serie = 0;
            }
            // mise a jour SMED en cours
            last_etat_changement_de_serie = etat_changement_de_serie;


            context.SaveChanges();
        }
Exemple #5
0
        public static void insert_db_arret()  // inserer nouvelle ligne dans machine_1_arret where : - date time: currenttime - OF=of - arret= arret non identifié - durée= count_arret;
        {
            machine_1_arrets model_machine_arrets = new machine_1_arrets();

            model_machine_arrets.of_1 = Calcul_TRS.OF_1;
            model_machine_arrets.of_2 = Calcul_TRS.OF_2;

            model_machine_arrets.arret      = "arret non identifié";
            model_machine_arrets.type_arret = "arret non plannifé";
            model_machine_arrets.duree      = count_arret;

            model_machine_arrets.date  = (DateTime.Now).ToShortDateString();
            model_machine_arrets.debut = t_production;
            model_machine_arrets.fin   = DateTime.Now;

            using (arrets_non_identifiés db = new arrets_non_identifiés())
            {
                db.machine_1_arrets.Add(model_machine_arrets);
                db.SaveChanges();
            }

            last_id = model_machine_arrets.id;
        }