Browse Source

库存条码解析生成

callm 8 months ago
parent
commit
07b44f37bf

+ 107 - 96
UAS_BARCODEIO/入库条码规则解析.Designer.cs

@@ -53,16 +53,6 @@
             this.label8 = new System.Windows.Forms.Label();
             this.GenBarCode = new System.Windows.Forms.Button();
             this.BarcodeIO = new System.Windows.Forms.DataGridView();
-            this.CheckBox = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pr_orispeccode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bi_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bi_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bi_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bi_inqty1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bi_vendbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bi_madedate = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_spec1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_detail1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.PrintBarCode = new System.Windows.Forms.Button();
             this.PrinterList = new System.Windows.Forms.ComboBox();
             this.label9 = new System.Windows.Forms.Label();
@@ -78,6 +68,17 @@
             this.DeletaBarcode = new System.Windows.Forms.Button();
             this.SCCODE = new System.Windows.Forms.TextBox();
             this.label11 = new System.Windows.Forms.Label();
+            this.CheckBox = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pr_orispeccode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bi_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bi_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bi_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bi_inqty1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bi_sccode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bi_vendbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bi_madedate = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_spec1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_detail1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.Prodiodetail)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.BarcodeIO)).BeginInit();
             this.SuspendLayout();
@@ -336,6 +337,7 @@
             this.bi_barcode,
             this.bi_outboxcode,
             this.bi_inqty1,
+            this.bi_sccode,
             this.bi_vendbarcode,
             this.bi_madedate,
             this.pr_spec1,
@@ -347,86 +349,6 @@
             this.BarcodeIO.Size = new System.Drawing.Size(2097, 595);
             this.BarcodeIO.TabIndex = 35;
             // 
-            // CheckBox
-            // 
-            this.CheckBox.DataPropertyName = "CheckBox";
-            this.CheckBox.HeaderText = "勾选";
-            this.CheckBox.MinimumWidth = 10;
-            this.CheckBox.Name = "CheckBox";
-            this.CheckBox.Width = 200;
-            // 
-            // pr_orispeccode
-            // 
-            this.pr_orispeccode.DataPropertyName = "pr_orispeccode";
-            this.pr_orispeccode.HeaderText = "型号";
-            this.pr_orispeccode.MinimumWidth = 10;
-            this.pr_orispeccode.Name = "pr_orispeccode";
-            this.pr_orispeccode.Width = 200;
-            // 
-            // bi_prodcode
-            // 
-            this.bi_prodcode.DataPropertyName = "bi_prodcode";
-            this.bi_prodcode.HeaderText = "料号";
-            this.bi_prodcode.MinimumWidth = 10;
-            this.bi_prodcode.Name = "bi_prodcode";
-            this.bi_prodcode.Width = 200;
-            // 
-            // bi_barcode
-            // 
-            this.bi_barcode.DataPropertyName = "bi_barcode";
-            this.bi_barcode.HeaderText = "条码号";
-            this.bi_barcode.MinimumWidth = 10;
-            this.bi_barcode.Name = "bi_barcode";
-            this.bi_barcode.Width = 200;
-            // 
-            // bi_outboxcode
-            // 
-            this.bi_outboxcode.DataPropertyName = "bi_outboxcode";
-            this.bi_outboxcode.HeaderText = "外箱条码";
-            this.bi_outboxcode.MinimumWidth = 10;
-            this.bi_outboxcode.Name = "bi_outboxcode";
-            this.bi_outboxcode.Width = 200;
-            // 
-            // bi_inqty1
-            // 
-            this.bi_inqty1.DataPropertyName = "bi_inqty";
-            this.bi_inqty1.HeaderText = "入库数量";
-            this.bi_inqty1.MinimumWidth = 10;
-            this.bi_inqty1.Name = "bi_inqty1";
-            this.bi_inqty1.Width = 200;
-            // 
-            // bi_vendbarcode
-            // 
-            this.bi_vendbarcode.DataPropertyName = "bi_vendbarcode";
-            this.bi_vendbarcode.HeaderText = "LOTNO";
-            this.bi_vendbarcode.MinimumWidth = 10;
-            this.bi_vendbarcode.Name = "bi_vendbarcode";
-            this.bi_vendbarcode.Width = 200;
-            // 
-            // bi_madedate
-            // 
-            this.bi_madedate.DataPropertyName = "bi_madedate";
-            this.bi_madedate.HeaderText = "DC";
-            this.bi_madedate.MinimumWidth = 10;
-            this.bi_madedate.Name = "bi_madedate";
-            this.bi_madedate.Width = 200;
-            // 
-            // pr_spec1
-            // 
-            this.pr_spec1.DataPropertyName = "pr_spec";
-            this.pr_spec1.HeaderText = "规格";
-            this.pr_spec1.MinimumWidth = 10;
-            this.pr_spec1.Name = "pr_spec1";
-            this.pr_spec1.Width = 200;
-            // 
-            // pr_detail1
-            // 
-            this.pr_detail1.DataPropertyName = "pr_detail";
-            this.pr_detail1.HeaderText = "物料名称";
-            this.pr_detail1.MinimumWidth = 10;
-            this.pr_detail1.Name = "pr_detail1";
-            this.pr_detail1.Width = 200;
-            // 
             // PrintBarCode
             // 
             this.PrintBarCode.Location = new System.Drawing.Point(1922, 273);
@@ -582,6 +504,94 @@
             this.label11.TabIndex = 48;
             this.label11.Text = "SCCODE";
             // 
+            // CheckBox
+            // 
+            this.CheckBox.DataPropertyName = "CheckBox";
+            this.CheckBox.HeaderText = "勾选";
+            this.CheckBox.MinimumWidth = 10;
+            this.CheckBox.Name = "CheckBox";
+            this.CheckBox.Width = 200;
+            // 
+            // pr_orispeccode
+            // 
+            this.pr_orispeccode.DataPropertyName = "pr_orispeccode";
+            this.pr_orispeccode.HeaderText = "型号";
+            this.pr_orispeccode.MinimumWidth = 10;
+            this.pr_orispeccode.Name = "pr_orispeccode";
+            this.pr_orispeccode.Width = 200;
+            // 
+            // bi_prodcode
+            // 
+            this.bi_prodcode.DataPropertyName = "bi_prodcode";
+            this.bi_prodcode.HeaderText = "料号";
+            this.bi_prodcode.MinimumWidth = 10;
+            this.bi_prodcode.Name = "bi_prodcode";
+            this.bi_prodcode.Width = 200;
+            // 
+            // bi_barcode
+            // 
+            this.bi_barcode.DataPropertyName = "bi_barcode";
+            this.bi_barcode.HeaderText = "条码号";
+            this.bi_barcode.MinimumWidth = 10;
+            this.bi_barcode.Name = "bi_barcode";
+            this.bi_barcode.Width = 200;
+            // 
+            // bi_outboxcode
+            // 
+            this.bi_outboxcode.DataPropertyName = "bi_outboxcode";
+            this.bi_outboxcode.HeaderText = "外箱条码";
+            this.bi_outboxcode.MinimumWidth = 10;
+            this.bi_outboxcode.Name = "bi_outboxcode";
+            this.bi_outboxcode.Width = 200;
+            // 
+            // bi_inqty1
+            // 
+            this.bi_inqty1.DataPropertyName = "bi_inqty";
+            this.bi_inqty1.HeaderText = "入库数量";
+            this.bi_inqty1.MinimumWidth = 10;
+            this.bi_inqty1.Name = "bi_inqty1";
+            this.bi_inqty1.Width = 200;
+            // 
+            // bi_sccode
+            // 
+            this.bi_sccode.DataPropertyName = "bi_sccode";
+            this.bi_sccode.HeaderText = "SCCODE";
+            this.bi_sccode.MinimumWidth = 10;
+            this.bi_sccode.Name = "bi_sccode";
+            this.bi_sccode.Width = 200;
+            // 
+            // bi_vendbarcode
+            // 
+            this.bi_vendbarcode.DataPropertyName = "bi_vendbarcode";
+            this.bi_vendbarcode.HeaderText = "LOTNO";
+            this.bi_vendbarcode.MinimumWidth = 10;
+            this.bi_vendbarcode.Name = "bi_vendbarcode";
+            this.bi_vendbarcode.Width = 200;
+            // 
+            // bi_madedate
+            // 
+            this.bi_madedate.DataPropertyName = "bi_madedate";
+            this.bi_madedate.HeaderText = "DC";
+            this.bi_madedate.MinimumWidth = 10;
+            this.bi_madedate.Name = "bi_madedate";
+            this.bi_madedate.Width = 200;
+            // 
+            // pr_spec1
+            // 
+            this.pr_spec1.DataPropertyName = "pr_spec";
+            this.pr_spec1.HeaderText = "规格";
+            this.pr_spec1.MinimumWidth = 10;
+            this.pr_spec1.Name = "pr_spec1";
+            this.pr_spec1.Width = 200;
+            // 
+            // pr_detail1
+            // 
+            this.pr_detail1.DataPropertyName = "pr_detail";
+            this.pr_detail1.HeaderText = "物料名称";
+            this.pr_detail1.MinimumWidth = 10;
+            this.pr_detail1.Name = "pr_detail1";
+            this.pr_detail1.Width = 200;
+            // 
             // 入库条码规则解析
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
@@ -669,22 +679,23 @@
         private System.Windows.Forms.Label 原厂型号;
         private System.Windows.Forms.CheckBox GenBoxCode;
         private System.Windows.Forms.Button PrintBox;
+        private System.Windows.Forms.TextBox pr_orispeccode3;
+        private System.Windows.Forms.Label label10;
+        private System.Windows.Forms.Button PrintStockBarCode;
+        private System.Windows.Forms.Button DeletaBarcode;
+        private System.Windows.Forms.TextBox SCCODE;
+        private System.Windows.Forms.Label label11;
         private System.Windows.Forms.DataGridViewCheckBoxColumn CheckBox;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_orispeccode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_barcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_outboxcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_inqty1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bi_sccode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_vendbarcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_madedate;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail1;
-        private System.Windows.Forms.TextBox pr_orispeccode3;
-        private System.Windows.Forms.Label label10;
-        private System.Windows.Forms.Button PrintStockBarCode;
-        private System.Windows.Forms.Button DeletaBarcode;
-        private System.Windows.Forms.TextBox SCCODE;
-        private System.Windows.Forms.Label label11;
     }
 }
 

+ 4 - 3
UAS_BARCODEIO/入库条码规则解析.cs

@@ -317,7 +317,7 @@ namespace UAS_BARCODEIO
 
         private void LoadBarcodeioData(string pr_code)
         {
-            string sql = "select 0 CheckBox,bi_barcode,bi_inqty,bi_datecode,bi_outboxcode,bi_vendbarcode,to_char(bi_madedate,'yyyy-mm-dd')bi_madedate,pr_detail,pr_spec,bi_prodcode,pr_orispeccode from barcodeio left join product on bi_prodcode=pr_code where bi_inoutno='" + pi_inoutno.Text + "' and bi_prodcode='" + pr_code + "'";
+            string sql = "select 0 CheckBox,bi_sccode,bi_barcode,bi_inqty,bi_datecode,bi_outboxcode,bi_vendbarcode,to_char(bi_madedate,'yyyy-mm-dd')bi_madedate,pr_detail,pr_spec,bi_prodcode,pr_orispeccode from barcodeio left join product on bi_prodcode=pr_code where bi_inoutno='" + pi_inoutno.Text + "' and bi_prodcode='" + pr_code + "'";
             DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
             BaseUtil.FillDgvWithDataTable(BarcodeIO, dt);
         }
@@ -498,14 +498,15 @@ namespace UAS_BARCODEIO
             if (Type == "OK")
             {
                 FileName = System.Windows.Forms.Application.StartupPath + @"\Resources\Sound\8378.wav";
-                thread.Start();
                 thread = new Thread(PlaySound);
+                thread.Start();
+            
             }
             else
             {
                 FileName = System.Windows.Forms.Application.StartupPath + @"\Resources\Sound\5185.wav";
-                thread.Start();
                 thread = new Thread(PlaySound);
+                thread.Start();
             }
         }
 

+ 3 - 0
UAS_BARCODEIO/入库条码规则解析.resx

@@ -156,6 +156,9 @@
   <metadata name="bi_inqty1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="bi_sccode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="bi_vendbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>

+ 42 - 6
UAS_BARCODEIO/库存条码打印.Designer.cs

@@ -57,6 +57,8 @@
             this.label2 = new System.Windows.Forms.Label();
             this.pr_code = new UAS_BARCODEIO.SearchTextBox();
             this.QueryBarcode = new System.Windows.Forms.Button();
+            this.sc_code = new System.Windows.Forms.TextBox();
+            this.label11 = new System.Windows.Forms.Label();
             this.CheckBox = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pr_orispeccode4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bar_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -65,6 +67,7 @@
             this.bar_remain = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bar_vendbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bar_madedate = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.sc_code1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_spec1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_detail1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.BarcodeIO)).BeginInit();
@@ -142,7 +145,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(30, 524);
+            this.label6.Location = new System.Drawing.Point(30, 518);
             this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(103, 38);
@@ -151,7 +154,7 @@
             // 
             // pr_zxbzs
             // 
-            this.pr_zxbzs.Location = new System.Drawing.Point(199, 584);
+            this.pr_zxbzs.Location = new System.Drawing.Point(199, 626);
             this.pr_zxbzs.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.pr_zxbzs.Name = "pr_zxbzs";
             this.pr_zxbzs.Size = new System.Drawing.Size(436, 35);
@@ -161,7 +164,7 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(30, 584);
+            this.label7.Location = new System.Drawing.Point(30, 626);
             this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(133, 38);
@@ -213,6 +216,7 @@
             this.bar_remain,
             this.bar_vendbarcode,
             this.bar_madedate,
+            this.sc_code1,
             this.pr_spec1,
             this.pr_detail1});
             this.BarcodeIO.Location = new System.Drawing.Point(27, 731);
@@ -235,7 +239,7 @@
             // PrinterList
             // 
             this.PrinterList.FormattingEnabled = true;
-            this.PrinterList.Location = new System.Drawing.Point(199, 658);
+            this.PrinterList.Location = new System.Drawing.Point(198, 691);
             this.PrinterList.Name = "PrinterList";
             this.PrinterList.Size = new System.Drawing.Size(312, 32);
             this.PrinterList.TabIndex = 37;
@@ -244,7 +248,7 @@
             // 
             this.label9.AutoSize = true;
             this.label9.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label9.Location = new System.Drawing.Point(30, 652);
+            this.label9.Location = new System.Drawing.Point(29, 685);
             this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label9.Name = "label9";
             this.label9.Size = new System.Drawing.Size(162, 38);
@@ -366,7 +370,7 @@
             // 
             // QueryBarcode
             // 
-            this.QueryBarcode.Location = new System.Drawing.Point(549, 181);
+            this.QueryBarcode.Location = new System.Drawing.Point(534, 181);
             this.QueryBarcode.Name = "QueryBarcode";
             this.QueryBarcode.Size = new System.Drawing.Size(101, 45);
             this.QueryBarcode.TabIndex = 48;
@@ -374,6 +378,25 @@
             this.QueryBarcode.UseVisualStyleBackColor = true;
             this.QueryBarcode.Click += new System.EventHandler(this.QueryBarcode_Click);
             // 
+            // sc_code
+            // 
+            this.sc_code.Location = new System.Drawing.Point(199, 576);
+            this.sc_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.sc_code.Name = "sc_code";
+            this.sc_code.Size = new System.Drawing.Size(436, 35);
+            this.sc_code.TabIndex = 50;
+            // 
+            // label11
+            // 
+            this.label11.AutoSize = true;
+            this.label11.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label11.Location = new System.Drawing.Point(29, 570);
+            this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label11.Name = "label11";
+            this.label11.Size = new System.Drawing.Size(134, 38);
+            this.label11.TabIndex = 49;
+            this.label11.Text = "SCCODE";
+            // 
             // CheckBox
             // 
             this.CheckBox.DataPropertyName = "CheckBox";
@@ -438,6 +461,14 @@
             this.bar_madedate.Name = "bar_madedate";
             this.bar_madedate.Width = 200;
             // 
+            // sc_code1
+            // 
+            this.sc_code1.DataPropertyName = "sc_code";
+            this.sc_code1.HeaderText = "SCCODE";
+            this.sc_code1.MinimumWidth = 10;
+            this.sc_code1.Name = "sc_code1";
+            this.sc_code1.Width = 200;
+            // 
             // pr_spec1
             // 
             this.pr_spec1.DataPropertyName = "pr_spec";
@@ -459,6 +490,8 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(2136, 1338);
+            this.Controls.Add(this.sc_code);
+            this.Controls.Add(this.label11);
             this.Controls.Add(this.QueryBarcode);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.bar_indate);
@@ -531,6 +564,8 @@
         private System.Windows.Forms.Label label2;
         private UAS_BARCODEIO.SearchTextBox pr_code;
         private System.Windows.Forms.Button QueryBarcode;
+        private System.Windows.Forms.TextBox sc_code;
+        private System.Windows.Forms.Label label11;
         private System.Windows.Forms.DataGridViewCheckBoxColumn CheckBox;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_orispeccode4;
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_prodcode;
@@ -539,6 +574,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_remain;
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_vendbarcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_madedate;
+        private System.Windows.Forms.DataGridViewTextBoxColumn sc_code1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail1;
     }

+ 58 - 4
UAS_BARCODEIO/库存条码打印.cs

@@ -6,6 +6,8 @@ using System.Data;
 using System.Drawing;
 using System.Drawing.Printing;
 using System.Linq;
+using System.Media;
+using System.Threading;
 using System.Windows.Forms;
 using static System.Runtime.CompilerServices.RuntimeHelpers;
 
@@ -112,6 +114,7 @@ namespace UAS_BARCODEIO
                 if (dt.Rows.Count == 0)
                 {
                     MessageBox.Show("无条码解析规则");
+                    Play("NG");
                     return;
                 }
                 string split = dt.Rows[0]["el_type"].ToString();
@@ -120,6 +123,7 @@ namespace UAS_BARCODEIO
                 if (str.Length < dt.Rows.Count)
                 {
                     MessageBox.Show("无条码解析规则");
+                    Play("NG");
                     return;
                 }
                 for (int i = 0; i < dt.Rows.Count; i++)
@@ -140,6 +144,9 @@ namespace UAS_BARCODEIO
                         case "QTY":
                             INQTY.Text = str[int.Parse(index) - 1];
                             break;
+                        case "SCCODE":
+                            sc_code.Text = str[int.Parse(index) - 1];
+                            break;
                         default:
                             break;
                     }
@@ -153,6 +160,8 @@ namespace UAS_BARCODEIO
                 INQTY.Text = outqty;
                 LOTNO.Text = lotno;
                 pr_orispeccode3.Text = spec;
+                GenBarCode.PerformClick();
+                Play("OK");
             }
         }
         bool AutoSized = false;
@@ -170,6 +179,7 @@ namespace UAS_BARCODEIO
             if (pr_orispeccode.Text != pr_orispeccode3.Text)
             {
                 MessageBox.Show("解析型号和单据型号不对应");
+                Play("NG");
                 return;
             }
             int Minpackage = 0;
@@ -178,6 +188,7 @@ namespace UAS_BARCODEIO
             if (!int.TryParse(pr_zxbzs.Text, out Minpackage))
             {
                 MessageBox.Show("最小包装数错误,料号" + pr_code.Text);
+                Play("NG");
                 return;
             }
             string outboxcode = "";
@@ -193,6 +204,7 @@ namespace UAS_BARCODEIO
             List<string> bar_code = new List<string>();
             List<string> bar_vendbarcode = new List<string>();
             List<string> bar_madedate = new List<string>();
+            List<string> bar_sccode = new List<string>();
             for (int i = 0; i < barcount; i++)
             {
                 string barcode = "";
@@ -221,18 +233,20 @@ namespace UAS_BARCODEIO
                 bar_code.Add(barcode);
                 bar_vendbarcode.Add(LOTNO.Text);
                 bar_madedate.Add(DC.Text);
+                bar_sccode.Add(sc_code.Text);
+
             }
             string sql = "insert into barcode(BAR_ID, bar_code, bar_prodcode, BAR_remain,bar_vendbarcode, " +
-                 "bar_madedate, BAR_PRODID, BAR_STATUS, BAR_CHECKMAN, BAR_INDATE,BAR_OUTBOXCODE1)select barcode_seq.nextval,:bar_code," +
-                 "'" + pr_code.Text + "',:bar_remain,:bar_vendbarcode,to_date(:bar_madedate,'yyyy-mm-dd'),pr_id,1,'管理员',sysdate,'" + outboxcode + "' " +
+                 "bar_madedate, BAR_PRODID, BAR_STATUS, BAR_CHECKMAN, BAR_INDATE,BAR_OUTBOXCODE1,bar_sccode)select barcode_seq.nextval,:bar_code," +
+                 "'" + pr_code.Text + "',:bar_remain,:bar_vendbarcode,to_date(:bar_madedate,'yyyy-mm-dd'),pr_id,1,'管理员',sysdate,'" + outboxcode + "',:bar_sccode " +
                  " from product where pr_code='" + pr_code.Text + "'";
-            dh.BatchInsert(sql, new string[] { "bar_code", "bar_remain", "bar_vendbarcode", "bar_madedate" }, bar_code.ToArray(), BAR_inqty.ToArray(), bar_vendbarcode.ToArray(), bar_madedate.ToArray());
+            dh.BatchInsert(sql, new string[] { "bar_code", "bar_remain", "bar_vendbarcode", "bar_madedate", "bar_sccode" }, bar_code.ToArray(), BAR_inqty.ToArray(), bar_vendbarcode.ToArray(), bar_madedate.ToArray(), bar_sccode.ToArray());
             LoadBarcodeioData(pr_code.Text);
         }
 
         private void LoadBarcodeioData(string pr_code)
         {
-            string sql = "select 0 CheckBox,bar_code,bar_remain,bar_indate,BAR_OUTBOXCODE1,bar_vendbarcode,to_char(bar_madedate,'yyyy-mm-dd')bar_madedate,pr_detail,pr_spec,bar_prodcode,pr_orispeccode from barcode left join product on bar_prodcode=pr_code where to_char(bar_indate,'yyyy-mm-dd')='" + bar_indate.Value.ToString("yyyy-MM-dd") + "' and bar_prodcode='" + pr_code + "'";
+            string sql = "select 0 CheckBox,bar_code,bar_remain,bar_indate,BAR_OUTBOXCODE1,bar_vendbarcode,to_char(bar_madedate,'yyyy-mm-dd')bar_madedate,pr_detail,pr_spec,bar_prodcode,pr_orispeccode,bar_sccode from barcode left join product on bar_prodcode=pr_code where to_char(bar_indate,'yyyy-mm-dd')='" + bar_indate.Value.ToString("yyyy-MM-dd") + "' and bar_prodcode='" + pr_code + "'";
             DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
             BaseUtil.FillDgvWithDataTable(BarcodeIO, dt);
         }
@@ -371,5 +385,45 @@ namespace UAS_BARCODEIO
         {
             LoadBarcodeioData(pr_code.Text);
         }
+
+        Thread thread;
+        string FileName = "";
+
+        public void Play(string Type)
+        {
+            if (Type == "OK")
+            {
+                FileName = System.Windows.Forms.Application.StartupPath + @"\Resources\Sound\8378.wav";
+                thread = new Thread(PlaySound);
+                thread.Start();
+
+            }
+            else
+            {
+                FileName = System.Windows.Forms.Application.StartupPath + @"\Resources\Sound\5185.wav";
+                thread = new Thread(PlaySound);
+                thread.Start();
+            }
+        }
+
+        private void PlaySound()
+        {
+            //要加载COM组件:Microsoft speech object Library    
+            if (!System.IO.File.Exists(FileName))
+            {
+                return;
+            }
+            try
+            {
+                SoundPlayer player = new SoundPlayer();
+                player.SoundLocation = FileName;
+                player.Load();
+                player.Play();
+            }
+            catch (Exception e)
+            {
+                MessageBox.Show(e.Message);
+            }
+        }
     }
 }

+ 3 - 0
UAS_BARCODEIO/库存条码打印.resx

@@ -141,6 +141,9 @@
   <metadata name="bar_madedate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="sc_code1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="pr_spec1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>