Quellcode durchsuchen

限制抽样计划维护抽样采样必选

章政 vor 8 Jahren
Ursprung
Commit
a0c01cf82c
1 geänderte Dateien mit 9 neuen und 3 gelöschten Zeilen
  1. 9 3
      UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.cs

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

@@ -98,11 +98,13 @@ namespace UAS_MES.OQC
                 //更新的数据
                 List<string> ci_kind_update = new List<string>();
                 List<string> oi_sampleqty_update = new List<string>();
+                int ChooseCount = 0;
                 for (int i = 0; i < CheckTypeDGV.Rows.Count; i++)
                 {
                     //用户勾选的数据才进行操作
                     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)))
                         {
                             oi_id.Add(CheckTypeDGV.Rows[i].Cells["oi_id"].Value.ToString());
@@ -116,6 +118,11 @@ namespace UAS_MES.OQC
                         }
                     }
                 }
+                if (ChooseCount == 0)
+                {
+                    OperateResult.AppendText(">>请勾选抽样数据\n", Color.Red);
+                    return;
+                }
                 //如果ID为0的数组存在内容则进行插入操作
                 dh.ExecuteSql("delete from oqcitems where oi_checkno='" + ob_checkno.Text + "'", "delete");
                 if (oi_id.Count > 0)
@@ -127,6 +134,7 @@ 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);
             }
             else
                 OperateResult.AppendText(">>送检批次必须为待检验状态\n", Color.Red);
@@ -149,7 +157,7 @@ namespace UAS_MES.OQC
         //对于最大不合格允通过数的校验
         private bool Checkob_maxngacceptqty()
         {
-            if (int.Parse(ob_maxngacceptqty.Text==""?"0":ob_maxngacceptqty.Text) < 0)
+            if (int.Parse(ob_maxngacceptqty.Text == "" ? "0" : ob_maxngacceptqty.Text) < 0)
             {
                 OperateResult.AppendText(">>最大不合格允通过数必须大于等于0\n", Color.Red);
                 ob_maxngacceptqty.Text = null;
@@ -160,12 +168,10 @@ namespace UAS_MES.OQC
                 int result = (int)dh.ExecuteSql("update OQCBatch set ob_projectcode='" + ob_projectcode.Text + "',ob_remark = '" + ob_remark.Text + "',ob_aqlcode='" + ob_aqlcode.Text + "',ob_maxngacceptqty='" + ob_maxngacceptqty.Text + "' where ob_checkno='" + ob_checkno.Text + "' ", "update");
                 if (result > 0)
                 {
-                    OperateResult.AppendText(">>保存成功\n", Color.Green);
                     return true;
                 }
                 else
                 {
-                    OperateResult.AppendText(">>保存失败\n", Color.Red);
                     return false;
                 }
             }