Browse Source

Modify the out-of-bounds error caused by unknown EFEM errors

zhouhr 1 year ago
parent
commit
ef5f92cb47
1 changed files with 12 additions and 5 deletions
  1. 12 5
      Venus/Venus_RT/Devices/EFEM/EfemMessage.cs

+ 12 - 5
Venus/Venus_RT/Devices/EFEM/EfemMessage.cs

@@ -248,18 +248,25 @@ namespace Venus_RT.Devices.YASKAWA
 
                     if (a6.Length < 3)
                     {
-                        LOG.Write(eEvent.WARN_EFEM_COMMON_WARN, ModuleName.EFEM, $"ABS 格式错误 {errStr}");
+                       //因为小于导致后续使用相关变量时会越界
+                       //需要补全 已保证使用
+                       msg.Factor = errStr;
+                       msg.Data.Add($"ABS 格式错误");
+                       msg.Data.Add($"{errStr}");
+                       LOG.Write(eEvent.WARN_EFEM_COMMON_WARN, ModuleName.EFEM, $"ABS 格式错误 {errStr}");
                     }
-
-                    msg.Factor = a6[0];
-                    msg.Data.Add(a6[1]);
-                    string errorcode = a6[2].Substring(1);
+                    else
+                    {
+                        msg.Factor = a6[0];
+                        msg.Data.Add(a6[1]);
+                        string errorcode = a6[2].Substring(1);
                         if (Constant._EFEMHWErrorCode2Msg.ContainsKey(errorcode))
                             msg.Data.Add(Constant._EFEMHWErrorCode2Msg[errorcode]);
                         else if (!string.IsNullOrEmpty(MatchError(errorcode)))
                             msg.Data.Add(MatchError(errorcode));
                         else
                             msg.Data.Add(a6[2]);
+                    }
                     break;
                 }
             }