Browse Source

特殊装箱代码同步到另一个项目

Hcsy 7 years ago
parent
commit
7c27e698a3
1 changed files with 7 additions and 4 deletions
  1. 7 4
      UAS_MES_NEW/FunctionCode/Make/Make_SpecialCartonPack.cs

+ 7 - 4
UAS_MES_NEW/FunctionCode/Make/Make_SpecialCartonPack.cs

@@ -29,6 +29,7 @@ namespace UAS_MES_NEW.Make
         string oMsID = "";
         string ActWeigh;
         string oMsStatus = "";
+        Regex re = new Regex("\\d+.\\d+\\w+");
 
         //称量的标准重量
         double Weight;
@@ -115,7 +116,7 @@ namespace UAS_MES_NEW.Make
                         {
                             try
                             {
-                                weight.Text = serialPort1.ReadLine();
+                                weight.Text = re.Match(serialPort1.ReadLine().Trim()).Groups[0].Value;
                                 ActWeigh = weight.Text.Replace("kg", "").Trim();
                             }
                             catch (Exception)
@@ -330,8 +331,8 @@ namespace UAS_MES_NEW.Make
                                     if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == int.Parse(pr_outboxinnerqty.Text))
                                     {
                                         ActWeigh = weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Trim();
-                                        float weigh = float.Parse(ActWeigh);
-                                        dh.UpdateByCondition("package", "pa_status=1,pa_packageqty=pa_currentqty,pa_weight='" + weight.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                        float weighA = float.Parse(ActWeigh);
+                                        dh.UpdateByCondition("package", "pa_status=1,pa_packageqty=pa_currentqty,pa_weight='" + weighA + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                         pa_standardqty.Text = "";
                                         pa_status.Text = "1";
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "满箱封箱成功\n", Color.Green);
@@ -410,8 +411,10 @@ namespace UAS_MES_NEW.Make
                 string Seal = MessageBox.Show(this.ParentForm, "是否确认封箱?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                 if (Seal == "Yes")
                 {
+                    ActWeigh = weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Trim();
+                    float weigh = float.Parse(ActWeigh);
                     OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "采集完成,手动封箱成功\n", Color.Green);
-                    dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                    dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty,pa_weight=" + weigh + "", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                     pa_status.Text = "1";
                     pa_standardqty.Text = "";
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "装箱采集", "封箱成功", pa_outboxcode.Text, "");