Browse Source

Merge remote-tracking branch 'refs/remotes/origin/master'

章政 8 years ago
parent
commit
8475f9cb0c

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

@@ -42,7 +42,8 @@ namespace UAS_MES.Make
         int MaxWeight;
         //最小重量
         int MinWeight;
-
+        //重量倍率
+        int Wetghtunit =1;
         DataTable ListC = new DataTable();
 
         Thread InitPrint;
@@ -116,15 +117,17 @@ namespace UAS_MES.Make
                     string _weight = dt.Rows[0]["pr_cartongw"].ToString();
                     string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
                     string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
+                    string pa_pr_cartonunit = dt.Rows[0]["pr_cartonunit"].ToString();
                     Weight = int.Parse(_weight == "" ? "0" : _weight);
                     MaxWeight = int.Parse(_maxweight == "" ? "0" : _maxweight);
                     MinWeight = int.Parse(_minweight == "" ? "0" : _minweight);
                     pa_totalqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
+                    Wetghtunit = int.Parse(pa_pr_cartonunit == "kg" ?"1000":"1");
                     if (Weight - MinWeight == MaxWeight - Weight)
                         pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight);
                     else
                         pr_cartongw.Text = MinWeight + "-" + MaxWeight;
-                    int ActualWeight = int.Parse(weight.Text == "" ? "0" : weight.Text);
+                    double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text);
                     //称量合格或不合格都记录重量
                     if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
                     {
@@ -164,7 +167,7 @@ namespace UAS_MES.Make
                         {
                             try
                             {
-                                weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
+                                weight.Text = Double.Parse(Regex.Replace(serialPort1.ReadLine(), "\\D+", ""))/ Wetghtunit+"";
                             }
                             catch (Exception)
                             {

+ 7 - 2
UAS-MES/FunctionCode/Make/Make_ColorBoxLabelPrint.cs

@@ -72,7 +72,7 @@ namespace UAS_MES.Make
             ma_code.Condition = "ma_statuscode='STARTED'";
             ma_code.DbChange += Ma_code_DbChange;
 
-            OperateResult.AppendText(">>请输入TSN\n", Color.Black);
+            OperateResult.AppendText(">>请输入TSN\n", Color.Black);  
         }
 
         private void Ma_code_DbChange(object sender, EventArgs e)
@@ -97,6 +97,7 @@ namespace UAS_MES.Make
             {
                 lbl = new ApplicationClass();
                 BaseUtil.WriteLbl(lbl);
+                ftpOperater ftp = new ftpOperater();
             }
             catch (Exception ex)
             {
@@ -283,7 +284,6 @@ namespace UAS_MES.Make
             PrintLabel.DataSource = dt;
             PrintLabel.DisplayMember = "pl_name";
             PrintLabel.ValueMember = "pl_labelcode";
-            ftpOperater ftp = new ftpOperater();
             indate = new System.DateTime[dt.Rows.Count];
             for (int i = 0; i < dt.Rows.Count; i++)
             {
@@ -347,5 +347,10 @@ namespace UAS_MES.Make
                 sncode.Focus();
             }
         }
+
+        private void PrintLabel_TabIndexChanged(object sender, EventArgs e)
+        {
+            MessageBox.Show(PrintLabel.Text);
+        }
     }
 }

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_CustomLabelPrint.cs

@@ -250,7 +250,7 @@ namespace UAS_MES.Make
 
         private void pr_code_Leave(object sender, EventArgs e)
         {
-            pr_code_KeyDown(sender, new KeyEventArgs(Keys.Enter));
+            //pr_code_KeyDown(sender, new KeyEventArgs(Keys.Enter));
         }
     }
 }

+ 2 - 2
UAS-MES/PublicMethod/BaseUtil.cs

@@ -1135,7 +1135,7 @@ namespace UAS_MES.PublicMethod
                 proc.StandardInput.WriteLine("exit");
                 while (!proc.HasExited)
                 {
-                    proc.WaitForExit(1000);
+                    proc.WaitForExit(1);
                 }
                 string errormsg = proc.StandardError.ReadToEnd();
                 proc.StandardError.Close();
@@ -1150,7 +1150,7 @@ namespace UAS_MES.PublicMethod
             }
             catch (Exception ex)
             {
-                throw ex;
+                throw new Exception(ex.Message);
             }
             finally
             {