Explorar o código

电子秤读书调整

callm %!s(int64=2) %!d(string=hai) anos
pai
achega
0b92efa174

+ 3 - 3
UAS_MES_YD/FunctionCode/Make/Make_ColorBoxWeigh_HUAGUAN.Designer.cs

@@ -873,11 +873,11 @@
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.彩盒称重_FormClosing);
             this.Load += new System.EventHandler(this.Make_ColorBoxWeigh_Load);
             this.SizeChanged += new System.EventHandler(this.彩盒称重_SizeChanged);
-            this.panel4.ResumeLayout(false);
+            this.panel4.ResumeLayout(true);
             this.panel4.PerformLayout();
-            this.groupBoxWithBorder2.ResumeLayout(false);
+            this.groupBoxWithBorder2.ResumeLayout(true);
             this.groupBoxWithBorder2.PerformLayout();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 3 - 1
UAS_MES_YD/FunctionCode/Packing/Packing_PalletWeigh.cs

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

+ 4 - 2
UAS_MES_YD/FunctionCode/Packing/Packing_PalletWightCollection.cs

@@ -15,6 +15,7 @@ using UAS_MES_NEW.Packing;
 using Seagull.BarTender.Print;
 using System.Net.Sockets;
 using System.Net;
+using System.Text.RegularExpressions;
 
 namespace UAS_MES_NEW.Packing
 {
@@ -734,6 +735,8 @@ namespace UAS_MES_NEW.Packing
             }
         }
 
+        Regex re = new Regex("\\d+.\\d+");
+
         private void getSerialData()
         {
             if (serialPort1.IsOpen)
@@ -747,8 +750,7 @@ namespace UAS_MES_NEW.Packing
                         {
                             try
                             {
-                                weight.Text = serialPort1.ReadLine();
-                                //weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
+                                weight.Text = re.Match(serialPort1.ReadLine()).Groups[0].Value;
                             }
                             catch (Exception)
                             {