Browse Source

栈板称重修改

callm 2 days ago
parent
commit
14a5ec2252
1 changed files with 2 additions and 10 deletions
  1. 2 10
      UAS_MES_YDCY/FunctionCode/Make/Make_PalletWeigh.cs

+ 2 - 10
UAS_MES_YDCY/FunctionCode/Make/Make_PalletWeigh.cs

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