From 2057778ce796422f1dab4ec011ca66eb1faf66cf Mon Sep 17 00:00:00 2001 From: lu <123456> Date: 星期日, 13 七月 2025 10:00:15 +0800 Subject: [PATCH] bug --- DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs | 53 +++++++++++++++++++++++++++++++++++------------------ 1 files changed, 35 insertions(+), 18 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs index 776ec67..f9d707e 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesDefectCodeShow.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json; using System; using System.Data; +using System.Text; namespace Gs.DevApp.DevFrm.QC @@ -12,31 +13,38 @@ { string strGuid = ""; string strUpGuid = ""; + string strType = "";//淇℃伅鐨勫垎绫籹_type string _webServiceName = "MesDefectCodeManager/"; - public Frm_MesDefectCodeShow(string _strGuid, string _strUpGuid) + + /// <summary> + /// + /// </summary> + /// <param name="_strGuid">涓婚敭</param> + /// <param name="_strUpGuid">鐖朵翰涓婚敭</param> + /// <param name="_strType">绫诲埆</param> + public Frm_MesDefectCodeShow(string _strGuid, string _strUpGuid, string _strType) { InitializeComponent(); - getSelect(); this.strGuid = _strGuid; this.strUpGuid = _strUpGuid; - - //杩欐槸鏇存柊 + this.strType = _strType; + getSelect(); + //杩欐槸鏇存柊,绂佹绫诲瀷鍜岀紪鍙� if (!string.IsNullOrEmpty(this.strGuid)) { getMode(strGuid); this.Text = "鏇存柊銆�" + txt_defectName.Text + "銆�"; txt_sType.Enabled = false; - txt_defectCode.Enabled = false; + txt_defectCode.ReadOnly = true; return; } - //杩欐槸澧炲姞瀛愰」 + //杩欐槸澧炲姞瀛愰」锛岄渶瑕佸垵濮嬪寲瀹冪殑缂栧彿 if (!string.IsNullOrEmpty(strUpGuid)) { getMode(strUpGuid); this.Text = "澧炲姞銆�" + txt_defectName.Text + "銆戠殑瀛愰」鐩�"; txt_sType.Enabled = false; - txt_defectCode.Enabled = true; - txt_defectCode.Text = ""; + txt_defectCode.ReadOnly = false; txt_defectName.Text = ""; return; } @@ -51,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; } @@ -74,22 +82,26 @@ SType = txt_sType.Text.Trim(), DefectName = txt_defectName.Text.Trim(), Pid = UtilityHelper.ToGuid(strUpGuid.Trim()), - Type1 = txt_type1.Checked + Type1 = txt_type1.Checked, + DefectSort = strType, }; try { 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); } } @@ -108,8 +120,11 @@ /// </summary> private void getSelect() { + System.Text.StringBuilder sbWhere = new StringBuilder(); + sbWhere.Append(" and a.defect_sort='" + strType + "'"); var _obj = new { + strWhere = sbWhere.ToString() }; var strReturn = UtilityHelper.HttpPost("", _webServiceName + "SelectCategory", JsonConvert.SerializeObject(_obj)); var dd = UtilityHelper.ReturnToList(strReturn); @@ -125,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 { @@ -139,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