Browse Source

添加分页功能

章政 7 năm trước cách đây
mục cha
commit
cc495e6c8f

+ 24 - 61
UAS-出货标签管理(吉利通)/UAS-出货标签管理(吉利通).csproj

@@ -94,7 +94,8 @@
     <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
   </PropertyGroup>
   <PropertyGroup>
-    <ApplicationIcon>Resources\print_128px_1082624_easyicon.net.ico</ApplicationIcon>
+    <ApplicationIcon>
+    </ApplicationIcon>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Analysis">
@@ -400,24 +401,6 @@
       <SubType>Designer</SubType>
     </None>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\timg.jpg" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\users_user_72px_523311_easyicon.net.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\users.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\Login_Icon.gif" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\1 %284%29.gif" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\46.gif" />
-  </ItemGroup>
   <ItemGroup>
     <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
       <Visible>False</Visible>
@@ -697,9 +680,6 @@
       <FileType>Assembly</FileType>
     </PublishFile>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\preview_16px_25980_easyicon.net.png" />
-  </ItemGroup>
   <ItemGroup>
     <COMReference Include="BarTender">
       <Guid>{D58562C1-E51B-11CF-8941-00A024A9083F}</Guid>
@@ -721,50 +701,33 @@
     </COMReference>
   </ItemGroup>
   <ItemGroup>
-    <None Include="Resources\bindingNavigatorAddNewItem.Image.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\bindingNavigatorDeleteItem.Image.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\bindingNavigatorMoveFirstItem.Image.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\bindingNavigatorMoveLastItem.Image.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\bindingNavigatorMoveNextItem.Image.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\bindingNavigatorMovePreviousItem.Image.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\download_17.519713261649px_1200629_easyicon.net %281%29.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\Excel_2010_16px_1180011_easyicon.net.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\search_16px_1202802_easyicon.net.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\upload_17.459649122807px_1200703_easyicon.net %281%29.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\close_32px_1181428_easyicon.net.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\close_up_32px_1181430_easyicon.net.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\write_15.893687707641px_1181413_easyicon.net.png" />
+    <Content Include="Resources\1 %284%29.gif" />
+    <Content Include="Resources\46.gif" />
+    <Content Include="Resources\bindingNavigatorAddNewItem.Image.png" />
+    <Content Include="Resources\bindingNavigatorDeleteItem.Image.png" />
+    <Content Include="Resources\bindingNavigatorMoveFirstItem.Image.png" />
+    <Content Include="Resources\bindingNavigatorMoveLastItem.Image.png" />
+    <Content Include="Resources\bindingNavigatorMoveNextItem.Image.png" />
+    <Content Include="Resources\bindingNavigatorMovePreviousItem.Image.png" />
+    <Content Include="Resources\close_32px_1181428_easyicon.net.png" />
+    <Content Include="Resources\close_up_32px_1181430_easyicon.net.png" />
+    <Content Include="Resources\download_17.519713261649px_1200629_easyicon.net %281%29.png" />
+    <Content Include="Resources\Excel_2010_16px_1180011_easyicon.net.png" />
+    <Content Include="Resources\Login_Icon.gif" />
+    <Content Include="Resources\matte_white_square_icon_business_tool_hammer_96px_571061_easyicon.net.ico" />
+    <Content Include="Resources\preview_16px_25980_easyicon.net.png" />
+    <Content Include="Resources\print_128px_1082624_easyicon.net.ico" />
+    <Content Include="Resources\search_16px_1202802_easyicon.net.png" />
+    <Content Include="Resources\timg.jpg" />
+    <Content Include="Resources\upload_17.459649122807px_1200703_easyicon.net %281%29.png" />
+    <Content Include="Resources\users.png" />
+    <Content Include="Resources\users_user_72px_523311_easyicon.net.png" />
+    <Content Include="Resources\write_15.893687707641px_1181413_easyicon.net.png" />
     <Content Include="tool\Analysis.dll" />
     <Content Include="tool\DataHelper.dll" />
     <Content Include="tool\NPOI.dll" />
     <Content Include="tool\Oracle.ManagedDataAccess.dll" />
     <Content Include="tool\Seagull.BarTender.Print.dll" />
-    <None Include="Resources\matte_white_square_icon_business_tool_hammer_96px_571061_easyicon.net.ico" />
-    <Content Include="Resources\print_128px_1082624_easyicon.net.ico" />
   </ItemGroup>
   <ItemGroup>
     <WCFMetadata Include="Service References\" />

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

@@ -70,7 +70,6 @@
             this.ListButtonMenu = new System.Windows.Forms.ListBox();
             this.pi_date = new System.Windows.Forms.Label();
             this.ExportFileDialog = new System.Windows.Forms.FolderBrowserDialog();
-            this.ChooseAll = new System.Windows.Forms.Button();
             this.MidSource = new System.Windows.Forms.BindingSource(this.components);
             this.GetGridOnly = new System.Windows.Forms.CheckBox();
             this.RefreshDBConnect = new System.Windows.Forms.Timer(this.components);
@@ -85,6 +84,12 @@
             this.PLCStart = new System.Windows.Forms.Button();
             this.cu_print_regexpression = new System.Windows.Forms.Label();
             this.label13 = new System.Windows.Forms.Label();
+            this.BeforePage = new System.Windows.Forms.LinkLabel();
+            this.NextPage = new System.Windows.Forms.LinkLabel();
+            this.PageInf = new System.Windows.Forms.Label();
+            this.FirstPage = new System.Windows.Forms.LinkLabel();
+            this.LastPage = new System.Windows.Forms.LinkLabel();
+            this.PageNum = 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();
@@ -130,6 +135,7 @@
             this.LabelInf = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
             this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pib_id1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.rownum = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_ifmodify = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -585,17 +591,6 @@
             this.pi_date.TabIndex = 86;
             this.pi_date.Visible = false;
             // 
-            // ChooseAll
-            // 
-            this.ChooseAll.Location = new System.Drawing.Point(4, 278);
-            this.ChooseAll.Margin = new System.Windows.Forms.Padding(2);
-            this.ChooseAll.Name = "ChooseAll";
-            this.ChooseAll.Size = new System.Drawing.Size(38, 22);
-            this.ChooseAll.TabIndex = 84;
-            this.ChooseAll.Text = "全选";
-            this.ChooseAll.UseVisualStyleBackColor = true;
-            this.ChooseAll.Click += new System.EventHandler(this.ChooseAll_Click);
-            // 
             // GetGridOnly
             // 
             this.GetGridOnly.AutoSize = true;
@@ -728,6 +723,68 @@
             this.label13.TabIndex = 95;
             this.label13.Text = "前端分隔符";
             // 
+            // BeforePage
+            // 
+            this.BeforePage.AutoSize = true;
+            this.BeforePage.Location = new System.Drawing.Point(127, 615);
+            this.BeforePage.Name = "BeforePage";
+            this.BeforePage.Size = new System.Drawing.Size(41, 12);
+            this.BeforePage.TabIndex = 97;
+            this.BeforePage.TabStop = true;
+            this.BeforePage.Text = "上一页";
+            this.BeforePage.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Page_LinkClicked);
+            // 
+            // NextPage
+            // 
+            this.NextPage.AutoSize = true;
+            this.NextPage.Location = new System.Drawing.Point(232, 615);
+            this.NextPage.Name = "NextPage";
+            this.NextPage.Size = new System.Drawing.Size(41, 12);
+            this.NextPage.TabIndex = 98;
+            this.NextPage.TabStop = true;
+            this.NextPage.Text = "下一页";
+            this.NextPage.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Page_LinkClicked);
+            // 
+            // PageInf
+            // 
+            this.PageInf.AutoSize = true;
+            this.PageInf.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.PageInf.Location = new System.Drawing.Point(176, 612);
+            this.PageInf.Name = "PageInf";
+            this.PageInf.Size = new System.Drawing.Size(0, 17);
+            this.PageInf.TabIndex = 99;
+            // 
+            // FirstPage
+            // 
+            this.FirstPage.AutoSize = true;
+            this.FirstPage.Location = new System.Drawing.Point(85, 615);
+            this.FirstPage.Name = "FirstPage";
+            this.FirstPage.Size = new System.Drawing.Size(41, 12);
+            this.FirstPage.TabIndex = 100;
+            this.FirstPage.TabStop = true;
+            this.FirstPage.Text = "第一页";
+            this.FirstPage.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Page_LinkClicked);
+            // 
+            // LastPage
+            // 
+            this.LastPage.AutoSize = true;
+            this.LastPage.Location = new System.Drawing.Point(279, 615);
+            this.LastPage.Name = "LastPage";
+            this.LastPage.Size = new System.Drawing.Size(41, 12);
+            this.LastPage.TabIndex = 101;
+            this.LastPage.TabStop = true;
+            this.LastPage.Text = "最后页";
+            this.LastPage.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Page_LinkClicked);
+            // 
+            // PageNum
+            // 
+            this.PageNum.AutoSize = true;
+            this.PageNum.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.PageNum.Location = new System.Drawing.Point(331, 609);
+            this.PageNum.Name = "PageNum";
+            this.PageNum.Size = new System.Drawing.Size(0, 20);
+            this.PageNum.TabIndex = 102;
+            // 
             // front_sg_separator
             // 
             this.front_sg_separator.Enabled = false;
@@ -1251,6 +1308,7 @@
             this.LabelInf.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Choose,
             this.pib_id1,
+            this.rownum,
             this.pib_pdno,
             this.pib_prodcode,
             this.pib_ifmodify,
@@ -1301,6 +1359,13 @@
             this.pib_id1.Visible = false;
             this.pib_id1.Width = 66;
             // 
+            // rownum
+            // 
+            this.rownum.DataPropertyName = "rownum";
+            this.rownum.HeaderText = "行号";
+            this.rownum.Name = "rownum";
+            this.rownum.Width = 54;
+            // 
             // pib_pdno
             // 
             this.pib_pdno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
@@ -2211,6 +2276,12 @@
             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.PageNum);
+            this.Controls.Add(this.LastPage);
+            this.Controls.Add(this.FirstPage);
+            this.Controls.Add(this.PageInf);
+            this.Controls.Add(this.NextPage);
+            this.Controls.Add(this.BeforePage);
             this.Controls.Add(this.front_sg_separator);
             this.Controls.Add(this.label13);
             this.Controls.Add(this.cu_print_regexpression);
@@ -2222,7 +2293,6 @@
             this.Controls.Add(this.ButtonSetting);
             this.Controls.Add(this.ListButtonMenu);
             this.Controls.Add(this.pi_date);
-            this.Controls.Add(this.ChooseAll);
             this.Controls.Add(this.GetGridOnly);
             this.Controls.Add(this.Fresh);
             this.Controls.Add(this.pi_cardcode_label);
@@ -2389,7 +2459,6 @@
         private System.Windows.Forms.ListBox ListButtonMenu;
         private System.Windows.Forms.Label pi_date;
         private System.Windows.Forms.FolderBrowserDialog ExportFileDialog;
-        private System.Windows.Forms.Button ChooseAll;
         private System.Windows.Forms.BindingSource MidSource;
         private System.Windows.Forms.CheckBox GetGridOnly;
         private System.Windows.Forms.Timer RefreshDBConnect;
@@ -2435,8 +2504,22 @@
         private CustomControl.GroupBoxWithBorder.GroupBoxWithBorder CollectionProcess;
         private System.Windows.Forms.Button PLCStop;
         private System.Windows.Forms.Button PLCStart;
+        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;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.LinkLabel BeforePage;
+        private System.Windows.Forms.LinkLabel NextPage;
+        private System.Windows.Forms.Label PageInf;
+        private System.Windows.Forms.LinkLabel FirstPage;
+        private System.Windows.Forms.LinkLabel LastPage;
+        private System.Windows.Forms.Label PageNum;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_id1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn rownum;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_pdno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_prodcode;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifmodify;
@@ -2461,12 +2544,5 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode2;
-        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;
-        private System.Windows.Forms.GroupBox groupBox1;
-        private System.Windows.Forms.GroupBox groupBox2;
     }
 }

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

@@ -93,18 +93,9 @@ namespace UAS_LabelMachine
         /// </summary>
         List<string> MidBoxArgument = new List<string>();
         /// <summary>
-        /// 全部采集
-        /// </summary>
-        bool AllCollect = false;
-        /// <summary>
-        /// 是否全选
-        /// </summary>
-        bool AllChecked = false;
-        /// <summary>
         /// 默认采集了指定的数据上传
         /// </summary>
         int UploadNum = 100;
-
         /*需要重绘的Cell*/
         Dictionary<DataGridViewCell, bool> PaintCell = new Dictionary<DataGridViewCell, bool>();
         /// <summary>
@@ -172,7 +163,7 @@ namespace UAS_LabelMachine
             OutBoxCapacity.Value = Properties.Settings.Default.OutboxCapacity;
             asc.controllInitializeSize(this);
             asc.controlAutoSize(this);
-          
+
             //实例化打印进程
             try
             {
@@ -228,174 +219,184 @@ namespace UAS_LabelMachine
                     case "FrontendCheck":
                         //比对当前箱数量和容量
                         FrontCollect.Text = msg;
-                        for (int i = 0; i < ScanGroup.Rows.Count; i++)
-                        {
-                            string sg_name = ScanGroup.Rows[i]["sg_name"].ToString();
-                            string sg_brand = ScanGroup.Rows[i]["sg_brand"].ToString();
-                            reg = new Regex(ScanGroup.Rows[i]["sg_script"].ToString());
-                            MatchCollection matchs = reg.Matches(msg);
-                            int index = 0;
-                            DataTable dt = BaseUtil.filterDataTable(ScanItem, "sg_name='" + sg_name + "' and sg_brand='" + sg_brand + "' and items_num=" + matchs.Count);
-                            if (dt.Rows.Count > 0)
-                            {
-                                for (int j = 0; j < dt.Rows.Count; j++)
-                                {
-                                    string si_expression = dt.Rows[j]["si_expression"].ToString();
-                                    Regex si_exp;
-                                    switch (dt.Rows[j]["si_item"].ToString())
-                                    {
-                                        case "DateCode":
-                                            if (si_expression != "")
-                                            {
-                                                si_exp = new Regex(si_expression);
-                                                DateCode = si_exp.Match(matchs[index].Value).Value;
-                                            }
-                                            else
-                                            {
-                                                DateCode = matchs[index].Value;
-                                            }
-                                            LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value = DateCode;
-                                            break;
-                                        case "LotNo":
-                                            LotNo = matchs[index].Value;
-                                            LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value = LotNo;
-                                            break;
-                                        case "PN":
-                                            PN = matchs[index].Value;
-                                            break;
-                                        case "Order":
-                                            Order = matchs[index].Value;
-                                            break;
-                                        case "QTY":
-                                            if (si_expression != "")
-                                            {
-                                                si_exp = new Regex(si_expression);
-                                                QTY = si_exp.Match(matchs[index].Value).Value;
-                                            }
-                                            else
-                                            {
-                                                QTY = matchs[index].Value;
-                                            }
-                                            break;
-                                        case "OutBox":
-                                            OutBox = matchs[index].Value;
-                                            break;
-                                        default:
-                                            break;
-                                    }
-                                    index = index + 1;
-                                }
-                                LabelInf.Refresh();
-                            }
-                        }
-                        LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
-                        LabelInf.Refresh();
+                        FrontCheckFunction(msg);
                         break;
                     case "BackendCheck":
                         BackCheck.Text = msg;
-                        string[] msgArr = BackCheck.Text.Split('@');
-                        //需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
-                        int checkItemCount = 0;
-                        for (int i = 0; i < msgArr.Length; i++)
+                        BackendCheckFunction(msg, pib_id);
+                        break;
+                    default:
+                        break;
+                }
+            }
+            catch (Exception ex)
+            {
+                LogManager.DoLog(ex.StackTrace);
+                MessageBox.Show("接收返回消息异常!具体原因:" + ex.Message, "提示信息");
+            }
+        }
+
+        private void FrontCheckFunction(string msg)
+        {
+            for (int i = 0; i < ScanGroup.Rows.Count; i++)
+            {
+                string sg_name = ScanGroup.Rows[i]["sg_name"].ToString();
+                string sg_brand = ScanGroup.Rows[i]["sg_brand"].ToString();
+                reg = new Regex(ScanGroup.Rows[i]["sg_script"].ToString());
+                MatchCollection matchs = reg.Matches(msg);
+                int index = 0;
+                DataTable dt = BaseUtil.filterDataTable(ScanItem, "sg_name='" + sg_name + "' and sg_brand='" + sg_brand + "' and items_num=" + matchs.Count);
+                if (dt.Rows.Count > 0)
+                {
+                    for (int j = 0; j < dt.Rows.Count; j++)
+                    {
+                        string si_expression = dt.Rows[j]["si_expression"].ToString();
+                        Regex si_exp;
+                        switch (dt.Rows[j]["si_item"].ToString())
                         {
-                            if (RecheckCuprodcode.Checked)
-                            {
-                                //直接验证两个值相等
-                                if (Equal.Checked)
+                            case "DateCode":
+                                if (si_expression != "")
                                 {
-                                    if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
-                                    {
-                                        checkItemCount = checkItemCount + 1;
-                                    }
-                                }
-                                //验证正则匹配过之后相等
-                                else if (Expression.Checked)
-                                {
-                                    Regex re = new Regex(cu_print_regexpression.Text);
-                                    if (re.Match(msgArr[i]).Value == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
-                                    {
-                                        checkItemCount = checkItemCount + 1;
-                                    }
+                                    si_exp = new Regex(si_expression);
+                                    DateCode = si_exp.Match(matchs[index].Value).Value;
                                 }
-                                if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString())
+                                else
                                 {
-                                    checkItemCount = checkItemCount + 1;
+                                    DateCode = matchs[index].Value;
                                 }
-                            }
-                            else if (RecheckBarcode.Checked)
-                            {
-                                if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pib_custbarcode"].Value.ToString())
+                                LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value = DateCode;
+                                break;
+                            case "LotNo":
+                                LotNo = matchs[index].Value;
+                                LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value = LotNo;
+                                break;
+                            case "PN":
+                                PN = matchs[index].Value;
+                                break;
+                            case "Order":
+                                Order = matchs[index].Value;
+                                break;
+                            case "QTY":
+                                if (si_expression != "")
                                 {
-                                    checkItemCount = checkItemCount + 1;
+                                    si_exp = new Regex(si_expression);
+                                    QTY = si_exp.Match(matchs[index].Value).Value;
                                 }
-                                if (msgArr[i] == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString())
+                                else
                                 {
-                                    checkItemCount = checkItemCount + 1;
+                                    QTY = matchs[index].Value;
                                 }
-                            }
-                        }
-                        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);
-                        boxcode = adh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode2)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
-                        int outboxcode2 = int.Parse(boxcode == "" ? "1" : boxcode);
-                        if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + outboxcode1) >= MidBoxCapacity.Value)
-                        {
-                            outboxcode1 = outboxcode1 + 1;
+                                break;
+                            case "OutBox":
+                                OutBox = matchs[index].Value;
+                                break;
+                            default:
+                                break;
                         }
-                        if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + outboxcode2) >= OutBoxCapacity.Value)
+                        index = index + 1;
+                    }
+                    LabelInf.Refresh();
+                }
+            }
+            LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
+            LabelInf.Refresh();
+        }
+
+        private void BackendCheckFunction(string msg, string pib_id)
+        {
+            string[] msgArr = msg.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())
                         {
-                            outboxcode2 = outboxcode2 + 1;
+                            checkItemCount = checkItemCount + 1;
                         }
-                        else if (CurrentRowIndex - 1 >= 0)
+                    }
+                    //验证正则匹配过之后相等
+                    else if (Expression.Checked)
+                    {
+                        Regex re = new Regex(cu_print_regexpression.Text);
+                        if (re.Match(msgArr[i]).Value == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
                         {
-                            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;
-                            }
+                            checkItemCount = checkItemCount + 1;
                         }
-                        LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value = outboxcode1;
-                        LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = outboxcode2;
-                        adh.ExecuteSql("update prodiobarcode set pib_outboxcode2=" + outboxcode2 + ",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();
-                        LogicHandler.CheckUploadData(pi_inoutno.Text, UploadNum);
-                        break;
-                    default:
-                        break;
+                    }
+                    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;
+                    }
                 }
             }
-            catch (Exception ex)
+            if (checkItemCount != 2)
             {
-                LogManager.DoLog(ex.StackTrace);
-                MessageBox.Show("接收返回消息异常!具体原因:" + ex.Message, "提示信息");
+                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);
+            boxcode = adh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode2)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
+            int outboxcode2 = int.Parse(boxcode == "" ? "1" : boxcode);
+            if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + outboxcode1) >= MidBoxCapacity.Value)
+            {
+                outboxcode1 = outboxcode1 + 1;
+            }
+            if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + outboxcode2) >= OutBoxCapacity.Value)
+            {
+                outboxcode2 = outboxcode2 + 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_outboxcode2"].Value = outboxcode2;
+            adh.ExecuteSql("update prodiobarcode set pib_outboxcode2=" + outboxcode2 + ",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();
+            LogicHandler.CheckUploadData(pi_inoutno.Text, UploadNum);
         }
 
         //只执行一次窗体自适应
@@ -632,6 +633,7 @@ namespace UAS_LabelMachine
         {
             if (e.KeyCode == Keys.Enter)
             {
+                CurrentPage = 1;
                 sql.Clear();
                 sql.Append("select pi_id,pi_cardcode,to_char(pi_date,'yyyymmdd')pi_date from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
@@ -1197,7 +1199,10 @@ namespace UAS_LabelMachine
         {
             LoadGridData(new object(), new EventArgs());
         }
-
+        int CurrentPage = 1;
+        int PageSize = 1000;
+        int DataSize = 0;
+        int MaxPageSize = 0;
         /// <summary>
         /// 自定义函数  加载明细行的数据,多处使用添加进函数
         /// </summary>
@@ -1205,21 +1210,25 @@ namespace UAS_LabelMachine
         /// <param name="e"></param>
         private void LoadGridData(object sender, EventArgs e)
         {
-            AllCollect = false;
-            dt = (DataTable)adh.ExecuteSql("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by pib_id", "select");
+            dt = (DataTable)adh.ExecuteSql("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and rownum between " + ((CurrentPage - 1) * PageSize + 1) + " and  " + CurrentPage * PageSize + " order by rownum", "select");
             if (dt.Rows.Count == 0)
             {
                 sql.Clear();
-                sql.Append("select pd_custprodcode,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,");
+                sql.Append("select rownum,pd_custprodcode,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,");
                 sql.Append("pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,");
                 sql.Append("pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join prodinout on pib_piid=pi_id left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
-                sql.Append("pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode where pib_piid='" + PI_ID + "' order by to_number(pib_id)");
+                sql.Append("pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode where pib_piid='" + PI_ID + "' order by rownum");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 //检验查询的字段和本地数据库字段是否匹配
                 adh.AddColumFromDataTable(dt, "prodiobarcode");
                 //将数据保存在本地数据库
                 adh.SaveDataTable(dt, "prodiobarcode");
+                dt = BaseUtil.filterDataTable(dt, "rownum <=" + PageSize);
             }
+            DataSize = adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "'");
+            PageNum.Text = "总数" + DataSize;
+            MaxPageSize = DataSize % PageSize == 0 ? DataSize / PageSize : (DataSize / PageSize) + 1;
+            PageInf.Text = CurrentPage + "/" + MaxPageSize;
             MidSource.DataSource = dt;
             BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
             //获取系统设置的上传数量,如参数异常则默认为100
@@ -1434,22 +1443,6 @@ namespace UAS_LabelMachine
             catch (Exception) { }
         }
 
-        private void ChooseAll_Click(object sender, EventArgs e)
-        {
-            if (AllChecked)
-            {
-                foreach (DataGridViewRow dr in LabelInf.Rows)
-                    dr.Cells[0].Value = false;
-                AllChecked = false;
-            }
-            else
-            {
-                foreach (DataGridViewRow dr in LabelInf.Rows)
-                    dr.Cells[0].Value = true;
-                AllChecked = true;
-            }
-        }
-
         private void ExportData_Click(object sender, EventArgs e)
         {
             ExportFileDialog.Description = "选择导出的路径";
@@ -1674,5 +1667,38 @@ namespace UAS_LabelMachine
                     break;
             }
         }
+
+        private void Page_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+        {
+            switch ((sender as LinkLabel).Name)
+            {
+                case "FirstPage":
+                    CurrentPage = 1;
+                    break;
+                case "LastPage":
+                    CurrentPage = MaxPageSize;
+                    break;
+                case "BeforePage":
+                    if (CurrentPage == 1)
+                    {
+                        MessageBox.Show("已经是第一页了", "提示");
+                        return;
+                    }
+                    CurrentPage = CurrentPage - 1;
+                    break;
+                case "NextPage":
+                    if (CurrentPage == MaxPageSize)
+                    {
+                        MessageBox.Show("已经是最后一页了", "提示");
+                        return;
+                    }
+                    CurrentPage = CurrentPage + 1;
+                    break;
+                default:
+                    break;
+            }
+            PageInf.Text = CurrentPage + "/" + MaxPageSize;
+            LoadGridData();
+        }
     }
 }

+ 3 - 0
UAS-出货标签管理(吉利通)/UAS_出货标签管理.resx

@@ -126,6 +126,9 @@
   <metadata name="RefreshDBConnect.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
+  <metadata name="rownum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="pib_ifmodify.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>