浏览代码

修改数量显示BUG

章政 8 年之前
父节点
当前提交
21e123ffcd
共有 1 个文件被更改,包括 29 次插入6 次删除
  1. 29 6
      UAS-MES/FunctionCode/Make/Make_TestCollection.cs

+ 29 - 6
UAS-MES/FunctionCode/Make/Make_TestCollection.cs

@@ -47,6 +47,8 @@ namespace UAS_MES.Make
         /// </summary>
         List<string> WaitList = new List<string>();
 
+        bool AutoCut = false;
+
         public Make_TestCollection()
         {
             InitializeComponent();
@@ -483,23 +485,35 @@ namespace UAS_MES.Make
             string condition = "";
             int nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
             int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
-            if (nowcheckqty + 1 == batchqty)
+            if (nowcheckqty + 1 == batchqty && AutoCut)
             {
                 condition = "and ob_status='UNCHECK' and ob_checkno='" + ob_checkno.Text + "'";
             }
             else
             {
-                if (nowcheckqty > batchqty)
-                {
-                    OperateResult.AppendText(">>已采集批数已超过抽检批数\n", Color.Red);
-                }
                 condition = "and ob_status='ENTERING' ";
             }
             sql.Append("select ob_batchqty,ob_nowcheckqty,ob_checkno from oqcbatch where ");
             sql.Append("ob_linecode='" + User.UserLineCode + "' and ob_prodcode='" + ma_prodcode.Text + "' and ");
             sql.Append("ob_stepcode='" + User.CurrentStepCode + "' " + condition);
             DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-            BaseUtil.SetFormValue(this.Controls, dt);
+            if (dt.Rows.Count > 0)
+            {
+                BaseUtil.SetFormValue(this.Controls, dt);
+                nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
+                batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
+                if (nowcheckqty > batchqty)
+                {
+                    OperateResult.AppendText(">>已采集批数已超过抽检批数\n", Color.Red);
+                }
+            }
+            else
+            {
+                ob_batchqty.Text = "";
+                ob_nowcheckqty.Text = "";
+                ob_checkno.Text = "";
+                SendCheck.Enabled = false;
+            }
             if (ob_batchqty.Text != "")
             {
                 SendCheck.Enabled = true;
@@ -545,6 +559,15 @@ namespace UAS_MES.Make
         {
             if (ob_checkno.Text != "")
             {
+                string Cut = dh.getFieldDataByCondition("product left join oqcbatch on ob_prodcode=pr_code", "pr_ifautocutcheckno", "ob_checkno='" + ob_checkno.Text + "'").ToString();
+                if (Cut == "" || Cut == "0")
+                {
+                    AutoCut = false;
+                }
+                else
+                {
+                    AutoCut = true;
+                }
                 SendCheck.Enabled = true;
             }
         }