Browse Source

采集进度刷新

章政 7 years ago
parent
commit
43267dc2c3

+ 2 - 2
UAS-出货标签管理(吉利通)/PublicMethod/LogicHandler.cs

@@ -40,9 +40,9 @@ namespace UAS_LabelMachine.PublicMethod
         /// 检测数据库未上传的数据,根据设置的上传条数上传数据
         /// </summary>
         /// <param name="iInoutno"></param>
-        public static void CheckUoloadData(string iInoutno, int iUploadNum)
+        public static void CheckUploadData(string iInoutno, int iUploadNum)
         {
-            DataTable dt = (DataTable)adh.ExecuteSql("select pib_id,pib_lotno,pib_ifmodify,pib_datecode,pib_ifpick,-1 as pib_ifupload,pib_ifprint,pib_ifrecheck from prodiobarcode where pib_inoutno='" + iInoutno + "' and pib_ifmodify=-1 and pib_ifupload<>-1", "select");
+            DataTable dt = (DataTable)adh.ExecuteSql("select pib_id,pib_lotno,pib_ifmodify,pib_datecode,pib_ifpick,-1 as pib_ifupload,pib_ifprint,pib_ifrecheck from prodiobarcode where pib_inoutno='" + iInoutno + "'  and pib_ifupload<>-1", "select");
             //如果本地需要上传的数据已经达到了需要上传的条数
             if (iUploadNum <= dt.Rows.Count)
             {

+ 104 - 72
UAS-出货标签管理(吉利通)/UAS_出货标签管理.Designer.cs

@@ -85,12 +85,14 @@
             this.PLCStop = new System.Windows.Forms.Button();
             this.PLCStart = new System.Windows.Forms.Button();
             this.cu_print_regexpression = new System.Windows.Forms.Label();
+            this.label13 = new System.Windows.Forms.Label();
+            this.front_sg_separator = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.FrontCollect = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.CollectionProcess = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.DetailRange2 = new System.Windows.Forms.NumericUpDown();
             this.DetailRange1 = new System.Windows.Forms.NumericUpDown();
-            this.label26 = new System.Windows.Forms.Label();
-            this.label17 = new System.Windows.Forms.Label();
+            this.outboxProcess = new System.Windows.Forms.Label();
+            this.midboxProcess = new System.Windows.Forms.Label();
             this.label25 = new System.Windows.Forms.Label();
             this.label24 = new System.Windows.Forms.Label();
             this.button8 = new System.Windows.Forms.Button();
@@ -109,8 +111,8 @@
             this.radioButton5 = new System.Windows.Forms.RadioButton();
             this.radioButton6 = new System.Windows.Forms.RadioButton();
             this.label22 = new System.Windows.Forms.Label();
-            this.radioButton4 = new System.Windows.Forms.RadioButton();
-            this.radioButton3 = new System.Windows.Forms.RadioButton();
+            this.RecheckBarcode = new System.Windows.Forms.RadioButton();
+            this.RecheckCuprodcode = new System.Windows.Forms.RadioButton();
             this.DetailRange = new System.Windows.Forms.CheckBox();
             this.label21 = new System.Windows.Forms.Label();
             this.radioButton1 = new System.Windows.Forms.RadioButton();
@@ -121,7 +123,7 @@
             this.label14 = new System.Windows.Forms.Label();
             this.label11 = new System.Windows.Forms.Label();
             this.Process = new System.Windows.Forms.Label();
-            this.sg_separator = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.back_sg_separator = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.BackCheck = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.MessageLog = new UAS_LabelMachine.CustomControl.RichText.RichTextAutoBottom();
             this.LabelInf = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
@@ -594,13 +596,14 @@
             // 
             this.GetGridOnly.AutoSize = true;
             this.GetGridOnly.Font = new System.Drawing.Font("微软雅黑", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.GetGridOnly.Location = new System.Drawing.Point(237, 38);
+            this.GetGridOnly.Location = new System.Drawing.Point(76, 38);
             this.GetGridOnly.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.GetGridOnly.Name = "GetGridOnly";
             this.GetGridOnly.Size = new System.Drawing.Size(77, 20);
             this.GetGridOnly.TabIndex = 82;
             this.GetGridOnly.Text = "仅获取表格";
             this.GetGridOnly.UseVisualStyleBackColor = true;
+            this.GetGridOnly.Visible = false;
             // 
             // RefreshDBConnect
             // 
@@ -662,11 +665,11 @@
             // 
             this.sg_separator_label.AutoSize = true;
             this.sg_separator_label.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sg_separator_label.Location = new System.Drawing.Point(233, 66);
+            this.sg_separator_label.Location = new System.Drawing.Point(205, 65);
             this.sg_separator_label.Name = "sg_separator_label";
-            this.sg_separator_label.Size = new System.Drawing.Size(51, 20);
+            this.sg_separator_label.Size = new System.Drawing.Size(79, 20);
             this.sg_separator_label.TabIndex = 61;
-            this.sg_separator_label.Text = "分隔符";
+            this.sg_separator_label.Text = "后端分隔符";
             // 
             // 后端复核
             // 
@@ -698,6 +701,7 @@
             this.PLCStop.TabIndex = 92;
             this.PLCStop.Text = "暂停";
             this.PLCStop.UseVisualStyleBackColor = true;
+            this.PLCStop.Click += new System.EventHandler(this.PLCStop_Click);
             // 
             // PLCStart
             // 
@@ -709,6 +713,7 @@
             this.PLCStart.TabIndex = 93;
             this.PLCStart.Text = "启动";
             this.PLCStart.UseVisualStyleBackColor = true;
+            this.PLCStart.Click += new System.EventHandler(this.PLCStart_Click);
             // 
             // cu_print_regexpression
             // 
@@ -720,6 +725,29 @@
             this.cu_print_regexpression.TabIndex = 94;
             this.cu_print_regexpression.Text = "分隔符";
             // 
+            // label13
+            // 
+            this.label13.AutoSize = true;
+            this.label13.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label13.Location = new System.Drawing.Point(205, 38);
+            this.label13.Name = "label13";
+            this.label13.Size = new System.Drawing.Size(79, 20);
+            this.label13.TabIndex = 95;
+            this.label13.Text = "前端分隔符";
+            // 
+            // front_sg_separator
+            // 
+            this.front_sg_separator.Enabled = false;
+            this.front_sg_separator.ID = null;
+            this.front_sg_separator.Location = new System.Drawing.Point(290, 38);
+            this.front_sg_separator.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.front_sg_separator.Name = "front_sg_separator";
+            this.front_sg_separator.Size = new System.Drawing.Size(28, 21);
+            this.front_sg_separator.Str = null;
+            this.front_sg_separator.Str1 = null;
+            this.front_sg_separator.Str2 = null;
+            this.front_sg_separator.TabIndex = 96;
+            // 
             // FrontCollect
             // 
             this.FrontCollect.Enabled = false;
@@ -737,8 +765,8 @@
             // 
             this.CollectionProcess.Controls.Add(this.DetailRange2);
             this.CollectionProcess.Controls.Add(this.DetailRange1);
-            this.CollectionProcess.Controls.Add(this.label26);
-            this.CollectionProcess.Controls.Add(this.label17);
+            this.CollectionProcess.Controls.Add(this.outboxProcess);
+            this.CollectionProcess.Controls.Add(this.midboxProcess);
             this.CollectionProcess.Controls.Add(this.label25);
             this.CollectionProcess.Controls.Add(this.label24);
             this.CollectionProcess.Controls.Add(this.button8);
@@ -757,8 +785,8 @@
             this.CollectionProcess.Controls.Add(this.radioButton5);
             this.CollectionProcess.Controls.Add(this.radioButton6);
             this.CollectionProcess.Controls.Add(this.label22);
-            this.CollectionProcess.Controls.Add(this.radioButton4);
-            this.CollectionProcess.Controls.Add(this.radioButton3);
+            this.CollectionProcess.Controls.Add(this.RecheckBarcode);
+            this.CollectionProcess.Controls.Add(this.RecheckCuprodcode);
             this.CollectionProcess.Controls.Add(this.DetailRange);
             this.CollectionProcess.Controls.Add(this.label21);
             this.CollectionProcess.Controls.Add(this.radioButton1);
@@ -797,27 +825,27 @@
             this.DetailRange1.Size = new System.Drawing.Size(47, 23);
             this.DetailRange1.TabIndex = 100;
             // 
-            // label26
+            // outboxProcess
             // 
-            this.label26.AutoSize = true;
-            this.label26.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label26.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
-            this.label26.Location = new System.Drawing.Point(238, 86);
-            this.label26.Name = "label26";
-            this.label26.Size = new System.Drawing.Size(35, 21);
-            this.label26.TabIndex = 114;
-            this.label26.Text = "0/0";
+            this.outboxProcess.AutoSize = true;
+            this.outboxProcess.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.outboxProcess.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
+            this.outboxProcess.Location = new System.Drawing.Point(238, 86);
+            this.outboxProcess.Name = "outboxProcess";
+            this.outboxProcess.Size = new System.Drawing.Size(35, 21);
+            this.outboxProcess.TabIndex = 114;
+            this.outboxProcess.Text = "0/0";
             // 
-            // label17
+            // midboxProcess
             // 
-            this.label17.AutoSize = true;
-            this.label17.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
-            this.label17.Location = new System.Drawing.Point(238, 38);
-            this.label17.Name = "label17";
-            this.label17.Size = new System.Drawing.Size(35, 21);
-            this.label17.TabIndex = 113;
-            this.label17.Text = "0/0";
+            this.midboxProcess.AutoSize = true;
+            this.midboxProcess.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.midboxProcess.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
+            this.midboxProcess.Location = new System.Drawing.Point(238, 38);
+            this.midboxProcess.Name = "midboxProcess";
+            this.midboxProcess.Size = new System.Drawing.Size(35, 21);
+            this.midboxProcess.TabIndex = 113;
+            this.midboxProcess.Text = "0/0";
             // 
             // label25
             // 
@@ -1021,29 +1049,29 @@
             this.label22.TabIndex = 95;
             this.label22.Text = "复核数据";
             // 
-            // radioButton4
-            // 
-            this.radioButton4.AutoSize = true;
-            this.radioButton4.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.radioButton4.Location = new System.Drawing.Point(182, 237);
-            this.radioButton4.Name = "radioButton4";
-            this.radioButton4.Size = new System.Drawing.Size(95, 21);
-            this.radioButton4.TabIndex = 94;
-            this.radioButton4.TabStop = true;
-            this.radioButton4.Text = "唯一码+型号";
-            this.radioButton4.UseVisualStyleBackColor = true;
-            // 
-            // radioButton3
-            // 
-            this.radioButton3.AutoSize = true;
-            this.radioButton3.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.radioButton3.Location = new System.Drawing.Point(70, 237);
-            this.radioButton3.Name = "radioButton3";
-            this.radioButton3.Size = new System.Drawing.Size(107, 21);
-            this.radioButton3.TabIndex = 93;
-            this.radioButton3.TabStop = true;
-            this.radioButton3.Text = "客户料号+型号";
-            this.radioButton3.UseVisualStyleBackColor = true;
+            // RecheckBarcode
+            // 
+            this.RecheckBarcode.AutoSize = true;
+            this.RecheckBarcode.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.RecheckBarcode.Location = new System.Drawing.Point(182, 237);
+            this.RecheckBarcode.Name = "RecheckBarcode";
+            this.RecheckBarcode.Size = new System.Drawing.Size(95, 21);
+            this.RecheckBarcode.TabIndex = 94;
+            this.RecheckBarcode.TabStop = true;
+            this.RecheckBarcode.Text = "唯一码+型号";
+            this.RecheckBarcode.UseVisualStyleBackColor = true;
+            // 
+            // RecheckCuprodcode
+            // 
+            this.RecheckCuprodcode.AutoSize = true;
+            this.RecheckCuprodcode.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.RecheckCuprodcode.Location = new System.Drawing.Point(70, 237);
+            this.RecheckCuprodcode.Name = "RecheckCuprodcode";
+            this.RecheckCuprodcode.Size = new System.Drawing.Size(107, 21);
+            this.RecheckCuprodcode.TabIndex = 93;
+            this.RecheckCuprodcode.TabStop = true;
+            this.RecheckCuprodcode.Text = "客户料号+型号";
+            this.RecheckCuprodcode.UseVisualStyleBackColor = true;
             // 
             // DetailRange
             // 
@@ -1155,18 +1183,18 @@
             this.Process.TabIndex = 65;
             this.Process.Text = "总进度";
             // 
-            // sg_separator
+            // back_sg_separator
             // 
-            this.sg_separator.Enabled = false;
-            this.sg_separator.ID = null;
-            this.sg_separator.Location = new System.Drawing.Point(290, 66);
-            this.sg_separator.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.sg_separator.Name = "sg_separator";
-            this.sg_separator.Size = new System.Drawing.Size(28, 21);
-            this.sg_separator.Str = null;
-            this.sg_separator.Str1 = null;
-            this.sg_separator.Str2 = null;
-            this.sg_separator.TabIndex = 62;
+            this.back_sg_separator.Enabled = false;
+            this.back_sg_separator.ID = null;
+            this.back_sg_separator.Location = new System.Drawing.Point(290, 66);
+            this.back_sg_separator.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.back_sg_separator.Name = "back_sg_separator";
+            this.back_sg_separator.Size = new System.Drawing.Size(28, 21);
+            this.back_sg_separator.Str = null;
+            this.back_sg_separator.Str1 = null;
+            this.back_sg_separator.Str2 = null;
+            this.back_sg_separator.TabIndex = 62;
             // 
             // BackCheck
             // 
@@ -2127,7 +2155,7 @@
             // 
             this.OutBoxLabelAutoPrint.AutoSize = true;
             this.OutBoxLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxLabelAutoPrint.Location = new System.Drawing.Point(8, 90);
+            this.OutBoxLabelAutoPrint.Location = new System.Drawing.Point(9, 91);
             this.OutBoxLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxLabelAutoPrint.Name = "OutBoxLabelAutoPrint";
             this.OutBoxLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -2161,6 +2189,8 @@
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(1389, 729);
+            this.Controls.Add(this.front_sg_separator);
+            this.Controls.Add(this.label13);
             this.Controls.Add(this.cu_print_regexpression);
             this.Controls.Add(this.PLCStart);
             this.Controls.Add(this.PLCStop);
@@ -2177,7 +2207,7 @@
             this.Controls.Add(this.pi_cardcode_label);
             this.Controls.Add(this.pi_cardcode);
             this.Controls.Add(this.CollectionProcess);
-            this.Controls.Add(this.sg_separator);
+            this.Controls.Add(this.back_sg_separator);
             this.Controls.Add(this.sg_separator_label);
             this.Controls.Add(this.后端复核);
             this.Controls.Add(this.BackCheck);
@@ -2292,7 +2322,7 @@
         private CustomControl.DataGridViewWithSerialNum LabelInf;
         private CustomControl.RichText.RichTextAutoBottom MessageLog;
         private CustomControl.EnterTextBox BackCheck;
-        private CustomControl.EnterTextBox sg_separator;
+        private CustomControl.EnterTextBox back_sg_separator;
         private CustomControl.EnterTextBox FrontCollect;
         private System.Windows.Forms.Button ExportData;
         private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn28;
@@ -2356,8 +2386,8 @@
         private System.Windows.Forms.RadioButton radioButton1;
         private System.Windows.Forms.Label label21;
         private System.Windows.Forms.CheckBox DetailRange;
-        private System.Windows.Forms.RadioButton radioButton3;
-        private System.Windows.Forms.RadioButton radioButton4;
+        private System.Windows.Forms.RadioButton RecheckCuprodcode;
+        private System.Windows.Forms.RadioButton RecheckBarcode;
         private System.Windows.Forms.Label label22;
         private System.Windows.Forms.RadioButton radioButton6;
         private System.Windows.Forms.RadioButton radioButton5;
@@ -2376,8 +2406,8 @@
         private System.Windows.Forms.Button button8;
         private System.Windows.Forms.Label label24;
         private System.Windows.Forms.Label label25;
-        private System.Windows.Forms.Label label17;
-        private System.Windows.Forms.Label label26;
+        private System.Windows.Forms.Label midboxProcess;
+        private System.Windows.Forms.Label outboxProcess;
         private CustomControl.GroupBoxWithBorder.GroupBoxWithBorder CollectionProcess;
         private System.Windows.Forms.Button PLCStop;
         private System.Windows.Forms.Button PLCStart;
@@ -2410,5 +2440,7 @@
         private System.Windows.Forms.Label cu_print_regexpression;
         private System.Windows.Forms.NumericUpDown DetailRange2;
         private System.Windows.Forms.NumericUpDown DetailRange1;
+        private CustomControl.EnterTextBox front_sg_separator;
+        private System.Windows.Forms.Label label13;
     }
 }

+ 118 - 51
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -224,9 +224,6 @@ namespace UAS_LabelMachine
                 switch (port.Tag)
                 {
                     case "FrontendCheck":
-                        //获取当前最大的箱号
-                        string boxcode = adh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode1)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
-                        int outboxcode1 = int.Parse(boxcode == "" ? "1" : boxcode);
                         //比对当前箱数量和容量
                         FrontCollect.Text = msg;
                         for (int i = 0; i < ScanGroup.Rows.Count; i++)
@@ -285,51 +282,98 @@ namespace UAS_LabelMachine
                                     }
                                     index = index + 1;
                                 }
-                                if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + outboxcode1) >= MidBoxCapacity.Value)
-                                {
-                                    outboxcode1 = outboxcode1 + 1;
-                                }
-                                else if (CurrentRowIndex - 1 >= 0)
-                                {
-                                    if (cu_print_midlotno.Checked)
-                                    {
-                                        if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_lotno"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString())
-                                            outboxcode1 = outboxcode1 + 1;
-                                    }
-                                    else if (cu_print_midpo.Checked)
-                                    {
-                                        if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_pocode"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_pocode"].Value.ToString())
-                                            outboxcode1 = outboxcode1 + 1;
-                                    }
-                                    else if (cu_print_midprod.Checked)
-                                    {
-                                        if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_custprodcode"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
-                                            outboxcode1 = outboxcode1 + 1;
-                                    }
-                                    else if (cu_print_midspec.Checked)
-                                    {
-                                        if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_custprodspec"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString())
-                                            outboxcode1 = outboxcode1 + 1;
-                                    }
-                                }
-                                LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value = outboxcode1;
-                                LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
-                                adh.ExecuteSql("update prodiobarcode set pib_outboxcode1=" + outboxcode1 + ",pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1 where pib_id=" + pib_id, "update");
                                 LabelInf.Refresh();
                             }
                         }
+                        LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
+                        LabelInf.Refresh();
                         break;
                     case "BackendCheck":
                         BackCheck.Text = msg;
+                        string[] msgArr = BackCheck.Text.Split('@');
+                        //需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
+                        int checkItemCount = 0;
+                        for (int i = 0; i < msgArr.Length; i++)
+                        {
+                            if (RecheckCuprodcode.Checked)
+                            {
+                                if (Equal.Checked)
+                                {
+                                    if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
+                                    {
+                                        checkItemCount = checkItemCount + 1;
+                                    }
+                                }
+                                else if (Expression.Checked)
+                                {
+                                    
+                                }
+                                if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString())
+                                {
+                                    checkItemCount = checkItemCount + 1;
+                                }
+                            }
+                            else if (RecheckBarcode.Checked)
+                            {
+                                if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pib_custbarcode"].Value.ToString())
+                                {
+                                    checkItemCount = checkItemCount + 1;
+                                }
+                                if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString())
+                                {
+                                    checkItemCount = checkItemCount + 1;
+                                }
+                            }
+                        }
+                        if (checkItemCount != 2)
+                        {
+                            MessageBox.Show("复核不通过");
+                            return;
+                        }
                         LabelInf.Rows[CurrentRowIndex].Cells["pib_ifrecheck"].Value = true;
                         adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1 where pib_id=" + pib_id, "update");
                         LabelInf.Refresh();
+                        //获取当前最大的箱号
+                        string boxcode = adh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode1)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
+                        int outboxcode1 = int.Parse(boxcode == "" ? "1" : boxcode);
+                        if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + outboxcode1) >= MidBoxCapacity.Value)
+                        {
+                            outboxcode1 = outboxcode1 + 1;
+                        }
+                        else if (CurrentRowIndex - 1 >= 0)
+                        {
+                            if (cu_print_midlotno.Checked)
+                            {
+                                if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_lotno"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString())
+                                    outboxcode1 = outboxcode1 + 1;
+                            }
+                            else if (cu_print_midpo.Checked)
+                            {
+                                if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_pocode"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_pocode"].Value.ToString())
+                                    outboxcode1 = outboxcode1 + 1;
+                            }
+                            else if (cu_print_midprod.Checked)
+                            {
+                                if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_custprodcode"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
+                                    outboxcode1 = outboxcode1 + 1;
+                            }
+                            else if (cu_print_midspec.Checked)
+                            {
+                                if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_custprodspec"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString())
+                                    outboxcode1 = outboxcode1 + 1;
+                            }
+                        }
+                        LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value = outboxcode1;
+                        adh.ExecuteSql("update prodiobarcode set pib_outboxcode1=" + outboxcode1 + ",pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1 where pib_id=" + pib_id, "update");
+                        LabelInf.Refresh();
                         if (CurrentRowIndex + 1 < LabelInf.Rows.Count)
                             CurrentRowIndex = CurrentRowIndex + 1;
+                        RefreshProcessData();
                         break;
                     default:
                         break;
                 }
+                LogicHandler.CheckUploadData(pi_inoutno.Text, UploadNum);
             }
             catch (Exception ex)
             {
@@ -576,7 +620,6 @@ namespace UAS_LabelMachine
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 if (dt.Rows.Count > 0)
                 {
-
                     pi_cardcode.Text = dt.Rows[0]["pi_cardcode"].ToString();
                     pi_date.Text = dt.Rows[0]["pi_date"].ToString();
                     PI_ID = dt.Rows[0]["pi_id"].ToString();
@@ -997,6 +1040,14 @@ namespace UAS_LabelMachine
             //获取对应行的pib_id
             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
             string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
+            //设置最少打印盘数
+            if (OnlyPrint.Checked)
+            {
+                if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + pib_outboxcode1) < LeastPrintNum.Value)
+                {
+                    return;
+                }
+            }
             for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
             {
                 DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
@@ -1083,26 +1134,26 @@ namespace UAS_LabelMachine
             {
                 //设置初始化的采集进度
                 int Count = 0;
-                int CurrentMidBoxCollectedCount = 0;
-                //当前盒号的总盘数
-                int CurrentMidBoxTotalCount = 0;
+                string midboxcode = "";
+                string outboxcode = "";
+                if (CurrentRowIndex - 1 >= 0)
+                {
+                    outboxcode = LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_outboxcode2"].Value.ToString();
+                    midboxcode = LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_outboxcode1"].Value.ToString();
+                }
                 //未超出当前范围的时候
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
-                    if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True")
+                    if (LabelInf.Rows[i].Cells["pib_ifrecheck"].FormattedValue.ToString() == "True")
                         Count++;
-                    //和当前编辑箱号相等行
-                    if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())
-                        CurrentMidBoxCollectedCount++;
-                    //当前盒号一共有几盘
-                    if (LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())
-                        CurrentMidBoxTotalCount++;
                 }
+                int midboxcount = adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (midboxcode == "" ? "0" : midboxcode));
+                midboxProcess.Text = midboxcount + "/" + MidBoxCapacity.Value;
                 //设置当前的箱号和盒号
-                Process_outboxcode.Text = LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value.ToString();
-                Process_midboxcode.Text = LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString();
+                Process_midboxcode.Text = midboxcode;
+                Process_outboxcode.Text = outboxcode;
                 //设置当前总数和已采集数量
-                CollectedCount.Text = Count.ToString();
+                CollectedCount.Text = Count.ToString() + "/" + LabelInf.Rows.Count;
             }
         }
 
@@ -1133,13 +1184,19 @@ namespace UAS_LabelMachine
                 //将数据保存在本地数据库
                 adh.SaveDataTable(dt, "prodiobarcode");
             }
+            MidSource.DataSource = dt;
+            BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
             //获取系统设置的上传数量,如参数异常则默认为100
-            if (!int.TryParse(adh.getFieldDataByCondition("dataextra", "uploadnum", "id=1").ToString(), out UploadNum))
+            dt = (DataTable)adh.ExecuteSql("select uploadnum,splitback,splitfront from dataextra", "select");
+            if (dt.Rows.Count > 0)
             {
-                UploadNum = 100;
+                if (!int.TryParse(dt.Rows[0]["uploadnum"].ToString(), out UploadNum))
+                {
+                    UploadNum = 100;
+                }
+                front_sg_separator.Text = dt.Rows[0]["splitback"].ToString();
+                back_sg_separator.Text = dt.Rows[0]["splitfront"].ToString();
             }
-            MidSource.DataSource = dt;
-            BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
             //获取所有的匹配脚本
             ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_script,sg_name from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null", "select");
             //绑定数据之后往下找到未采集的数据显示在当前采集的栏目
@@ -1530,5 +1587,15 @@ namespace UAS_LabelMachine
                 DetailRange2.Enabled = true;
             }
         }
+
+        private void PLCStart_Click(object sender, EventArgs e)
+        {
+
+        }
+
+        private void PLCStop_Click(object sender, EventArgs e)
+        {
+
+        }
     }
 }