Browse Source

OQC抽样计划维护默认全部勾选

章政 8 years ago
parent
commit
c4cbe606b9

+ 1 - 1
UAS-MES/FunctionCode/OQC/OQC_Inspection.cs

@@ -151,7 +151,7 @@ namespace UAS_MES.OQC
                 if (ErrorMessage == "")
                 {
                     BaseUtil.SetFormValue(Controls, dt[0]);
-                    BaseUtil.FillExpandDgvWithDataTable(CheckBatchDGV, dt[1], true);
+                    BaseUtil.FillExpandDgvWithDataTable(CheckBatchDGV, dt[1], true,true);
                 }
                 else
                 {

+ 22 - 13
UAS-MES/FunctionCode/OQC/OQC_SamplingDataCollection.cs

@@ -139,18 +139,31 @@ namespace UAS_MES.OQC
         private void GetBatchTypeGridData()
         {
             dt = (DataTable)dh.ExecuteSql("select oi_checkkind,max(oi_sampleqty) oi_count,nvl(max(oi_checkqty),0) oi_checkedcount from OQCBatch  left join OQCItems on ob_checkno=oi_checkno  where oi_checkno='" + ob_checkno.Text + "' group by oi_checkkind ", "select");
-            BaseUtil.FillExpandDgvWithDataTable(CheckTypeDGV, dt, true);
+            BaseUtil.FillExpandDgvWithDataTable(CheckTypeDGV, dt, true,true);
             if (CheckTypeDGV.Rows.Count == 0)
             {
                 OperateResult.AppendText(">>请先维护抽样计划\n", Color.Red);
                 return;
             }
+            string checkkind = "";
+            for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
+            {
+                checkkind +=("'"+ CheckTypeDGV.Rows[i].Cells["oi_itemcode"].Value.ToString() + "',") ;
+            }
+            sql.Clear();
+            sql.Append("select 1 choose,oi_checkkind,ois_sncode,nvl(ois_id,0) ois_id ,oi_itemcode ,nvl(ois_ifng,0) oi_ng,nvl(ois_defectlevel,'-1')");
+            sql.Append("oi_leveldefect,ois_remark,case nvl(ois_id,0) when 0 then '未检验' else '已检验' end ois_status from OQCItems ");
+            sql.Append("left join OQCItemSamples on  ois_sncode='" + sncode.Text + "' and ois_checkno=oi_checkno and ");
+            sql.Append("ois_itemcode=oi_itemcode and ois_projectcode = oi_projectcode where oi_checkno ='" + ob_checkno.Text + "' ");
+            sql.Append("and oi_checkkind in (" + checkkind.Substring(0,checkkind.Length-1) + ")");
+            TempForCheckType = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+
             sql.Clear();
             sql.Append("select bg_code,bg_name from product left join productkind ");
             sql.Append("on pr_kind=pk_code left join PRODUCTBADGROUP on pk_code= pb_kindcode ");
             sql.Append("left join badgroup on  bg_code=pb_badgroup where pr_code='" + ob_prodcode.Text + "'");
             BadCode = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-            BaseUtil.FillExpandDgvWithDataTable(WaitChooseDGV, BadCode, true);
+            BaseUtil.FillExpandDgvWithDataTable(WaitChooseDGV, BadCode, true,false);
         }
 
         private void Confirm_Click(object sender, EventArgs e)
@@ -185,7 +198,7 @@ namespace UAS_MES.OQC
                         //将布尔值转换为0,-1
                         if (TempForCheckType.Rows[i]["ois_id"].ToString() != "" && TempForCheckType.Rows[i]["ois_id"].ToString() != "0")
                         {
-                            ois_ifng_update.Add(TempForCheckType.Rows[i]["oi_ng"].ToString() == "True" ? "-1" : "0");
+                            ois_ifng_update.Add(TempForCheckType.Rows[i]["oi_ng"].ToString());
                             ois_defectlevel_update.Add(TempForCheckType.Rows[i]["oi_leveldefect"].ToString());
                             ois_remark_update.Add(TempForCheckType.Rows[i]["ois_remark"].ToString());
                             ois_id_update.Add(TempForCheckType.Rows[i]["ois_id"].ToString());
@@ -193,7 +206,7 @@ namespace UAS_MES.OQC
                         else
                         {
                             oi_itemcode_insert.Add(TempForCheckType.Rows[i]["oi_itemcode"].ToString());
-                            ois_ifng_insert.Add(TempForCheckType.Rows[i]["oi_ng"].ToString() == "True" ? "-1" : "0");
+                            ois_ifng_insert.Add(TempForCheckType.Rows[i]["oi_ng"].ToString());
                             ois_defectlevel_insert.Add(TempForCheckType.Rows[i]["oi_leveldefect"].ToString());
                             ois_remark_insert.Add(TempForCheckType.Rows[i]["ois_remark"].ToString());
                         }
@@ -202,12 +215,12 @@ namespace UAS_MES.OQC
                     bool AllPass = true;
                     for (int i = 0; i < ois_ifng_insert.Count; i++)
                     {
-                        if (ois_ifng_insert[i] == "-1")
+                        if (ois_ifng_insert[i] != "0")
                             AllPass = false;
                     }
                     for (int i = 0; i < ois_ifng_update.Count; i++)
                     {
-                        if (ois_ifng_update[i] == "-1")
+                        if (ois_ifng_update[i] != "0")
                             AllPass = false;
                     }
                     if (ChoosedDGV.RowCount > 0 || AllPass)
@@ -366,13 +379,8 @@ namespace UAS_MES.OQC
             if (!dgvr.Contains(CheckTypeDGV.Rows[e.RowIndex]))
             {
                 string checkkind = CheckTypeDGV.Rows[e.RowIndex].Cells["oi_itemcode"].Value.ToString();
-                sql.Clear();
-                sql.Append("select oi_checkkind,ois_sncode,nvl(ois_id,0) ois_id ,oi_itemcode ,nvl(ois_ifng,0) oi_ng,nvl(ois_defectlevel,'-1')");
-                sql.Append("oi_leveldefect,ois_remark,case nvl(ois_id,0) when 0 then '未检验' else '已检验' end ois_status from OQCItems ");
-                sql.Append("left join OQCItemSamples on  ois_sncode='" + sncode.Text + "' and ois_checkno=oi_checkno and ");
-                sql.Append("ois_itemcode=oi_itemcode and ois_projectcode = oi_projectcode where oi_checkno ='" + ob_checkno.Text + "' ");
-                sql.Append("and oi_checkkind='" + checkkind + "'");
-                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+
+                DataTable dt = BaseUtil.filterDataTable(TempForCheckType,"oi_checkkind='"+checkkind+"'");
                 DataGridViewRow headerRow = new DataGridViewRow();
 
                 DataGridViewTextBoxCell textcell = new DataGridViewTextBoxCell();
@@ -417,6 +425,7 @@ namespace UAS_MES.OQC
                     dataRow.Tag = "SonRow";
                     DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
                     checkcell.Tag = "SonRow";
+                    checkcell.Value=true;
                     dataRow.Cells.Add(checkcell);
 
                     textcell = new DataGridViewTextBoxCell();

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

@@ -622,7 +622,7 @@ namespace UAS_MES.PublicMethod
         /// <param name="dgv"></param>
         /// <param name="dt"></param>
         /// <param name="CheckBox"></param>
-        public static void FillExpandDgvWithDataTable(DataGridViewExpand dgv, DataTable dt, bool CheckBox)
+        public static void FillExpandDgvWithDataTable(DataGridViewExpand dgv, DataTable dt, bool CheckBox,bool CheckBoxTrue)
         {
             CleanDGVData(dgv);
             if (CheckBox)
@@ -633,6 +633,7 @@ namespace UAS_MES.PublicMethod
                     collapseRow.IsCollapse = true;
                     DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
                     collapseRow.Cells.Add(checkcell);
+                    checkcell.Value = CheckBoxTrue;
                     //因为DGV中可能有空置的列多出,所以需要用DataTable的列进行循环
                     for (int j = 0; j < dt.Columns.Count; j++)
                     {