Browse Source

维修自动带出不良信息

yhluo 3 months ago
parent
commit
641074b97d
1 changed files with 32 additions and 0 deletions
  1. 32 0
      UAS_MES_BG/FunctionCode/Make/Make_Repair.cs

+ 32 - 0
UAS_MES_BG/FunctionCode/Make/Make_Repair.cs

@@ -371,6 +371,8 @@ namespace UAS_MES_NEW.Make
                     else OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                 }
                 else OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+
+                QueryBadLocal();
             }
         }
 
@@ -874,9 +876,39 @@ namespace UAS_MES_NEW.Make
         private void mbl_loc_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)
+                QueryBadLocal();
                 SaveBadLocation_Click(sender, e);
         }
 
+        private void QueryBadLocal()
+        {
+            if (string.IsNullOrEmpty(GetSNCode.Text))
+            {
+                return;
+            }
+
+            List<string> enterLocal = new List<string>();
+            for (int i = 0;i < mbl_locdgv.RowCount; i++)
+            {
+                enterLocal.Add(mbl_locdgv.Rows[i].Cells["mbl_loc1"].ToString());
+            }
+
+            sql.Clear();
+            sql.Append($"SELECT mb_badlocation FROM makebad WHERE mb_sncode = '{GetSNCode.Text.Trim()}' AND mb_status = 0");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            if (dt.Rows.Count > 0)
+            {
+                string[] loaclArr = dt.Rows[0]["mb_badlocation"].ToString().Split('&');
+                foreach(string item in loaclArr)
+                {
+                    if(enterLocal.IndexOf(item) == -1)
+                    {
+                        mbl_loc.Text = item;
+                    }
+                }
+            }
+        }
+
         private void prodcode_TextKeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Enter)