Browse Source

优化只读取数据

callm 1 week ago
parent
commit
8d9c54eca8
1 changed files with 2 additions and 2 deletions
  1. 2 2
      UAS_MES_YD/FunctionCode/Make/Make_ColorBoxWeigh.cs

+ 2 - 2
UAS_MES_YD/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -41,7 +41,7 @@ namespace UAS_MES_NEW.Make
 
 
         DataTable Dbfind;
         DataTable Dbfind;
 
 
-        Regex re = new Regex("\\d+.\\w+");
+        Regex re = new Regex("\\d+.\\d+");
 
 
         string ErrorMessage;
         string ErrorMessage;
 
 
@@ -262,11 +262,11 @@ namespace UAS_MES_NEW.Make
                                 Byte[] readBuffer = new Byte[len];
                                 Byte[] readBuffer = new Byte[len];
                                 serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
                                 serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
                                 string weigh = Encoding.Default.GetString(readBuffer);
                                 string weigh = Encoding.Default.GetString(readBuffer);
-                                Remark.AppendText(weigh + "\n");
                                 if (weigh != "")
                                 if (weigh != "")
                                 {
                                 {
                                     weight.Text = re.Match(weigh).Value;
                                     weight.Text = re.Match(weigh).Value;
                                 }
                                 }
+                                Remark.AppendText(weight.Text+"\n");
                             }
                             }
                             catch (Exception)
                             catch (Exception)
                             {
                             {