Hcsy 8 years ago
parent
commit
92fc55d838
1 changed files with 3 additions and 4 deletions
  1. 3 4
      UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

+ 3 - 4
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -42,8 +42,6 @@ namespace UAS_MES.Make
         int MaxWeight;
         int MaxWeight;
         //最小重量
         //最小重量
         int MinWeight;
         int MinWeight;
-        //重量倍率
-        int Wetghtunit =1;
         DataTable ListC = new DataTable();
         DataTable ListC = new DataTable();
 
 
         Thread InitPrint;
         Thread InitPrint;
@@ -122,7 +120,6 @@ namespace UAS_MES.Make
                     MaxWeight = int.Parse(_maxweight == "" ? "0" : _maxweight);
                     MaxWeight = int.Parse(_maxweight == "" ? "0" : _maxweight);
                     MinWeight = int.Parse(_minweight == "" ? "0" : _minweight);
                     MinWeight = int.Parse(_minweight == "" ? "0" : _minweight);
                     pa_totalqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
                     pa_totalqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
-                    Wetghtunit = int.Parse(pa_pr_cartonunit == "kg" ?"1000":"1");
                     if (Weight - MinWeight == MaxWeight - Weight)
                     if (Weight - MinWeight == MaxWeight - Weight)
                         pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight);
                         pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight);
                     else
                     else
@@ -167,7 +164,9 @@ namespace UAS_MES.Make
                         {
                         {
                             try
                             try
                             {
                             {
-                                weight.Text = Double.Parse(Regex.Replace(serialPort1.ReadLine(), "\\D+", ""))/ Wetghtunit+"";
+                                weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
+                                if (pr_cartonunit.Text == "kg")
+                                    weight.Text = (float.Parse(weight.Text) / 1000).ToString();
                             }
                             }
                             catch (Exception)
                             catch (Exception)
                             {
                             {