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; } }
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(); }
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; }