Browse Source

支持声音播放,添加入库字段

callm 1 year ago
parent
commit
deeeddbcc7

+ 31 - 6
UAS_BARCODEIO/入库条码规则解析.Designer.cs

@@ -76,6 +76,8 @@
             this.es_custcode = new UAS_BARCODEIO.SearchTextBox();
             this.PrintStockBarCode = new System.Windows.Forms.Button();
             this.DeletaBarcode = new System.Windows.Forms.Button();
+            this.SCCODE = new System.Windows.Forms.TextBox();
+            this.label11 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.Prodiodetail)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.BarcodeIO)).BeginInit();
             this.SuspendLayout();
@@ -255,7 +257,7 @@
             // 
             // LOTNO
             // 
-            this.LOTNO.Location = new System.Drawing.Point(1445, 533);
+            this.LOTNO.Location = new System.Drawing.Point(1445, 527);
             this.LOTNO.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.LOTNO.Name = "LOTNO";
             this.LOTNO.Size = new System.Drawing.Size(436, 35);
@@ -265,7 +267,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(1276, 533);
+            this.label6.Location = new System.Drawing.Point(1276, 527);
             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);
@@ -274,7 +276,7 @@
             // 
             // ZXBZ
             // 
-            this.ZXBZ.Location = new System.Drawing.Point(1445, 593);
+            this.ZXBZ.Location = new System.Drawing.Point(1445, 627);
             this.ZXBZ.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.ZXBZ.Name = "ZXBZ";
             this.ZXBZ.Size = new System.Drawing.Size(436, 35);
@@ -284,7 +286,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(1276, 593);
+            this.label7.Location = new System.Drawing.Point(1276, 627);
             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);
@@ -438,7 +440,7 @@
             // PrinterList
             // 
             this.PrinterList.FormattingEnabled = true;
-            this.PrinterList.Location = new System.Drawing.Point(1445, 654);
+            this.PrinterList.Location = new System.Drawing.Point(1445, 688);
             this.PrinterList.Name = "PrinterList";
             this.PrinterList.Size = new System.Drawing.Size(312, 32);
             this.PrinterList.TabIndex = 37;
@@ -447,7 +449,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(1276, 648);
+            this.label9.Location = new System.Drawing.Point(1276, 682);
             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);
@@ -561,11 +563,32 @@
             this.DeletaBarcode.UseVisualStyleBackColor = true;
             this.DeletaBarcode.Click += new System.EventHandler(this.DeletaBarcode_Click);
             // 
+            // SCCODE
+            // 
+            this.SCCODE.Location = new System.Drawing.Point(1445, 579);
+            this.SCCODE.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.SCCODE.Name = "SCCODE";
+            this.SCCODE.Size = new System.Drawing.Size(436, 35);
+            this.SCCODE.TabIndex = 49;
+            // 
+            // 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(1276, 579);
+            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 = 48;
+            this.label11.Text = "SCCODE";
+            // 
             // 入库条码规则解析
             // 
             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.SCCODE);
+            this.Controls.Add(this.label11);
             this.Controls.Add(this.DeletaBarcode);
             this.Controls.Add(this.PrintStockBarCode);
             this.Controls.Add(this.pr_orispeccode3);
@@ -660,6 +683,8 @@
         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;
     }
 }
 

+ 62 - 5
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;
 
@@ -110,6 +112,10 @@ namespace UAS_BARCODEIO
                 "where bi_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pr_brand) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode order by pr_code";
             DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
             BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
+            if (Prodiodetail.Rows.Count > SelectIndex)
+            {
+                Prodiodetail.Rows[SelectIndex].Selected = true;
+            }
         }
 
         private void Barcode_KeyDown(object sender, KeyEventArgs e)
@@ -120,6 +126,7 @@ namespace UAS_BARCODEIO
                     " on es_id=esd_esid where es_custcode='" + es_custcode.Text + "'", "select");
                 if (dt.Rows.Count == 0)
                 {
+                    Play("NG");
                     MessageBox.Show("无条码解析规则");
                     return;
                 }
@@ -128,6 +135,7 @@ namespace UAS_BARCODEIO
                 //分割后的字符串数组需要大于设置的参数解析
                 if (str.Length < dt.Rows.Count)
                 {
+                    Play("NG");
                     MessageBox.Show("解析参数与解析规则不匹配");
                     return;
                 }
@@ -149,6 +157,9 @@ namespace UAS_BARCODEIO
                         case "QTY":
                             INQTY.Text = str[int.Parse(index) - 1];
                             break;
+                        case "SCCODE":
+                            SCCODE.Text = str[int.Parse(index) - 1];
+                            break;
                         default:
                             break;
                     }
@@ -157,12 +168,14 @@ namespace UAS_BARCODEIO
                 string outqty;
                 string lotno;
                 string spec;
-                LogicHandler.GetWeekData(DC.Text, INQTY.Text, es_custcode.Text.ToUpper(), pr_orispeccode3.Text,LOTNO.Text, out madedate, out outqty, out lotno,out spec);
+                LogicHandler.GetWeekData(DC.Text, INQTY.Text, es_custcode.Text.ToUpper(), pr_orispeccode3.Text, LOTNO.Text, out madedate, out outqty, out lotno, out spec);
                 DC.Text = madedate;
                 INQTY.Text = outqty;
                 LOTNO.Text = lotno;
                 pr_orispeccode3.Text = spec;
                 Barcode.Clear();
+                GenBarCode.PerformClick();
+                Play("OK");
             }
         }
         bool AutoSized = false;
@@ -219,11 +232,13 @@ namespace UAS_BARCODEIO
             DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
             if (dt.Rows.Count == 0)
             {
+                Play("NG");
                 MessageBox.Show("物料不在对应入库单中" + pi_inoutno.Text);
                 return;
             }
             if (pr_orispeccode2.Text != pr_orispeccode3.Text)
             {
+                Play("NG");
                 MessageBox.Show("解析型号和单据型号不对应");
                 return;
             }
@@ -237,11 +252,13 @@ namespace UAS_BARCODEIO
             int NowInqty = int.Parse(INQTY.Text);
             if (!int.TryParse(ZXBZ.Text, out Minpackage))
             {
+                Play("NG");
                 MessageBox.Show("最小包装数错误,料号" + PR_CODE.Text);
                 return;
             }
             if (int.Parse(INQTY.Text) > pdinqty - barqty)
             {
+                Play("NG");
                 MessageBox.Show("物料采集后超出入库单数量" + PR_CODE.Text);
                 return;
             }
@@ -258,6 +275,7 @@ namespace UAS_BARCODEIO
             List<string> bi_barcode = new List<string>();
             List<string> bi_vendbarcode = new List<string>();
             List<string> bi_madedate = new List<string>();
+            List<string> bi_sccode = new List<string>();
             for (int i = 0; i < barcount; i++)
             {
                 string barcode = "";
@@ -286,12 +304,13 @@ namespace UAS_BARCODEIO
                 bi_barcode.Add(barcode);
                 bi_vendbarcode.Add(LOTNO.Text);
                 bi_madedate.Add(DC.Text);
+                bi_sccode.Add(SCCODE.Text);
             }
             sql = "insert into barcodeio(BI_ID, BI_BARCODE, BI_PIID, BI_PICLASS, BI_INOUTNO, BI_PDNO, BI_PDID, BI_PRODCODE, BI_INQTY,bi_vendbarcode, " +
-                 "BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE,BI_OUTBOXCODE)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
-                 "'" + pd_piclass + "','" + pi_inoutno.Text + "',0,0,'" + PR_CODE.Text + "',:bi_inqty,:bi_vendbarcode,to_date(:bi_madedate,'yyyy-mm-dd'),pr_id,0,'','管理员',sysdate,'" + outboxcode + "' " +
+                 "BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE,BI_OUTBOXCODE,bi_sccode)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
+                 "'" + pd_piclass + "','" + pi_inoutno.Text + "',0,0,'" + PR_CODE.Text + "',:bi_inqty,:bi_vendbarcode,to_date(:bi_madedate,'yyyy-mm-dd'),pr_id,0,'','管理员',sysdate,'" + outboxcode + "',:bi_sccode " +
                  " from product where pr_code='" + PR_CODE.Text + "'";
-            dh.BatchInsert(sql, new string[] { "bi_inqty", "bi_barcode", "bi_vendbarcode", "bi_madedate" }, bi_barcode.ToArray(), bi_inqty.ToArray(), bi_vendbarcode.ToArray(), bi_madedate.ToArray());
+            dh.BatchInsert(sql, new string[] { "bi_inqty", "bi_barcode", "bi_vendbarcode", "bi_madedate" , "bi_sccode" }, bi_barcode.ToArray(), bi_inqty.ToArray(), bi_vendbarcode.ToArray(), bi_madedate.ToArray(),bi_sccode.ToArray());
             LoadGridData();
             LoadBarcodeioData(PR_CODE.Text);
         }
@@ -365,7 +384,7 @@ namespace UAS_BARCODEIO
 
             }
         }
-
+        int SelectIndex = 0;
         private void Prodiodetail_CellClick(object sender, DataGridViewCellEventArgs e)
         {
             if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != "")
@@ -376,6 +395,7 @@ namespace UAS_BARCODEIO
                 PR_CODE.Text = Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString();
                 pr_orispeccode2.Text = Prodiodetail.Rows[e.RowIndex].Cells["pr_orispeccode1"].Value.ToString();
                 LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
+                SelectIndex = e.RowIndex;
             }
         }
 
@@ -471,5 +491,42 @@ 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.Start();
+                thread = new Thread(PlaySound);
+            }
+            else
+            {
+                FileName = System.Windows.Forms.Application.StartupPath + @"\Resources\Sound\5185.wav";
+                thread.Start();
+                thread = new Thread(PlaySound);
+            }
+        }
+
+        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);
+            }
+        }
     }
 }

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

@@ -138,57 +138,6 @@
   <metadata name="bi_inqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pd_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_orispeccode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_brand.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_detail.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_spec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_inqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bi_inqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="CheckBox.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_orispeccode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bi_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bi_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bi_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <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_vendbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bi_madedate.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>
-  <metadata name="pr_detail1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <metadata name="CheckBox.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>