Browse Source

添加次数限制

yhluo 3 days ago
parent
commit
7c61748a0f
1 changed files with 23 additions and 0 deletions
  1. 23 0
      UAS_MES_YTDZ/FunctionCode/Make/Make_ToolingManager.cs

+ 23 - 0
UAS_MES_YTDZ/FunctionCode/Make/Make_ToolingManager.cs

@@ -223,6 +223,22 @@ namespace UAS_MES_NEW.Make
                 return;
             }
 
+            if (li_code.Text.Contains("A") || li_code.Text.Contains("B"))
+            {
+                ShowMsg(MsgBox, 0, "NG,A和B新线体不允许手动领用,须通过测试仪领用");
+                li_code.Focus();
+                return;
+            }
+
+
+            int st_maxusecount = (int)dh.getFieldDataByCondition("stencil", "nvl(st_maxusecount, 0)", $"st_code = '{toolingVal.Text.Trim()}'");
+            int st_usecount = (int)dh.getFieldDataByCondition("stencil", "nvl(st_usecount, 0)", $"st_code = '{toolingVal.Text.Trim()}'");
+            if (st_maxusecount - st_usecount <= 0)
+            {
+                ShowMsg(MsgBox, 0, $"NG,可使用次数不足,使用次数上限为:{st_maxusecount},当前使用次数为:{st_usecount}");
+                return;
+            }
+
             if (IsCheckProd.Checked)
             {
                 dt = (DataTable)dh.ExecuteSql($"SELECT sp_detno FROM stenilcanusepro,make WHERE sp_stcode = '{toolingVal.Text.Trim()}' AND ma_code = '{ma_code.Text}' AND ma_code = sp_prodcode", "select");
@@ -360,6 +376,13 @@ namespace UAS_MES_NEW.Make
                 useCountVal.Text = "0";
             }
 
+            string stLine = (string)dh.getFieldDataByCondition("stencil", "st_line", $"st_code = '{toolingVal.Text.Trim()}'");
+            if (stLine.Contains("A") || stLine.Contains("B"))
+            {
+                ShowMsg(MsgBox, 0, "NG,A和B新线体不允许手动归还,须通过测试仪归还");
+                return;
+            }
+
             dt = (DataTable)dh.ExecuteSql($@"SELECT st_usestatus,st_usecount
                 FROM stencil WHERE st_code = '{toolingVal.Text.Trim()}'", "select");
             string status = dt.Rows[0]["st_usestatus"].ToString();