Selaa lähdekoodia

添加箱号长度限制

章政 8 vuotta sitten
vanhempi
commit
f6cfb25ede

+ 76 - 27
UAS-MES/FunctionCode/Make/Make_PackageCollection.Designer.cs

@@ -59,6 +59,9 @@
             this.PrintList_label = new System.Windows.Forms.Label();
             this.PrintNum_label = new System.Windows.Forms.Label();
             this.groupBoxWithBorder1 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.OutBoxLength_label = new System.Windows.Forms.Label();
+            this.OutBoxLength = new UAS_MES.CustomControl.TextBoxWithIcon.SnCollectionBox();
+            this.CheckOutBox = new System.Windows.Forms.CheckBox();
             this.pr_outboxinnerqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.DeleteAll = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.AutoGenBoxCode = new System.Windows.Forms.CheckBox();
@@ -247,11 +250,11 @@
             this.PrintNum.Enabled = false;
             this.PrintNum.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.PrintNum.ID = null;
-            this.PrintNum.Location = new System.Drawing.Point(308, 155);
+            this.PrintNum.Location = new System.Drawing.Point(317, 155);
             this.PrintNum.Margin = new System.Windows.Forms.Padding(4);
             this.PrintNum.Name = "PrintNum";
             this.PrintNum.Power = null;
-            this.PrintNum.Size = new System.Drawing.Size(67, 27);
+            this.PrintNum.Size = new System.Drawing.Size(40, 27);
             this.PrintNum.Str = null;
             this.PrintNum.Str1 = null;
             this.PrintNum.Str2 = null;
@@ -261,7 +264,7 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(360, 18);
+            this.label1.Location = new System.Drawing.Point(363, 25);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(92, 27);
@@ -273,7 +276,7 @@
             this.checkweightlabel.AutoSize = true;
             this.checkweightlabel.CutLength = null;
             this.checkweightlabel.ForeColor = System.Drawing.Color.Red;
-            this.checkweightlabel.Location = new System.Drawing.Point(156, 14);
+            this.checkweightlabel.Location = new System.Drawing.Point(159, 21);
             this.checkweightlabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.checkweightlabel.MaximumSize = new System.Drawing.Size(267, 0);
             this.checkweightlabel.Name = "checkweightlabel";
@@ -284,7 +287,7 @@
             // 
             this.ob_nowcheckqty.AutoSize = true;
             this.ob_nowcheckqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty.Location = new System.Drawing.Point(468, 105);
+            this.ob_nowcheckqty.Location = new System.Drawing.Point(471, 112);
             this.ob_nowcheckqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty.Name = "ob_nowcheckqty";
             this.ob_nowcheckqty.Size = new System.Drawing.Size(0, 27);
@@ -294,7 +297,7 @@
             // 
             this.ob_batchqty.AutoSize = true;
             this.ob_batchqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty.Location = new System.Drawing.Point(468, 60);
+            this.ob_batchqty.Location = new System.Drawing.Point(471, 67);
             this.ob_batchqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty.Name = "ob_batchqty";
             this.ob_batchqty.Size = new System.Drawing.Size(0, 27);
@@ -304,7 +307,7 @@
             // 
             this.ob_nowcheckqty_label.AutoSize = true;
             this.ob_nowcheckqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(360, 105);
+            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(363, 112);
             this.ob_nowcheckqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty_label.Name = "ob_nowcheckqty_label";
             this.ob_nowcheckqty_label.Size = new System.Drawing.Size(92, 27);
@@ -315,7 +318,7 @@
             // 
             this.ob_batchqty_label.AutoSize = true;
             this.ob_batchqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty_label.Location = new System.Drawing.Point(360, 61);
+            this.ob_batchqty_label.Location = new System.Drawing.Point(363, 68);
             this.ob_batchqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty_label.Name = "ob_batchqty_label";
             this.ob_batchqty_label.Size = new System.Drawing.Size(92, 27);
@@ -326,7 +329,7 @@
             // 
             this.ob_checkno.AutoSize = true;
             this.ob_checkno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_checkno.Location = new System.Drawing.Point(468, 18);
+            this.ob_checkno.Location = new System.Drawing.Point(471, 25);
             this.ob_checkno.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_checkno.Name = "ob_checkno";
             this.ob_checkno.Size = new System.Drawing.Size(0, 27);
@@ -381,7 +384,7 @@
             this.PrintLabel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.PrintLabel.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.PrintLabel.FormattingEnabled = true;
-            this.PrintLabel.Location = new System.Drawing.Point(157, 105);
+            this.PrintLabel.Location = new System.Drawing.Point(160, 113);
             this.PrintLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.PrintLabel.Name = "PrintLabel";
             this.PrintLabel.Size = new System.Drawing.Size(183, 28);
@@ -392,7 +395,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(11, 105);
+            this.label3.Location = new System.Drawing.Point(14, 112);
             this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(92, 27);
@@ -402,7 +405,7 @@
             // AutoPrint
             // 
             this.AutoPrint.Checked = false;
-            this.AutoPrint.Location = new System.Drawing.Point(95, 155);
+            this.AutoPrint.Location = new System.Drawing.Point(114, 155);
             this.AutoPrint.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.AutoPrint.Name = "AutoPrint";
             this.AutoPrint.Size = new System.Drawing.Size(111, 29);
@@ -411,7 +414,7 @@
             // PrintList
             // 
             this.PrintList.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.PrintList.Location = new System.Drawing.Point(157, 61);
+            this.PrintList.Location = new System.Drawing.Point(160, 69);
             this.PrintList.Margin = new System.Windows.Forms.Padding(8, 9, 8, 9);
             this.PrintList.Name = "PrintList";
             this.PrintList.Size = new System.Drawing.Size(181, 28);
@@ -442,7 +445,7 @@
             // 
             this.PrintList_label.AutoSize = true;
             this.PrintList_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintList_label.Location = new System.Drawing.Point(11, 61);
+            this.PrintList_label.Location = new System.Drawing.Point(14, 68);
             this.PrintList_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintList_label.Name = "PrintList_label";
             this.PrintList_label.Size = new System.Drawing.Size(112, 27);
@@ -453,7 +456,7 @@
             // 
             this.PrintNum_label.AutoSize = true;
             this.PrintNum_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintNum_label.Location = new System.Drawing.Point(225, 155);
+            this.PrintNum_label.Location = new System.Drawing.Point(247, 150);
             this.PrintNum_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintNum_label.Name = "PrintNum_label";
             this.PrintNum_label.Size = new System.Drawing.Size(52, 27);
@@ -463,6 +466,9 @@
             // groupBoxWithBorder1
             // 
             this.groupBoxWithBorder1.BorderColor = System.Drawing.Color.Black;
+            this.groupBoxWithBorder1.Controls.Add(this.OutBoxLength_label);
+            this.groupBoxWithBorder1.Controls.Add(this.OutBoxLength);
+            this.groupBoxWithBorder1.Controls.Add(this.CheckOutBox);
             this.groupBoxWithBorder1.Controls.Add(this.pr_outboxinnerqty);
             this.groupBoxWithBorder1.Controls.Add(this.DeleteAll);
             this.groupBoxWithBorder1.Controls.Add(this.AutoGenBoxCode);
@@ -486,6 +492,46 @@
             this.groupBoxWithBorder1.Text = "装箱信息";
             this.groupBoxWithBorder1.TextColor = System.Drawing.Color.Black;
             // 
+            // OutBoxLength_label
+            // 
+            this.OutBoxLength_label.AutoSize = true;
+            this.OutBoxLength_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.OutBoxLength_label.Location = new System.Drawing.Point(129, 19);
+            this.OutBoxLength_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.OutBoxLength_label.Name = "OutBoxLength_label";
+            this.OutBoxLength_label.Size = new System.Drawing.Size(52, 27);
+            this.OutBoxLength_label.TabIndex = 184;
+            this.OutBoxLength_label.Text = "长度";
+            // 
+            // OutBoxLength
+            // 
+            this.OutBoxLength.AllPower = null;
+            this.OutBoxLength.BackColor = System.Drawing.Color.White;
+            this.OutBoxLength.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.OutBoxLength.ID = null;
+            this.OutBoxLength.Location = new System.Drawing.Point(190, 20);
+            this.OutBoxLength.Margin = new System.Windows.Forms.Padding(8, 9, 8, 9);
+            this.OutBoxLength.Name = "OutBoxLength";
+            this.OutBoxLength.Power = null;
+            this.OutBoxLength.Size = new System.Drawing.Size(68, 27);
+            this.OutBoxLength.Str = null;
+            this.OutBoxLength.Str1 = null;
+            this.OutBoxLength.Str2 = null;
+            this.OutBoxLength.TabIndex = 183;
+            this.OutBoxLength.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OutBoxLength_KeyDown);
+            // 
+            // CheckOutBox
+            // 
+            this.CheckOutBox.AutoSize = true;
+            this.CheckOutBox.Checked = true;
+            this.CheckOutBox.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.CheckOutBox.Location = new System.Drawing.Point(269, 23);
+            this.CheckOutBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.CheckOutBox.Name = "CheckOutBox";
+            this.CheckOutBox.Size = new System.Drawing.Size(18, 17);
+            this.CheckOutBox.TabIndex = 182;
+            this.CheckOutBox.UseVisualStyleBackColor = true;
+            // 
             // pr_outboxinnerqty
             // 
             this.pr_outboxinnerqty.AllPower = null;
@@ -493,7 +539,7 @@
             this.pr_outboxinnerqty.Enabled = false;
             this.pr_outboxinnerqty.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.pr_outboxinnerqty.ID = null;
-            this.pr_outboxinnerqty.Location = new System.Drawing.Point(131, 93);
+            this.pr_outboxinnerqty.Location = new System.Drawing.Point(131, 105);
             this.pr_outboxinnerqty.Margin = new System.Windows.Forms.Padding(4);
             this.pr_outboxinnerqty.Name = "pr_outboxinnerqty";
             this.pr_outboxinnerqty.Power = null;
@@ -511,7 +557,7 @@
             this.DeleteAll.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.DeleteAll.Image = null;
             this.DeleteAll.IsShowBorder = true;
-            this.DeleteAll.Location = new System.Drawing.Point(453, 46);
+            this.DeleteAll.Location = new System.Drawing.Point(453, 58);
             this.DeleteAll.Margin = new System.Windows.Forms.Padding(4);
             this.DeleteAll.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.MoveImage")));
             this.DeleteAll.Name = "DeleteAll";
@@ -526,7 +572,7 @@
             // AutoGenBoxCode
             // 
             this.AutoGenBoxCode.AutoSize = true;
-            this.AutoGenBoxCode.Location = new System.Drawing.Point(291, 44);
+            this.AutoGenBoxCode.Location = new System.Drawing.Point(291, 50);
             this.AutoGenBoxCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.AutoGenBoxCode.Name = "AutoGenBoxCode";
             this.AutoGenBoxCode.Size = new System.Drawing.Size(114, 31);
@@ -538,7 +584,7 @@
             // 
             this.pa_currentqty_label.AutoSize = true;
             this.pa_currentqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty_label.Location = new System.Drawing.Point(285, 93);
+            this.pa_currentqty_label.Location = new System.Drawing.Point(285, 99);
             this.pa_currentqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty_label.Name = "pa_currentqty_label";
             this.pa_currentqty_label.Size = new System.Drawing.Size(92, 27);
@@ -549,7 +595,7 @@
             // 
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(285, 145);
+            this.pr_detail_label.Location = new System.Drawing.Point(285, 151);
             this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(92, 27);
@@ -562,7 +608,7 @@
             this.pa_outboxcode.BackColor = System.Drawing.Color.White;
             this.pa_outboxcode.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.pa_outboxcode.ID = null;
-            this.pa_outboxcode.Location = new System.Drawing.Point(131, 42);
+            this.pa_outboxcode.Location = new System.Drawing.Point(131, 54);
             this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(8, 9, 8, 9);
             this.pa_outboxcode.Name = "pa_outboxcode";
             this.pa_outboxcode.Power = null;
@@ -577,7 +623,7 @@
             // 
             this.pa_currentqty.AutoSize = true;
             this.pa_currentqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty.Location = new System.Drawing.Point(395, 93);
+            this.pa_currentqty.Location = new System.Drawing.Point(395, 99);
             this.pa_currentqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty.Name = "pa_currentqty";
             this.pa_currentqty.Size = new System.Drawing.Size(0, 27);
@@ -587,7 +633,7 @@
             // 
             this.pr_code_label.AutoSize = true;
             this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code_label.Location = new System.Drawing.Point(14, 147);
+            this.pr_code_label.Location = new System.Drawing.Point(14, 153);
             this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code_label.Name = "pr_code_label";
             this.pr_code_label.Size = new System.Drawing.Size(92, 27);
@@ -598,7 +644,7 @@
             // 
             this.pr_detail.AutoSize = true;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(395, 145);
+            this.pr_detail.Location = new System.Drawing.Point(395, 151);
             this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 27);
@@ -608,7 +654,7 @@
             // 
             this.pr_outboxinnerqty_label.AutoSize = true;
             this.pr_outboxinnerqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(14, 93);
+            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(14, 99);
             this.pr_outboxinnerqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_outboxinnerqty_label.Name = "pr_outboxinnerqty_label";
             this.pr_outboxinnerqty_label.Size = new System.Drawing.Size(92, 27);
@@ -619,7 +665,7 @@
             // 
             this.pr_code.AutoSize = true;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code.Location = new System.Drawing.Point(129, 145);
+            this.pr_code.Location = new System.Drawing.Point(129, 151);
             this.pr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_code.Name = "pr_code";
@@ -631,7 +677,7 @@
             // 
             this.pa_code_label.AutoSize = true;
             this.pa_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_code_label.Location = new System.Drawing.Point(14, 42);
+            this.pa_code_label.Location = new System.Drawing.Point(14, 48);
             this.pa_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_code_label.Name = "pa_code_label";
             this.pa_code_label.Size = new System.Drawing.Size(52, 27);
@@ -854,5 +900,8 @@
         private CustomControl.TextBoxWithIcon.EnterTextBox pr_outboxinnerqty;
         private CustomControl.TextBoxWithIcon.EnterTextBox PrintNum;
         private System.Windows.Forms.ComboBox PrintLabel;
+        private System.Windows.Forms.CheckBox CheckOutBox;
+        private System.Windows.Forms.Label OutBoxLength_label;
+        private CustomControl.TextBoxWithIcon.SnCollectionBox OutBoxLength;
     }
 }

+ 47 - 3
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -61,6 +61,11 @@ namespace UAS_MES.Make
             SetLoadingWindow stw = new SetLoadingWindow(thread, "初始化打印程序");
             BaseUtil.SetFormCenter(stw);
             stw.ShowDialog();
+            try
+            {
+                OutBoxLength.Text = BaseUtil.GetCacheData("OutBoxLength").ToString();
+            }
+            catch (Exception) { }
             dh = new DataHelper();
             sn_code.Focus();
         }
@@ -98,7 +103,6 @@ namespace UAS_MES.Make
             else
             {
                 pa_makecode.Text = "";
-                sn_code.Focus();
             }
             LoadCheckQTY();
         }
@@ -137,7 +141,10 @@ namespace UAS_MES.Make
             {
                 LoadData();
                 LoadGridData();
-                sn_code.Focus();
+                if (CheckOutBoxLength())
+                {
+                    sn_code.Focus();
+                }
             }
         }
 
@@ -305,6 +312,10 @@ namespace UAS_MES.Make
                                     BaseUtil.CleanDGVData(PackageDetail);
                                     pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", "", pr_code.Text, User.UserCode);
                                 }
+                                if (!CheckOutBoxLength())
+                                {
+                                    return;
+                                }
                                 ////箱号不存在的情况
                                 if (LogicHandler.Packing(sn_code.Text, pa_outboxcode.Text, AutoGenBoxCode.Checked, "标准", User.UserSourceCode, User.UserCode, pr_outboxinnerqty.Text, Cancel.Checked, out oOutBoxCode, out ErrorMessage))
                                 {
@@ -645,10 +656,43 @@ namespace UAS_MES.Make
                         }
                         else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已下地,不允许解除\n", Color.Red);
                     }
-                    else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已装箱"+ dt.Rows[0]["pa_mothercode"].ToString() + ",不允许解除\n", Color.Red);
+                    else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已装箱" + dt.Rows[0]["pa_mothercode"].ToString() + ",不允许解除\n", Color.Red);
                 }
                 else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在\n", Color.Red);
             }
         }
+
+        private void OutBoxLength_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                try
+                {
+                    int.Parse(OutBoxLength.Text);
+                    BaseUtil.SetCacheData("OutBoxLength", OutBoxLength.Text);
+                    pa_outboxcode.Focus();
+                }
+                catch (Exception)
+                {
+                    OutBoxLength.Clear();
+                    MessageBox.Show("请输入正确的长度");
+                }
+            }
+        }
+
+        private bool CheckOutBoxLength()
+        {
+            //勾选了检验长度进行校验
+            if (CheckOutBox.Checked)
+            {
+                if (pa_outboxcode.Text.Length != int.Parse(OutBoxLength.Text))
+                {
+                    OperateResult.AppendText(">>箱号长度错误,请重新输入箱号\n", Color.Red);
+                    return false;
+                }
+                else return true;
+            }
+            return true;
+        }
     }
 }

+ 85 - 36
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.Designer.cs

@@ -90,6 +90,9 @@
             this.pa_sccode = new System.Windows.Forms.Label();
             this.ms_makecode = new System.Windows.Forms.Label();
             this.pa_standardqty = new System.Windows.Forms.Label();
+            this.OutBoxLength_label = new System.Windows.Forms.Label();
+            this.OutBoxLength = new UAS_MES.CustomControl.TextBoxWithIcon.SnCollectionBox();
+            this.CheckOutBox = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
             this.groupBoxWithBorder2.SuspendLayout();
@@ -123,7 +126,7 @@
             // 
             this.pa_code_label.AutoSize = true;
             this.pa_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_code_label.Location = new System.Drawing.Point(18, 54);
+            this.pa_code_label.Location = new System.Drawing.Point(18, 63);
             this.pa_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_code_label.Name = "pa_code_label";
             this.pa_code_label.Size = new System.Drawing.Size(52, 27);
@@ -134,7 +137,7 @@
             // 
             this.PrintList_label.AutoSize = true;
             this.PrintList_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintList_label.Location = new System.Drawing.Point(4, 56);
+            this.PrintList_label.Location = new System.Drawing.Point(11, 66);
             this.PrintList_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintList_label.Name = "PrintList_label";
             this.PrintList_label.Size = new System.Drawing.Size(112, 27);
@@ -145,7 +148,7 @@
             // 
             this.PrintNum_label.AutoSize = true;
             this.PrintNum_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintNum_label.Location = new System.Drawing.Point(235, 154);
+            this.PrintNum_label.Location = new System.Drawing.Point(235, 153);
             this.PrintNum_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintNum_label.Name = "PrintNum_label";
             this.PrintNum_label.Size = new System.Drawing.Size(52, 27);
@@ -180,7 +183,7 @@
             this.PrintLabel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.PrintLabel.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.PrintLabel.FormattingEnabled = true;
-            this.PrintLabel.Location = new System.Drawing.Point(151, 104);
+            this.PrintLabel.Location = new System.Drawing.Point(146, 115);
             this.PrintLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.PrintLabel.Name = "PrintLabel";
             this.PrintLabel.Size = new System.Drawing.Size(199, 28);
@@ -191,7 +194,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(4, 104);
+            this.label3.Location = new System.Drawing.Point(11, 114);
             this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(92, 27);
@@ -204,7 +207,7 @@
             this.pa_outboxcode.BackColor = System.Drawing.Color.White;
             this.pa_outboxcode.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.pa_outboxcode.ID = null;
-            this.pa_outboxcode.Location = new System.Drawing.Point(141, 54);
+            this.pa_outboxcode.Location = new System.Drawing.Point(141, 64);
             this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(8, 9, 8, 9);
             this.pa_outboxcode.Name = "pa_outboxcode";
             this.pa_outboxcode.Power = null;
@@ -218,7 +221,7 @@
             // PrintList
             // 
             this.PrintList.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.PrintList.Location = new System.Drawing.Point(151, 56);
+            this.PrintList.Location = new System.Drawing.Point(146, 67);
             this.PrintList.Margin = new System.Windows.Forms.Padding(8, 9, 8, 9);
             this.PrintList.Name = "PrintList";
             this.PrintList.Size = new System.Drawing.Size(199, 28);
@@ -369,7 +372,7 @@
             // AutoPrint
             // 
             this.AutoPrint.Checked = false;
-            this.AutoPrint.Location = new System.Drawing.Point(95, 154);
+            this.AutoPrint.Location = new System.Drawing.Point(104, 154);
             this.AutoPrint.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.AutoPrint.Name = "AutoPrint";
             this.AutoPrint.Size = new System.Drawing.Size(112, 28);
@@ -378,6 +381,9 @@
             // groupBoxWithBorder1
             // 
             this.groupBoxWithBorder1.BorderColor = System.Drawing.Color.Black;
+            this.groupBoxWithBorder1.Controls.Add(this.OutBoxLength_label);
+            this.groupBoxWithBorder1.Controls.Add(this.OutBoxLength);
+            this.groupBoxWithBorder1.Controls.Add(this.CheckOutBox);
             this.groupBoxWithBorder1.Controls.Add(this.pr_outboxinnerqty);
             this.groupBoxWithBorder1.Controls.Add(this.DeleteAll);
             this.groupBoxWithBorder1.Controls.Add(this.pa_currentqty_label);
@@ -408,7 +414,7 @@
             this.pr_outboxinnerqty.Enabled = false;
             this.pr_outboxinnerqty.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.pr_outboxinnerqty.ID = null;
-            this.pr_outboxinnerqty.Location = new System.Drawing.Point(141, 101);
+            this.pr_outboxinnerqty.Location = new System.Drawing.Point(141, 111);
             this.pr_outboxinnerqty.Margin = new System.Windows.Forms.Padding(4);
             this.pr_outboxinnerqty.Name = "pr_outboxinnerqty";
             this.pr_outboxinnerqty.Power = null;
@@ -426,7 +432,7 @@
             this.DeleteAll.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.DeleteAll.Image = null;
             this.DeleteAll.IsShowBorder = true;
-            this.DeleteAll.Location = new System.Drawing.Point(461, 51);
+            this.DeleteAll.Location = new System.Drawing.Point(461, 61);
             this.DeleteAll.Margin = new System.Windows.Forms.Padding(4);
             this.DeleteAll.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.MoveImage")));
             this.DeleteAll.Name = "DeleteAll";
@@ -442,7 +448,7 @@
             // 
             this.pa_currentqty_label.AutoSize = true;
             this.pa_currentqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty_label.Location = new System.Drawing.Point(294, 101);
+            this.pa_currentqty_label.Location = new System.Drawing.Point(294, 110);
             this.pa_currentqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty_label.Name = "pa_currentqty_label";
             this.pa_currentqty_label.Size = new System.Drawing.Size(92, 27);
@@ -453,7 +459,7 @@
             // 
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(294, 143);
+            this.pr_detail_label.Location = new System.Drawing.Point(294, 152);
             this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(92, 27);
@@ -464,7 +470,7 @@
             // 
             this.pa_currentqty.AutoSize = true;
             this.pa_currentqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty.Location = new System.Drawing.Point(405, 101);
+            this.pa_currentqty.Location = new System.Drawing.Point(405, 110);
             this.pa_currentqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty.Name = "pa_currentqty";
             this.pa_currentqty.Size = new System.Drawing.Size(0, 27);
@@ -474,7 +480,7 @@
             // 
             this.pr_code_label.AutoSize = true;
             this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code_label.Location = new System.Drawing.Point(18, 143);
+            this.pr_code_label.Location = new System.Drawing.Point(18, 152);
             this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code_label.Name = "pr_code_label";
             this.pr_code_label.Size = new System.Drawing.Size(92, 27);
@@ -485,7 +491,7 @@
             // 
             this.pr_detail.AutoSize = true;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(405, 143);
+            this.pr_detail.Location = new System.Drawing.Point(405, 152);
             this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 27);
@@ -495,7 +501,7 @@
             // 
             this.pr_outboxinnerqty_label.AutoSize = true;
             this.pr_outboxinnerqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(18, 101);
+            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(18, 110);
             this.pr_outboxinnerqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_outboxinnerqty_label.Name = "pr_outboxinnerqty_label";
             this.pr_outboxinnerqty_label.Size = new System.Drawing.Size(92, 27);
@@ -506,7 +512,7 @@
             // 
             this.pr_code.AutoSize = true;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code.Location = new System.Drawing.Point(137, 143);
+            this.pr_code.Location = new System.Drawing.Point(137, 152);
             this.pr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_code.Name = "pr_code";
@@ -517,7 +523,7 @@
             // AutoGenBoxCode
             // 
             this.AutoGenBoxCode.AutoSize = true;
-            this.AutoGenBoxCode.Location = new System.Drawing.Point(299, 54);
+            this.AutoGenBoxCode.Location = new System.Drawing.Point(299, 63);
             this.AutoGenBoxCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.AutoGenBoxCode.Name = "AutoGenBoxCode";
             this.AutoGenBoxCode.Size = new System.Drawing.Size(114, 31);
@@ -567,7 +573,7 @@
             this.PrintNum.Margin = new System.Windows.Forms.Padding(4);
             this.PrintNum.Name = "PrintNum";
             this.PrintNum.Power = null;
-            this.PrintNum.Size = new System.Drawing.Size(76, 27);
+            this.PrintNum.Size = new System.Drawing.Size(55, 27);
             this.PrintNum.Str = null;
             this.PrintNum.Str1 = null;
             this.PrintNum.Str2 = null;
@@ -577,7 +583,7 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(365, 15);
+            this.label1.Location = new System.Drawing.Point(372, 25);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(92, 27);
@@ -589,7 +595,7 @@
             this.checkweightlabel.AutoSize = true;
             this.checkweightlabel.CutLength = null;
             this.checkweightlabel.ForeColor = System.Drawing.Color.Black;
-            this.checkweightlabel.Location = new System.Drawing.Point(141, 17);
+            this.checkweightlabel.Location = new System.Drawing.Point(148, 27);
             this.checkweightlabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.checkweightlabel.MaximumSize = new System.Drawing.Size(267, 0);
             this.checkweightlabel.Name = "checkweightlabel";
@@ -600,7 +606,7 @@
             // 
             this.ob_nowcheckqty.AutoSize = true;
             this.ob_nowcheckqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty.Location = new System.Drawing.Point(473, 104);
+            this.ob_nowcheckqty.Location = new System.Drawing.Point(480, 114);
             this.ob_nowcheckqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty.Name = "ob_nowcheckqty";
             this.ob_nowcheckqty.Size = new System.Drawing.Size(0, 27);
@@ -610,7 +616,7 @@
             // 
             this.ob_batchqty.AutoSize = true;
             this.ob_batchqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty.Location = new System.Drawing.Point(473, 56);
+            this.ob_batchqty.Location = new System.Drawing.Point(480, 66);
             this.ob_batchqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty.Name = "ob_batchqty";
             this.ob_batchqty.Size = new System.Drawing.Size(0, 27);
@@ -620,7 +626,7 @@
             // 
             this.ob_nowcheckqty_label.AutoSize = true;
             this.ob_nowcheckqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(365, 104);
+            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(372, 114);
             this.ob_nowcheckqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty_label.Name = "ob_nowcheckqty_label";
             this.ob_nowcheckqty_label.Size = new System.Drawing.Size(92, 27);
@@ -631,7 +637,7 @@
             // 
             this.ob_batchqty_label.AutoSize = true;
             this.ob_batchqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty_label.Location = new System.Drawing.Point(365, 56);
+            this.ob_batchqty_label.Location = new System.Drawing.Point(372, 66);
             this.ob_batchqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty_label.Name = "ob_batchqty_label";
             this.ob_batchqty_label.Size = new System.Drawing.Size(92, 27);
@@ -683,7 +689,7 @@
             // 
             this.ob_checkno.AutoSize = true;
             this.ob_checkno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_checkno.Location = new System.Drawing.Point(473, 15);
+            this.ob_checkno.Location = new System.Drawing.Point(480, 25);
             this.ob_checkno.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_checkno.Name = "ob_checkno";
             this.ob_checkno.Size = new System.Drawing.Size(0, 27);
@@ -737,7 +743,7 @@
             // 
             this.pr_cartonunit1.AutoSize = true;
             this.pr_cartonunit1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonunit1.Location = new System.Drawing.Point(116, 152);
+            this.pr_cartonunit1.Location = new System.Drawing.Point(116, 151);
             this.pr_cartonunit1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonunit1.Name = "pr_cartonunit1";
             this.pr_cartonunit1.Size = new System.Drawing.Size(25, 27);
@@ -750,7 +756,7 @@
             // 
             this.pr_cartonunit.AutoSize = true;
             this.pr_cartonunit.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonunit.Location = new System.Drawing.Point(75, 26);
+            this.pr_cartonunit.Location = new System.Drawing.Point(75, 25);
             this.pr_cartonunit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonunit.Name = "pr_cartonunit";
             this.pr_cartonunit.Size = new System.Drawing.Size(25, 27);
@@ -762,7 +768,7 @@
             // 
             this.pr_cartonboxgw.AutoSize = true;
             this.pr_cartonboxgw.Font = new System.Drawing.Font("微软雅黑", 35F);
-            this.pr_cartonboxgw.Location = new System.Drawing.Point(35, 204);
+            this.pr_cartonboxgw.Location = new System.Drawing.Point(35, 203);
             this.pr_cartonboxgw.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonboxgw.Name = "pr_cartonboxgw";
             this.pr_cartonboxgw.Size = new System.Drawing.Size(0, 78);
@@ -772,7 +778,7 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(19, 152);
+            this.label4.Location = new System.Drawing.Point(19, 151);
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(92, 27);
@@ -784,7 +790,7 @@
             this.weight.AutoSize = true;
             this.weight.Font = new System.Drawing.Font("微软雅黑", 35F);
             this.weight.ForeColor = System.Drawing.Color.DarkGreen;
-            this.weight.Location = new System.Drawing.Point(32, 69);
+            this.weight.Location = new System.Drawing.Point(32, 68);
             this.weight.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.weight.Name = "weight";
             this.weight.Size = new System.Drawing.Size(0, 78);
@@ -794,7 +800,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(19, 26);
+            this.label2.Location = new System.Drawing.Point(19, 25);
             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(52, 27);
@@ -878,6 +884,46 @@
             this.pa_standardqty.TabIndex = 183;
             this.pa_standardqty.Visible = false;
             // 
+            // OutBoxLength_label
+            // 
+            this.OutBoxLength_label.AutoSize = true;
+            this.OutBoxLength_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.OutBoxLength_label.Location = new System.Drawing.Point(136, 25);
+            this.OutBoxLength_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.OutBoxLength_label.Name = "OutBoxLength_label";
+            this.OutBoxLength_label.Size = new System.Drawing.Size(52, 27);
+            this.OutBoxLength_label.TabIndex = 187;
+            this.OutBoxLength_label.Text = "长度";
+            // 
+            // OutBoxLength
+            // 
+            this.OutBoxLength.AllPower = null;
+            this.OutBoxLength.BackColor = System.Drawing.Color.White;
+            this.OutBoxLength.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.OutBoxLength.ID = null;
+            this.OutBoxLength.Location = new System.Drawing.Point(198, 25);
+            this.OutBoxLength.Margin = new System.Windows.Forms.Padding(8, 9, 8, 9);
+            this.OutBoxLength.Name = "OutBoxLength";
+            this.OutBoxLength.Power = null;
+            this.OutBoxLength.Size = new System.Drawing.Size(68, 27);
+            this.OutBoxLength.Str = null;
+            this.OutBoxLength.Str1 = null;
+            this.OutBoxLength.Str2 = null;
+            this.OutBoxLength.TabIndex = 186;
+            this.OutBoxLength.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OutBoxLength_KeyDown);
+            // 
+            // CheckOutBox
+            // 
+            this.CheckOutBox.AutoSize = true;
+            this.CheckOutBox.Checked = true;
+            this.CheckOutBox.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.CheckOutBox.Location = new System.Drawing.Point(277, 31);
+            this.CheckOutBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.CheckOutBox.Name = "CheckOutBox";
+            this.CheckOutBox.Size = new System.Drawing.Size(18, 17);
+            this.CheckOutBox.TabIndex = 185;
+            this.CheckOutBox.UseVisualStyleBackColor = true;
+            // 
             // Make_PackageCollectionWeigh
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -913,13 +959,13 @@
             this.Load += new System.EventHandler(this.Make_PackageCollectionWeigh_Load);
             this.SizeChanged += new System.EventHandler(this.Make_PackageCollectionWeigh_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).EndInit();
-            this.groupBoxWithBorder1.ResumeLayout(true);
+            this.groupBoxWithBorder1.ResumeLayout(false);
             this.groupBoxWithBorder1.PerformLayout();
-            this.groupBoxWithBorder2.ResumeLayout(true);
+            this.groupBoxWithBorder2.ResumeLayout(false);
             this.groupBoxWithBorder2.PerformLayout();
-            this.groupBoxWithBorder3.ResumeLayout(true);
+            this.groupBoxWithBorder3.ResumeLayout(false);
             this.groupBoxWithBorder3.PerformLayout();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -987,5 +1033,8 @@
         private System.Windows.Forms.Label label1;
         private CustomControl.TextBoxWithIcon.EnterTextBox PrintNum;
         private CustomControl.TextBoxWithIcon.EnterTextBox pr_outboxinnerqty;
+        private System.Windows.Forms.Label OutBoxLength_label;
+        private CustomControl.TextBoxWithIcon.SnCollectionBox OutBoxLength;
+        private System.Windows.Forms.CheckBox CheckOutBox;
     }
 }

+ 41 - 1
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -216,7 +216,10 @@ namespace UAS_MES.Make
             {
                 LoadData();
                 LoadGridData();
-                sn_code.Focus();
+                if (CheckOutBoxLength())
+                {
+                    sn_code.Focus();
+                }
             }
         }
 
@@ -378,6 +381,10 @@ namespace UAS_MES.Make
                                     BaseUtil.CleanDGVData(PackageDetail);
                                     pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", "", pr_code.Text, User.UserCode);
                                 }
+                                if (!CheckOutBoxLength())
+                                {
+                                    return;
+                                }
                                 ////箱号不存在的情况
                                 if (LogicHandler.Packing(sn_code.Text, pa_outboxcode.Text, AutoGenBoxCode.Checked, "标准", User.UserSourceCode, User.UserCode, pr_outboxinnerqty.Text, Cancel.Checked, out oOutBoxCode, out ErrorMessage))
                                 {
@@ -748,5 +755,38 @@ namespace UAS_MES.Make
                 else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在\n", Color.Red);
             }
         }
+
+        private void OutBoxLength_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                try
+                {
+                    int.Parse(OutBoxLength.Text);
+                    BaseUtil.SetCacheData("OutBoxLength", OutBoxLength.Text);
+                    pa_outboxcode.Focus();
+                }
+                catch (Exception)
+                {
+                    OutBoxLength.Clear();
+                    MessageBox.Show("请输入正确的长度");
+                }
+            }
+        }
+
+        private bool CheckOutBoxLength()
+        {
+            //勾选了检验长度进行校验
+            if (CheckOutBox.Checked)
+            {
+                if (pa_outboxcode.Text.Length != int.Parse(OutBoxLength.Text))
+                {
+                    OperateResult.AppendText(">>箱号长度错误,请重新输入箱号\n", Color.Red);
+                    return false;
+                }
+                else return true;
+            }
+            return true;
+        }
     }
 }