using DevExpress.Internal.WinApi.Windows.UI.Notifications; using DevExpress.Utils.Drawing.Helpers; using GSproduction.SQL; using GSProduction.SQLLT; using SpeechLib; using System; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; namespace GSproduction { public partial class GSBGBarcodeFrm : Form { #region 参数 private Panel panel1; private Timer timer1; private System.ComponentModel.IContainer components; private TextBox textBox1; private Label label5; SQLHelper SQL = null; OracleHelper OraSQL = null; DataTable tbB = null; DataTable tbC = null; DataTable tbD = null; DataTable tbA = null; DataTable dtWC = null; DataTable tbG = null; private int b =0; private string tmNO =""; private Panel panel2; private DataGridView dataGridView1; private GSproductionClass wc = new GSproductionClass(); private WeightCollectDataSet1 weightCollectDataSet1; private BindingSource bGBarcodeBindingSource; private WeightCollectDataSet1TableAdapters.BGBarcodeTableAdapter bGBarcodeTableAdapter; int d = 0; String connStr = "Data Source=192.168.1.198;Initial Catalog=CSFrameworkV5_Normal;User Id=sa;Password=Weaver@2001;Pooling=False;Pooling=true;Min Pool Size=10;Max Pool Size=50;Connect Timeout=500"; private DataGridViewTextBoxColumn BianNo; private Label label9; private TextBox textBox5; private Label label10; private TextBox textBox6; private Label label8; private TextBox textBox4; private Label label7; private TextBox textBox3; private Label label6; private TextBox textBox2; private Timer timer2; private TextBox textBox7; private Label label1; String connectionString = "Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.19)(PORT =1521)))(CONNECT_DATA =(SERVICE_NAME = ORCL)));Persist Security Info=True;User Id = abtdev;Password=abt_dev"; //String connectionString = "Data Source = 192.168.1.19; Initial Catalog = abtdev; User ID = abtdev; Password=abt_dev"; #endregion #region 初始化数据 public GSBGBarcodeFrm() { InitializeComponent(); this.TopMost = true; // 窗口置顶 // this.FormBorderStyle = FormBorderStyle.None; // 去除边框 // this.SetStyle(ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true); // 设置样式 this.WindowState = FormWindowState.Maximized;//最大化 this.textBox1.Focus(); // 默认聚焦到textbox1 SQL = new SQLHelper(connStr); // OraSQL = new OracleHelper(connectionString); // string sql = "select BarcodeNO 条码号,LinesName 线别,WorkNo 工单单号,Product 产品类型,CheckCategory1 检测类别1,CheckCategory2 检测类别2,CheckCategory3 检测类别3,CheckCategory4 检测类别4,CheckCategory5 检测类别5,CheckCategory6 检测类别6,CheckCategory7 检测类别7,CheckCategory8 检测类别8,CheckCategory9 检测类别9,CheckCategory10 检测类别10 from BGBarcode where 1=2"; string sql = "select BARCODE,CREATETIME,BILLNO,QUANTITY,PORESULT,ERMSG from GSLOG_BG(NOLOCK) where 1 = 2"; // dtWC = OraSQL.ReturnDataSet("SELECT BARCODENO,'' CHEEKTIME ,LINESNAME,WORKNO,PRODUCT,CHECKCATEGORY1,CHECKCATEGORY2,CHECKCATEGORY3,CHECKCATEGORY4,CHECKCATEGORY5,CHECKCATEGORY6,CHECKCATEGORY7,CHECKCATEGORY8,CHECKCATEGORY9,CHECKCATEGORY10 FROM BGBarcode where 1 = 2", "BGBarcode").Tables[0]; dtWC = SQL.ExecuteDataTable(sql); dtWC.Columns.Add("BianNo"); dataGridView1.DataSource = dtWC; dataGridView1.Columns[0].HeaderText = "条码"; dataGridView1.Columns[1].HeaderText = "报工时间"; dataGridView1.Columns[2].HeaderText = "工单单号"; dataGridView1.Columns[3].HeaderText = "报工数量"; dataGridView1.Columns[4].HeaderText = "报工结果"; dataGridView1.Columns[5].HeaderText = "返回信息"; // dataGridView1.Columns[0].Width = 200; //comboBox2.Enabled = false; //comboBox1.ForeColor = System.Drawing.Color.Yellow; } #endregion #region 初始化 private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.panel1 = new System.Windows.Forms.Panel(); this.textBox7 = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.textBox6 = new System.Windows.Forms.TextBox(); this.textBox5 = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.textBox4 = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.textBox3 = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.panel2 = new System.Windows.Forms.Panel(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.BianNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.timer2 = new System.Windows.Forms.Timer(this.components); this.bGBarcodeBindingSource = new System.Windows.Forms.BindingSource(this.components); this.weightCollectDataSet1 = new GSproduction.WeightCollectDataSet1(); this.bGBarcodeTableAdapter = new GSproduction.WeightCollectDataSet1TableAdapters.BGBarcodeTableAdapter(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bGBarcodeBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.weightCollectDataSet1)).BeginInit(); this.SuspendLayout(); // // panel1 // this.panel1.Controls.Add(this.textBox7); this.panel1.Controls.Add(this.label1); this.panel1.Controls.Add(this.label10); this.panel1.Controls.Add(this.textBox6); this.panel1.Controls.Add(this.textBox5); this.panel1.Controls.Add(this.label9); this.panel1.Controls.Add(this.label8); this.panel1.Controls.Add(this.textBox4); this.panel1.Controls.Add(this.label7); this.panel1.Controls.Add(this.textBox3); this.panel1.Controls.Add(this.label6); this.panel1.Controls.Add(this.textBox2); this.panel1.Controls.Add(this.textBox1); this.panel1.Controls.Add(this.label5); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.panel1.ForeColor = System.Drawing.Color.Black; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(1039, 449); this.panel1.TabIndex = 0; this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // // textBox7 // this.textBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox7.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox7.Location = new System.Drawing.Point(168, 382); this.textBox7.Name = "textBox7"; this.textBox7.ReadOnly = true; this.textBox7.Size = new System.Drawing.Size(815, 38); this.textBox7.TabIndex = 22; this.textBox7.TextChanged += new System.EventHandler(this.textBox7_TextChanged); // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Location = new System.Drawing.Point(30, 385); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(120, 27); this.label1.TabIndex = 23; this.label1.Text = "已报工数"; this.label1.Click += new System.EventHandler(this.label1_Click); // // label10 // this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label10.Location = new System.Drawing.Point(30, 104); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(120, 27); this.label10.TabIndex = 19; this.label10.Text = "指令单号"; this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.label10.Click += new System.EventHandler(this.label10_Click); // // textBox6 // this.textBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox6.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox6.Location = new System.Drawing.Point(169, 101); this.textBox6.Name = "textBox6"; this.textBox6.ReadOnly = true; this.textBox6.Size = new System.Drawing.Size(815, 38); this.textBox6.TabIndex = 18; this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged); // // textBox5 // this.textBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox5.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox5.Location = new System.Drawing.Point(168, 321); this.textBox5.Name = "textBox5"; this.textBox5.ReadOnly = true; this.textBox5.Size = new System.Drawing.Size(816, 38); this.textBox5.TabIndex = 20; this.textBox5.TextChanged += new System.EventHandler(this.textBox5_TextChanged); // // label9 // this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label9.Location = new System.Drawing.Point(29, 324); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(120, 27); this.label9.TabIndex = 21; this.label9.Text = "工单数量"; this.label9.Click += new System.EventHandler(this.label9_Click); // // label8 // this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label8.Location = new System.Drawing.Point(29, 271); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(120, 27); this.label8.TabIndex = 17; this.label8.Text = "产品规格"; // // textBox4 // this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox4.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox4.Location = new System.Drawing.Point(169, 268); this.textBox4.Name = "textBox4"; this.textBox4.ReadOnly = true; this.textBox4.Size = new System.Drawing.Size(815, 34); this.textBox4.TabIndex = 16; this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged); // // label7 // this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label7.Location = new System.Drawing.Point(30, 215); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(120, 27); this.label7.TabIndex = 15; this.label7.Text = "产品名称"; // // textBox3 // this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox3.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox3.Location = new System.Drawing.Point(169, 212); this.textBox3.Name = "textBox3"; this.textBox3.ReadOnly = true; this.textBox3.Size = new System.Drawing.Size(815, 38); this.textBox3.TabIndex = 14; this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged); // // label6 // this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label6.Location = new System.Drawing.Point(30, 157); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(120, 27); this.label6.TabIndex = 13; this.label6.Text = "产品编码"; // // textBox2 // this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox2.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox2.Location = new System.Drawing.Point(169, 154); this.textBox2.Name = "textBox2"; this.textBox2.ReadOnly = true; this.textBox2.Size = new System.Drawing.Size(815, 38); this.textBox2.TabIndex = 12; // // textBox1 // this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox1.Location = new System.Drawing.Point(169, 42); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(815, 42); this.textBox1.TabIndex = 9; this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress); // // label5 // this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label5.Location = new System.Drawing.Point(29, 45); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(73, 30); this.label5.TabIndex = 8; this.label5.Text = "条码"; this.label5.Click += new System.EventHandler(this.label5_Click); // // timer1 // this.timer1.Enabled = true; this.timer1.Interval = 1000; // // panel2 // this.panel2.Controls.Add(this.dataGridView1); this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.panel2.Location = new System.Drawing.Point(0, 449); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(1039, 78); this.panel2.TabIndex = 1; // // dataGridView1 // this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.BianNo}); this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.Location = new System.Drawing.Point(0, 0); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowHeadersWidth = 51; this.dataGridView1.RowTemplate.Height = 27; this.dataGridView1.Size = new System.Drawing.Size(1039, 78); this.dataGridView1.TabIndex = 0; this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); this.dataGridView1.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_ColumnHeaderMouseClick); // // BianNo // this.BianNo.DataPropertyName = "BianNo"; this.BianNo.HeaderText = "编号"; this.BianNo.MinimumWidth = 6; this.BianNo.Name = "BianNo"; this.BianNo.ReadOnly = true; // // timer2 // this.timer2.Enabled = true; this.timer2.Interval = 2000; // // bGBarcodeBindingSource // this.bGBarcodeBindingSource.DataMember = "BGBarcode"; this.bGBarcodeBindingSource.DataSource = this.weightCollectDataSet1; // // weightCollectDataSet1 // this.weightCollectDataSet1.DataSetName = "WeightCollectDataSet1"; this.weightCollectDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // bGBarcodeTableAdapter // this.bGBarcodeTableAdapter.ClearBeforeFill = true; // // GSBGBarcodeFrm // this.ClientSize = new System.Drawing.Size(1039, 527); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Name = "GSBGBarcodeFrm"; this.Text = "产线报工"; this.Load += new System.EventHandler(this.GSBGBarcodeFrm_Load); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bGBarcodeBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.weightCollectDataSet1)).EndInit(); this.ResumeLayout(false); } #endregion #region 初始化窗口、启动下拉控件 private void GSBGBarcodeFrm_Load(object sender, EventArgs e) { this.textBox1.Focus(); // TODO: 这行代码将数据加载到表“weightCollectDataSet1.BGBarcode”中。您可以根据需要移动或删除它。 //this.bGBarcodeTableAdapter.Fill(this.weightCollectDataSet1.BGBarcode); //下拉选择工单 //tbB = SQL.ExecuteDataTable("SELECT WORKNO FROM WORKN(NOLOCK)");//条码表 // tbB =OraSQL.ReturnDataSet("SELECT DAA001,DAA002,DAA003,DAA004,DAA006,DAA007,DAA008,DAA015,DAA021 FROM WOMDAA WHERE DAA006>SYSDATE-2", "WOMDAA").Tables[0]; ////tbB.TableName = "WORKN"; //foreach (DataRow dr in tbB.Rows) //{ // comboBox1.Items.Add(dr["DAA001"]); //} //////下拉选择产线 ////tbC = OraSQL.ReturnDataSet("SELECT LinesName FROM XBNO", "XBNO").Tables[0];//线别表 ////foreach (DataRow dc in tbC.Rows) ////{ //// comboBox2.Items.Add(dc[0]); ////} ////下拉选择工艺 //tbD = OraSQL.ReturnDataSet("SELECT PolytechnicName FROM Polytechnic", "Polytechnic").Tables[0];//工艺表 //foreach (DataRow dd in tbD.Rows) //{ // comboBox3.Items.Add(dd[0]); //} } #endregion #region 扫描条码回车事件 private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { SQL = new SQLHelper(connStr); string sqlCommand = string.Format(@"EXEC dbo.[WMS_CREATE_SAOMIAOBG] '{0}'", textBox1.Text); DataTable tb1 = SQL.ExecuteDataTable(sqlCommand); b = b + 1; //将值插入报工对象类中 wc.BianNo = b.ToString(); //编号 wc.BarcodeNO = textBox1.Text.ToString(); //条码 wc.CHEEKTIME = tb1.Rows[0]["STR2"].ToString(); //时间 wc.LinesName = tb1.Rows[0]["STR3"].ToString(); //工单号 wc.WorkNo = tb1.Rows[0]["STR4"].ToString(); //报工数量 wc.Product = tb1.Rows[0]["STR5"].ToString(); //结果 wc.CheckCategory1 = tb1.Rows[0]["STR6"].ToString(); //错误信息 textBox6.Text = tb1.Rows[0]["STR3"].ToString(); textBox5.Text = tb1.Rows[0]["GSZS"].ToString(); textBox7.Text = tb1.Rows[0]["BGZS"].ToString(); textBox2.Text = tb1.Rows[0]["ITEMNO"].ToString(); textBox3.Text = tb1.Rows[0]["ITEMNAME"].ToString(); textBox4.Text = tb1.Rows[0]["ITEMMODEL"].ToString(); InsertRowToDataTable(wc); textBox1.Text = ""; textBox1.Focus(); } } #endregion #region 将数据增加到表格中 InsertRowToDataTable(GSproductionClass wc) /// /// 将数据增加到表格中 /// /// 数据类 private void InsertRowToDataTable(GSproductionClass wc) { DataRow newRow = dtWC.NewRow(); newRow["BianNo"] = wc.BianNo; newRow["BARCODE"] = wc.BarcodeNO; newRow["CREATETIME"] = wc.CHEEKTIME; newRow["BILLNO"] = wc.LinesName; newRow["QUANTITY"] = wc.WorkNo; newRow["PORESULT"] = wc.Product; newRow["ERMSG"] = wc.CheckCategory1; dtWC.Rows.InsertAt(newRow, 0); } #endregion #region 表格排序 dataGridView1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) /// /// 表格排序 /// /// 数据类 private void dataGridView1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { switch (dataGridView1.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection) { case SortOrder.None: break; case SortOrder.Ascending: dataGridView1.Sort(dataGridView1.Columns[e.ColumnIndex], ListSortDirection.Ascending); break; case SortOrder.Descending: dataGridView1.Sort(dataGridView1.Columns[e.ColumnIndex], ListSortDirection.Descending); dataGridView1.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = SortOrder.Descending; break; default: break; } } private void Form1_Load(object sender, EventArgs e) { textBox1.Select(); } #endregion #region 声音播放 private void playT(string s) { SpeechVoiceSpeakFlags Flags = SpeechVoiceSpeakFlags.SVSFlagsAsync; SpVoice voice = new SpVoice(); voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0); voice.Rate = 0; voice.Volume = 100; voice.Speak(s, Flags); } #endregion private void textBox6_TextChanged(object sender, EventArgs e) { textBox1.Focus(); } private void panel1_Paint(object sender, PaintEventArgs e) { textBox1.Focus(); } private void label5_Click(object sender, EventArgs e) { textBox1.Focus(); } private void label10_Click(object sender, EventArgs e) { textBox1.Focus(); } private void label9_Click(object sender, EventArgs e) { textBox1.Focus(); } private void textBox5_TextChanged(object sender, EventArgs e) { textBox1.Focus(); } private void label1_Click(object sender, EventArgs e) { textBox1.Focus(); } private void textBox7_TextChanged(object sender, EventArgs e) { textBox1.Focus(); } private void textBox3_TextChanged(object sender, EventArgs e) { textBox1.Focus(); } private void textBox4_TextChanged(object sender, EventArgs e) { textBox1.Focus(); } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { textBox1.Focus(); } } }