|
|
@@ -104,14 +104,15 @@ namespace UAS_MES_NEW.Warehouse
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- int len = serialPort1.BytesToRead;
|
|
|
- Byte[] readBuffer = new Byte[len];
|
|
|
- serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
|
|
|
- string weigh = Encoding.Default.GetString(readBuffer);
|
|
|
- if (weigh != "")
|
|
|
- {
|
|
|
- weight.Text = re.Match(weigh).Value; ;
|
|
|
- }
|
|
|
+ //int len = serialPort1.BytesToRead;
|
|
|
+ //Byte[] readBuffer = new Byte[len];
|
|
|
+ //serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
|
|
|
+ //string weigh = Encoding.Default.GetString(readBuffer);
|
|
|
+ //if (weigh != "")
|
|
|
+ //{
|
|
|
+ // weight.Text = re.Match(weigh).Value; ;
|
|
|
+ //}
|
|
|
+ weight.Text = re.Match(serialPort1.ReadLine()).Groups[0].Value;
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|