|
@@ -4,6 +4,7 @@ using System.Data;
|
|
|
using System.Drawing;
|
|
using System.Drawing;
|
|
|
using System.IO;
|
|
using System.IO;
|
|
|
using System.IO.Ports;
|
|
using System.IO.Ports;
|
|
|
|
|
+using System.Text.RegularExpressions;
|
|
|
using System.Threading;
|
|
using System.Threading;
|
|
|
using System.Windows.Forms;
|
|
using System.Windows.Forms;
|
|
|
using UAS_MES_NEW.DataOperate;
|
|
using UAS_MES_NEW.DataOperate;
|
|
@@ -242,6 +243,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
thread.Abort();
|
|
thread.Abort();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ Regex re = new Regex("\\d+.\\d+");
|
|
|
private void getSerialData()
|
|
private void getSerialData()
|
|
|
{
|
|
{
|
|
|
if (serialPort1.IsOpen)
|
|
if (serialPort1.IsOpen)
|
|
@@ -256,7 +258,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
//weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
|
|
//weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
|
|
|
- weight.Text = serialPort1.ReadLine();
|
|
|
|
|
|
|
+ weight.Text = re.Match(serialPort1.ReadLine()).Groups[0].Value;
|
|
|
}
|
|
}
|
|
|
catch (Exception)
|
|
catch (Exception)
|
|
|
{
|
|
{
|