From 6b7f640c7952a3948b896d4c585d416f546788a1 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期四, 17 七月 2025 08:17:12 +0800
Subject: [PATCH] bug

---
 DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs
index a8b1746..f9d707e 100644
--- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs
@@ -13,9 +13,8 @@
     {
         string strGuid = "";
         string strUpGuid = "";
-        string  strType = "";//绫诲埆(鏅�氫俊鎭紝璁よ瘉淇℃伅)
+        string strType = "";//淇℃伅鐨勫垎绫籹_type
         string _webServiceName = "MesDefectCodeManager/";
-
 
         /// <summary>
         /// 
@@ -30,7 +29,7 @@
             this.strUpGuid = _strUpGuid;
             this.strType = _strType;
             getSelect();
-            //杩欐槸鏇存柊
+            //杩欐槸鏇存柊,绂佹绫诲瀷鍜岀紪鍙�
             if (!string.IsNullOrEmpty(this.strGuid))
             {
                 getMode(strGuid);
@@ -39,14 +38,13 @@
                 txt_defectCode.ReadOnly = true;
                 return;
             }
-            //杩欐槸澧炲姞瀛愰」
+            //杩欐槸澧炲姞瀛愰」锛岄渶瑕佸垵濮嬪寲瀹冪殑缂栧彿
             if (!string.IsNullOrEmpty(strUpGuid))
             {
                 getMode(strUpGuid);
                 this.Text = "澧炲姞銆�" + txt_defectName.Text + "銆戠殑瀛愰」鐩�";
                 txt_sType.Enabled = false;
                 txt_defectCode.ReadOnly = false;
-                txt_defectCode.Text = "";
                 txt_defectName.Text = "";
                 return;
             }
@@ -61,19 +59,19 @@
         {
             if (string.IsNullOrEmpty(txt_defectCode.Text))
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("缂栧彿涓嶈兘涓虹┖锛�");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("缂栧彿涓嶈兘涓虹┖锛�");
                 txt_defectCode.Focus();
                 return;
             }
             if (txt_sType.SelectedIndex <= 0)
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("绫诲瀷涓嶈兘涓虹┖锛�");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("绫诲瀷涓嶈兘涓虹┖锛�");
                 txt_sType.Focus();
                 return;
             }
             if (string.IsNullOrEmpty(txt_defectName.Text))
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("鍚嶇О涓嶈兘涓虹┖锛�");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("鍚嶇О涓嶈兘涓虹┖锛�");
                 txt_defectName.Focus();
                 return;
             }
@@ -91,16 +89,19 @@
             {
                 string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
                 ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+              
                 if (_rtn.rtnCode > 0)
                 {
+                    ToolBox.MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
                     UpdateParent?.Invoke(this, new UpdateParentEventArgs { StringSingle = "" });
                     Close();
                 }
+                else
+                    ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
 
@@ -139,11 +140,11 @@
         /// 璇诲彇瀹炰綋
         /// </summary>
         /// <param name="strGuid"></param>
-        private void getMode(string strGuid)
+        private void getMode(string guid)
         {
             var _obj = new
             {
-                guid = strGuid,//涓诲缓
+                guid = guid,//涓诲缓
             };
             try
             {
@@ -153,13 +154,15 @@
                 {
                     dynamic dy = _rtn.rtnData;
                     UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, true);
+                    if(string.IsNullOrEmpty(strGuid))
+                    txt_defectCode.Text = dy.maxNo;
                 }
                 else
-                    ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                    ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
     }

--
Gitblit v1.9.3