Browse Source

添加声音提示和全部已采集

章政 6 years ago
parent
commit
8e61b0e865

BIN
UAS-出货标签管理(标签复核)/NG.wav


BIN
UAS-出货标签管理(标签复核)/OK.wav


+ 21 - 0
UAS-出货标签管理(标签复核)/PublicMethod/BaseUtil.cs

@@ -9,6 +9,7 @@ using UAS_LabelMachine.CustomControl.GroupBoxWithBorder;
 using static System.Windows.Forms.Control;
 using System.Text.RegularExpressions;
 using System.Web.Script.Serialization;
+using System.Media;
 
 namespace UAS_LabelMachine
 {
@@ -40,6 +41,26 @@ namespace UAS_LabelMachine
             }
         }
 
+        public static void PlaySound(string FileName)
+        {
+            //要加载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)
+            {
+
+            }
+        }
+
         public static string DToAny(double DB, int Type)
         {
             string H = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

+ 15 - 0
UAS-出货标签管理(标签复核)/UAS_出货标签管理.Designer.cs

@@ -129,6 +129,7 @@
             this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.CollectAll = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             this.CollectionProcess.SuspendLayout();
@@ -1118,12 +1119,25 @@
             this.pi_inoutno.TabIndex = 2;
             this.pi_inoutno.KeyDown += new System.Windows.Forms.KeyEventHandler(this.pi_inoutno_KeyDown);
             // 
+            // CollectAll
+            // 
+            this.CollectAll.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.CollectAll.Location = new System.Drawing.Point(522, 216);
+            this.CollectAll.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.CollectAll.Name = "CollectAll";
+            this.CollectAll.Size = new System.Drawing.Size(68, 26);
+            this.CollectAll.TabIndex = 92;
+            this.CollectAll.Text = "全部已采";
+            this.CollectAll.UseVisualStyleBackColor = true;
+            this.CollectAll.Click += new System.EventHandler(this.CollectAll_Click);
+            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(1012, 709);
+            this.Controls.Add(this.CollectAll);
             this.Controls.Add(this.ExportData);
             this.Controls.Add(this.cu_code);
             this.Controls.Add(this.CleanBarCode);
@@ -1276,5 +1290,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_lotno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_qty;
+        private System.Windows.Forms.Button CollectAll;
     }
 }

+ 30 - 3
UAS-出货标签管理(标签复核)/UAS_出货标签管理.cs

@@ -292,8 +292,8 @@ namespace UAS_LabelMachine
                 {
                     string orispeccode = LabelInf.Rows[i].Cells["pr_orispeccode"].Value.ToString();
                     Console.WriteLine((MatchStr(arr[j].ToString(), "MPN")));
-                    Console.WriteLine(MatchStr(arr[j].ToString(), "MPN").Trim().Replace(" ",""));
-                    if ((MatchStr(arr[j].ToString(), "MPN").Contains(orispeccode) || MatchStr(arr[j].ToString(), "MPN").Trim().Replace(" ","").Contains(orispeccode) || orispeccode == MatchStr(arr[j].ToString(), "MPN") || LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString() == MatchStr(arr[j].ToString(), "CPN")) && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
+                    Console.WriteLine(MatchStr(arr[j].ToString(), "MPN").Trim().Replace(" ", ""));
+                    if ((MatchStr(arr[j].ToString(), "MPN").Contains(orispeccode) || MatchStr(arr[j].ToString(), "MPN").Trim().Replace(" ", "").Contains(orispeccode) || orispeccode == MatchStr(arr[j].ToString(), "MPN") || LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString() == MatchStr(arr[j].ToString(), "CPN")) && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
                     {
                         CurrentRowIndex = i;
                         if (CurrentRowIndex - 5 > 0)
@@ -518,9 +518,10 @@ namespace UAS_LabelMachine
                             Matchstr = MatchStr(data[j], "MPN");
                             //采集的供应商号不匹配的话
                             Console.WriteLine(Matchstr.Trim().Replace(" ", ""));
-                            if (cell.Value.ToString() == Matchstr || Matchstr.Trim().Replace(" ","").Contains(cell.Value.ToString()) || Matchstr.Contains(cell.Value.ToString()))
+                            if (cell.Value.ToString() == Matchstr || Matchstr.Trim().Replace(" ", "").Contains(cell.Value.ToString()) || Matchstr.Contains(cell.Value.ToString()))
                             {
                                 ErrorType.Add("OK_MPN");
+                                BaseUtil.PlaySound("OK.wav");
                                 LabelInf.Refresh();
                                 CollectVeProdCodePass = true;
                             }
@@ -528,6 +529,7 @@ namespace UAS_LabelMachine
                             {
                                 ErrorType.Add("NG_MPN");
                                 CollectVeProdCodePass = false;
+                                BaseUtil.PlaySound("NG.wav");
                                 //添加需要重绘的Cell
                                 LabelInf.Refresh();
                                 MessageLog.AppendText(">>供应商物料编号不匹配\n", Color.Red);
@@ -560,6 +562,7 @@ namespace UAS_LabelMachine
                             if (cell.Value.ToString() != Matchstr)
                             {
                                 ErrorType.Add("NG_CPN");
+                                BaseUtil.PlaySound("NG.wav");
                                 CollectQTYPass = false;
                                 LabelInf.Refresh();
                                 MessageLog.AppendText(">>CPN不匹配\n", Color.Red);
@@ -567,6 +570,7 @@ namespace UAS_LabelMachine
                             else
                             {
                                 ErrorType.Add("OK_CPN");
+                                BaseUtil.PlaySound("OK.wav");
                                 LabelInf.Refresh();
                                 CollectQTYPass = true;
                             }
@@ -1032,5 +1036,28 @@ namespace UAS_LabelMachine
                 LoadGridData(sender, e);
             }
         }
+
+        private void CollectAll_Click(object sender, EventArgs e)
+        {
+            int PickedCount = 0;
+            for (int i = 0; i < LabelInf.Rows.Count; i++)
+            {
+                if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
+                {
+                    LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
+                }
+                else
+                {
+                    PickedCount = PickedCount + 1;
+                }
+            }
+            if (PickedCount == LabelInf.Rows.Count)
+            {
+                for (int i = 0; i < LabelInf.Rows.Count; i++)
+                {
+                    LabelInf.Rows[i].Cells["pib_ifpick"].Value = false;
+                }
+            }
+        }
     }
 }