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 label8;
|
private TextBox textBox4;
|
private Label label7;
|
private TextBox textBox3;
|
private Label label6;
|
private TextBox textBox2;
|
private Timer timer2;
|
private Label label1;
|
private TextBox textBox6;
|
private Label label2;
|
private TextBox textBox7;
|
private DataTable tbBARDAB;//条码表
|
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.label2 = new System.Windows.Forms.Label();
|
this.textBox7 = new System.Windows.Forms.TextBox();
|
this.label1 = 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.label2);
|
this.panel1.Controls.Add(this.textBox7);
|
this.panel1.Controls.Add(this.label1);
|
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(1356, 449);
|
this.panel1.TabIndex = 0;
|
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
|
//
|
// label2
|
//
|
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Right)));
|
this.label2.AutoSize = true;
|
this.label2.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
this.label2.Location = new System.Drawing.Point(30, 361);
|
this.label2.Name = "label2";
|
this.label2.Size = new System.Drawing.Size(79, 33);
|
this.label2.TabIndex = 23;
|
this.label2.Text = "数量";
|
//
|
// 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(170, 361);
|
this.textBox7.Name = "textBox7";
|
this.textBox7.ReadOnly = true;
|
this.textBox7.Size = new System.Drawing.Size(1131, 44);
|
this.textBox7.TabIndex = 22;
|
//
|
// 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, 361);
|
this.label1.Name = "label1";
|
this.label1.Size = new System.Drawing.Size(79, 33);
|
this.label1.TabIndex = 23;
|
this.label1.Text = "数量";
|
//
|
// 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(170, 361);
|
this.textBox6.Name = "textBox6";
|
this.textBox6.ReadOnly = true;
|
this.textBox6.Size = new System.Drawing.Size(1131, 44);
|
this.textBox6.TabIndex = 22;
|
//
|
// 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(169, 289);
|
this.textBox5.Name = "textBox5";
|
this.textBox5.ReadOnly = true;
|
this.textBox5.Size = new System.Drawing.Size(1132, 44);
|
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(30, 292);
|
this.label9.Name = "label9";
|
this.label9.Size = new System.Drawing.Size(79, 33);
|
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(30, 237);
|
this.label8.Name = "label8";
|
this.label8.Size = new System.Drawing.Size(143, 33);
|
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(170, 234);
|
this.textBox4.Name = "textBox4";
|
this.textBox4.ReadOnly = true;
|
this.textBox4.Size = new System.Drawing.Size(1132, 39);
|
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, 175);
|
this.label7.Name = "label7";
|
this.label7.Size = new System.Drawing.Size(143, 33);
|
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, 172);
|
this.textBox3.Name = "textBox3";
|
this.textBox3.ReadOnly = true;
|
this.textBox3.Size = new System.Drawing.Size(1132, 44);
|
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, 115);
|
this.label6.Name = "label6";
|
this.label6.Size = new System.Drawing.Size(143, 33);
|
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, 112);
|
this.textBox2.Name = "textBox2";
|
this.textBox2.ReadOnly = true;
|
this.textBox2.Size = new System.Drawing.Size(1132, 44);
|
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(1132, 49);
|
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(87, 36);
|
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(1356, 260);
|
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(1356, 260);
|
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(1356, 709);
|
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();
|
}
|
#endregion
|
|
#region 扫描条码回车事件
|
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
|
{
|
if (e.KeyChar == 13)
|
{
|
string sqlstr = String.Format(@"SELECT * FROM BARDAB(NOLOCK) WHERE DAB001='{0}'", textBox1.Text.ToString());
|
tbBARDAB = SQL.ExecuteDataTable(sqlstr);
|
wc.BianNo = b.ToString(); //编号
|
wc.BarcodeNO = textBox1.Text.ToString(); //条码
|
wc.CHEEKTIME = DateTime.Now.ToString(); //时间
|
wc.Product = ""; //结果
|
wc.CheckCategory1 = ""; //错误信息
|
|
if (tbBARDAB.Rows.Count <= 0)
|
{
|
wc.LinesName = ""; //工单号
|
wc.WorkNo = ""; //报工数量
|
wc.Product = "报工失败"; //结果
|
wc.CheckCategory1 = "该条码不存在"; //错误信息
|
InsertRowToDataTable(wc);
|
textBox1.Text = "";
|
return;
|
}
|
|
wc.LinesName = tbBARDAB.Rows[0]["DAB031"].ToString(); //工单号
|
wc.WorkNo = tbBARDAB.Rows[0]["DAB005"].ToString(); //报工数量
|
if (tbBARDAB.Rows[0]["DAB049"].ToString() == "1")
|
{
|
|
wc.Product = "报工失败"; //结果
|
wc.CheckCategory1 = "该条码已报工"; //错误信息
|
InsertRowToDataTable(wc);
|
textBox1.Text = "";
|
return;
|
}
|
textBox2.Text = tbBARDAB.Rows[0]["DAB020"].ToString();
|
textBox3.Text = tbBARDAB.Rows[0]["DAB021"].ToString();
|
textBox4.Text = tbBARDAB.Rows[0]["DAB008"].ToString();
|
textBox5.Text = tbBARDAB.Rows[0]["DAB022"].ToString();
|
textBox7.Text = tbBARDAB.Rows[0]["DAB005"].ToString();
|
|
string sqlstr2 = String.Format(@"EXEC WMS_CREATE_SAOMIAOBG '{0}'", textBox1.Text.ToString());
|
DataTable table = SQL.ExecuteDataTable(sqlstr2);
|
textBox1.Text = "";
|
this.textBox1.Focus();
|
if(table!= null && table.Rows.Count > 0)
|
{
|
if(table.Rows[0]["RESULT"].ToString() == "1")
|
{
|
wc.Product = "报工失败"; //结果
|
wc.CheckCategory1 = table.Rows[0]["MSG"].ToString(); //错误信息
|
}
|
else
|
{
|
wc.Product = "报工成功"; //结果
|
wc.CheckCategory1 = ""; //错误信息
|
}
|
}
|
|
InsertRowToDataTable(wc);
|
|
}
|
}
|
#endregion
|
|
#region 将数据增加到表格中 InsertRowToDataTable(GSproductionClass wc)
|
/// <summary>
|
/// 将数据增加到表格中
|
/// </summary>
|
/// <param name="wc">数据类</param>
|
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)
|
/// <summary>
|
/// 表格排序
|
/// </summary>
|
/// <param name="wc">数据类</param>
|
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();
|
}
|
}
|
}
|