Beispiel #1
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     this.technic = new TestResult();
     this.reality = new TestResult();
     this.setTestValue(DataReadHelper.TextRead(this.textBox1.Text.Trim()), this.technic, this.reality);
     PrintHelper.Print(PrintType.PrintView, this.sample, this.technic, this.reality);
 }
Beispiel #2
0
        public void BuildReport(string fileName)
        {
            this.technic = new TestResult();
            this.reality = new TestResult();
            string templateFile = Application.StartupPath + ConfigurationManager.AppSettings["template"];

            this.setTestValue(DataReadHelper.TextRead(this.textBox1.Text.Trim()), this.technic, this.reality);
            if (PrintHelper.Save(this.sample, this.technic, this.reality, fileName, templateFile))
            {
                MessageBox.Show("检测数据生成成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show("检测数据生成失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Beispiel #3
0
 private void btnDataImport_Click(object sender, EventArgs e)
 {
     try
     {
         string str = this.textBox1.Text.Trim();
         if ((str != null) && (str != ""))
         {
             this.dataGridView1.DataSource = DataReadHelper.ExcelRead(this.textBox1.Text.Trim());
         }
         else
         {
             MessageBox.Show("未选择厂商信息文件", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show("数据文件有问题" + exception.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
Beispiel #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Exception exception;

            this.technic = new TestResult();
            this.reality = new TestResult();
            this.technic.DecodingData = this.sample.BarCodeNumber;
            try
            {
                this.technic.SymbolLevel    = ConfigurationManager.AppSettings["jsfhdj"];
                this.technic.SizeOfZ        = ConfigurationManager.AppSettings["jszcc"];
                this.technic.IsValidBarcode = ConfigurationManager.AppSettings["jscsdmyxx"];
            }
            catch (Exception exception1)
            {
                exception = exception1;
                MessageBox.Show("配置文件有误!" + exception.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (this.txtRHeight.Text.Trim() != "")
            {
                this.reality.BarHeight = Convert.ToInt32(this.txtRHeight.Text.Trim());
            }
            else
            {
                MessageBox.Show("条高不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (this.txtRLeft.Text.Trim() != "")
            {
                this.reality.LeftBlank = this.txtRLeft.Text.Trim();
            }
            else
            {
                MessageBox.Show("左侧空白区不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (this.txtRRight.Text.Trim() != "")
            {
                this.reality.RightBlank = this.txtRRight.Text.Trim();
            }
            else
            {
                MessageBox.Show("右侧空白区不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter           = "Excel文件(*.xls)|*.xls";
            dialog.RestoreDirectory = false;
            dialog.FilterIndex      = 0;
            dialog.FileName         = this.sample.SerialNumber;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string templateFile = Application.StartupPath + ConfigurationManager.AppSettings["template"];
                    this.setTestValue(DataReadHelper.TextRead(this.textBox1.Text.Trim()), this.technic, this.reality);
                    this.reality.IsValidBarcode = this.technic.DecodingData.Equals(this.reality.DecodingData) ? "有效" : "无效";
                    if (PrintHelper.Save(this.sample, this.technic, this.reality, dialog.FileName, templateFile))
                    {
                        MessageBox.Show("检测数据生成成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        try
                        {
                            new Quatity().insertTestingData(this.sample, this.technic, this.reality);
                        }
                        catch (Exception exception2)
                        {
                            exception = exception2;
                            MessageBox.Show(exception.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        }
                        base.Close();
                    }
                    else
                    {
                        MessageBox.Show("检测数据生成失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
                catch (Exception exception3)
                {
                    exception = exception3;
                    MessageBox.Show("生成数据异常!" + exception.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }