Browse Source

读取展讯平台LOG

callm 3 years ago
parent
commit
12423bcd7a

+ 9 - 2
UAS_MES_PW/CustomControl/GroupBoxWithBorder/GroupBoxWithBorder.Designer.cs

@@ -17,9 +17,16 @@
             {
                 components.Dispose();
             }
-            base.Dispose(disposing);
-        }
+            try
+            {
+                base.Dispose(disposing);
 
+            }
+            catch (System.Exception)
+            {
+
+            }
+        }
         #region 组件设计器生成的代码
 
         /// <summary> 

+ 10 - 3
UAS_MES_PW/FunctionCode/Make/Make_ColorBoxLoadPrint.Designer.cs

@@ -13,11 +13,18 @@
         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
         protected override void Dispose(bool disposing)
         {
-            if (disposing && (components != null))
+            try
             {
-                components.Dispose();
+                if (disposing && (components != null))
+                {
+                    components.Dispose();
+                }
+                base.Dispose(disposing);
+            }
+            catch (System.Exception)
+            {
+               
             }
-            base.Dispose(disposing);
         }
 
         #region Windows Form Designer generated code

+ 4 - 3
UAS_MES_PW/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -12,12 +12,13 @@ using System.Collections.Generic;
 using UAS_MES_NEW.PublicForm;
 using LabelManager2;
 using System.Threading;
+using Seagull.BarTender.Print;
 
 namespace UAS_MES_NEW.Make
 {
     public partial class Make_ColorBoxLoadPrint : Form
     {
-        ApplicationClass lbl;
+        Engine engine;
         //MakeSerial表主键
         string ms_id;
         //制造单号                                                                             
@@ -73,7 +74,7 @@ namespace UAS_MES_NEW.Make
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception)
@@ -507,7 +508,7 @@ namespace UAS_MES_NEW.Make
                     //刷新数据
                     EventArgs e = new EventArgs();
                     object sender = null;
-                    if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode, int.Parse(PrintNum.Text), ma_code, ma_prodcode.Text, "SN标签", "0", out ErrorMessage))
+                    if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode, int.Parse(PrintNum.Text), ma_code, ma_prodcode.Text, "SN标签", "0", out ErrorMessage))
                     {
                         OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
                     }

+ 45 - 20
UAS_MES_PW/FunctionCode/Make/Make_ReadWriteInfo.Designer.cs

@@ -40,17 +40,19 @@
             this.label2 = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
             this.CheckItemDGV = new System.Windows.Forms.DataGridView();
+            this.ms_item = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ms_info = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.FileWatcher = new System.IO.FileSystemWatcher();
             this.WatchPath = new System.Windows.Forms.TextBox();
             this.label6 = new System.Windows.Forms.Label();
             this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ms_item = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ms_info = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.StepCount = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SourceStepCount();
             this.sncode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
             this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.button1 = new System.Windows.Forms.Button();
+            this.Watch = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.CheckItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.FileWatcher)).BeginInit();
             this.SuspendLayout();
@@ -185,6 +187,24 @@
             this.CheckItemDGV.TabIndex = 33;
             this.CheckItemDGV.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.CheckItemDGV_CellPainting);
             // 
+            // ms_item
+            // 
+            this.ms_item.DataPropertyName = "ms_item";
+            this.ms_item.HeaderText = "检测项";
+            this.ms_item.MinimumWidth = 130;
+            this.ms_item.Name = "ms_item";
+            this.ms_item.ReadOnly = true;
+            this.ms_item.Width = 150;
+            // 
+            // ms_info
+            // 
+            this.ms_info.DataPropertyName = "ms_info";
+            this.ms_info.HeaderText = "参数值";
+            this.ms_info.MinimumWidth = 300;
+            this.ms_info.Name = "ms_info";
+            this.ms_info.ReadOnly = true;
+            this.ms_info.Width = 468;
+            // 
             // FileWatcher
             // 
             this.FileWatcher.EnableRaisingEvents = true;
@@ -229,24 +249,6 @@
             this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
             this.dataGridViewTextBoxColumn2.ReadOnly = true;
             // 
-            // ms_item
-            // 
-            this.ms_item.DataPropertyName = "ms_item";
-            this.ms_item.HeaderText = "检测项";
-            this.ms_item.MinimumWidth = 130;
-            this.ms_item.Name = "ms_item";
-            this.ms_item.ReadOnly = true;
-            this.ms_item.Width = 150;
-            // 
-            // ms_info
-            // 
-            this.ms_info.DataPropertyName = "ms_info";
-            this.ms_info.HeaderText = "参数值";
-            this.ms_info.MinimumWidth = 300;
-            this.ms_info.Name = "ms_info";
-            this.ms_info.ReadOnly = true;
-            this.ms_info.Width = 468;
-            // 
             // StepCount
             // 
             this.StepCount.LineCode = null;
@@ -292,11 +294,32 @@
             this.dataGridViewTextBoxColumn3.MinimumWidth = 460;
             this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
             // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(958, 130);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 36;
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            // 
+            // Watch
+            // 
+            this.Watch.Location = new System.Drawing.Point(1232, 782);
+            this.Watch.Name = "Watch";
+            this.Watch.Size = new System.Drawing.Size(123, 35);
+            this.Watch.TabIndex = 37;
+            this.Watch.Text = "监控";
+            this.Watch.UseVisualStyleBackColor = true;
+            this.Watch.Click += new System.EventHandler(this.Watch_Click);
+            // 
             // Make_ReadWriteInfo
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1772, 866);
+            this.Controls.Add(this.Watch);
+            this.Controls.Add(this.button1);
             this.Controls.Add(this.label6);
             this.Controls.Add(this.WatchPath);
             this.Controls.Add(this.CheckItemDGV);
@@ -351,5 +374,7 @@
         private System.IO.FileSystemWatcher FileWatcher;
         private System.Windows.Forms.Label label6;
         private System.Windows.Forms.TextBox WatchPath;
+        private System.Windows.Forms.Button Watch;
+        private System.Windows.Forms.Button button1;
     }
 }

+ 8 - 4
UAS_MES_PW/FunctionCode/Make/Make_ReadWriteInfo.cs

@@ -47,10 +47,6 @@ namespace UAS_MES_NEW.Make
             StepCount.Dh = dh;
             StepCount.Start();
 
-            FileWatcher.Path = WatchPath.Text;
-            FileWatcher.Filter = "*.log";
-            FileWatcher.EnableRaisingEvents = true;
-            FileWatcher.Created += new FileSystemEventHandler(Watcher_Created);
         }
 
         private void Make_LabelCheck_SizeChanged(object sender, EventArgs e)
@@ -205,5 +201,13 @@ namespace UAS_MES_NEW.Make
                 }
             }
         }
+
+        private void Watch_Click(object sender, EventArgs e)
+        {
+            FileWatcher.Path = WatchPath.Text;
+            FileWatcher.Filter = "*.log";
+            FileWatcher.EnableRaisingEvents = true;
+            FileWatcher.Created += new FileSystemEventHandler(Watcher_Created);
+        }
     }
 }

+ 3 - 3
UAS_MES_PW/FunctionCode/Make/Make_ReadWriteInfo.resx

@@ -123,13 +123,13 @@
   <metadata name="ms_info.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="FileWatcher.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
   <metadata name="ms_item.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="ms_info.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="FileWatcher.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>

+ 2 - 2
UAS_MES_PW/FunctionCode/Make/Make_TestCollection.cs

@@ -224,7 +224,7 @@ namespace UAS_MES_NEW.Make
                             {
                                 if (stepcode == User.CurrentStepCode && (reworkstatus == "1" || reworkstatus == "2") && ifrepair == "0")
                                 {
-                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
+                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepName + "工序,采集结果为良品\n", Color.Red, ms_sncode);
                                     return;
                                 }
                             }
@@ -232,7 +232,7 @@ namespace UAS_MES_NEW.Make
                             {
                                 if (stepcode == User.CurrentStepCode && (status == "1" || status == "2") && ifrepair == "0")
                                 {
-                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
+                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepName + "工序,采集结果为良品\n", Color.Red, ms_sncode);
                                     return;
                                 }
                             }

+ 10 - 3
UAS_MES_PW/FunctionCode/Packing/Packing_PalletWightCollection.Designer.cs

@@ -13,11 +13,18 @@
         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
         protected override void Dispose(bool disposing)
         {
-            if (disposing && (components != null))
+            try
             {
-                components.Dispose();
+                if (disposing && (components != null))
+                {
+                    components.Dispose();
+                }
+                base.Dispose(disposing);
+            }
+            catch (System.Exception)
+            {
+
             }
-            base.Dispose(disposing);
         }
 
         #region Windows Form Designer generated code

+ 31 - 23
UAS_MES_PW/PublicMethod/BaseUtil.cs

@@ -1073,28 +1073,28 @@ namespace UAS_MES_NEW.PublicMethod
 
         public static void WriteLbl()
         {
-            Process[] processes = System.Diagnostics.Process.GetProcessesByName("lppa");
-            Dictionary<string, int> ProInf = new Dictionary<string, int>();
-            for (int i = 0; i < processes.Length; i++)
-            {
-                try
-                {
-                    if (processes[i].ProcessName == "lppa")
-                    {
-                        ProInf.Add(processes[i].StartTime.ToString(), processes[i].Id);
-                    }
-                }
-                catch
-                {
-                }
-            }
-            var temp = ProInf.Keys.Max();
-            String str = SystemInf.ProcessesID + "|" + ProInf[temp];
-            FileStream fs = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.Append, FileAccess.Write);
-            StreamWriter sw = new StreamWriter(fs);
-            sw.WriteLine(str, Encoding.UTF8);
-            sw.Close();
-            fs.Close();
+            //Process[] processes = System.Diagnostics.Process.GetProcessesByName("lppa");
+            //Dictionary<string, int> ProInf = new Dictionary<string, int>();
+            //for (int i = 0; i < processes.Length; i++)
+            //{
+            //    try
+            //    {
+            //        if (processes[i].ProcessName == "lppa")
+            //        {
+            //            ProInf.Add(processes[i].StartTime.ToString(), processes[i].Id);
+            //        }
+            //    }
+            //    catch
+            //    {
+            //    }
+            //}
+            //var temp = ProInf.Keys.Max();
+            //String str = SystemInf.ProcessesID + "|" + ProInf[temp];
+            //FileStream fs = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.Append, FileAccess.Write);
+            //StreamWriter sw = new StreamWriter(fs);
+            //sw.WriteLine(str, Encoding.UTF8);
+            //sw.Close();
+            //fs.Close();
         }
 
         public static Object GetCacheData(string ParamName)
@@ -1538,10 +1538,18 @@ namespace UAS_MES_NEW.PublicMethod
                         txt += str + "\n";
                     }
                     IMEI0 = Regex.Match(txt, "IMEI[0] = \\S[0-9]{15}\\S").Value.Replace("IMEI[", "").Replace("]", "");
-                    IMEI1 = Regex.Match(txt, "IMEI[0] = \\S[0-9]{15}\\S").Value.Replace("IMEI[", "").Replace("]", "");
+                    IMEI1 = Regex.Match(txt, "IMEI[1] = \\S[0-9]{15}\\S").Value.Replace("IMEI[", "").Replace("]", "");
                     MAC = Regex.Match(txt, "WIFIADDRESS = \\[\\S+\\]").Value.Replace("WIFIADDRESS = [", "").Replace("]", "").Replace(":", "");
                     BT = Regex.Match(txt, "BTADDRESS = \\[\\S+\\]").Value.Replace("BTADDRESS = [", "").Replace("]", "").Replace(":", "");
                     BARCODE = Regex.Match(txt, "BARCODE = \\[\\S+\\]").Value.Replace("BARCODE = [", "").Replace("]", "").Replace(":", "");
+
+                    if (BARCODE == "")
+                    {
+                        IMEI0 = Regex.Match(txt, "IMEI1\\s+'\\d+'").Value.Replace("IMEI1", "").Replace("'", "").Trim();
+                        MAC = Regex.Match(txt, "WIFI\\s+'\\S+'").Value.Replace("WIFI", "").Replace("'", "").Trim();
+                        BT = Regex.Match(txt, "BT\\s+'\\S+'").Value.Replace("BT", "").Replace("'", "").Trim();
+                        BARCODE = Regex.Match(txt, "SN1\\s+'\\S+'").Value.Replace("SN1", "").Replace("'", "").Trim();
+                    }
                     break;
                 }
                 catch (Exception e)