Эх сурвалжийг харах

OQC修改,对展开的DataGridView的赋值方法的BUG进行修复

章政 8 жил өмнө
parent
commit
5e3992d9b4

+ 11 - 11
UAS-MES/FunctionCode/OQC/OQC_Inspection.Designer.cs

@@ -60,8 +60,8 @@
             this.勾选 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.ob_batchqty_dgv = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.obd_outboxcode_dgv = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.ob_makecode_dgv = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.obd_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.obd_makecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.panel2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.CheckBatchDGV)).BeginInit();
             this.SuspendLayout();
@@ -459,8 +459,8 @@
             this.勾选,
             this.ob_batchqty_dgv,
             this.obd_outboxcode_dgv,
-            this.ob_makecode_dgv,
-            this.obd_id});
+            this.obd_id,
+            this.obd_makecode});
             this.CheckBatchDGV.Location = new System.Drawing.Point(27, 174);
             this.CheckBatchDGV.Name = "CheckBatchDGV";
             this.CheckBatchDGV.RowHeadersWidth = 20;
@@ -493,13 +493,6 @@
             this.obd_outboxcode_dgv.Name = "obd_outboxcode_dgv";
             this.obd_outboxcode_dgv.Width = 190;
             // 
-            // ob_makecode_dgv
-            // 
-            this.ob_makecode_dgv.DataPropertyName = "ob_makecode";
-            this.ob_makecode_dgv.HeaderText = "工单代码";
-            this.ob_makecode_dgv.Name = "ob_makecode_dgv";
-            this.ob_makecode_dgv.Width = 215;
-            // 
             // obd_id
             // 
             this.obd_id.DataPropertyName = "obd_id";
@@ -507,6 +500,13 @@
             this.obd_id.Name = "obd_id";
             this.obd_id.Visible = false;
             // 
+            // obd_makecode
+            // 
+            this.obd_makecode.DataPropertyName = "obd_makecode";
+            this.obd_makecode.HeaderText = "工单号";
+            this.obd_makecode.Name = "obd_makecode";
+            this.obd_makecode.Width = 215;
+            // 
             // OQC_Inspection
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -586,7 +586,7 @@
         private System.Windows.Forms.DataGridViewCheckBoxColumn 勾选;
         private System.Windows.Forms.DataGridViewTextBoxColumn ob_batchqty_dgv;
         private System.Windows.Forms.DataGridViewTextBoxColumn obd_outboxcode_dgv;
-        private System.Windows.Forms.DataGridViewTextBoxColumn ob_makecode_dgv;
         private System.Windows.Forms.DataGridViewTextBoxColumn obd_id;
+        private System.Windows.Forms.DataGridViewTextBoxColumn obd_makecode;
     }
 }

+ 17 - 35
UAS-MES/FunctionCode/OQC/OQC_Inspection.cs

@@ -28,7 +28,6 @@ namespace UAS_MES.OQC
         {
             asc.controllInitializeSize(this);
             dh = new DataHelper();
-          
             //工单号放大镜配置
             ma_code.TableName = "make";
             ma_code.SelectField = "ma_code # 工单号,ma_prodcode # 产品编号";
@@ -81,9 +80,7 @@ namespace UAS_MES.OQC
                             OperateResult.AppendText(">>箱号已从送检批中移除\n", Color.Green);
                         }
                         else
-                        {
                             OperateResult.AppendText(">>箱号不在抽检明细中\n", Color.Red);
-                        }
                     }
                     //未勾选撤销
                     else
@@ -115,28 +112,20 @@ namespace UAS_MES.OQC
                                 }
                                 //存在则进行提示
                                 else
-                                {
                                     OperateResult.AppendText(">>箱号已存在送检批" + dt.Rows[0]["obd_checkno"] + "中\n", Color.Red);
-                                }
                             }
                             else if (ma_prodcode.Text == "")
                             {
                             }
                             else
-                            {
                                 OperateResult.AppendText(">>箱内产品与抽检批次产品不一致\n", Color.Red);
-                            }
                         }
                         else
-                        {
-                            OperateResult.AppendText(">>箱号不存在\n", Color.Red);
-                        }
+                            OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在\n", Color.Red);
                     }
                 }
                 else
-                {
                     OperateResult.AppendText(">>只允许在录入状态的抽检批才允许操作\n", Color.Red);
-                }
             }
         }
 
@@ -150,9 +139,7 @@ namespace UAS_MES.OQC
                 BaseUtil.FillExpandDgvWithDataTable(CheckBatchDGV, dt[1], true);
             }
             else
-            {
                 OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-            }
         }
 
         private void dataGridViewExpand1_DataError(object sender, DataGridViewDataErrorEventArgs e)
@@ -239,24 +226,29 @@ namespace UAS_MES.OQC
 
         private void RemoveAll_Click(object sender, EventArgs e)
         {
-            List<string> DeleteID = new List<string>();
-            //判断有多少勾选了
-            for (int i = 0; i < CheckBatchDGV.Rows.Count; i++)
+            DataTable dt = (DataTable)dh.ExecuteSql("select ob_status,ob_source from OQCBatch where ob_checkno='" + ob_checkno.Text + "'", "select");
+            if (dt.Rows.Count > 0)
             {
-                if (CheckBatchDGV.Rows[i].Cells[0].Value != null)
+                if (dt.Rows[0]["ob_status"].ToString() == "ENTERING")
                 {
-                    if (CheckBatchDGV.Rows[i].Cells[0].FormattedValue.ToString() == "True")
+                    List<string> DeleteID = new List<string>();
+                    //判断有多少勾选了
+                    for (int i = 0; i < CheckBatchDGV.Rows.Count; i++)
                     {
                         DeleteID.Add(CheckBatchDGV.Rows[i].Cells["obd_id"].Value.ToString());
                     }
+                    if (DeleteID.Count > 0)
+                    {
+                        //删除全部明细
+                        dh.DeleteDataByID("OQCBatchDetail", "obd_id", DeleteID.ToArray());
+                        dh.UpdateByCondition("OQCBatch", "ob_batchqty=0,ob_prodcode=''", "ob_checkno='" + ob_checkno.Text + "'");
+                        GetBatch.PerformClick();
+                        OperateResult.AppendText(">>已全部移除\n", Color.Green);
+                    }
                 }
+                else OperateResult.AppendText(">>只允许移除在录入状态的抽检品的单号\n", Color.Red);
             }
-            if (DeleteID.Count > 0)
-            {
-                dh.DeleteDataByID("OQCBatchDetail", "obd_id", DeleteID.ToArray());
-                GetBatch.PerformClick();
-                OperateResult.AppendText(">>已全部移除\n", Color.Green);
-            }
+            else OperateResult.AppendText(">>抽检批次号不存在\n", Color.Red);
         }
 
         /// <summary>
@@ -274,9 +266,7 @@ namespace UAS_MES.OQC
                 BaseUtil.CleanForm(this);
             }
             else
-            {
                 OperateResult.AppendText(">>抽检批次不存在或者单据状态不是在录入\n", Color.Red);
-            }
         }
 
         /// <summary>
@@ -287,33 +277,25 @@ namespace UAS_MES.OQC
         private void SendOQC_Click(object sender, EventArgs e)
         {
             if (dh.CheckExist("OQCBatch", "ob_checkno='" + ob_checkno.Text + "'") && ob_status.Text == "在录入")
-            {
                 dh.UpdateByCondition("OQCBatch", "ob_status='UNCHECK'", "ob_checkno='" + ob_checkno.Text + "'");
-            }
         }
 
         private void ob_checkno_TextChanged(object sender, EventArgs e)
         {
             if (ob_checkno.Text != "")
-            {
                 SendOQC.Enabled = true;
-            }
         }
 
         private void ob_checkno_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)
-            {
                 GetBatch.PerformClick();
-            }
         }
 
         private void obd_outboxcode_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)
-            {
                 GetBatch.PerformClick();
-            }
         }
     }
 }

+ 2 - 2
UAS-MES/FunctionCode/OQC/OQC_Inspection.resx

@@ -1044,10 +1044,10 @@
   <metadata name="obd_outboxcode_dgv.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="ob_makecode_dgv.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="obd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="obd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="obd_makecode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
 </root>

+ 12 - 12
UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.designer.cs

@@ -168,7 +168,7 @@
             // 
             this.ob_remark_label.AutoSize = true;
             this.ob_remark_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_remark_label.Location = new System.Drawing.Point(39, 544);
+            this.ob_remark_label.Location = new System.Drawing.Point(39, 532);
             this.ob_remark_label.Name = "ob_remark_label";
             this.ob_remark_label.Size = new System.Drawing.Size(42, 21);
             this.ob_remark_label.TabIndex = 172;
@@ -188,7 +188,7 @@
             // 
             this.ob_maxacceptqty_label.AutoSize = true;
             this.ob_maxacceptqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_maxacceptqty_label.Location = new System.Drawing.Point(39, 584);
+            this.ob_maxacceptqty_label.Location = new System.Drawing.Point(39, 570);
             this.ob_maxacceptqty_label.Name = "ob_maxacceptqty_label";
             this.ob_maxacceptqty_label.Size = new System.Drawing.Size(170, 21);
             this.ob_maxacceptqty_label.TabIndex = 182;
@@ -198,7 +198,7 @@
             // 
             this.ob_aqlcode_label.AutoSize = true;
             this.ob_aqlcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_aqlcode_label.Location = new System.Drawing.Point(410, 544);
+            this.ob_aqlcode_label.Location = new System.Drawing.Point(410, 532);
             this.ob_aqlcode_label.Name = "ob_aqlcode_label";
             this.ob_aqlcode_label.Size = new System.Drawing.Size(42, 21);
             this.ob_aqlcode_label.TabIndex = 184;
@@ -238,7 +238,7 @@
             this.ob_aqlcode.AllPower = null;
             this.ob_aqlcode.BackColor = System.Drawing.Color.White;
             this.ob_aqlcode.ID = null;
-            this.ob_aqlcode.Location = new System.Drawing.Point(472, 546);
+            this.ob_aqlcode.Location = new System.Drawing.Point(472, 534);
             this.ob_aqlcode.Name = "ob_aqlcode";
             this.ob_aqlcode.Power = null;
             this.ob_aqlcode.Size = new System.Drawing.Size(169, 21);
@@ -253,7 +253,7 @@
             this.ob_maxngacceptqty.AllPower = null;
             this.ob_maxngacceptqty.BackColor = System.Drawing.Color.White;
             this.ob_maxngacceptqty.ID = null;
-            this.ob_maxngacceptqty.Location = new System.Drawing.Point(215, 584);
+            this.ob_maxngacceptqty.Location = new System.Drawing.Point(215, 570);
             this.ob_maxngacceptqty.Name = "ob_maxngacceptqty";
             this.ob_maxngacceptqty.Power = null;
             this.ob_maxngacceptqty.Size = new System.Drawing.Size(169, 21);
@@ -296,7 +296,7 @@
             this.Clean.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Clean.Image = ((System.Drawing.Image)(resources.GetObject("Clean.Image")));
             this.Clean.IsShowBorder = true;
-            this.Clean.Location = new System.Drawing.Point(874, 498);
+            this.Clean.Location = new System.Drawing.Point(872, 498);
             this.Clean.MoveImage = ((System.Drawing.Image)(resources.GetObject("Clean.MoveImage")));
             this.Clean.Name = "Clean";
             this.Clean.NormalImage = ((System.Drawing.Image)(resources.GetObject("Clean.NormalImage")));
@@ -313,7 +313,7 @@
             this.ob_remark.AllPower = null;
             this.ob_remark.BackColor = System.Drawing.Color.White;
             this.ob_remark.ID = null;
-            this.ob_remark.Location = new System.Drawing.Point(102, 546);
+            this.ob_remark.Location = new System.Drawing.Point(102, 534);
             this.ob_remark.Name = "ob_remark";
             this.ob_remark.Power = null;
             this.ob_remark.Size = new System.Drawing.Size(282, 21);
@@ -331,7 +331,7 @@
             this.GetBatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.GetBatch.Image = ((System.Drawing.Image)(resources.GetObject("GetBatch.Image")));
             this.GetBatch.IsShowBorder = true;
-            this.GetBatch.Location = new System.Drawing.Point(507, 136);
+            this.GetBatch.Location = new System.Drawing.Point(507, 137);
             this.GetBatch.MoveImage = ((System.Drawing.Image)(resources.GetObject("GetBatch.MoveImage")));
             this.GetBatch.Name = "GetBatch";
             this.GetBatch.NormalImage = ((System.Drawing.Image)(resources.GetObject("GetBatch.NormalImage")));
@@ -351,7 +351,7 @@
             this.SaveConfiguration.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.SaveConfiguration.Image = ((System.Drawing.Image)(resources.GetObject("SaveConfiguration.Image")));
             this.SaveConfiguration.IsShowBorder = true;
-            this.SaveConfiguration.Location = new System.Drawing.Point(299, 507);
+            this.SaveConfiguration.Location = new System.Drawing.Point(299, 499);
             this.SaveConfiguration.MoveImage = ((System.Drawing.Image)(resources.GetObject("SaveConfiguration.MoveImage")));
             this.SaveConfiguration.Name = "SaveConfiguration";
             this.SaveConfiguration.NormalImage = ((System.Drawing.Image)(resources.GetObject("SaveConfiguration.NormalImage")));
@@ -371,7 +371,7 @@
             this.RefreshConfiguration.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.RefreshConfiguration.Image = ((System.Drawing.Image)(resources.GetObject("RefreshConfiguration.Image")));
             this.RefreshConfiguration.IsShowBorder = true;
-            this.RefreshConfiguration.Location = new System.Drawing.Point(460, 507);
+            this.RefreshConfiguration.Location = new System.Drawing.Point(460, 499);
             this.RefreshConfiguration.MoveImage = ((System.Drawing.Image)(resources.GetObject("RefreshConfiguration.MoveImage")));
             this.RefreshConfiguration.Name = "RefreshConfiguration";
             this.RefreshConfiguration.NormalImage = ((System.Drawing.Image)(resources.GetObject("RefreshConfiguration.NormalImage")));
@@ -391,7 +391,7 @@
             this.Save.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Save.Image = ((System.Drawing.Image)(resources.GetObject("Save.Image")));
             this.Save.IsShowBorder = true;
-            this.Save.Location = new System.Drawing.Point(413, 580);
+            this.Save.Location = new System.Drawing.Point(413, 568);
             this.Save.MoveImage = ((System.Drawing.Image)(resources.GetObject("Save.MoveImage")));
             this.Save.Name = "Save";
             this.Save.NormalImage = ((System.Drawing.Image)(resources.GetObject("Save.NormalImage")));
@@ -577,7 +577,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1022, 616);
+            this.ClientSize = new System.Drawing.Size(1022, 600);
             this.Controls.Add(this.ob_projectcode);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.ob_aqlcode);

+ 2 - 3
UAS-MES/PublicMethod/BaseUtil.cs

@@ -554,9 +554,8 @@ namespace UAS_MES.PublicMethod
                     collapseRow.IsCollapse = true;
                     DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
                     collapseRow.Cells.Add(checkcell);
-
                     //因为DGV中可能有空置的列多出,所以需要用DataTable的列进行循环
-                    for (int j = 1; j < dt.Columns.Count; j++)
+                    for (int j = 1; j <= dt.Columns.Count; j++)
                     {
                         DataGridViewTextBoxCell textcell = new DataGridViewTextBoxCell();
                         textcell.Value = dt.Rows[i][j - 1].ToString();
@@ -573,7 +572,7 @@ namespace UAS_MES.PublicMethod
                 {
                     CollapseDataGridViewRow collapseRow = new CollapseDataGridViewRow();
                     collapseRow.IsCollapse = true;
-                    for (int j = 1; j < dt.Columns.Count; j++)
+                    for (int j = 1; j <= dt.Columns.Count; j++)
                     {
                         DataGridViewTextBoxCell textcell = new DataGridViewTextBoxCell();
                         textcell.Value = dt.Rows[i][j - 1].ToString();

+ 2 - 2
UAS-MES/PublicMethod/LogicHandler.cs

@@ -802,8 +802,8 @@ namespace UAS_MES.PublicMethod
             {
                 case "OQCSENDCHECK":
                     sql.Clear();
-                    sql.Append("select count(1) ob_batchqty,obd_outboxcode,obd_makecode ma_code, obd_id from OQCBatchdetail ");
-                    sql.Append("where obd_checkno = '" + iCheckNo + "' group by  obd_outboxcode,obd_makecode ,obd_id");
+                    sql.Append("select count(1) ob_batchqty,obd_outboxcode,obd_id,obd_makecode from OQCBatchdetail ");
+                    sql.Append("where obd_checkno = '" + iCheckNo + "' group by obd_outboxcode,obd_makecode,obd_id");
                     Grid = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                     Form = (DataTable)dh.ExecuteSql("select ob_id,ob_status,ob_prodcode,ob_batchqty,ob_source,ob_checkno from OQCBatch where ob_checkno='" + iCheckNo + "'", "select");
                     if (Form.Rows.Count > 0)