Exemplo n.º 1
0
        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='Triangle'", 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;
            }
        }
Exemplo n.º 2
0
        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 Svague=@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);
            }
        }