Browse Source

修改验证

章政 8 years ago
parent
commit
01f6cfb561
1 changed files with 20 additions and 9 deletions
  1. 20 9
      UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.cs

+ 20 - 9
UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.cs

@@ -105,15 +105,23 @@ namespace UAS_MES.OQC
                     if (CheckTypeDGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
                     {
                         ChooseCount = ChooseCount + 1;
-                        if (!(int.Parse(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString()) > int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text)))
+                        if (int.Parse(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString()) > 0)
                         {
-                            oi_id.Add(CheckTypeDGV.Rows[i].Cells["oi_id"].Value.ToString());
-                            ci_kind.Add(CheckTypeDGV.Rows[i].Cells["ci_kind"].Value.ToString());
-                            oi_sampleqty.Add(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString());
+                            if (!(int.Parse(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString()) > int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text)))
+                            {
+                                oi_id.Add(CheckTypeDGV.Rows[i].Cells["oi_id"].Value.ToString());
+                                ci_kind.Add(CheckTypeDGV.Rows[i].Cells["ci_kind"].Value.ToString());
+                                oi_sampleqty.Add(CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString());
+                            }
+                            else
+                            {
+                                OperateResult.AppendText(">>第" + (i + 1) + "行的数量大于送检批数量\n", Color.Red);
+                                return;
+                            }
                         }
                         else
                         {
-                            OperateResult.AppendText(">>第" + (i + 1) + "行的数量大于送检批数量\n", Color.Red);
+                            OperateResult.AppendText(">>第" + (i + 1) + "行的抽样数量必需大于0\n", Color.Red);
                             return;
                         }
                     }
@@ -134,7 +142,8 @@ namespace UAS_MES.OQC
                     sql.Append("LEFT JOIN QUA_CHECKITEM ON PD_CIID=CI_ID  where pr_code='" + ob_projectcode.Text + "' and ci_kind=:ci_kind1");
                     dh.BatchInsert(sql.GetString(), new string[] { "ci_kind", "oi_sampleqty", "ci_kind1" }, ci_kind.ToArray(), oi_sampleqty.ToArray(), ci_kind.ToArray());
                 }
-                OperateResult.AppendText(">>保存成功\n",Color.Green);
+                GetBatch.PerformClick();
+                OperateResult.AppendText(">>保存成功\n", Color.Green);
             }
             else
                 OperateResult.AppendText(">>送检批次必须为待检验状态\n", Color.Red);
@@ -147,7 +156,6 @@ namespace UAS_MES.OQC
                 if (Checkob_maxngacceptqty())
                 {
                     SaveConfiguration_Click(sender, e);
-                    GetBatch.PerformClick();
                 }
             }
             else
@@ -233,14 +241,17 @@ namespace UAS_MES.OQC
         {
             for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
             {
-                CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value = ad_qty.Text;
+                if (CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value.ToString() == "0")
+                {
+                    CheckTypeDGV.Rows[i].Cells["oi_sampleqty"].Value = ad_qty.Text;
+                }
             }
         }
 
         private void ob_projectcode_UserControlTextChanged(object sender, EventArgs e)
         {
             sql.Clear();
-            sql.Append("select nvl(max(oi_id),0)oi_id, ci_kind,nvl(max(oi_sampleqty),0) oi_sampleqty from QUA_PROJECT left join ");
+            sql.Append("select nvl(max(oi_id),0)oi_id,ci_kind,nvl(max(oi_sampleqty),0) oi_sampleqty from QUA_PROJECT left join ");
             sql.Append(" QUA_ProjectDetail on pd_prid=pr_id  left join QUA_CheckItem on pd_ciid=ci_id ");
             sql.Append("left join OQCITEMS on oi_checkno ='" + ob_checkno.Text + "' and oi_projectcode='" + ob_projectcode.Text + "' ");
             sql.Append("and oi_projectcode = pr_code and oi_checkkind = ci_kind where  pr_code='" + ob_projectcode.Text + "'  group by ci_kind");