From 3ee759fb8ca911b0fa3c4ccb82d318ca8ee559ad Mon Sep 17 00:00:00 2001 From: lu <123456> Date: 星期一, 18 八月 2025 11:00:54 +0800 Subject: [PATCH] bug --- DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs | 270 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 154 insertions(+), 116 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs index 84acee8..6d87553 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs @@ -2,13 +2,11 @@ using Gs.DevApp.DevFrm.QC.Models; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; -using Gs.DevApp.UserControl; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; -using System.Threading.Tasks; using System.Windows.Forms; namespace Gs.DevApp.DevFrm.QC @@ -20,63 +18,60 @@ public Frm_MesQmAql1() { InitializeComponent(); + object[] _objAry = { "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T"}; + this.repositoryItemComboBox1.Items.AddRange(_objAry); + this.repositoryItemComboBox2.Items.AddRange(_objAry); + this.repositoryItemComboBox3.Items.AddRange(_objAry); + this.repositoryItemComboBox4.Items.AddRange(_objAry); + this.repositoryItemComboBox5.Items.AddRange(_objAry); + this.repositoryItemComboBox6.Items.AddRange(_objAry); + this.repositoryItemComboBox7.Items.AddRange(_objAry); + this.repositoryItemComboBox8.Items.AddRange(_objAry); this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick; this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1; this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; - this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; - toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick; + this.toolBarMenu1.getXmlConfig(); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "foneChecked", "", (value) => - { - Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); - }); + { + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); + }, tips); Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => { getModel(value); }, (value) => { getPageList(this.pageBar1.CurrentPage); - }); + }, lbGuid); getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; } - private void GridView1_ColumnFilterChanged(object sender, EventArgs e) - { - _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); - Task.Delay(100); - getPageList(1); - } - /// <summary> - /// 鎵瑰噯 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void ToolBarMenu1_btnPiZhunClick(object sender, EventArgs e) - { - string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, - lbGuid, txt_sampleSizeNo, gridView1); - try - { - string strJson = UtilityHelper.HttpPost("", _webServiceName + "Approval", JsonConvert.SerializeObject(rowGuid)); - ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) - { - getPageList(this.pageBar1.CurrentPage); - } - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - } - catch (Exception ex) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - } + /// <summary> /// 鍙嶅鏍� @@ -98,7 +93,7 @@ { _toolCk(1); } - + /// <summary> /// 鍒嗛〉浜嬩欢 /// </summary> @@ -108,30 +103,7 @@ { getPageList(curPage); } - /// <summary> - /// 鏌ヨ浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) - { - gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; - gridView1.ActiveFilter.Clear(); - gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; - var frm = new ShowFilter(gridView1.Columns, _filterList); - frm.UpdateParent += Frm_UpdateParent; - frm.ShowDialog(); - } - /// <summary> - /// 鏌ヨ鍥炶皟 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) - { - _filterList = e.FilterList; - getPageList(1); - } + /// <summary> /// 鍙栨秷浜嬩欢 /// </summary> @@ -150,10 +122,10 @@ private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e) { string rowGuid = "", rowName = ""; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_sampleSizeNo, gridView1); + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_sampleSizeNo, gridView1, "sampleSizeNo"); if (string.IsNullOrEmpty(rowGuid)) { - ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵")) @@ -167,16 +139,20 @@ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { + ToolBox.MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); if (xtraTabControl1.SelectedTabPageIndex == 0) + { getPageList(this.pageBar1.CurrentPage); + } else Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2); } - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + else + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -191,14 +167,15 @@ getModel(lbGuid.Text.Trim()); else { - _filterList.Clear(); - if (gridView1.ActiveFilter.Count > 0) - { - gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; - gridView1.ActiveFilter.Clear(); - gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; - } - getPageList(1); + //_filterList.Clear(); + //if (gridView1.ActiveFilter.Count > 0) + //{ + // gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + // gridView1.ActiveFilter.Clear(); + // gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + //} + //getPageList(1); + getPageList(this.pageBar1.CurrentPage); } } /// <summary> @@ -212,7 +189,7 @@ (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_sampleSizeNo, gridView1); if (string.IsNullOrEmpty(rowGuid)) { - ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); @@ -220,11 +197,12 @@ { getModel(rowGuid); } - else { + else + { List<GridView> gridViews = new List<GridView>(); gridViews.Add(gvMx1); gridViews.Add(gvMx2); - UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gridViews); + UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gridViews); } } /// <summary> @@ -239,8 +217,8 @@ List<GridView> gridViews = new List<GridView>(); gridViews.Add(gvMx1); gridViews.Add(gvMx2); - UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews); - UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews); + UtilityHelper.SetDefaultTable(gcMx1, gvMx1); UtilityHelper.SetDefaultTable(gcMx2, gvMx2); txt_createDate.Text = DateTime.Now.ToString("G"); txt_fversion.Text = "1"; @@ -255,20 +233,22 @@ toolBarMenu1.isSetBtn = false; if (string.IsNullOrEmpty(txt_sampleSizeNo.Text.Trim())) { - Gs.DevApp.ToolBox.MsgHelper.Warning("鏍囧噯缂栫爜涓嶈兘涓虹┖锛�"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("鏍囧噯缂栫爜涓嶈兘涓虹┖锛�"); txt_sampleSizeNo.Focus(); return; } if (string.IsNullOrEmpty(txt_sampleSizeName.Text.Trim())) { - Gs.DevApp.ToolBox.MsgHelper.Warning("鏍囧噯鍚嶇О涓嶈兘涓虹┖锛�"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("鏍囧噯鍚嶇О涓嶈兘涓虹┖锛�"); txt_sampleSizeName.Focus(); return; } gvMx1.CloseEditor(); + gvMx1.PostEditor(); gvMx1.UpdateCurrentRow(); gvMx2.CloseEditor(); + gvMx2.PostEditor(); gvMx2.UpdateCurrentRow(); try { @@ -277,6 +257,17 @@ { var row = gvMx1.GetDataRow(i); if (row != null) + { + if (string.IsNullOrEmpty(row["LotFrom"].ToString())) + { + MsgHelper.ShowError("鎵归噺寮�濮嬩笉鑳戒负绌猴紒"); + return; + } + if (string.IsNullOrEmpty(row["LotTo"].ToString())) + { + MsgHelper.ShowError("鎵归噺缁撴潫涓嶈兘涓虹┖锛�"); + return; + } qmaql2.Add(new MesQmAql2 { Guid = UtilityHelper.ToGuid(row["Guid"].ToString()), @@ -291,12 +282,24 @@ FlevelIii = row["FlevelIii"].ToString(), Memo = row["Memo"].ToString() }); + } } var qmaql3 = new List<MesQmAql3>(); for (var i = 0; i < gvMx2.DataRowCount; i++) { var row = gvMx2.GetDataRow(i); if (row != null) + { + if (string.IsNullOrEmpty(row["FsampleSizeWord"].ToString())) + { + MsgHelper.ShowError("鏍锋湰澶у皬涓嶈兘涓虹┖锛�"); + return; + } + if (string.IsNullOrEmpty(row["SampleSizeWord"].ToString())) + { + MsgHelper.ShowError("鏍锋湰瀛楃爜涓嶈兘涓虹┖锛�"); + return; + } qmaql3.Add(new MesQmAql3 { Guid = UtilityHelper.ToGuid(row["Guid"].ToString()), @@ -320,15 +323,16 @@ Aql1000 = Convert.ToInt32(row["Aql1000"].ToString()), Memo = row["Memo"].ToString() }); + } } if (qmaql2.Count <= 0) { - Gs.DevApp.ToolBox.MsgHelper.Warning("鏍锋湰閲忓瓙鐮佷笉鑳戒负绌猴紒"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("鏍锋湰閲忓瓙鐮佷笉鑳戒负绌猴紒"); return; } if (qmaql3.Count <= 0) { - Gs.DevApp.ToolBox.MsgHelper.Warning("鎶芥牱鏂规涓嶈兘涓虹┖锛�"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("鎶芥牱鏂规涓嶈兘涓虹┖锛�"); return; } var _obj = new MesQmAql1 @@ -349,20 +353,25 @@ { 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); lbGuid.Text = _rtn.rtnData; toolBarMenu1.isSetBtn = true; List<GridView> gridViews = new List<GridView>(); gridViews.Add(gvMx1); gridViews.Add(gvMx2); - UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gridViews); + UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gridViews); + toolBarMenu1.currentAction = ""; + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); } + else + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } catch (Exception ex) @@ -370,7 +379,7 @@ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } - + } /// <summary> @@ -380,7 +389,7 @@ /// <param name="pageSize">姣忛〉鍑犳潯</param> private void getPageList(int curPage) { - var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try @@ -390,16 +399,15 @@ if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; - gcMain.BindingContext = new BindingContext(); - gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gcMain1.BindingContext = new BindingContext(); if (dt.Rows.Count > 0) { - gcMain.DataSource = dt; - gcMain.ForceInitialize(); + gcMain1.DataSource = dt; + gcMain1.ForceInitialize(); + gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } else - UtilityHelper.SetDefaultTable(gcMain, gridView1); - gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + UtilityHelper.SetDefaultTable(gcMain1, gridView1); pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 @@ -411,9 +419,14 @@ } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } + + /// <summary> + /// 璇诲彇瀹炰綋 + /// </summary> + /// <param name="strGuid"></param> private void getModel(string strGuid) { bool isEdit = false; @@ -421,7 +434,7 @@ if (toolBarMenu1.currentAction == "edit") isEdit = true; if (string.IsNullOrEmpty(strGuid)) { - ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } var _obj = new @@ -439,7 +452,7 @@ List<GridView> gvList = new List<GridView>(); gvList.Add(gvMx1); gvList.Add(gvMx2); - UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList); + UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); JObject _job = JObject.Parse(strJson); JArray array = new JArray(); JArray mesQmAql3s = new JArray(); @@ -453,6 +466,7 @@ gcMx1.BindingContext = new BindingContext(); gcMx1.DataSource = dt; gcMx1.ForceInitialize(); + //gvMx1.BestFitColumns(); } else { @@ -468,6 +482,7 @@ gcMx2.BindingContext = new BindingContext(); gcMx2.DataSource = dt1; gcMx2.ForceInitialize(); + // gvMx2.BestFitColumns(); } else { @@ -475,17 +490,23 @@ } } else - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } + /// <summary> + /// 鍒犻櫎瀛楃爜 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { gvMx1.CloseEditor(); + gvMx1.PostEditor(); gvMx1.UpdateCurrentRow(); var rowhandle = gvMx1.FocusedRowHandle; if (rowhandle < 0) @@ -511,17 +532,25 @@ JsonConvert.SerializeObject(lst)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) getModel(lbGuid.Text); - - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + if (_rtn.rtnCode > 0) + { + MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); + getModel(lbGuid.Text); + } + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } } - + /// <summary> + /// 鍒犻櫎鏂规 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { gvMx2.CloseEditor(); @@ -550,13 +579,16 @@ JsonConvert.SerializeObject(lst)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) getModel(lbGuid.Text); - - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + if (_rtn.rtnCode > 0) + { + getModel(lbGuid.Text); MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); + } + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } } @@ -576,13 +608,14 @@ case 0: strMsg = "鍙嶅鏍�"; break; - }; + } + ; toolBarMenu1.guidKey = ""; string rowGuid, rowName; (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_sampleSizeNo, gridView1, "sampleSizeNo"); if (string.IsNullOrEmpty(rowGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵")) @@ -599,18 +632,23 @@ var strJson = UtilityHelper.HttpPost("", "General/GeneralCheck", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - MsgHelper.Warning(_rtn.rtnData.outMsg.ToString()); if (_rtn.rtnCode > 0) { + MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString()); if (xtraTabControl1.SelectedTabPageIndex == 1) + { getModel(lbGuid.Text.Trim()); - else - getPageList(this.pageBar1.CurrentPage); + } + int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid); + gridView1.FocusedRowHandle = rowHandle; + UtilityHelper.SetCheckIco(gridView1, "foneChecked", "foneCheckor", "foneCheckdate", picCheckBox, this, _inFieldValue.ToString()); } + else + MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString()); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } } -- Gitblit v1.9.3