yhluo il y a 2 jours
Parent
commit
f37df8b994

+ 1 - 0
UAS_MES_YTDZ/FunctionCode/Make/Make_ToolingManager.Designer.cs

@@ -200,6 +200,7 @@
             this.toolingVal.Size = new System.Drawing.Size(204, 31);
             this.toolingVal.TabIndex = 1;
             this.toolingVal.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.toolingVal_KeyPress);
+            this.toolingVal.Leave += new System.EventHandler(this.toolingVal_Leave);
             // 
             // toolingLab
             // 

+ 14 - 3
UAS_MES_YTDZ/FunctionCode/Make/Make_ToolingManager.cs

@@ -64,6 +64,12 @@ namespace UAS_MES_NEW.Make
             //Confirm.PerformClick();
         }
 
+        private void toolingVal_Leave(object sender, EventArgs e)
+        {
+            KeyPressEventArgs newEvent = new KeyPressEventArgs((char)Keys.Enter);
+            toolingVal_KeyPress(toolingVal, newEvent);
+        }
+
         private void toolingVal_KeyPress(object sender, KeyPressEventArgs e)
         {
             if (e.KeyChar != (char)Keys.Enter) return;
@@ -219,7 +225,7 @@ namespace UAS_MES_NEW.Make
             {
                 //ShowMsg(MsgBox, 2, "Warning,钢网:" + toolingVal.Text + "使用次数接近上限");
                 DialogResult result = MessageBox.Show(this.ParentForm, $"Warning,{typeVal.Text}:{toolingVal.Text}使用次数接近上限,已使用{useCount},距离上限还有{(maxCount - useCount)}次", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
-                if (result == DialogResult.No) return;
+                if (result == DialogResult.No || result == DialogResult.Cancel) return;
             }
 
             dt = (DataTable)dh.ExecuteSql($"select ma_prodcode from make where ma_code='{ma_code.Text}'", "select");
@@ -282,7 +288,9 @@ namespace UAS_MES_NEW.Make
             ShowMsg(MsgBox, 1, $"OK,{typeVal.Text}编号:{toolingVal.Text},已领用成功");
 
             CleanDetail("Receive");
-            toolingVal_KeyPress(null, null);
+
+            KeyPressEventArgs newEvent = new KeyPressEventArgs((char)Keys.Enter);
+            toolingVal_KeyPress(toolingVal, newEvent);
         }
 
         private void CleanDetail(string type)
@@ -386,12 +394,15 @@ namespace UAS_MES_NEW.Make
             ShowMsg(MsgBox, 1, $"OK,{typeVal.Text}编号:{toolingVal.Text},已归还成功");
 
             CleanDetail("Receive");
-            toolingVal_KeyPress(null, null);
+
+            KeyPressEventArgs newEvent = new KeyPressEventArgs((char)Keys.Enter);
+            toolingVal_KeyPress(toolingVal, newEvent);
         }
 
         private void Scrap_Click(object sender, EventArgs e)
         {
 
         }
+
     }
 }