private void timer1_Tick(object sender, EventArgs e) { if (signal.print == true && signal.InputParameter == true && signal.printControl == true) { resultTextBox.Text = "条码打印开始~~~"; PrintForm tempForm = new PrintForm(); tempForm.dealBarcode(); barcodeTextBox.Text = barcode.bar; nameTextBox.Text = barcode.name; string delete = "DELETE * FROM 需打印数据"; string insert1 = "INSERT INTO 需打印数据(零部件编号,产品名称,型号,班次,颜色,配置,条码信息) values('" + barcode.number + "','" + barcode.name + "','" + barcode.version + "','" + barcode.team + "','" + barcode.colour + "','" + barcode.deploy + "','" + barcode.bar + "')"; ///清空需打印数据中的所有数据 tempFix.FixDataBase(delete); //将要打印的一条条码写入到需打印数据中 tempFix.FixDataBase(insert1); printer.printBarcode(); //将这个打印过程写入到打印记录表中 string tempdate = DateTime.Now.ToLongDateString(); string temptime = DateTime.Now.ToLongTimeString(); string insert2 = "INSERT INTO 打印过程记录(零部件编号,产品名称,型号,班次,颜色,配置,条码信息,条码计数,日期,时间) values('" + barcode.number + "','" + barcode.name + "','" + barcode.version + "','" + barcode.team + "','" + barcode.colour + "','" + barcode.deploy + "','" + barcode.bar + "','" + barcode.count + "','" + tempdate + "','" + temptime + "')"; tempFix.FixDataBase(insert2); signal.print = false; resultTextBox.Text = "条码打印结束~~~~"; } }
private void deleteButton_Click(object sender, EventArgs e) { if (modelTextBox.Text != "") { DataTable tempTable = tempFix.FindData("摄像头模板", "'" + modelTextBox.Text + "'", "模板名称"); if (tempTable.Rows.Count == 0) { MessageBox.Show("该数据不存在"); this.modelTextBox.Clear(); return; } else { string path = tempTable.Rows[0]["模板保存路径"].ToString(); string fixstring = "DELETE FROM 摄像头模板 WHERE 模板名称=" + "'" + modelTextBox.Text + "'"; tempFix.FixDataBase(fixstring); File.Delete(path); this.modelTextBox.Clear(); MessageBox.Show("删除成功!!!!!"); } } else { MessageBox.Show("没有选择模板参数!!!!!"); return; } }
private void printButton_Click(object sender, EventArgs e) { if (numTextBox.Text != "" && IDTextBox.Text != "" && nameTextBox.Text != "" && FIDTextBox.Text != "" && versionTextBox.Text != "" && colourTextBox.Text != "" && deployTextBox.Text != "" && teamComboBox.Text != "") { /// ///捕捉配置和班次信息 /// try { barcode.team = teamComboBox.Text.Trim().ToString().Trim().ToUpper();//班次信息 dealBarcode(); string delete = "DELETE * FROM 需打印数据"; string insert1 = "INSERT INTO 需打印数据(零部件编号,产品名称,型号,班次,颜色,配置,条码信息) values('" + barcode.number + "','" + barcode.name + "','" + barcode.version + "','" + barcode.team + "','" + barcode.colour + "','" + barcode.deploy + "','" + barcode.bar + "')"; ///清空需打印数据中的所有数据 tempFix.FixDataBase(delete); //将要打印的一条条码写入到需打印数据中 tempFix.FixDataBase(insert1); printer.printBarcode(); //将这个打印过程写入到打印记录表中 string tempdate = DateTime.Now.ToLongDateString(); string temptime = DateTime.Now.ToLongTimeString(); string insert2 = "INSERT INTO 打印过程记录(零部件编号,产品名称,型号,班次,颜色,配置,条码信息,条码计数,日期,时间) values('" + barcode.number + "','" + barcode.name + "','" + barcode.version + "','" + barcode.team + "','" + barcode.colour + "','" + barcode.deploy + "','" + barcode.bar + "','" + barcode.count + "','" + tempdate + "','" + temptime + "')"; tempFix.FixDataBase(insert2); MessageBox.Show("此项打印成功"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("参数输入不全,请检查!!!!!!1"); } }
private void saveModel_Click(object sender, EventArgs e) { if (nametextBox.Text != "") { string name = nametextBox.Text.Trim(); string path = Environment.CurrentDirectory.ToString() + "\\模板"; string version = "全景"; if (PortNo == 1) { version = "全景"; } else if (PortNo == 0) { version = "其它"; } DataTable tempTable = tempFix.FindData("摄像头模板", "'" + nametextBox.Text + "'", "模板名称"); if (tempTable.Rows.Count == 0) { if (false == Directory.Exists(path)) { Directory.CreateDirectory(path); } path = path + "\\" + name + ".shm"; FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); //创建文件对象 HOperatorSet.WriteShapeModel(vision.Model.m_ModelID, path); /// ///写入数据库 /// string fixstring = "INSERT INTO 摄像头模板(摄像头型号,模板保存路径,模板名称) values('" + version + "','" + path + "','" + name + "')"; databaseoperate.FixDataBase(fixstring); MessageBox.Show("添加成功!!!"); } else { MessageBox.Show("已经存在相同的名称!!!!"); this.nametextBox.Clear(); } } else { MessageBox.Show("未输入文件名!!"); } }