Exemple #1
0
 /// <summary>
 /// 重做实验
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button2_Click(object sender, EventArgs e)
 {
     lists.Clear();
     sy5_Lists.Clear();
     this.dataGridView1.DataSource = new BindingList <Sy5_List>(sy5_Lists);
     Export_All_SY.DBDel(tb);
 }
        public static void Exp_SY6()
        {
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            Document document = new Document();

            document.SetPageSize(PageSize.A4.Rotate());  //  设置文档为横向
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(tempname, FileMode.Create));

            document.Open();
            document.NewPage();
            table = new PdfPTable(21);//  设计试验6的表格总共有21列
            table.WidthPercentage = 100;
            Paragraph Title = new Paragraph("6. 滑板控制装置系统调试精度试验记录", fonttitle);

            Title.SetAlignment("center");
            document.Add(Title);
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;  //此数值用于调整空白大小0
            document.Add(nullb);
            dtb   = Export_All_SY.DBQuery("SY6_Xtts");
            table = Export_Table_Design.SY6_Table(table, dtb);
            Export_All_SY.DBDel("SY6_Xtts");
            document.Add(table);//將table放到pdf文件中
            Title = new Paragraph("注:表中θ表示尾翼板角度,β表示首下板角度,φ表示首上板角度", fonttitle3);
            Title.SetAlignment("center");
            document.Add(Title); //将标题段加入PDF文档中
            document.Close();
        }
        public static void Exp_HPSY()
        {
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            Document document = new Document();

            document.SetPageSize(PageSize.A4.Rotate());  //  设置文档为横向
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(tempname, FileMode.Create));

            document.Open();
            document.NewPage();
            table = new PdfPTable(13);//  设计试验8的表格总共有13列
            table.WidthPercentage = 100;
            Paragraph Title1 = new Paragraph("7. 滑板控制装置(I型车)火炮联锁试验记录", fonttitle);

            Title1.SetAlignment("center");
            document.Add(Title1);
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;  //此数值用于调整空白大小0
            document.Add(nullb);
            dtb   = Export_All_SY.DBQuery("SY8_Hplx");
            table = Export_Table_Design.SY8_Table(table, dtb);
            Export_All_SY.DBDel("SY8_Hplx");
            document.Add(table);  //將table放到pdf文件中
            Title1 = new Paragraph("注:试验中“√”表示动作正常,“×”表示动作异常", fonttitle3);
            document.Add(Title1); //将标题段加入PDF文档中
            document.Close();
        }
 /// <summary>
 /// 开关按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     dt = Export_All_SY.DBQuery(tb);
     if (this.button1.Text == "开")
     {
         if (dt.Rows.Count > 0)
         {
             MessageBox.Show("数据库中已有数据,请进行下一个实验或点击重新实验");
             return;
         }
         timer1.Start();
         this.button1.Text      = "关";
         this.button1.BackColor = Color.SandyBrown;
     }
     else if (this.button1.Text == "关")
     {
         timer1.Enabled         = false;
         this.button1.Text      = "开";
         this.button1.BackColor = Color.FloralWhite;
         this.pictureBox1.Image = Properties.Resources.Start;
         this.pictureBox2.Image = Properties.Resources.Start;
         this.pictureBox3.Image = Properties.Resources.Start;
         this.pictureBox4.Image = Properties.Resources.Start;
         this.pictureBox5.Image = Properties.Resources.Start;
         this.pictureBox6.Image = Properties.Resources.Start;
         this.pictureBox7.Image = Properties.Resources.Start;
         this.pictureBox8.Image = Properties.Resources.Start;
     }
 }
        static iTextSharp.text.Font fonttitle3 = new iTextSharp.text.Font(bf1, 10);    //表格內容字体,大小15
        public static void Exp_SY1_SY2()
        {
            PdfReader pdfReader; PdfStamper pdfStamper; AcroFields pdfFormFields;
            BaseFont  bf1 = BaseFont.CreateFont("C:\\Windows\\Fonts\\SIMSUN.TTC,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            //文件保存的真正路径
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            string path = AppDomain.CurrentDomain.BaseDirectory;
            int    flag = 1;

            path = System.IO.Directory.GetParent(path).Parent.Parent.FullName + "\\SY1_SY2_MB.pdf";
            //MessageBox.Show(path);
            pdfReader                 = new PdfReader(path);//模板的路径
            pdfStamper                = new PdfStamper(pdfReader, new FileStream(tempname, FileMode.OpenOrCreate));
            pdfFormFields             = pdfStamper.AcroFields;
            pdfStamper.FormFlattening = true;
            pdfFormFields.AddSubstitutionFont(bf1);
            dtb = Export_All_SY.DBQuery("Sy1_Fdsk");
            Export_All_SY.DBDel("Sy1_Fdsk");
            Export_Table_Design.SY1_Table(pdfFormFields, ref flag, dtb);
            flag = 1;
            dtb  = Export_All_SY.DBQuery("Sy2_Gzzd");
            Export_All_SY.DBDel("Sy2_Gzzd");
            Export_Table_Design.SY2_Table(pdfFormFields, ref flag, dtb);
            pdfStamper.Close();
            pdfReader.Close();
        }
Exemple #6
0
 /// <summary>
 /// 生成打印报表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button2_Click(object sender, EventArgs e)
 {
     if (MainFrom.textB_CgqData_Form == null || MainFrom.textB_HbData_Form == null || MainFrom.comBoxData_Form == null)
     {
         MessageBox.Show("请先保存设备属性值,再进行打印操作");
         return;
     }
     Export_All_SY.Exp_PDF(0);
 }
        /// <summary>
        /// 重做试验按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            sy3_Lists.Clear();
            count_num = 0;
            this.dataGridView1.DataSource = new BindingList <Sy3_List>(sy3_Lists);
            string tb = "[SY3_Timer]";

            Export_All_SY.DBDel(tb);
        }
        public static void Exp_SY3_SY4()
        {
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            Document  document = new Document();
            PdfWriter writer   = PdfWriter.GetInstance(document, new FileStream(tempname, FileMode.Create));

            document.Open();
            table = new PdfPTable(3);//  设计试验3的表格总共有3列
            table.WidthPercentage = 82;
            table.SetTotalWidth(new float[] { 100f, 200f, 250f });
            ///表頭設計
            //添加段落,第二个参数指定使用fonttitle格式的字体,写入中文必须指定字体否则无法显示中文
            Paragraph Title = new Paragraph("3. 滑板控制装置首板收板时间试验记录", fonttitle);

            Title.SetAlignment("center");                       //设置居中
            document.Add(Title);                                //将标题段加入PDF文档中
                                                                //空一行
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;                                 //此数值用于调整空白大小0
            document.Add(nullb);
            DataTable dtb = Export_All_SY.DBQuery("SY3_Timer"); //表格3设计单独做一个函数

            table = Export_Table_Design.SY3_Table(table, dtb);
            Export_All_SY.DBDel("SY3_Timer");
            document.Add(table);
            //空一行
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 60;       //此数值用于调整空白大小0
            document.Add(nullb);
            table = new PdfPTable(5); //  设计试验4的表格总共有5列
            table.WidthPercentage = 82;
            table.SetTotalWidth(new float[] { 100f, 200f, 200f, 200f, 200f });
            Title = new Paragraph("4. 滑板控制装置连续收板(手动20次)试验记录", fonttitle);
            Title.SetAlignment("center");
            document.Add(Title);
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;                        //此数值用于调整空白大小0
            document.Add(nullb);
            dtb   = Export_All_SY.DBQuery("SY4_Lxsb"); //表格4设计单独做一个函数
            table = Export_Table_Design.SY4_Table(table, dtb);
            Export_All_SY.DBDel("SY4_Lxsb");
            document.Add(table); //將table放到pdf文件中
            Title = new Paragraph("         注:试验中“√”表示动作正常,“×”表示动作异常", fonttitle3);
            document.Add(Title); //将标题段加入PDF文档中
            document.Close();
        }
        public static void Exp_SY7()
        {
            Paragraph Title;
            String    tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            Document  document = new Document();
            PdfWriter writer   = PdfWriter.GetInstance(document, new FileStream(tempname, FileMode.Create));

            document.Open();
            table = new PdfPTable(2);//  设计试验7的表格总共有6列
            table.WidthPercentage = 100;
            if (MainFrom.comBoxData_Form == "HBK-II/1")
            {
                Title = new Paragraph("7. 滑板控制装置连续收板(程控20次)试验记录", fonttitle);
            }
            else
            {
                Title = new Paragraph("8. 滑板控制装置连续收板(程控20次)试验记录", fonttitle);
            }
            Title.SetAlignment("center");
            document.Add(Title);
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;  //此数值用于调整空白大小0
            document.Add(nullb);
            int       flag   = 1;
            PdfPTable table1 = new PdfPTable(6);
            PdfPTable table2 = new PdfPTable(6);

            dtb    = Export_All_SY.DBQuery("SY7_Lxsb_Ck");
            table1 = Export_Table_Design.SY7_Table1(table1, ref flag, dtb); //表格7设计单独做一个函数
            table2 = Export_Table_Design.SY7_Table2(table2, ref flag, dtb); //表格7设计单独做一个函数
            Export_All_SY.DBDel("SY7_Lxsb_Ck");
            cell1         = new PdfPCell(table1);
            cell1.Padding = 0;
            table.AddCell(cell1);
            cell1         = new PdfPCell(table2);
            cell1.Padding = 0.5f;
            table.AddCell(cell1);
            document.Add(table); //將table放到pdf文件中
            Title = new Paragraph("  注:试验中“√”表示动作正常,“×”表示动作异常", fonttitle3);
            document.Add(Title); //将标题段加入PDF文档中
            document.Close();
        }
Exemple #10
0
 /// <summary>
 /// 控制模拟数据开始接受数据,(定时器的开始与暂停)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button_open_Click(object sender, EventArgs e)
 {
     dt = Export_All_SY.DBQuery(tb);
     if (this.button_open.Text == "开")
     {
         if (dt.Rows.Count > 0)
         {
             MessageBox.Show("数据库中已有数据,请进行下一个实验或点击重新实验");
             return;
         }
         this.button1.Enabled       = true;
         this.hight_one.Enabled     = true;
         this.higth_two.Enabled     = true;
         this.hight_three.Enabled   = true;
         timer_Show.Enabled         = true;
         this.button_open.BackColor = Color.SandyBrown;
         this.button_open.Text      = "关";
     }
     else if (this.button_open.Text == "关")
     {
         if (this.button1.Text == "停止采集")
         {
             MessageBox.Show("请先关闭数据采集的线程开关!!!", "提示");
             return;
         }
         timer_Show.Enabled         = false;
         this.button_open.BackColor = Color.FloralWhite;
         this.label1.Text           = "  " + 0;
         this.label2.Text           = "  " + 0;
         this.label3.Text           = "  " + 0;
         this.label4.Text           = "  " + 0;
         this.label12.Text          = "  " + 0;
         this.label20.Text          = "  " + 0;
         this.button_open.Text      = "开";
         this.button1.Enabled       = false;
         this.hight_one.Enabled     = false;
         this.higth_two.Enabled     = false;
         this.hight_three.Enabled   = false;
         this.pictureBox1.Image     = Properties.Resources.Start;
         this.pictureBox2.Image     = Properties.Resources.Start;
         this.pictureBox3.Image     = Properties.Resources.Start;
         this.pictureBox4.Image     = Properties.Resources.Start;
         this.pictureBox5.Image     = Properties.Resources.Start;
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            dt = Export_All_SY.DBQuery(tb);
            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("数据库中已有数据,请进行下一个实验或点击重新实验");
                return;
            }
            if (chB1.Checked == true)
            {
                checkData[0] = 1;
            }
            if (chB2.Checked == true)
            {
                checkData[1] = 1;
            }
            if (chB3.Checked == true)
            {
                checkData[2] = 1;
            }
            if (chB4.Checked == true)
            {
                checkData[3] = 1;
            }
            if (chB5.Checked == true)
            {
                checkData[4] = 1;
            }
            if (chB6.Checked == true)
            {
                checkData[5] = 1;
            }
            DateTime timer   = DateTime.Now;
            String   sqldata = "insert into [SY1_Fdsk](Ss_s,Ss_f,Sx_s,Sx_f,Wy_s,Wy_f,Insert_timer,Sy_user,P_no,C_no,Angle_no)" +
                               " values(@a1,@a2,@a3,@a4,@a5,@a6,@a7,@a8,@a9,@a10,@a11)";

            SqlHelper.ExecuteNonQuery(sqldata, new SqlParameter("@a1", checkData[0]), new SqlParameter("@a2", checkData[1]),
                                      new SqlParameter("@a3", checkData[2]), new SqlParameter("@a4", checkData[3]), new SqlParameter("@a5", checkData[4]),
                                      new SqlParameter("@a6", checkData[5]), new SqlParameter("@a7", timer), new SqlParameter("@a8", MainFrom.Uname),
                                      new SqlParameter("@a9", MainFrom.comBoxData_Form), new SqlParameter("@a10", MainFrom.textB_HbData_Form)
                                      , new SqlParameter("@a11", MainFrom.textB_CgqData_Form));
            MessageBox.Show("数据提交成功,记得及时打印!!!");
        }
Exemple #12
0
        /// <summary>
        /// 开启数据开关
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_open_Click(object sender, EventArgs e)
        {
            dt = Export_All_SY.DBQuery(tb);
            if (this.button_open.Text == "开")
            {
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("数据库中已有数据,请进行下一个实验或点击重新实验");
                    return;
                }
                t1 = new Thread(dj_AskMsg);//陀螺仪接收数据线程
                timer_Six_Show.Start();
                t1.Start();
                this.button_open.BackColor = Color.SandyBrown;
                this.button_open.Text      = "关";
            }
            else if (this.button_open.Text == "关")
            {
                timer_Six_Show.Enabled     = false;
                this.button_open.BackColor = Color.FloralWhite;
                if (t1.IsAlive)
                {
                    t1.Abort();
                }
                if (socket2 != null)
                {
                    socket2.Close();
                }
                this.label1.Text  = "" + 0;
                this.label2.Text  = "" + 0;
                this.label3.Text  = "" + 0;
                this.label4.Text  = "" + 0;
                this.label15.Text = "" + 0;
                this.label16.Text = "" + 0;

                this.label13.Text     = "" + 0;
                this.label14.Text     = "" + 0;
                this.button_open.Text = "开";
            }
        }
 /// <summary>
 /// 重新试验
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button4_Click(object sender, EventArgs e)
 {
     C_no = 1;
     //数据库
     Export_All_SY.DBDel(tb);
 }
        private void button1_Click(object sender, EventArgs e)
        {
            dt = Export_All_SY.DBQuery(tb);
            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("数据库中已有数据,请进行下一个实验或点击重新实验");
                return;
            }
            string[] data_Beizhu = new string[8];
            for (int i = 0; i < data_Beizhu.Length; i++)
            {
                data_Beizhu[i] = "";
            }
            data_Beizhu[0] = textBox1.Text.Trim(); data_Beizhu[1] = textBox2.Text.Trim();
            data_Beizhu[2] = textBox3.Text.Trim(); data_Beizhu[3] = textBox4.Text.Trim();
            data_Beizhu[4] = textBox5.Text.Trim(); data_Beizhu[5] = textBox6.Text.Trim();
            data_Beizhu[6] = textBox7.Text.Trim(); data_Beizhu[7] = textBox8.Text.Trim();
            int[] data_one = new int[24];
            for (int i = 0; i < data_one.Length; i++)
            {
                data_one[i] = 0;
            }
            if (checkBox1.Checked == true)
            {
                data_one[0] = 1;
            }
            if (checkBox2.Checked == true)
            {
                data_one[1] = 1;
            }
            if (checkBox3.Checked == true)
            {
                data_one[2] = 1;
            }
            if (checkBox4.Checked == true)
            {
                data_one[3] = 1;
            }
            if (checkBox5.Checked == true)
            {
                data_one[4] = 1;
            }
            if (checkBox6.Checked == true)
            {
                data_one[5] = 1;
            }
            if (checkBox7.Checked == true)
            {
                data_one[6] = 1;
            }
            if (checkBox8.Checked == true)
            {
                data_one[7] = 1;
            }
            if (checkBox9.Checked == true)
            {
                data_one[8] = 1;
            }
            if (checkBox10.Checked == true)
            {
                data_one[9] = 1;
            }
            if (checkBox11.Checked == true)
            {
                data_one[10] = 1;
            }
            if (checkBox12.Checked == true)
            {
                data_one[11] = 1;
            }
            if (checkBox13.Checked == true)
            {
                data_one[12] = 1;
            }
            if (checkBox14.Checked == true)
            {
                data_one[13] = 1;
            }
            if (checkBox15.Checked == true)
            {
                data_one[14] = 1;
            }
            if (checkBox16.Checked == true)
            {
                data_one[15] = 1;
            }
            if (checkBox17.Checked == true)
            {
                data_one[16] = 1;
            }
            if (checkBox18.Checked == true)
            {
                data_one[17] = 1;
            }
            if (checkBox19.Checked == true)
            {
                data_one[18] = 1;
            }
            if (checkBox20.Checked == true)
            {
                data_one[19] = 1;
            }
            if (checkBox21.Checked == true)
            {
                data_one[20] = 1;
            }
            if (checkBox22.Checked == true)
            {
                data_one[21] = 1;
            }
            if (checkBox23.Checked == true)
            {
                data_one[22] = 1;
            }
            if (checkBox24.Checked == true)
            {
                data_one[23] = 1;
            }
            C_no++;
            if (C_no == 2)
            {
                this.button1.Enabled = false;
                this.button2.Enabled = true; this.button3.Enabled = false;
            }
            string[] Gk = new string[8];
            Gk[0] = "陆上"; Gk[1] = "低速";
            Gk[2] = "中速"; Gk[3] = "高速";
            Gk[4] = "应急"; Gk[5] = "中速";
            Gk[6] = "低速"; Gk[7] = "陆上";
            //插入数据库
            String sqldata;

            for (int i = 0; i < 8; i++)
            {
                DateTime timer = DateTime.Now;
                sqldata = "insert into [SY7_Lxsb_Ck](Gk,Ss_b,Sx_b,Wy_b,Beizhu,Insert_timer,Sy_user,P_no,C_no,Angle_no)" +
                          " values(@a1,@a2,@a3,@a4,@a5,@a6,@a7,@a8,@a9,@a10)";
                SqlHelper.ExecuteNonQuery(sqldata,
                                          new SqlParameter("@a1", Gk[i]),
                                          new SqlParameter("@a2", data_one[3 * i]),
                                          new SqlParameter("@a3", data_one[3 * i + 1]),
                                          new SqlParameter("@a4", data_one[3 * i + 2]),
                                          new SqlParameter("@a5", data_Beizhu[i]),
                                          new SqlParameter("@a6", timer),
                                          new SqlParameter("@a7", MainFrom.Uname),
                                          new SqlParameter("@a8", MainFrom.comBoxData_Form),
                                          new SqlParameter("@a9", MainFrom.textB_HbData_Form),
                                          new SqlParameter("@a10", MainFrom.textB_CgqData_Form));
            }
        }
        private void Second_Btn_Result_Click(object sender, EventArgs e)
        {
            dt = Export_All_SY.DBQuery(tb);
            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("数据库中已有数据,请进行下一个实验或点击重新实验");
                return;
            }
            int[] a = new int[15];
            for (int i = 0; i < 15; i++)
            {
                a[i] = 0;
            }
            if (chB01.Checked == true)
            {
                a[0] = 1;
            }
            if (chB02.Checked == true)
            {
                a[1] = 1;
            }
            if (chB03.Checked == true)
            {
                a[2] = 1;
            }
            if (chB04.Checked == true)
            {
                a[3] = 1;
            }
            if (chB05.Checked == true)
            {
                a[4] = 1;
            }
            if (chB06.Checked == true)
            {
                a[5] = 1;
            }
            if (chB07.Checked == true)
            {
                a[6] = 1;
            }
            if (chB08.Checked == true)
            {
                a[7] = 1;
            }
            if (chB09.Checked == true)
            {
                a[8] = 1;
            }
            if (chB10.Checked == true)
            {
                a[9] = 1;
            }
            if (chB11.Checked == true)
            {
                a[10] = 1;
            }
            if (chB12.Checked == true)
            {
                a[11] = 1;
            }
            if (chB13.Checked == true)
            {
                a[12] = 1;
            }
            if (chB14.Checked == true)
            {
                a[13] = 1;
            }
            if (chB15.Checked == true)
            {
                a[14] = 1;
            }
            DateTime timer   = DateTime.Now;
            String   sqldata = "insert into [SY2_Gzzd](XH_G,YC_G,DD_D,DD_Z,DD_G,DL_D,DL_Z,DL_G,JT_D,JT_Z,DY_D,DY_Z,DY_G,DL_CK,KL_CK,Insert_timer,Sy_user,P_no,C_no,Angle_no)" +
                               " values(@a1,@a2,@a3,@a4,@a5,@a6,@a7,@a8,@a9,@a10,@a11,@a12,@a13,@a14,@a15,@a16,@a17,@a18,@a19,@a20)";

            SqlHelper.ExecuteNonQuery(sqldata, new SqlParameter("@a1", a[0]), new SqlParameter("@a2", a[1]),
                                      new SqlParameter("@a3", a[2]), new SqlParameter("@a4", a[3]), new SqlParameter("@a5", a[4]),
                                      new SqlParameter("@a6", a[5]), new SqlParameter("@a7", a[6]), new SqlParameter("@a8", a[7]),
                                      new SqlParameter("@a9", a[8]), new SqlParameter("@a10", a[9]), new SqlParameter("@a11", a[10]),
                                      new SqlParameter("@a12", a[11]), new SqlParameter("@a13", a[12]), new SqlParameter("@a14", a[13]),
                                      new SqlParameter("@a15", a[14]), new SqlParameter("@a16", timer), new SqlParameter("@a17", MainFrom.Uname),
                                      new SqlParameter("@a18", MainFrom.comBoxData_Form), new SqlParameter("@a19", MainFrom.textB_HbData_Form),
                                      new SqlParameter("@a20", MainFrom.textB_CgqData_Form));
            MessageBox.Show("数据提交成功,记得及时打印!!!");
        }
 private void button1_Click(object sender, EventArgs e)
 {
     Export_All_SY.DBDel(tb);
 }
Exemple #17
0
        private void button1_Click(object sender, EventArgs e)
        {
            ////////////////////////////////////////////////////////////////////////
            //得到产品型号
            Cp_no   = this.comboBox1.Text;
            Kzx_no  = this.textBox1.Text; //滑板控制箱编号
            Cgq_no  = this.textBox2.Text; //角度传感器编号
            Czy     = this.textBox3.Text; //操作员
            Sy_date = this.comboBox2.Text + this.comboBox3.Text + this.comboBox4.Text;
            date    = this.comboBox2.Text + "-" + this.comboBox3.Text + "-" + this.comboBox4.Text;
            Sycs    = this.textBox4.Text;
            //判断以哪种方式进行查询
            if (this.radioButton1.Checked)
            {
                flag = 1;//表示以文档形式查询
            }
            if (this.radioButton2.Checked)
            {
                flag = 2;//表示以数据库查询
            }
            //if (Cp_no == "" || Kzx_no == "" || Czy == "" || Cgq_no == "" || Sy_date == "" || Sycs == "" || flag == 0)
            //{
            //    MessageBox.Show("请完整填写查询属性,再保存参数!!!");
            //    return;
            //}
            if (flag == 2)
            {
                if (Cp_no == "" || Kzx_no == "" || Czy == "" || Cgq_no == "" || Sy_date == "" || flag == 0)
                {
                    MessageBox.Show("请完整填写查询属性,可以不填实验次数,再保存参数!!!");
                    return;
                }
                SY_Data data = new SY_Data(Cp_no, Kzx_no, Cgq_no, Czy, date);
                Export_All_SY.getCount(data);
                if (Export_All_SY.count == 1)
                {
                    this.label11.Text = "您在" + date + "没有做任何实验,请选择查询其它日期";
                }
                else
                {
                    this.label11.Text = "您在" + date + "一共做了" + (Export_All_SY.count - 1) + "次实验,请在上方文本框中输入您要查询哪一次实验";
                }
            }
            else
            {
                this.label11.Text = "";
            }
            ////////////////////////////////////////////////////////////////////////////////
            int f = 0;

            //判断以哪种方式进行查询
            if (this.radioButton1.Checked)
            {
                f = 1;//表示以文档形式查询
            }
            if (this.radioButton2.Checked)
            {
                f = 2;//表示以数据库查询
            }

            if (Cp_no != this.comboBox1.Text || Kzx_no != this.textBox1.Text ||
                Cgq_no != this.textBox2.Text || Czy != this.textBox3.Text ||
                Sy_date != (this.comboBox2.Text + this.comboBox3.Text + this.comboBox4.Text) ||
                Sycs != this.textBox4.Text || flag != f)
            {
                MessageBox.Show("您修改了参数但没有保存,请先保存参数,再进行查询!!!");
                return;
            }
            //FolderBrowserDialog openFileDialog = new FolderBrowserDialog();
            if (flag == 1)
            {
                Boolean  isFile = false;
                string[] com    = Cp_no.Split('/');
                string   p_no   = "";
                for (int k = 0; k < com.Length; k++)
                {
                    p_no = p_no + com[k];
                }
                //获得要查询的文件名
                FileName[0] = Sycs;
                FileName[1] = p_no;
                FileName[2] = Kzx_no;
                FileName[3] = Czy;
                FileName[4] = Cgq_no;
                FileName[5] = Sy_date;
                //DialogResult result = openFileDialog.ShowDialog();
                string hz = "pdf";
                //文件查询
                //if (result == DialogResult.OK)
                //{
                //DirectoryInfo dir = new DirectoryInfo(openFileDialog.SelectedPath);
                DirectoryInfo dir      = new DirectoryInfo(StrPath);
                FileInfo[]    fileInfo = dir.GetFiles();
                foreach (FileInfo item in fileInfo)
                {
                    int    flag     = 1;
                    string fileName = item.Name;
                    if (fileName.Substring(fileName.LastIndexOf(".") + 1) == hz)
                    {
                        string[] fname = fileName.Split('_');
                        if (fname.Length != 6)
                        {
                            continue;
                        }
                        for (int h = 0; h < 5; h++)
                        {
                            if (FileName[h] != "")
                            {
                                if (FileName[h] != fname[h])
                                {
                                    flag = 0;
                                }
                            }
                        }
                        if (FileName[5] != "")
                        {
                            if (!fname[5].Contains(FileName[5]))
                            {
                                flag = 0;
                            }
                        }
                        if (flag == 1)
                        {
                            //加判断条件
                            if (MessageBox.Show("确定打开?" + StrPath + "\\" + item.Name, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                MessageBox.Show("正在打开" + StrPath + "\\" + item.Name);
                                Process.Start("explorer", StrPath + item.Name);
                            }
                            //MessageBox.Show("正在打开" + StrPath + "\\" + item.Name);
                            //Process.Start("explorer", StrPath + item.Name);
                            isFile = true;      //判断是否查询到文件
                        }
                    }
                }
                if (!isFile)
                {
                    MessageBox.Show("未查询到文件,重新试验或进一步查询!!!");
                }
                //}
            }
            else
            {
                if (Cp_no == "" || Kzx_no == "" || Czy == "" || Cgq_no == "" || Sy_date == "" || Sycs == "" || flag == 0)
                {
                    MessageBox.Show("请完整填写查询属性,再进行查询!!!");
                    return;
                }
                state = 0;
                getState();
                if (state == 0)
                {
                    MessageBox.Show("没有查到任何数据");
                    return;
                }
                //数据库查询,并生成文件
                Export_All_SY.Exp_PDF(1);
            }
        }
Exemple #18
0
        private void button2_Click(object sender, EventArgs e)
        {
            string tb = "[SY4_Lxsb]";

            Export_All_SY.DBDel(tb);
            ////////////////////////////////////////////////////////
            ///以下代码为了更改下拉菜单内容
            count = getCount();
            this.cobB1.Items.Clear();
            switch (count)
            {
            case 0:
                string[] items0 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };
                this.cobB1.Items.AddRange(items0);
                break;

            case 1:
                string[] items1 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" };
                this.cobB1.Items.AddRange(items1);
                break;

            case 2:
                string[] items2 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18" };
                this.cobB1.Items.AddRange(items2);
                break;

            case 3:
                string[] items3 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17" };
                this.cobB1.Items.AddRange(items3);
                break;

            case 4:
                string[] items4 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" };
                this.cobB1.Items.AddRange(items4);
                break;

            case 5:
                string[] items5 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
                this.cobB1.Items.AddRange(items5);
                break;

            case 6:
                string[] items6 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14" };
                this.cobB1.Items.AddRange(items6);
                break;

            case 7:
                string[] items7 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" };
                this.cobB1.Items.AddRange(items7);
                break;

            case 8:
                string[] items8 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" };
                this.cobB1.Items.AddRange(items8);
                break;

            case 9:
                string[] items9 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11" };
                this.cobB1.Items.AddRange(items9);
                break;

            case 10:
                string[] items10 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
                this.cobB1.Items.AddRange(items10);
                break;

            case 11:
                string[] items11 = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
                this.cobB1.Items.AddRange(items11);
                break;

            case 12:
                string[] items12 = { "1", "2", "3", "4", "5", "6", "7", "8" };
                this.cobB1.Items.AddRange(items12);
                break;

            case 13:
                string[] items13 = { "1", "2", "3", "4", "5", "6", "7" };
                this.cobB1.Items.AddRange(items13);
                break;

            case 14:
                string[] items14 = { "1", "2", "3", "4", "5", "6" };
                this.cobB1.Items.AddRange(items14);
                break;

            case 15:
                string[] items15 = { "1", "2", "3", "4", "5" };
                this.cobB1.Items.AddRange(items15);
                break;

            case 16:
                string[] items16 = { "1", "2", "3", "4" };
                this.cobB1.Items.AddRange(items16);
                break;

            case 17:
                string[] items17 = { "1", "2", "3" };
                this.cobB1.Items.AddRange(items17);
                break;

            case 18:
                string[] items18 = { "1", "2" };
                this.cobB1.Items.AddRange(items18);
                break;

            case 19:
                string[] items19 = { "1" };
                this.cobB1.Items.AddRange(items19);
                break;

            case 20:
                string[] items20 = { };
                this.cobB1.Items.AddRange(items20);
                this.cobB1.Text = "0";
                break;
            }
        }