shim %!s(int64=8) %!d(string=hai) anos
pai
achega
c359a0e55f

+ 0 - 2
UAS-MES/FunctionCode/Packing/Packing_ProdWeightSet.Designer.cs

@@ -102,7 +102,6 @@
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 31);
             this.pr_detail.TabIndex = 217;
-            this.pr_detail.TextChanged += new System.EventHandler(this.pr_detail_TextChanged);
             // 
             // label3
             // 
@@ -428,7 +427,6 @@
             this.ma_code.Tag = "makecode";
             this.ma_code.TextBoxEnable = true;
             this.ma_code.UserControlTextChanged += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextChange(this.ma_code_UserControlTextChanged);
-            this.ma_code.TextKeyDown += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextKeyDown(this.ma_code_KeyDown);
             // 
             // Packing_ProdWeightSet
             // 

+ 39 - 36
UAS-MES/FunctionCode/Packing/Packing_ProdWeightSet.cs

@@ -47,6 +47,8 @@ namespace UAS_MES.Packing
 
         string recordSW = ""; //存标准重量
         string recordEV = "";//存误差值
+
+        bool isKg = false;//记录单位是否KG
         public Packing_ProdWeightSet()
         {
             InitializeComponent();
@@ -183,8 +185,16 @@ namespace UAS_MES.Packing
             }
             sum = sum / weights.Count;
             //更新彩盒重量最大值最小值
-            dh.ExecuteSql("update product set PR_COLORBOXMAXW ='"+(sum+double.Parse(errorValue.Text))+"', PR_COLORBOXMINW = '"+ (sum - double.Parse(errorValue.Text)) + "',PR_COLORBOXUNIT='"+pr_cartonunit.Text+"' where pr_code='" + pr_code.Text+"'", "update");
-            OperateResult.AppendText("<<重量设置成功,最大值"+ (sum + double.Parse(errorValue.Text)) + ",最小值"+ (sum - double.Parse(errorValue.Text)) + "\n", Color.Green);
+            if (isKg)
+            {
+                dh.ExecuteSql("update product set PR_COLORBOXMAXW ='" + (sum + double.Parse(errorValue.Text))/1000 + "', PR_COLORBOXMINW = '" + (sum - double.Parse(errorValue.Text))/1000 + "',PR_COLORBOXUNIT='" + pr_cartonunit.Text + "' where pr_code='" + pr_code.Text + "'", "update");
+                OperateResult.AppendText("<<重量设置成功,最大值" + (sum + double.Parse(errorValue.Text))/1000 + "kg,最小值" + (sum - double.Parse(errorValue.Text))/1000 + "kg\n", Color.Green);
+            }
+            else
+            {
+                dh.ExecuteSql("update product set PR_COLORBOXMAXW ='" + (sum + double.Parse(errorValue.Text)) + "', PR_COLORBOXMINW = '" + (sum - double.Parse(errorValue.Text)) + "',PR_COLORBOXUNIT='" + pr_cartonunit.Text + "' where pr_code='" + pr_code.Text + "'", "update");
+                OperateResult.AppendText("<<重量设置成功,最大值"+ (sum + double.Parse(errorValue.Text)) + "g,最小值"+ (sum - double.Parse(errorValue.Text)) + "g\n", Color.Green);
+            }
             //更新采样记录表
             string serialNum = dh.GetSerialNumberByCaller("ProdWeightSample");
             sql.Clear();
@@ -255,6 +265,16 @@ namespace UAS_MES.Packing
 
         private void ma_code_UserControlTextChanged(object sender, EventArgs e)
         {
+            //赋值
+            sql.Clear();
+            sql.Append("select ma_code,pr_code,pr_detail,pr_spec,ma_qty from make left join product on ma_prodcode=pr_code ");
+            sql.Append("where ma_code='" + ma_code.Text + "'");
+            Dbfind = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            if (Dbfind.Rows.Count == 0)
+            {
+                return;
+            }
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
             //清空称量记录
             showResult.Items.Clear();
             indates.Clear();
@@ -279,26 +299,6 @@ namespace UAS_MES.Packing
             }
         }
 
-        private void pr_detail_TextChanged(object sender, EventArgs e)
-        {
-            //产品更换的时候
-            DataTable d =  (DataTable)dh.ExecuteSql("select PR_COLORBOXMAXW,PR_COLORBOXMINW from product where pr_code='"+pr_code.Text+"'","select");
-            //给标准重量赋值
-            if (d.Rows[0]["PR_COLORBOXMAXW"].ToString() == "" || d.Rows[0]["PR_COLORBOXMINW"].ToString() == "")
-            {
-                standardWeight.Text = 0 + "";
-            }
-            else
-            {
-                //取二者平均值来
-                standardWeight.Text = (double.Parse(d.Rows[0]["PR_COLORBOXMAXW"].ToString())+ double.Parse(d.Rows[0]["PR_COLORBOXMINW"].ToString()))/2+"";
-            }
-        }
-
-        private void standardWeight_TextChanged(object sender, EventArgs e)
-        {
-        }
-
         private void standardWeight_Leave(object sender, EventArgs e)
         {
             //在采样的时候不能更改
@@ -335,25 +335,28 @@ namespace UAS_MES.Packing
             recordEV = errorValue.Text;
         }
 
-        private void ma_code_KeyDown(object sender, KeyEventArgs e)
+        private void pr_code_TextChanged(object sender, EventArgs e)
         {
-            if (e.KeyCode==Keys.Enter)
+            //产品更换的时候
+            DataTable d = (DataTable)dh.ExecuteSql("select PR_COLORBOXMAXW,PR_COLORBOXMINW,PR_COLORBOXUNIT from product where pr_code='" + pr_code.Text + "'", "select");
+            isKg = false;
+            //给标准重量赋值
+            if (d.Rows[0]["PR_COLORBOXMAXW"].ToString() == "" || d.Rows[0]["PR_COLORBOXMINW"].ToString() == "")
             {
-                //赋值
-                sql.Clear();
-                sql.Append("select ma_code,pr_code,pr_detail,pr_spec,ma_qty from make left join product on ma_prodcode=pr_code ");
-                sql.Append("where ma_code='" + ma_code.Text + "'");
-                Dbfind = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                if (Dbfind.Rows.Count==0)
+                standardWeight.Text = 0 + "";
+            }
+            else
+            {
+                //取二者平均值来
+                standardWeight.Text = (double.Parse(d.Rows[0]["PR_COLORBOXMAXW"].ToString()) + double.Parse(d.Rows[0]["PR_COLORBOXMINW"].ToString())) / 2 + "";
+                if (d.Rows[0]["PR_COLORBOXUNIT"].ToString()=="kg")
                 {
-                    return;
+                    isKg = true;
+                    standardWeight.Text = double.Parse(standardWeight.Text) * 1000 + "";
                 }
-                BaseUtil.SetFormValue(this.Controls, Dbfind);
             }
-        }
-
-        private void pr_code_TextChanged(object sender, EventArgs e)
-        {
+            //取误差值
+            errorValue.Text = dh.GetConfig("prodWeightErrorValue", "MESSetting").ToString();
             //查询重量设置采样个数
             try
             {