Browse Source

补丁AOI处理

yhluo 1 day ago
parent
commit
d4c59c28e6
1 changed files with 20 additions and 2 deletions
  1. 20 2
      UAS_MES_BG/FunctionCode/Make/Make_ParseLog.cs

+ 20 - 2
UAS_MES_BG/FunctionCode/Make/Make_ParseLog.cs

@@ -816,9 +816,11 @@ namespace UAS_MES_NEW.Make
                 List<Log> logArr = new List<Log>() { };
                 string[] lines = restOfStream.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                 int fileNum = string.IsNullOrEmpty(lines[lines.Length - 1]) ? lines.Length - 1 : lines.Length;
+                int isItemErrorCount = 0, trueRows = 0;
                 foreach (var item in lines)
                 {
                     if (string.IsNullOrEmpty(item)) continue;
+                    trueRows += 1;
                     string[] currItem = item.Split(',');
                     string res = "",wo = "",detail = "",line = "",sn = "";
                     bool hasSn = false;
@@ -859,8 +861,16 @@ namespace UAS_MES_NEW.Make
                         }
                         else
                         {
-                            LogMessage($"NG,文件{PathName} 序列号{currItem[0]}无归属过站记录");
-                            continue;
+                            if(Regex.IsMatch(currItem[0], @"^[a-zA-Z]"))
+                            {
+                                LogMessage($"NG,文件{PathName} 序列号{currItem[0]}无归属过站记录");
+                                continue;
+                            }
+                            else
+                            {
+                                isItemErrorCount += 1;
+                                continue;
+                            }
                         }
 
                         if (string.IsNullOrEmpty(wo) && string.IsNullOrEmpty(line))
@@ -916,6 +926,14 @@ namespace UAS_MES_NEW.Make
                         File.Delete(PathName);
                     }
                 }
+                if (trueRows == isItemErrorCount)
+                {
+                    if (ConsoleLog(restOfStream, PathName))
+                    {
+                        File.WriteAllText(PathName, string.Empty);
+                        File.Delete(PathName);
+                    }
+                }
             }
             catch (Exception ex)
             {