private void button1_Click(object sender, EventArgs e) { try { TxtNomAtelier.Text = "Triangle"; TxtEffectif.Text = Convert.ToString(1); TxtTKT_Time.Text = Convert.ToString(16); BL.CDB db = new BL.CDB(); db.openConnection(); // a modifer pour chaque Poste MySqlDataAdapter asdf = new MySqlDataAdapter("SELECT * from stock_poste WHERE Date = '" + TxtDate.Text + "'", db.getConnection()); DataTable ss = new DataTable(); asdf.Fill(ss); TxtStockEc_Nominale.Text = ss.Rows[0][5].ToString(); //close the connection db.closeConnection(); } catch (Exception ex) { MessageBox.Show("Entrer la Date d'aujourd'hui d'abord et cliquer sur le button ouverture ", "Lire le Guide ", MessageBoxButtons.OK, MessageBoxIcon.Error); timer1.Stop(); timer2.Stop(); } }
private void BtnAtelier_Click(object sender, EventArgs e) { BL.CDB db = new BL.CDB(); MySqlCommand command = new MySqlCommand("UPDATE connexion SET Ctriangle=@s WHERE 1 ", db.getConnection()); db.openConnection(); int a = 1; command.Parameters.Add("@s", MySqlDbType.Int32).Value = a; command.ExecuteNonQuery(); db.closeConnection(); pnlbut.Top = BtnAtelier.Top; if (!pnlfirst.Controls.Contains(User_Client_Atelier.Instance)) { pnlfirst.Controls.Add(User_Client_Atelier.Instance); User_Client_Atelier.Instance.Dock = DockStyle.Fill; User_Client_Atelier.Instance.BringToFront(); } else { User_Client_Atelier.Instance.BringToFront(); } }
private void BtnQuitter_Click_1(object sender, EventArgs e) { Application.Exit(); BL.CDB db = new BL.CDB(); MySqlCommand command = new MySqlCommand("UPDATE connexion SET Ctriangle=@s WHERE 1 ", db.getConnection()); db.openConnection(); int a = 0; command.Parameters.Add("@s", MySqlDbType.Int32).Value = a; command.ExecuteNonQuery(); db.closeConnection(); }
private void BtnSuvegarderp_Click(object sender, EventArgs e) { try { if (TxtPer_TRG.Text == "TRG ") { MessageBox.Show("cliquer sur le button Performance ET vérifier si les champs sont remplis", "Lire le Guide ", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { BL.CDB db = new BL.CDB(); MySqlCommand command = new MySqlCommand("INSERT INTO `affichage_poste`(`Date`, `Stock`, `TRG`, `Taux_conformité`, `Cycle_Time`, `TKT_VS_CT`, `Nom_Atelier`) VALUES (@dt, @st, @trg, @tc, @ct, @tktct, @nat)", db.getConnection()); // fill table affichage_poste command.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command.Parameters.Add("@st", MySqlDbType.VarChar).Value = TxtPer_StockEC_Atelier.Text; command.Parameters.Add("@trg", MySqlDbType.VarChar).Value = TxtPer_TRG.Text; command.Parameters.Add("@tc", MySqlDbType.VarChar).Value = TxtPer_TauxConfor.Text; command.Parameters.Add("@ct", MySqlDbType.VarChar).Value = TxtCycleTime.Text; command.Parameters.Add("@tktct", MySqlDbType.VarChar).Value = TxtPer_TKTCT.Text; command.Parameters.Add("@nat", MySqlDbType.VarChar).Value = TxtNomAtelier.Text; //open the onnection db.openConnection(); //execute Query if (command.ExecuteNonQuery() == 1) { MessageBox.Show("Données de votre poste est transférée au poste Pilote "); } else { MessageBox.Show("Données NON enregistrées"); } //close the connection db.closeConnection(); } } catch (Exception ex) { MessageBox.Show("vérifier si les champs sont remplis ", "Lire le Guide ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnPerform_Click(object sender, EventArgs e) { try { BL.CDB db = new BL.CDB(); MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM affichage_poste", db.getConnection()); db.openConnection(); DataSet ds = new DataSet(); adapter.Fill(ds, "affichage_poste"); dataGridViewStock.DataSource = ds.Tables["affichage_poste"]; db.closeConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Btn_Sauvegarder_Click(object sender, EventArgs e) { try { BL.CDB db = new BL.CDB(); MySqlCommand command = new MySqlCommand("INSERT INTO `saisie_poste`( `Nom_Atelier`, `Date`, `Piece_C`, `Piece_NC`, `Effectif`, `TKT`, `H_debut`, `H_fin`, `time`) VALUES (@nm, @dt, @pc, @pnc, @ef, @tkt, @hd, @hf, @t)", db.getConnection()); // fill table saisie_poste command.Parameters.Add("@nm", MySqlDbType.VarChar).Value = TxtNomAtelier.Text; command.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command.Parameters.Add("@pc", MySqlDbType.Int32).Value = TxtP_Conforme.Text; command.Parameters.Add("@pnc", MySqlDbType.Int32).Value = TxtP_N_Conformes.Text; command.Parameters.Add("@tkt", MySqlDbType.Int32).Value = TxtTKT_Time.Text; command.Parameters.Add("@hd", MySqlDbType.VarChar).Value = TxtH_Debut.Text; command.Parameters.Add("@hf", MySqlDbType.VarChar).Value = TxtH_Fin.Text; command.Parameters.Add("@t", MySqlDbType.Int32).Value = TxtTimer.Text; command.Parameters.Add("@ef", MySqlDbType.Int32).Value = TxtEffectif.Text; //open the onnection db.openConnection(); //execute Query if (command.ExecuteNonQuery() == 1) { MessageBox.Show("Fin de Journeé MERCI "); } else { MessageBox.Show("Données fin journeé NON enregistrées"); } //close the connection db.closeConnection(); } catch (Exception ex) { MessageBox.Show("Entrer la *Date d'aujourd'hui* d'abord et cliquer sur le button *Ouverture* aprés button *Suivant* apres button*fermeture* et assurer que tous les champs sont remplis ", "Lire le Guide ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button3_Click(object sender, EventArgs e) { try { //auto_increment pour PC et PNC et stocke int s = Convert.ToInt32(TxtStockEc_Nominale.Text); if (s > 0) { if (checkBoxPC.Checked && comboBoxPosteSuivant.Text != "Poste Suivant") { a++; TxtP_Conforme.Text = a.ToString(); checkBoxPC.Checked = false; TxtStockEc_Nominale.Text = Convert.ToString(s - 1); TxtStock_EC.Text = TxtStockEc_Nominale.Text; BL.CDB db = new BL.CDB(); MySqlCommand command = new MySqlCommand("UPDATE stock_poste SET Striangle=@s WHERE Date=@dt ", db.getConnection()); // update stock command.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command.Parameters.Add("@s", MySqlDbType.Int32).Value = TxtStockEc_Nominale.Text; //open the onnection db.openConnection(); //envoie OF a PF if (comboBoxPosteSuivant.SelectedItem.Equals("PF")) { MySqlCommand command_1 = new MySqlCommand("UPDATE stock_poste SET PF=PF+1 WHERE Date=@dt ", db.getConnection()); command_1.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_1.ExecuteNonQuery(); } //envoie OF au poste croix if (comboBoxPosteSuivant.SelectedItem.Equals("Croix")) { MySqlCommand command_2 = new MySqlCommand("UPDATE stock_poste SET Scroix=Scroix+1 WHERE Date=@dt ", db.getConnection()); command_2.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_2.ExecuteNonQuery(); } //envoie OF au poste vague if (comboBoxPosteSuivant.SelectedItem.Equals("Vague")) { MySqlCommand command_3 = new MySqlCommand("UPDATE stock_poste SET Svague=Svague+1 WHERE Date=@dt ", db.getConnection()); command_3.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_3.ExecuteNonQuery(); } //envoie OF au poste Etoile if (comboBoxPosteSuivant.SelectedItem.Equals("Etoile")) { MySqlCommand command_4 = new MySqlCommand("UPDATE stock_poste SET Setoile=Setoile+1 WHERE Date=@dt ", db.getConnection()); command_4.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_4.ExecuteNonQuery(); } //envoie OF au poste Ovale if (comboBoxPosteSuivant.SelectedItem.Equals("Ovale")) { MySqlCommand command_5 = new MySqlCommand("UPDATE stock_poste SET Sovale=Sovale+1 WHERE Date=@dt ", db.getConnection()); command_5.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_5.ExecuteNonQuery(); } //envoie OF au poste Rect if (comboBoxPosteSuivant.SelectedItem.Equals("Rect")) { MySqlCommand command_6 = new MySqlCommand("UPDATE stock_poste SET Srect=Srect+1 WHERE Date=@dt ", db.getConnection()); command_6.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_6.ExecuteNonQuery(); } //envoie OF au poste Triangle if (comboBoxPosteSuivant.SelectedItem.Equals("Triangle")) { MySqlCommand command_7 = new MySqlCommand("UPDATE stock_poste SET Striangle=Striangle+1 WHERE Date=@dt ", db.getConnection()); command_7.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_7.ExecuteNonQuery(); } //execute Query if (command.ExecuteNonQuery() == 1) { MessageBox.Show("sortie de produit"); } else { MessageBox.Show("erreur lors sortie de produit "); } //close the connection db.closeConnection(); } // si la piece non conforme envoie au poste suivant if (checkBoxPNC.Checked && comboBox1.Text != "Poste Suivant ") { b++; TxtP_N_Conformes.Text = b.ToString(); checkBoxPNC.Checked = false; TxtStockEc_Nominale.Text = Convert.ToString(s - 1); TxtStock_EC.Text = TxtStockEc_Nominale.Text; BL.CDB db = new BL.CDB(); MySqlCommand command8 = new MySqlCommand("UPDATE stock_poste SET Striangle=@s WHERE Date=@dt ", db.getConnection()); // update stock command8.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command8.Parameters.Add("@s", MySqlDbType.Int32).Value = TxtStockEc_Nominale.Text; //open the onnection db.openConnection(); //envoie OF a PF if (comboBox1.SelectedItem.Equals("PncPF")) { MySqlCommand command_12 = new MySqlCommand("UPDATE stock_poste SET PF=PF+1 WHERE Date=@dt ", db.getConnection()); command_12.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_12.ExecuteNonQuery(); } //envoie OF au poste croix if (comboBox1.SelectedItem.Equals("PncCroix")) { MySqlCommand command_23 = new MySqlCommand("UPDATE stock_poste SET Scroix=Scroix+1 WHERE Date=@dt ", db.getConnection()); command_23.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_23.ExecuteNonQuery(); } //envoie OF au poste vague if (comboBox1.SelectedItem.Equals("PncVague")) { MySqlCommand command_34 = new MySqlCommand("UPDATE stock_poste SET Svague=Svague+1 WHERE Date=@dt ", db.getConnection()); command_34.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_34.ExecuteNonQuery(); } //envoie OF au poste Etoile if (comboBox1.SelectedItem.Equals("PncEtoile")) { MySqlCommand command_45 = new MySqlCommand("UPDATE stock_poste SET Setoile=Setoile+1 WHERE Date=@dt ", db.getConnection()); command_45.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_45.ExecuteNonQuery(); } //envoie OF au poste Ovale if (comboBox1.SelectedItem.Equals("PncOvale")) { MySqlCommand command_56 = new MySqlCommand("UPDATE stock_poste SET Sovale=Sovale+1 WHERE Date=@dt ", db.getConnection()); command_56.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_56.ExecuteNonQuery(); } //envoie OF au poste Rect if (comboBox1.SelectedItem.Equals("PncRect")) { MySqlCommand command_67 = new MySqlCommand("UPDATE stock_poste SET Srect=Srect+1 WHERE Date=@dt ", db.getConnection()); command_67.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_67.ExecuteNonQuery(); } //envoie OF au poste Triangle if (comboBox1.SelectedItem.Equals("PncTriangle")) { MySqlCommand command_78 = new MySqlCommand("UPDATE stock_poste SET Striangle=Striangle+1 WHERE Date=@dt ", db.getConnection()); command_78.Parameters.Add("@dt", MySqlDbType.VarChar).Value = TxtDate.Text; command_78.ExecuteNonQuery(); } //execute Query if (command8.ExecuteNonQuery() == 1) { MessageBox.Show("sortie de produit"); } else { MessageBox.Show("erreur lors sortie de produit "); } //close the connection db.closeConnection(); } } } catch (Exception ex) { MessageBox.Show("Entrer la Date d'aujourd'hui d'abord et cliquer sur le button ouverture ", "Lire le Guide ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Btn_Performance_Click(object sender, EventArgs e) { solidGaugeTRG.Visible = true; label3.Visible = true; solidGaugeTC.Visible = true; label2.Visible = true; chart1.Visible = true; if (TxtDate.Text == "Date") { MessageBox.Show("Entrer la Date d'aujourd'hui d'abord et cliquer sur le button Performance ", "Lire le Guide ", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { BL.CDB db = new BL.CDB(); db.openConnection(); // a modifer pour chaque Poste MySqlDataAdapter asdf = new MySqlDataAdapter("SELECT * from saisie_poste WHERE Date = '" + TxtDate.Text + "' AND Nom_Atelier='Vague'", db.getConnection()); DataTable ss = new DataTable(); asdf.Fill(ss); TxtNomAtelier.Text = ss.Rows[0][1].ToString(); string v = ss.Rows[0][3].ToString(); // get PC from saisie_poste string w = ss.Rows[0][4].ToString(); //get PNC from saisie_poste string tk = ss.Rows[0][6].ToString(); // get TKT from saisie_poste int sum = int.Parse(w) + int.Parse(v); //calcule de la QT TxtQteProduite.Text = sum.ToString(); //set QT dans TXTBOX string t = ss.Rows[0][9].ToString(); // get time from saisie_poste decimal ct = (decimal)int.Parse(t) / (sum); // calcule de cycle time decimal ctr = Math.Round(ct, 2); TxtCycleTime.Text = ctr.ToString(); // set cycle time dans TXTBOX decimal tkct = Math.Abs(int.Parse(tk) - ct); //calcule de TKTvsCT decimal tktctr = Math.Round(tkct, 2); if (tktctr <= 3) { TxtPer_TKTCT.Text = tktctr.ToString(); //set TKTCT dans txtbox TxtPer_TKTCT.ForeColor = Color.DarkGreen; button3.Visible = true; } else { TxtPer_TKTCT.Text = tktctr.ToString(); //set TKTCT dans txtbox TxtPer_TKTCT.ForeColor = Color.Crimson; button4.Visible = true; } decimal Trg = (decimal)(int.Parse(v) * ct) * 100 / 1207; // calcule TRG decimal Trgr = Math.Round(Trg, 2); // round with two number solidGaugeTRG.Uses360Mode = false; solidGaugeTRG.From = 0; solidGaugeTRG.To = 100; solidGaugeTRG.Value = (double)(decimal)Trgr; if (Trgr >= 70) { TxtPer_TRG.Text = Trgr.ToString(); // set %TRG to TXTBOX TxtPer_TRG.ForeColor = Color.DarkGreen; button8.Visible = true; } else { TxtPer_TRG.Text = Trgr.ToString(); // set %TRG to TXTBOX TxtPer_TRG.ForeColor = Color.Crimson; button7.Visible = true; } decimal tc = (decimal)(int.Parse(v) * 100 / sum); // calcule TC decimal tcr = Math.Round(tc, 2); // round with two number solidGaugeTC.Uses360Mode = false; solidGaugeTC.From = 0; solidGaugeTC.To = 100; solidGaugeTC.Value = (double)(decimal)tcr; if (tcr > 80) { TxtPer_TauxConfor.Text = tcr.ToString(); // set %CONFORMITe to TXTBOX TxtPer_TauxConfor.ForeColor = Color.DarkGreen; button6.Visible = true; } else { TxtPer_TauxConfor.Text = tcr.ToString(); // set %CONFORMITe to TXTBOX TxtPer_TauxConfor.ForeColor = Color.Crimson; button5.Visible = true; } //close the connection db.closeConnection(); db.openConnection(); // get valeur de stock triangle MySqlDataAdapter asdf1 = new MySqlDataAdapter("SELECT * from stock_poste WHERE Date = '" + TxtDate.Text + "'", db.getConnection()); DataTable ss1 = new DataTable(); asdf1.Fill(ss1); string s = ss1.Rows[0][5].ToString(); // a modifier pour chaque poste if (int.Parse(s) <= 4) { TxtPer_StockEC_Atelier.Text = s.ToString(); TxtPer_StockEC_Atelier.ForeColor = Color.DarkGreen; button10.Visible = true; } else { TxtPer_StockEC_Atelier.Text = s.ToString(); TxtPer_StockEC_Atelier.ForeColor = Color.Crimson; button9.Visible = true; } //-------------------------------------------------------------------------------------------------------------------- MySqlDataAdapter asdf2 = new MySqlDataAdapter("SELECT Striangle ,Date from stock_poste ", db.getConnection()); DataSet ds = new DataSet(); asdf2.Fill(ds, "Striangle"); chart1.DataSource = ds.Tables["Striangle"]; Series series1 = chart1.Series["Series1"]; series1.ChartType = SeriesChartType.Column; series1.Name = "Stock Poste Triangle"; var chart = chart1; chart.Series[series1.Name].XValueMember = "Date"; chart.Series[series1.Name].YValueMembers = "Striangle"; chart.Series[0].IsValueShownAsLabel = true; chart.Series[0]["pieLabelStyle"] = "outside"; chart.Series[0].BorderWidth = 1; chart.Series[0].BorderColor = Color.Black; chart.ChartAreas[0].Area3DStyle.Enable3D = true; db.closeConnection(); //show labels labelCT.Visible = true; labelQt.Visible = true; labelSec.Visible = true; labelTC.Visible = true; labelTKTCT.Visible = true; labelTrg.Visible = true; } }