yhluo 2 هفته پیش
والد
کامیت
ca27ba847d
2فایلهای تغییر یافته به همراه101 افزوده شده و 1 حذف شده
  1. 16 1
      UAS_MES_HYSX/FunctionCode/Make/Make_ThruputLog.Designer.cs
  2. 85 0
      UAS_MES_HYSX/FunctionCode/Make/Make_ThruputLog.cs

+ 16 - 1
UAS_MES_HYSX/FunctionCode/Make/Make_ThruputLog.Designer.cs

@@ -42,6 +42,7 @@
             this.label3 = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
             this.serialNumber = new System.Windows.Forms.Label();
+            this.Clear = new System.Windows.Forms.Button();
             this.SNDetails.SuspendLayout();
             this.tableLayoutPanel1.SuspendLayout();
             this.SuspendLayout();
@@ -69,7 +70,7 @@
             // 
             this.Parse.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Parse.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Parse.Location = new System.Drawing.Point(685, 246);
+            this.Parse.Location = new System.Drawing.Point(212, 255);
             this.Parse.Name = "Parse";
             this.Parse.Size = new System.Drawing.Size(135, 39);
             this.Parse.TabIndex = 91;
@@ -213,11 +214,24 @@
             this.serialNumber.TabIndex = 4;
             this.serialNumber.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
+            // Clear
+            // 
+            this.Clear.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.Clear.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Clear.Location = new System.Drawing.Point(399, 255);
+            this.Clear.Name = "Clear";
+            this.Clear.Size = new System.Drawing.Size(135, 39);
+            this.Clear.TabIndex = 92;
+            this.Clear.Text = "轻触提示";
+            this.Clear.UseVisualStyleBackColor = true;
+            this.Clear.Click += new System.EventHandler(this.Clear_Click);
+            // 
             // Make_ThruputLog
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1600, 900);
+            this.Controls.Add(this.Clear);
             this.Controls.Add(this.Parse);
             this.Controls.Add(this.OperatResult);
             this.Controls.Add(this.SNDetails);
@@ -253,5 +267,6 @@
         private System.Windows.Forms.Label serialNumber;
         private CustomControl.RichText.RichTextAutoBottom OperatResult;
         private System.Windows.Forms.Button Parse;
+        private System.Windows.Forms.Button Clear;
     }
 }

+ 85 - 0
UAS_MES_HYSX/FunctionCode/Make/Make_ThruputLog.cs

@@ -55,6 +55,8 @@ namespace UAS_MES_NEW.Make
                 string upRes = ParseIperfBitrate(currLog);
 
                 string sn = Path.GetFileName(currLog).Split('_')[0];
+                UpdateSN("L", sn);
+
                 SQL.Clear();
                 SQL.Append($@"SELECT ms_sncode,ma_code,pr_code,pr_spec FROM makeserial,make,product WHERE ms_sncode = '{sn}' AND ms_makecode = ma_code AND ms_prodcode = pr_code");
                 dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
@@ -71,6 +73,30 @@ namespace UAS_MES_NEW.Make
                 string tDetail = $"upRate/{upRes};downRate/{downRes}";
 
                 CheckPassStation(wo, sn, "PASS", tDetail);
+
+                using (StreamReader SR = new StreamReader(currLog, Encoding.GetEncoding("GBK")))
+                {
+                    string Content = SR.ReadToEnd();
+                    SR.Close();
+                    SR.Dispose();
+                    if (ConsoleLog(Content, currLog, $"{sn}_up.log"))
+                    {
+                        File.WriteAllText(currLog, string.Empty);
+                        File.Delete(currLog);
+                    }
+                }
+
+                using (StreamReader SR = new StreamReader(downLog, Encoding.GetEncoding("GBK")))
+                {
+                    string Content = SR.ReadToEnd();
+                    SR.Close();
+                    SR.Dispose();
+                    if (ConsoleLog(Content, currLog, $"{sn}_down.log"))
+                    {
+                        File.WriteAllText(currLog, string.Empty);
+                        File.Delete(currLog);
+                    }
+                }
             }
 
             string[] failFiles = Directory.GetFiles(failPath, $"*up.log");
@@ -78,6 +104,8 @@ namespace UAS_MES_NEW.Make
             {
                 string upRes = ParseIperfBitrate(currLog);
                 string sn = Path.GetFileName(currLog).Split('_')[0];
+                UpdateSN("L", sn);
+
                 SQL.Clear();
                 SQL.Append($@"SELECT ms_sncode,ma_code,pr_code,pr_spec FROM makeserial,make,product WHERE ms_sncode = '{sn}' AND ms_makecode = ma_code AND ms_prodcode = pr_code");
                 dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
@@ -94,6 +122,30 @@ namespace UAS_MES_NEW.Make
                 string tDetail = $"upRate/{upRes};downRate/{downRes}";
 
                 CheckPassStation(wo, sn, "PASS", tDetail);
+
+                using (StreamReader SR = new StreamReader(currLog, Encoding.GetEncoding("GBK")))
+                {
+                    string Content = SR.ReadToEnd();
+                    SR.Close();
+                    SR.Dispose();
+                    if (ConsoleLog(Content, currLog, $"{sn}_up.log"))
+                    {
+                        File.WriteAllText(currLog, string.Empty);
+                        File.Delete(currLog);
+                    }
+                }
+
+                using (StreamReader SR = new StreamReader(downLog, Encoding.GetEncoding("GBK")))
+                {
+                    string Content = SR.ReadToEnd();
+                    SR.Close();
+                    SR.Dispose();
+                    if (ConsoleLog(Content, currLog, $"{sn}_down.log"))
+                    {
+                        File.WriteAllText(currLog, string.Empty);
+                        File.Delete(currLog);
+                    }
+                }
             }
         }
         private void CheckPassStation(string wo,string sn, string testRes, string testDetail)
@@ -185,6 +237,11 @@ namespace UAS_MES_NEW.Make
             return rVal2;
         }
 
+        private void Clear_Click(object sender, EventArgs e)
+        {
+            OperatResult.Clear();
+            UpdateSN("C", "");
+        }
 
         private void ShowMsg(int type, string msg)
         {
@@ -256,5 +313,33 @@ namespace UAS_MES_NEW.Make
                 }
             }
         }
+
+        private bool ConsoleLog(string Content, string PathName, string SN)
+        {
+            try
+            {
+                string sourcePaht = Path.GetDirectoryName(PathName);
+                string changeName = Path.Combine(sourcePaht, SN);
+
+                string newFolderName = "Logs";
+                string newFolderPath = Path.Combine(sourcePaht, newFolderName);
+
+                if (!Directory.Exists(newFolderPath))
+                {
+                    Directory.CreateDirectory(newFolderPath);
+                }
+
+                string newFileName = "Log_" + Path.GetFileName(changeName);
+                string newFilePath = Path.Combine(newFolderPath, newFileName);
+
+                File.AppendAllText(newFilePath, Content + Environment.NewLine);
+                return true;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(this.ParentForm, ex.Message, "警告");
+                return false;
+            }
+        }
     }
 }