コード例 #1
0
        private void btnASave_Click(object sender, EventArgs e)
        {
            try
            {
                Global.JobOrdNo = "***";
                Process[] prs = Process.GetProcesses();
                foreach (Process pr in prs)
                {
                    //if (pr.ProcessName == "ModbusPollCS") pr.Kill();
                    if (pr.ProcessName == "Editors")
                    {
                        pr.Kill();
                    }
                    if (pr.ProcessName == "Dataappliacation")
                    {
                        pr.Kill();
                    }
                }

                if (TextBox1.Text == String.Empty) // "")
                {
                    MessageBox.Show("Please Type Engine No. ...... ");
                    TextBox1.Focus();
                }
                else if (PrjCombo.Text == String.Empty)
                {
                    MessageBox.Show("Please Select Project. ...... ");
                    PrjCombo.Focus();
                }
                else if ((textBox7.Text == String.Empty) || (textBox8.Text == String.Empty) || (textBox13.Text == String.Empty))
                {
                    Erp1.SetError(groupBox2, "Some Input Value Is missing." + "\n\n" + " 1. Engine Idle RPM " + "\n" +
                                  " 2. Engine FlyUp RPM " + "\n" +
                                  " 3. Engine Max Power @ RPM " + "\n" +
                                  " 4. Engine Max Torque@ RPM ");

                    MessageBox.Show("Some Input Value Is missing." + "\n\n" + " 1. Engine Idle RPM " + "\n" +
                                    " 2. Engine FlyUp RPM " + "\n" +
                                    " 3. Engine Max Power @ RPM " + "\n" +
                                    " 4. Engine Max Torque@ RPM ");
                    groupBox2.Focus();
                }
                else
                {
                    Global.EngNo      = TextBox1.Text;
                    Global.EngineNo   = TextBox1.Text;
                    Global.FipNo      = TextBox2.Text;
                    Global.EngMd      = TextBox3.Text;
                    Global.OperatorNm = TextBox4.Text;
                    Global.EnginerNm  = TextBox5.Text;
                    Global.TestRef    = TextBox6.Text;
                    Global.PrjNm      = PrjCombo.Text;
                    Global.T_Date     = TextBox9.Text;
                    Global.Shift      = TextBox10.Text;
                    Global.HzLog      = HzCombo.Text;

                    if (checkBox1.CheckState == CheckState.Checked)
                    {
                        Global.flg_smk = true;
                    }
                    else
                    {
                        Global.flg_smk = false;
                    }
                    if (checkBox2.CheckState == CheckState.Checked)
                    {
                        Global.flg_Radiator = true;
                    }
                    else
                    {
                        Global.flg_Radiator = false;
                    }
                    if (checkBox3.CheckState == CheckState.Checked)
                    {
                        Global.flg_Fan = true;
                    }
                    else
                    {
                        Global.flg_Fan = false;
                    }
                    if (checkBox4.CheckState == CheckState.Checked)
                    {
                        Global.flg_AirCln = true;
                    }
                    else
                    {
                        Global.flg_AirCln = false;
                    }
                    if (checkBox5.CheckState == CheckState.Checked)
                    {
                        Global.flg_Silincer = true;
                    }
                    else
                    {
                        Global.flg_Silincer = false;
                    }
                    if (rd_New.Checked == true)
                    {
                        Global.flg_NewFile = true;
                    }
                    else
                    {
                        Global.flg_NewFile = false;
                    }
                    if (rd_Last.Checked == true)
                    {
                        Global.flg_OldFile = true;
                    }
                    else
                    {
                        Global.flg_OldFile = false;
                    }
                    if (rd_smooth.Checked == true)
                    {
                        Global.flg_Smt_Changeover = true;
                    }
                    else
                    {
                        Global.flg_Smt_Changeover = false;
                    }
                    if (rd_standard.Checked == true)
                    {
                        Global.flg_Std_Changeover = true;
                    }
                    else
                    {
                        Global.flg_Std_Changeover = false;
                    }


                    String X = textBox7.Text;
                    Global.S_Rpm = int.Parse(X);
                    Global.I_Rpm = (int.Parse(X) + int.Parse(X) / 10);

                    String Y = textBox8.Text;
                    Global.F_Rpm = (int.Parse(Y) + int.Parse(Y) / 10);

                    String Z = textBox13.Text;
                    Global.Max_Trq = (Double.Parse(Z) + (Double.Parse(Z) / 10));


                    Global.Open_Connection("gen_db", "con");
                    MySqlCommand cmd = new MySqlCommand("UPDATE TbSys SET " +
                                                        " CH1 = '" + Global.EngNo + "'," +
                                                        " CH2 = '" + Global.FipNo + "'," +
                                                        " CH3 = '" + Global.EngMd + "'," +
                                                        " CH4 = '" + Global.OperatorNm + "'," +
                                                        " CH5 = '" + Global.TKnNo + "'," +
                                                        " CH6 = '" + Global.TestRef + "'," +
                                                        " CH7 = '" + Global.PrjNm + "'," +
                                                        " CH8 = '" + Global.flg_smk + "'," +
                                                        " CH9 = '" + Global.flg_Radiator + "'," +
                                                        " CH10 = '" + Global.flg_Fan + "'," +
                                                        " CH11 = '" + Global.flg_AirCln + "'," +
                                                        " CH12 = '" + Global.flg_Silincer + "'," +
                                                        " CH13 = '" + Global.flg_NewFile + "'," +
                                                        " CH14 = '" + Global.flg_OldFile + "'," +
                                                        " CH15 = '" + Global.flg_Smt_Changeover + "'," +
                                                        " CH16 = '" + Global.flg_Std_Changeover + "'," +
                                                        " CH17 = '" + X + "'," +
                                                        " CH18 = '" + Y + "'," +
                                                        " CH19 = '" + Z + "'," +
                                                        " CH20 = '" + Global.HzLog + "'" +
                                                        " WHERE FileName = 'EngNo'", Global.con);
                    cmd.ExecuteNonQuery();
                    Global.con.Close();
                    Global.Rd_System();
                    Global.PrjNm = PrjCombo.Text;
                    Check_File_Validation();
                    Global.flg_Auto   = true;
                    Global.flg_Manual = false;
                    Global.Read_Eng();
                    clsLimit.Read_Limfl();
                    Global.Flg_Ready          = true;
                    Global.main.BtnSA.Enabled = false;
                    Global.main.Btn21.Enabled = true;
                    Global.flg_Semi_Auto      = false;

                    switch (HzCombo.Text)
                    {
                    case "100 Hz":
                        Global.Dly_cnt = 10000;
                        break;

                    case "080 Hz":
                        Global.Dly_cnt = 12500;
                        break;

                    case "060 Hz":
                        Global.Dly_cnt = 16667;
                        break;

                    case "050 Hz":
                        Global.Dly_cnt = 20000;
                        break;

                    case "040 Hz":
                        Global.Dly_cnt = 25000;
                        break;

                    case "020 Hz":
                        Global.Dly_cnt = 50000;
                        break;

                    case "010 Hz":
                        Global.Dly_cnt = 100000;
                        break;

                    case "001 Hz":
                        Global.Dly_cnt = 1000000;
                        break;

                    default:
                        Global.Dly_cnt = 1000000;
                        break;
                    }
                    //Global.flg_RunStart = true;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " : Engine Dialog  Save Auto File....", "Alart");
            }
        }
コード例 #2
0
ファイル: EngDialog.cs プロジェクト: vkk12345678/sonalika
        private void btnASave_Click(object sender, EventArgs e)
        {
            try
            {
                Global.JobOrdNo = "***";
                Process[] prs = Process.GetProcesses();
                foreach (Process pr in prs)
                {
                    //if (pr.ProcessName == "ModbusPollCS") pr.Kill();
                    if (pr.ProcessName == "Editors")
                    {
                        pr.Kill();
                    }
                    if (pr.ProcessName == "Dataappliacation")
                    {
                        pr.Kill();
                    }
                }
                Erp1.Clear();
                if (txtbarcode.Text == String.Empty) // "")
                {
                    Erp1.SetError(txtbarcode, "Please Type Engine No.....");
                    MessageBox.Show("Please Type Engine No. ...... ");
                    txtbarcode.Focus();
                }
                else if (TextBox1.Text == String.Empty) // "")
                {
                    Erp1.SetError(TextBox1, "Please Scan Engine No.....");
                    MessageBox.Show("Please Scan Engine No. ...... ");
                    TextBox1.Focus();
                }
                else if (PrjCombo.Text == String.Empty)
                {
                    Erp1.SetError(PrjCombo, "Please Select Project.....");
                    MessageBox.Show("Please Select Project. ...... ");
                    PrjCombo.Focus();
                }
                else if ((textBox7.Text == String.Empty) || (textBox8.Text == String.Empty) || (textBox11.Text == String.Empty) ||
                         (textBox12.Text == String.Empty) || (textBox13.Text == String.Empty) || (textBox14.Text == String.Empty))
                {
                    Erp1.SetError(panel2, "Some Input Value Is missing." + "\n\n" + " 1. Engine Idle RPM " + "\n" +
                                  " 2. Engine FlyUp RPM " + "\n" +
                                  " 3. Engine Max Power @ RPM " + "\n" +
                                  " 4. Engine Max Torque@ RPM ");

                    MessageBox.Show("Some Input Value Is missing." + "\n\n" + " 1. Engine Idle RPM " + "\n" +
                                    " 2. Engine FlyUp RPM " + "\n" +
                                    " 3. Engine Max Power @ RPM " + "\n" +
                                    " 4. Engine Max Torque@ RPM ");
                    panel2.Focus();
                }
                else
                {
                    Global.EngNo     = TextBox1.Text;
                    Global.EngineNo  = TextBox1.Text;
                    Global.FipNo     = TextBox2.Text;
                    Global.EngMd     = TextBox3.Text;
                    Global.Chasis_N  = TextBox4.Text;
                    Global.EnginerNm = textBox5.Text;
                    Global.TestRef   = TextBox6.Text;//eng_reating
                    Global.PrjNm     = PrjCombo.Text;
                    Global.T_Date    = TextBox9.Text;
                    Global.Shift     = TextBox10.Text;
                    if (checkBox1.CheckState == CheckState.Checked)
                    {
                        Global.flg_smk = true;
                    }
                    else
                    {
                        Global.flg_smk = false;
                    }
                    if (checkBox2.CheckState == CheckState.Checked)
                    {
                        Global.flg_Radiator = true;
                    }
                    else
                    {
                        Global.flg_Radiator = false;
                    }
                    if (checkBox3.CheckState == CheckState.Checked)
                    {
                        Global.flg_Fan = true;
                    }
                    else
                    {
                        Global.flg_Fan = false;
                    }
                    if (checkBox4.CheckState == CheckState.Checked)
                    {
                        Global.flg_AirCln = true;
                    }
                    else
                    {
                        Global.flg_AirCln = false;
                    }
                    if (checkBox5.CheckState == CheckState.Checked)
                    {
                        Global.flg_Silincer = true;
                    }
                    else
                    {
                        Global.flg_Silincer = false;
                    }
                    if (rd_New.Checked == true)
                    {
                        Global.flg_NewFile = true;
                    }
                    else
                    {
                        Global.flg_NewFile = false;
                    }
                    if (rd_Last.Checked == true)
                    {
                        Global.flg_OldFile = true;
                    }
                    else
                    {
                        Global.flg_OldFile = false;
                    }

                    //Global.I_Rpm = int.Parse(textBox7.Text);
                    //Global.F_Rpm = int.Parse(textBox8.Text);
                    //Global.Max_Pow = Double.Parse(textBox11.Text);
                    //Global.Pow_RPM = Double.Parse(textBox12.Text);
                    //Double X = Double.Parse(textBox13.Text);
                    //Global.Max_Trq = X + (X / 10);
                    //Global.Trq_RPM = Double.Parse(textBox14.Text);

                    Global.Open_Connection("General", "con");
                    MySqlCommand cmd = new MySqlCommand("UPDATE TbSys SET " +
                                                        " CH1 = '" + Global.EngNo + "'," +
                                                        " CH2 = '" + Global.FipNo + "'," +
                                                        " CH3 = '" + Global.EngMd + "'," +
                                                        " CH4 = '" + Global.EnginerNm + "'," +
                                                        " CH5 = '" + Global.TKnNo + "'," +
                                                        " CH6 = '" + Global.TestRef + "'," +
                                                        " CH7 = '" + Global.PrjNm + "'," +
                                                        " CH8 = '" + Global.flg_smk + "'," +
                                                        " CH9 = '" + Global.flg_Radiator + "'," +
                                                        " CH10 = '" + Global.flg_Fan + "'," +
                                                        " CH11 = '" + Global.flg_AirCln + "'," +
                                                        " CH12 = '" + Global.flg_Silincer + "'," +
                                                        " CH13 = '" + Global.flg_NewFile + "'," +
                                                        " CH14 = '" + Global.flg_OldFile + "'" +
                                                        " WHERE FileName = 'EngNo'", Global.con);
                    cmd.ExecuteNonQuery();
                    Global.con.Close();
                    Global.Rd_System();
                    Global.PrjNm = PrjCombo.Text;
                    Check_File_Validation();
                    Global.flg_Auto   = true;
                    Global.flg_Manual = false;
                    Global.Read_Eng();
                    Global.Read_Limfl();
                    Global.Flg_Ready          = true;
                    Global.main.BtnSA.Enabled = false;
                    Global.main.Btn21.Enabled = true;

                    //Global.I_Rpm = int.Parse(textBox7.Text);
                    //Global.F_Rpm = int.Parse(textBox8.Text);
                    //Global.Max_Pow = Double.Parse(textBox11.Text);
                    //Global.Pow_RPM  = Double.Parse(textBox12.Text);
                    //Double X = Double.Parse(textBox13.Text);
                    //Global.Max_Trq = X + (X / 10);
                    //Global.Trq_RPM = Double.Parse(textBox14.Text);


                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ErrorCode- 1002", ex.Message);
            }
        }