예제 #1
0
        public static void Print(PrintType printType, BarcodeSample sample, TestResult technic, TestResult reality)
        {
            ExcelAccess access   = new ExcelAccess();
            string      path     = ConfigurationManager.AppSettings["template"];
            string      fullPath = Path.GetFullPath(path);

            access.Open(fullPath);
            access.IsVisibledExcel = true;
            access.FormCaption     = "商品条码符号检测数据";
            switch (printType)
            {
            case PrintType.Print:
                access.Print();
                break;

            case PrintType.PrintView:
                access.PrintPreview();
                break;

            default:
                access.Close();
                break;
            }
            access.Close();
        }
예제 #2
0
        public void insertTestingData(BarcodeSample sample, TestResult technic, TestResult reality)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@serialnumber", sample.SerialNumber), new SqlParameter("@barcodenumber", sample.BarCodeNumber), new SqlParameter("@samplename", sample.SampleName), new SqlParameter("@barcodetype", reality.BarcodeType), new SqlParameter("@customername", sample.CustomerName), new SqlParameter("@contactman", sample.CustomerContactPersoner), new SqlParameter("@contactphone", sample.CustomerContactNumber), new SqlParameter("@contactaddress", sample.CustomerContactAddress), new SqlParameter("@bussinesstype", sample.BussinessType), new SqlParameter("@agencycode", sample.RegisterPoint), new SqlParameter("@printformat", sample.PrintFormat), new SqlParameter("@specification", sample.Specification), new SqlParameter("@brand", sample.Brand), new SqlParameter("@tsymbollevel", technic.SymbolLevel), new SqlParameter("@tdecodingdata", technic.DecodingData), new SqlParameter("@tleftblank", technic.LeftBlank),
                new SqlParameter("@trightblank", technic.RightBlank), new SqlParameter("@tbarheight", technic.BarHeight), new SqlParameter("@tsizeofz", technic.SizeOfZ), new SqlParameter("@testingdate", reality.TestDate), new SqlParameter("@rsymbollevel", reality.SymbolLevel), new SqlParameter("@rdecodingdata", reality.DecodingData), new SqlParameter("@rleftblank", reality.LeftBlank), new SqlParameter("@rrightblank", reality.RightBlank), new SqlParameter("@rbarheight", reality.BarHeight), new SqlParameter("@rsizeofz", reality.SizeOfZ), new SqlParameter("@tisvalidcode", technic.IsValidBarcode), new SqlParameter("@risvalidcode", reality.IsValidBarcode)
            };
            string sqlstring = string.Format("insert into jy_quatity_service(SerialNumber,BarCodeNumber,SampleName,BarCodeType,CustomerName,ContactMan,ContactPhone,ContactAddress,BussinessType,AgencyCode,PrintFormat,Specification,Brand,Tech_SymbolLevel,Tech_DecodingData,Tech_LeftBlank,Tech_RightBlank,Tech_BarHeight,Tech_SizeOfZ,Tech_IsValidCode,Real_SymbolLevel,Real_DecodingData,Real_LeftBlank,Real_RightBlank,Real_BarHeight,Real_SizeOfZ,Real_IsValidCode,TestingDate,ReportDate) values(@SerialNumber,@BarCodeNumber,@SampleName,@BarCodeType,@CustomerName,@ContactMan,@ContactPhone,@ContactAddress,@BussinessType,@AgencyCode,@PrintFormat,@Specification,@Brand,@TSymbolLevel,@TDecodingData,@TLeftBlank,@TRightBlank,@TBarHeight,@TSizeOfZ,@tisvalidcode,@RSymbolLevel,@RDecodingData,@RLeftBlank,@RRightBlank,@RBarHeight,@RSizeOfZ,@risvalidcode,@TestingDate,GetDate())", new object[0]);

            try
            {
                SqlHelper.ExecNonQuery(DatabaseConn.DbZwb, sqlstring, param);
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
예제 #3
0
 protected BarcodeSample setBarcodeSampleValue(DataGridView dgv)
 {
     this.sample = new BarcodeSample();
     if ((dgv.RowCount > 0) && (dgv.SelectedRows.Count > 0))
     {
         this.sample.SerialNumber            = dgv.SelectedRows[0].Cells[1].Value.ToString();
         this.sample.BarCodeNumber           = dgv.SelectedRows[0].Cells[2].Value.ToString();
         this.sample.SampleName              = dgv.SelectedRows[0].Cells[3].Value.ToString();
         this.sample.PrintFormat             = dgv.SelectedRows[0].Cells[4].Value.ToString();
         this.sample.BarcodeType             = dgv.SelectedRows[0].Cells[5].Value.ToString();
         this.sample.CustomerName            = dgv.SelectedRows[0].Cells[6].Value.ToString();
         this.sample.CustomerContactPersoner = dgv.SelectedRows[0].Cells[7].Value.ToString();
         this.sample.CustomerContactNumber   = dgv.SelectedRows[0].Cells[8].Value.ToString();
         this.sample.CustomerContactAddress  = dgv.SelectedRows[0].Cells[9].Value.ToString();
         this.sample.BussinessType           = dgv.SelectedRows[0].Cells[10].Value.ToString();
         this.sample.RegisterPoint           = dgv.SelectedRows[0].Cells[11].Value.ToString();
     }
     return(this.sample);
 }
예제 #4
0
 private void btnBuild_Click(object sender, EventArgs e)
 {
     if (this.dataGridView1.RowCount > 0)
     {
         if (this.dataGridView1.SelectedRows.Count > 0)
         {
             this.sample = this.setBarcodeSampleValue(this.dataGridView1);
             frmPrint print = new frmPrint(this.sample);
             print.Text = "检验数据——" + this.sample.SerialNumber;
             print.ShowDialog();
         }
         else
         {
             MessageBox.Show("未选中数据!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("没有数据!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
예제 #5
0
        public static bool Save(BarcodeSample sample, TestResult technic, TestResult reality, string saveFilename, string templateFile)
        {
            ExcelAccess access = new ExcelAccess();

            access.Open(templateFile);
            access.IsVisibledExcel = true;
            access.FormCaption     = "商品条码符号检测数据";
            bool flag = false;

            access.SetCellText(2, "F", sample.SerialNumber);
            access.SetCellText(3, "F", sample.CustomerName);
            access.SetCellText(3, "Z", reality.BarcodeType);
            access.SetCellText(4, "F", sample.SampleName);
            access.SetCellText(4, "Z", sample.PrintFormat);
            access.SetCellText(6, "F", sample.CustomerContactPersoner);
            access.SetCellText(6, "N", sample.CustomerContactNumber);
            access.SetCellText(0x11, "J", "代办点" + sample.RegisterPoint);
            access.SetCellText(10, "J", technic.SymbolLevel);
            access.SetCellText(11, "J", technic.DecodingData);
            access.SetCellText(12, "J", "≥" + technic.LeftBlank);
            access.SetCellText(13, "J", "≥" + technic.RightBlank);
            access.SetCellText(14, "J", "≥" + technic.BarHeight.ToString());
            access.SetCellText(15, "J", technic.SizeOfZ);
            access.SetCellText(0x10, "J", technic.IsValidBarcode);
            access.SetCellText(10, "V", reality.SymbolLevel);
            access.SetCellText(11, "V", reality.DecodingData);
            access.SetCellText(12, "V", reality.LeftBlank);
            access.SetCellText(13, "V", reality.RightBlank);
            access.SetCellText(14, "V", reality.BarHeight.ToString());
            access.SetCellText(15, "V", reality.SizeOfZ.ToString());
            access.SetCellText(0x10, "V", reality.IsValidBarcode);
            access.SetCellText(6, "Z", reality.TestDate.ToString("yyyyMMdd"));
            if (access.SaveAs(saveFilename, false))
            {
                flag = true;
            }
            access.Close();
            return(flag);
        }
예제 #6
0
 public frmPrint(BarcodeSample sample)
 {
     this.InitializeComponent();
     this.sample = sample;
 }