|
|
@@ -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)
|
|
|
{
|