Hcsy 8 лет назад
Родитель
Сommit
622c038484
1 измененных файлов с 7 добавлено и 7 удалено
  1. 7 7
      UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

+ 7 - 7
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -28,11 +28,11 @@ namespace UAS_MES.Make
         string oMakeCode = "";
         string oMsID = "";
         //称量的标准重量
-        int Weight;
+        double Weight;
         //最大重量
-        int MaxWeight;
+        double MaxWeight;
         //最小重量
-        int MinWeight;
+        double MinWeight;
 
         //创建串口实例
         SerialPort serialPort1 = new SerialPort();
@@ -109,7 +109,7 @@ namespace UAS_MES.Make
                             {
                                 weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
                                 if (pr_cartonunit.Text == "kg")
-                                    weight.Text = (float.Parse(weight.Text) / 1000).ToString();
+                                    weight.Text = (double.Parse(weight.Text) / 1000).ToString();
                             }
                             catch (Exception)
                             {
@@ -166,9 +166,9 @@ namespace UAS_MES.Make
                 string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
                 string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
                 //赋值重量单位
-                Weight = int.Parse(_weight == "" ? "0" : _weight);
-                MaxWeight = int.Parse(_maxweight == "" ? "0" : _maxweight);
-                MinWeight = int.Parse(_minweight == "" ? "0" : _minweight);
+                Weight = double.Parse(_weight == "" ? "0" : _weight);
+                MaxWeight = double.Parse(_maxweight == "" ? "0" : _maxweight);
+                MinWeight = double.Parse(_minweight == "" ? "0" : _minweight);
                 BaseUtil.SetFormValue(this.Controls, dt);
                 if (Weight - MinWeight == MaxWeight - Weight)
                     pr_cartonboxgw.Text = Weight + "±" + (MaxWeight - Weight);