|
@@ -13,6 +13,7 @@ using UAS_MES_NEW.DataOperate;
|
|
|
using UAS_MES_NEW.Entity;
|
|
using UAS_MES_NEW.Entity;
|
|
|
using UAS_MES_NEW.PublicForm;
|
|
using UAS_MES_NEW.PublicForm;
|
|
|
using UAS_MES_NEW.PublicMethod;
|
|
using UAS_MES_NEW.PublicMethod;
|
|
|
|
|
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
|
|
|
|
namespace UAS_MES_NEW.Packing
|
|
namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
{
|
|
@@ -204,6 +205,7 @@ namespace UAS_MES_NEW.Packing
|
|
|
{
|
|
{
|
|
|
if (serialPort1.IsOpen)
|
|
if (serialPort1.IsOpen)
|
|
|
{
|
|
{
|
|
|
|
|
+ OperateResult.AppendText(SystemInf.OpenPort.Contains(serialPort1.PortName).ToString());
|
|
|
if (!SystemInf.OpenPort.Contains(serialPort1.PortName))
|
|
if (!SystemInf.OpenPort.Contains(serialPort1.PortName))
|
|
|
{
|
|
{
|
|
|
SystemInf.OpenPort.Add(serialPort1.PortName);
|
|
SystemInf.OpenPort.Add(serialPort1.PortName);
|
|
@@ -217,9 +219,11 @@ namespace UAS_MES_NEW.Packing
|
|
|
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);
|
|
|
- if (weigh != "")
|
|
|
|
|
|
|
+ string str = re.Match(weigh.Trim()).Groups[0].Value;
|
|
|
|
|
+ OperateResult.AppendText(str);
|
|
|
|
|
+ if (str != "")
|
|
|
{
|
|
{
|
|
|
- weight.Text = re.Match(weigh).Groups[0].Value;
|
|
|
|
|
|
|
+ weight.Text = str;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
catch (Exception)
|
|
catch (Exception)
|