From 0504a2c26fd099fadbf9923ef021f8c858cdd670 Mon Sep 17 00:00:00 2001
From: jingh <jingh@LAPTOP-I53VDLOO>
Date: 星期一, 16 八月 2021 19:35:54 +0800
Subject: [PATCH] 进度条实现

---
 BLL/公用模块/Gy_DataInTmp.designer.cs   |   38 +++++++++++++++++++-------------------
 PlanM/数据导入/Gy_DataIn_RoutingBill.cs |   18 +++++++++++++++---
 2 files changed, 34 insertions(+), 22 deletions(-)

diff --git "a/BLL/\345\205\254\347\224\250\346\250\241\345\235\227/Gy_DataInTmp.designer.cs" "b/BLL/\345\205\254\347\224\250\346\250\241\345\235\227/Gy_DataInTmp.designer.cs"
index d757a54..0e5ecbf 100644
--- "a/BLL/\345\205\254\347\224\250\346\250\241\345\235\227/Gy_DataInTmp.designer.cs"
+++ "b/BLL/\345\205\254\347\224\250\346\250\241\345\235\227/Gy_DataInTmp.designer.cs"
@@ -50,6 +50,7 @@
             this.tc = new System.Windows.Forms.ToolStripButton();
             this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
             this.pPic = new System.Windows.Forms.Panel();
+            this.pb1 = new System.Windows.Forms.ProgressBar();
             this.txtHDataInTmp = new System.Windows.Forms.TextBox();
             this.cmdHDataInTmp = new System.Windows.Forms.Button();
             this.label5 = new System.Windows.Forms.Label();
@@ -64,7 +65,6 @@
             this.timer1 = new System.Windows.Forms.Timer(this.components);
             this.grdPrint = new System.Windows.Forms.DataGridView();
             this.panel1 = new System.Windows.Forms.Panel();
-            this.pb1 = new System.Windows.Forms.ProgressBar();
             this.Tool.SuspendLayout();
             this.pPic.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.grdMain)).BeginInit();
@@ -293,15 +293,22 @@
             this.pPic.Controls.Add(this.lbldj);
             this.pPic.Dock = System.Windows.Forms.DockStyle.Top;
             this.pPic.Location = new System.Drawing.Point(0, 59);
-            this.pPic.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pPic.Margin = new System.Windows.Forms.Padding(4);
             this.pPic.Name = "pPic";
             this.pPic.Size = new System.Drawing.Size(1460, 56);
             this.pPic.TabIndex = 18;
             // 
+            // pb1
+            // 
+            this.pb1.Location = new System.Drawing.Point(920, 18);
+            this.pb1.Name = "pb1";
+            this.pb1.Size = new System.Drawing.Size(391, 23);
+            this.pb1.TabIndex = 104;
+            // 
             // txtHDataInTmp
             // 
             this.txtHDataInTmp.Location = new System.Drawing.Point(509, 18);
-            this.txtHDataInTmp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtHDataInTmp.Margin = new System.Windows.Forms.Padding(4);
             this.txtHDataInTmp.Name = "txtHDataInTmp";
             this.txtHDataInTmp.Size = new System.Drawing.Size(236, 25);
             this.txtHDataInTmp.TabIndex = 103;
@@ -312,7 +319,7 @@
             this.cmdHDataInTmp.Image = ((System.Drawing.Image)(resources.GetObject("cmdHDataInTmp.Image")));
             this.cmdHDataInTmp.ImageAlign = System.Drawing.ContentAlignment.TopRight;
             this.cmdHDataInTmp.Location = new System.Drawing.Point(747, 18);
-            this.cmdHDataInTmp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.cmdHDataInTmp.Margin = new System.Windows.Forms.Padding(4);
             this.cmdHDataInTmp.Name = "cmdHDataInTmp";
             this.cmdHDataInTmp.Size = new System.Drawing.Size(29, 28);
             this.cmdHDataInTmp.TabIndex = 102;
@@ -368,7 +375,7 @@
             this.cmdHPath.Image = ((System.Drawing.Image)(resources.GetObject("cmdHPath.Image")));
             this.cmdHPath.ImageAlign = System.Drawing.ContentAlignment.TopRight;
             this.cmdHPath.Location = new System.Drawing.Point(1063, 8);
-            this.cmdHPath.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.cmdHPath.Margin = new System.Windows.Forms.Padding(4);
             this.cmdHPath.Name = "cmdHPath";
             this.cmdHPath.Size = new System.Drawing.Size(29, 28);
             this.cmdHPath.TabIndex = 34;
@@ -378,7 +385,7 @@
             // txtHPath
             // 
             this.txtHPath.Location = new System.Drawing.Point(613, 9);
-            this.txtHPath.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtHPath.Margin = new System.Windows.Forms.Padding(4);
             this.txtHPath.Multiline = true;
             this.txtHPath.Name = "txtHPath";
             this.txtHPath.Size = new System.Drawing.Size(447, 49);
@@ -403,7 +410,7 @@
             this.grdMain.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.grdMain.Dock = System.Windows.Forms.DockStyle.Fill;
             this.grdMain.Location = new System.Drawing.Point(0, 177);
-            this.grdMain.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.grdMain.Margin = new System.Windows.Forms.Padding(4);
             this.grdMain.Name = "grdMain";
             this.grdMain.ReadOnly = true;
             this.grdMain.RowHeadersWidth = 51;
@@ -421,7 +428,7 @@
             this.grdSum.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.grdSum.Dock = System.Windows.Forms.DockStyle.Bottom;
             this.grdSum.Location = new System.Drawing.Point(0, 765);
-            this.grdSum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.grdSum.Margin = new System.Windows.Forms.Padding(4);
             this.grdSum.Name = "grdSum";
             this.grdSum.ReadOnly = true;
             this.grdSum.RowHeadersWidth = 51;
@@ -438,7 +445,7 @@
             // 
             this.grdPrint.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.grdPrint.Location = new System.Drawing.Point(713, 379);
-            this.grdPrint.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.grdPrint.Margin = new System.Windows.Forms.Padding(4);
             this.grdPrint.Name = "grdPrint";
             this.grdPrint.RowHeadersWidth = 51;
             this.grdPrint.RowTemplate.Height = 23;
@@ -454,17 +461,10 @@
             this.panel1.Controls.Add(this.cmdHPath);
             this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
             this.panel1.Location = new System.Drawing.Point(0, 115);
-            this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.panel1.Margin = new System.Windows.Forms.Padding(4);
             this.panel1.Name = "panel1";
             this.panel1.Size = new System.Drawing.Size(1460, 62);
             this.panel1.TabIndex = 50;
-            // 
-            // pb1
-            // 
-            this.pb1.Location = new System.Drawing.Point(920, 18);
-            this.pb1.Name = "pb1";
-            this.pb1.Size = new System.Drawing.Size(391, 23);
-            this.pb1.TabIndex = 104;
             // 
             // Gy_DataInTmp
             // 
@@ -477,7 +477,7 @@
             this.Controls.Add(this.grdSum);
             this.Controls.Add(this.pPic);
             this.Controls.Add(this.Tool);
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Gy_DataInTmp";
             this.Text = "鏁版嵁瀵煎叆";
             this.Load += new System.EventHandler(this.Gy_DataInTmp_Load);
@@ -530,6 +530,6 @@
         public System.Windows.Forms.Button cmdHPath;
         public System.Windows.Forms.TextBox txtHPath;
         public System.Windows.Forms.Label label4;
-        private System.Windows.Forms.ProgressBar pb1;
+        public System.Windows.Forms.ProgressBar pb1;
     }
 }
\ No newline at end of file
diff --git "a/PlanM/\346\225\260\346\215\256\345\257\274\345\205\245/Gy_DataIn_RoutingBill.cs" "b/PlanM/\346\225\260\346\215\256\345\257\274\345\205\245/Gy_DataIn_RoutingBill.cs"
index eb40246..91dca73 100644
--- "a/PlanM/\346\225\260\346\215\256\345\257\274\345\205\245/Gy_DataIn_RoutingBill.cs"
+++ "b/PlanM/\346\225\260\346\215\256\345\257\274\345\205\245/Gy_DataIn_RoutingBill.cs"
@@ -227,9 +227,16 @@
                 BillNew.omodel.HProductNum = "";
                 BillNew.omodel.HVerNum = "";
                 BillNew.DetailColl.Clear();
-            } 
+            }
+            //初始化进度条
+            pb1.Maximum = grdMain.Rows.Count ;
+            pb1.Value = 0;
+            //
             for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
             {
+                pb1.Value = i + 1;
+                Application.DoEvents();
+                //
                 BillNew.omodel.HPicNumVer = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumVerCol].Value);
                 BillNew.omodel.HPicNumAssemble = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumAssembleCol].Value);
                 BillNew.omodel.HMaterTexture = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterTextureCol].Value);
@@ -297,11 +304,13 @@
                         }
                         else
                         {
+                            Application.DoEvents();
                             BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                             b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                             if (b == false) return;
                             c++;
                             BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
+                            Application.DoEvents();
                         }
 
 
@@ -336,8 +345,10 @@
                         j = 0;
                         HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
                         BillNew.omodel.HBillNo = HBillNo;
-                        //写入类
-                        WriteClass(i);
+                        //写入类 
+                        Application.DoEvents();
+                        WriteClass(i); 
+                        Application.DoEvents();
                     }
                 }
                 else
@@ -360,6 +371,7 @@
                     if (b == false) return;
                     c++;
                     BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
+                    Application.DoEvents();
                 //}
                 MessageBox.Show("导入完毕:共"+c.ToString()+"个工艺路线");
                 grdMain.DataSource = null;

--
Gitblit v1.9.1