浏览代码

修改彩盒称重设置

callm 3 周之前
父节点
当前提交
40823e490e

+ 5 - 1
UAS_MES_YDCY/CustomControl/TextBoxWithIcon/SnCollectionBox.cs

@@ -39,7 +39,11 @@ namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
                     this.FindForm().Tag.ToString() == "Make!ColorBoxWeigh" ||
                     this.FindForm().Tag.ToString() == "Make!TestCollection" ||
                     this.FindForm().Tag.ToString() == "Make!ColorBoxLabelPrint" ||
-                    this.FindForm().Tag.ToString() == "Make!SNLabelCheck" ||
+                    this.FindForm().Tag.ToString() == "Make!SNLabelCheckSH" ||
+                    this.FindForm().Tag.ToString() == "Make!SNLabelCheckBXK" ||
+                    this.FindForm().Tag.ToString() == "Make!SNLabelCheckColorBox" ||
+                    this.FindForm().Tag.ToString() == "Make!SNLabelCheckMidBox" ||
+                    this.FindForm().Tag.ToString() == "Packing!ProdWeightSetMidBox" ||
                     this.FindForm().Tag.ToString() == "Make!Repair")
                 {
                     DataTable dt = (DataTable)SystemInf.dh.ExecuteSql("select nvl(pr_alllength,0)pr_alllength,pr_suffix,pr_prefix,nvl(pr_length,0)pr_length from product where " +

+ 2 - 2
UAS_MES_YDCY/FunctionCode/Make/Make_RePrintLabel.Designer.cs

@@ -384,9 +384,9 @@
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Make_RePrintLabel_FormClosing);
             this.Load += new System.EventHandler(this.Make_RePrintLabel_Load);
             this.SizeChanged += new System.EventHandler(this.Make_RePrintLabel_SizeChanged);
-            this.groupBoxWithBorder1.ResumeLayout(false);
+            this.groupBoxWithBorder1.ResumeLayout(true);
             this.groupBoxWithBorder1.PerformLayout();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 1 - 1
UAS_MES_YDCY/FunctionCode/Make/Make_SNLabelCheckBXK.Designer.cs

@@ -745,7 +745,7 @@
             this.SizeChanged += new System.EventHandler(this.Make_FeedingCollection_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 1 - 1
UAS_MES_YDCY/FunctionCode/Make/Make_SNLabelCheckColorBox.Designer.cs

@@ -745,7 +745,7 @@
             this.SizeChanged += new System.EventHandler(this.Make_FeedingCollection_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 1 - 1
UAS_MES_YDCY/FunctionCode/Make/Make_SNLabelCheckMidBox.Designer.cs

@@ -745,7 +745,7 @@
             this.SizeChanged += new System.EventHandler(this.Make_FeedingCollection_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 1 - 1
UAS_MES_YDCY/FunctionCode/Make/Make_SNLabelCheckSH.Designer.cs

@@ -745,7 +745,7 @@
             this.SizeChanged += new System.EventHandler(this.Make_FeedingCollection_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 1 - 1
UAS_MES_YDCY/FunctionCode/OQC/OQC_CancelMakeDown.Designer.cs

@@ -204,7 +204,7 @@
             this.Tag = "Special!CancelCollection";
             this.Text = "取消采集";
             this.Load += new System.EventHandler(this.Special_CancelCollection_Load);
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 1 - 1
UAS_MES_YDCY/FunctionCode/OQC/OQC_QCRecheck.Designer.cs

@@ -204,7 +204,7 @@
             this.Tag = "Special!CancelCollection";
             this.Text = "取消采集";
             this.Load += new System.EventHandler(this.Special_CancelCollection_Load);
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 9 - 9
UAS_MES_YDCY/FunctionCode/Packing/Packing_ProdWeightSetMidBox.Designer.cs

@@ -207,7 +207,7 @@
             // errorValue
             // 
             this.errorValue.Location = new System.Drawing.Point(327, 25);
-            this.errorValue.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.errorValue.Margin = new System.Windows.Forms.Padding(4);
             this.errorValue.Name = "errorValue";
             this.errorValue.Size = new System.Drawing.Size(132, 35);
             this.errorValue.TabIndex = 52;
@@ -217,7 +217,7 @@
             // standardWeight
             // 
             this.standardWeight.Location = new System.Drawing.Point(111, 25);
-            this.standardWeight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.standardWeight.Margin = new System.Windows.Forms.Padding(4);
             this.standardWeight.Name = "standardWeight";
             this.standardWeight.Size = new System.Drawing.Size(132, 35);
             this.standardWeight.TabIndex = 51;
@@ -232,7 +232,7 @@
             this.confirm.Image = null;
             this.confirm.IsShowBorder = true;
             this.confirm.Location = new System.Drawing.Point(493, 115);
-            this.confirm.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.confirm.Margin = new System.Windows.Forms.Padding(4);
             this.confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("confirm.MoveImage")));
             this.confirm.Name = "confirm";
             this.confirm.NormalImage = ((System.Drawing.Image)(resources.GetObject("confirm.NormalImage")));
@@ -261,9 +261,8 @@
             this.unit.Location = new System.Drawing.Point(495, 29);
             this.unit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.unit.Name = "unit";
-            this.unit.Size = new System.Drawing.Size(47, 35);
+            this.unit.Size = new System.Drawing.Size(0, 35);
             this.unit.TabIndex = 47;
-            this.unit.Text = "kg";
             // 
             // label6
             // 
@@ -313,8 +312,9 @@
             this.weight.Location = new System.Drawing.Point(197, 99);
             this.weight.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
             this.weight.Name = "weight";
-            this.weight.Size = new System.Drawing.Size(0, 78);
+            this.weight.Size = new System.Drawing.Size(138, 78);
             this.weight.TabIndex = 41;
+            this.weight.Text = "790";
             // 
             // label1
             // 
@@ -334,7 +334,7 @@
             this.sncode.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.sncode.ID = null;
             this.sncode.Location = new System.Drawing.Point(147, 701);
-            this.sncode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.sncode.Margin = new System.Windows.Forms.Padding(4);
             this.sncode.Name = "sncode";
             this.sncode.Power = null;
             this.sncode.Size = new System.Drawing.Size(248, 39);
@@ -432,7 +432,7 @@
             this.ma_code.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.ma_code.FormName = null;
             this.ma_code.Location = new System.Drawing.Point(201, 24);
-            this.ma_code.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(5);
             this.ma_code.Name = "ma_code";
             this.ma_code.Power = "";
             this.ma_code.ReturnData = null;
@@ -468,7 +468,7 @@
             this.Controls.Add(this.ma_code);
             this.Controls.Add(this.ms_makecode_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Packing_ProdWeightSetMidBox";
             this.Tag = "Packing!ProdWeightSet";
             this.Text = "Packing_ProdWeightSet";

+ 24 - 16
UAS_MES_YDCY/FunctionCode/Packing/Packing_ProdWeightSetMidBox.cs

@@ -63,7 +63,7 @@ namespace UAS_MES_NEW.Packing
             ma_code.TableName = "make left join product on ma_prodcode=pr_code";
             ma_code.SelectField = "ma_code # 工单号,pr_code # 产品编号,pr_detail # 产品名称,pr_spec # 规格,ma_qty # 工单数量";
             ma_code.FormName = Name;
-            ma_code.SetValueField = new string[] { "ma_code","pr_code","pr_detail","pr_spec" };
+            ma_code.SetValueField = new string[] { "ma_code", "pr_code", "pr_detail", "pr_spec" };
             ma_code.DbChange += Ma_code_DbChange;
 
             dh = SystemInf.dh;
@@ -77,12 +77,12 @@ namespace UAS_MES_NEW.Packing
             //取误差值
             errorValue.Text = dh.GetConfig("prodWeightErrorValue", "MESSetting").ToString();
         }
-        private void recordResult(int index,string palletcode, string weigh, DateTime time)
+        private void recordResult(int index, string palletcode, string weigh, DateTime time)
         {
             //创建一个item
             ListViewItem lvi = new ListViewItem();
             //分条赋值
-            lvi.SubItems.Add(index+"");
+            lvi.SubItems.Add(index + "");
             lvi.SubItems.Add(palletcode);
             lvi.SubItems.Add(weigh);
             lvi.SubItems.Add(time.ToString());
@@ -171,13 +171,13 @@ namespace UAS_MES_NEW.Packing
         private void confirm_Click(object sender, EventArgs e)
         {
             //按确认更新产品重量
-            if (ma_code.Text=="")
+            if (ma_code.Text == "")
             {
                 OperateResult.AppendText("<<请先选择工单\n", Color.Red);
                 return;
             }
             //判断是否达到已称数量
-            if (showResult.Items.Count<samplesCount)
+            if (showResult.Items.Count < samplesCount)
             {
                 OperateResult.AppendText("<<采样个数不足\n", Color.Red);
                 return;
@@ -190,17 +190,25 @@ namespace UAS_MES_NEW.Packing
             //}
             //sum = sum / weights.Count;
             //更新彩盒重量最大值最小值
+            double totalweight = 0;
+            foreach (string w in weights)
+            {
+                totalweight += double.Parse(w);
+            }
+            standardWeight.Text = (totalweight / weights.Count).ToString();
             dh.ExecuteSql("update product set pr_midboxmaxweight ='" + (double.Parse(standardWeight.Text) + double.Parse(errorValue.Text)) + "', pr_midboxminweight = '" + (double.Parse(standardWeight.Text) - double.Parse(errorValue.Text)) + "' where pr_code='" + pr_code.Text + "'", "update");
             //更新此产品需要检测彩盒重量
             //dh.ExecuteSql("update product set pr_checkcolorboxw = 1 where pr_code='" + pr_code.Text + "'", "update");
-            OperateResult.AppendText("<<重量设置成功,最大值" + (double.Parse(standardWeight.Text) + double.Parse(errorValue.Text)) +unit.Text+ ",最小值" + (double.Parse(standardWeight.Text) - double.Parse(errorValue.Text)) + unit.Text+"\n", Color.Green);
-            LogicHandler.DoCommandLog(Tag.ToString(),User.UserCode,"",User.UserLineCode,User.UserSourceCode,"产品重量设置","产品编号"+pr_code.Text+",最大"+ (double.Parse(standardWeight.Text) + double.Parse(errorValue.Text))+unit.Text+"最小"+ (double.Parse(standardWeight.Text) - double.Parse(errorValue.Text))+unit.Text,"","");
+            OperateResult.AppendText("<<重量设置成功,最大值" + (double.Parse(standardWeight.Text) + double.Parse(errorValue.Text)) + unit.Text + ",最小值" + (double.Parse(standardWeight.Text) - double.Parse(errorValue.Text)) + unit.Text + "\n", Color.Green);
+            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "产品重量设置", "产品编号" + pr_code.Text + ",最大" + (double.Parse(standardWeight.Text) + double.Parse(errorValue.Text)) + unit.Text + "最小" + (double.Parse(standardWeight.Text) - double.Parse(errorValue.Text)) + unit.Text, "", "");
             //更新采样记录表
             string serialNum = dh.GetSerialNumberByCaller("ProdWeightSample");
             sql.Clear();
             sql.Append("insert into PRODWEIGHTSAMPLE(PWS_CODE,PWS_SNCODE,PWS_MAKECODE,PWS_PRODCODE,PWS_INDATE,PWS_WEIGHT,PWS_UNIT) ");
-            sql.Append("values ('"+serialNum+"',:sncode,'"+ma_code.Text+"','"+pr_code.Text+ "',TO_Date(:indate,'YYYY-MM-dd HH24:mi:ss'),:weight,'" + unit.Text+"')");
-            dh.BatchInsert(sql.GetString(), new string[] { "sncode", "indate" , "weight" },sncodes.ToArray(),indates.ToArray(),weights.ToArray());
+            sql.Append("values ('" + serialNum + "',:sncode,'" + ma_code.Text + "','" + pr_code.Text + "',TO_Date(:indate,'YYYY-MM-dd HH24:mi:ss'),:weight,'" + unit.Text + "')");
+            dh.BatchInsert(sql.GetString(), new string[] { "sncode", "indate", "weight" }, sncodes.ToArray(), indates.ToArray(), weights.ToArray());
+
+
         }
 
         private void sncode_KeyDown(object sender, KeyEventArgs e)
@@ -230,9 +238,9 @@ namespace UAS_MES_NEW.Packing
                     return;
                 }
                 //验证彩盒是否与产品对应
-                if (!dh.CheckExist("makeserial","ms_prodcode='"+pr_code.Text+"' and ms_sncode = '"+sncode.Text+"'"))
+                if (!dh.CheckExist("makeserial", "ms_prodcode='" + pr_code.Text + "' and ms_sncode = '" + sncode.Text + "'"))
                 {
-                    OperateResult.AppendText("<<序列号"+sncode.Text+"对应产品编号不是"+pr_code.Text+"\n", Color.Red, sncode);
+                    OperateResult.AppendText("<<序列号" + sncode.Text + "对应产品编号不是" + pr_code.Text + "\n", Color.Red, sncode);
                     return;
                 }
                 //验证所称彩盒是否重复
@@ -243,13 +251,13 @@ namespace UAS_MES_NEW.Packing
                 }
                 //判断称重记录是否满足标准重量+-误差值
                 double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Trim());
-                if (ActualWeight < (double.Parse(standardWeight.Text)- double.Parse(errorValue.Text))|| ActualWeight > (double.Parse(standardWeight.Text) + double.Parse(errorValue.Text)))
+                if (ActualWeight < (double.Parse(standardWeight.Text) - double.Parse(errorValue.Text)) || ActualWeight > (double.Parse(standardWeight.Text) + double.Parse(errorValue.Text)))
                 {
                     OperateResult.AppendText("<<序列号" + sncode.Text + "重量不在预设范围内\n", Color.Red, sncode);
                     return;
                 }
                 //记录重量
-                recordResult(showResult.Items.Count+1,sncode.Text, weight.Text, System.DateTime.Now);
+                recordResult(showResult.Items.Count + 1, sncode.Text, weight.Text, System.DateTime.Now);
                 sncode.Text = "";
             }
         }
@@ -306,11 +314,11 @@ namespace UAS_MES_NEW.Packing
             //在采样的时候不能更改
             if (showResult.Items.Count > 0)
             {
-                if ((sender as TextBox).Name == "standardWeight"&& standardWeight.Text == recordSW)
+                if ((sender as TextBox).Name == "standardWeight" && standardWeight.Text == recordSW)
                 {
                     return;
                 }
-                else if((sender as TextBox).Name == "errorValue" && errorValue.Text == recordEV)
+                else if ((sender as TextBox).Name == "errorValue" && errorValue.Text == recordEV)
                 {
                     return;
                 }
@@ -369,7 +377,7 @@ namespace UAS_MES_NEW.Packing
             catch (Exception ess)
             {
                 //如果没维护的话默认是10
-                samplesCount = 10;
+                samplesCount = 5;
             }
             OperateResult.AppendText("<<重量设置需采样个数为" + samplesCount + "\n", Color.Black);
             //清空称量记录

+ 1 - 1
UAS_MES_YDCY/FunctionCode/SystemSetting/SystemSetting_PrinterTest.Designer.cs

@@ -452,7 +452,7 @@
             this.Load += new System.EventHandler(this.SystemSetting_PrinterTest_Load);
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.NumLength)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }