Browse Source

取消采集BUG,电子秤读书调整

callm 2 years ago
parent
commit
1732d84243

+ 7 - 4
UAS_MES_LGDZ/FunctionCode/Make/Make_ColorBoxWeigh_ReadLine.cs

@@ -41,7 +41,7 @@ namespace UAS_MES_NEW.Make
 
 
         DataTable Dbfind;
         DataTable Dbfind;
 
 
-        Regex re = new Regex("\\d+.\\w+");
+        Regex re = new Regex("\\d+.\\d+");
 
 
         string ErrorMessage;
         string ErrorMessage;
 
 
@@ -259,13 +259,16 @@ namespace UAS_MES_NEW.Make
                             try
                             try
                             {
                             {
                                 int len = serialPort1.BytesToRead;
                                 int len = serialPort1.BytesToRead;
+                                
                                 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);
-                                Remark.AppendText(weigh + "\n");
-                                if (weigh != "")
+                                //Remark.AppendText(weigh.Trim() + "\n");
+                                string str = re.Match(weigh.Trim()).Groups[0].Value;
+                                if (str != "")
                                 {
                                 {
-                                    weight.Text = re.Match(weigh).Value;
+                                    weight.Text = str;
+                                    Remark.AppendText(weight.Text + "\n");
                                 }
                                 }
                             }
                             }
                             catch (Exception)
                             catch (Exception)

+ 6 - 2
UAS_MES_LGDZ/FunctionCode/Packing/Packing_CartonBoxWeigh_ReadLine.cs

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

+ 4 - 3
UAS_MES_LGDZ/FunctionCode/Packing/Packing_PackageCollectionWeigh_ReadLine.cs

@@ -136,10 +136,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);
-                                pa_remark.AppendText(weigh + "\n");
-                                if (weigh != "")
+                                string str = re.Match(weigh.Trim()).Groups[0].Value;
+                                if (str != "")
                                 {
                                 {
-                                    weight.Text = re.Match(weigh).Groups[0].Value;
+                                    weight.Text = str;
+                                    pa_remark.AppendText(weight.Text + "\n");
                                 }
                                 }
                             }
                             }
                             catch (Exception)
                             catch (Exception)

+ 1 - 1
UAS_MES_LGDZ/FunctionCode/Special/Special_CancelCollection.cs

@@ -91,7 +91,7 @@ namespace UAS_MES_NEW.Special
                 //删除IMIE分配记录
                 //删除IMIE分配记录
                 sqls.Add("update  makeimeilist set mil_status=0 where mil_sncode='" + sn_code.Text + "' and mil_makecode='" + ms_makecode + "'");
                 sqls.Add("update  makeimeilist set mil_status=0 where mil_sncode='" + sn_code.Text + "' and mil_makecode='" + ms_makecode + "'");
                 //更新MAC使用记录
                 //更新MAC使用记录
-                sqls.Add("update  makeaddresslist set mal_status=0,mal_sncode='' where mal_sncode='" + sn_code.Text + "' and mal_makecode='" + ms_makecode + "'");
+                sqls.Add("update  makeaddresslist set mal_status=0 where mal_sncode='" + sn_code.Text + "' and mal_makecode='" + ms_makecode + "'");
                 //解除前一工单板的使用
                 //解除前一工单板的使用
                 sqls.Add("update makeserial set ms_nextmacode='' where ms_firstsn='" + ms_firstsn + "' and ms_nextmacode='" + ms_makecode + "'");
                 sqls.Add("update makeserial set ms_nextmacode='' where ms_firstsn='" + ms_firstsn + "' and ms_nextmacode='" + ms_makecode + "'");
                 //初始化导入数据状态
                 //初始化导入数据状态