From 236874a930147c27e46c673d8c1a607f1260e8aa Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期一, 31 三月 2025 12:43:43 +0800 Subject: [PATCH] 追溯码 --- DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs | 207 +++++++++++++++++++++++++++++++-------------------- 1 files changed, 126 insertions(+), 81 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs index bbd6949..9762696 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Data; -using System.Drawing; using System.Threading.Tasks; using System.Windows.Forms; @@ -28,57 +27,49 @@ this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; - gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - gridView1.FocusedRowChanged += (s, e) => + List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gvList.Add(gridView1); + Gs.DevApp.ToolBox.UtilityHelper.getGridViewConfig(this.GetType().FullName, gvList); + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "status", "", (value) => { - UtilityHelper.SetCheckIco(s, picCheckBox, this, "status", ""); - }; + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); + }); + Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => + { + getModel(value); + }, (value) => + { + getPageList(this.pageBar1.CurrentPage); + }); getPageList(1); - Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); pageBar1.PagerEvent += PageBar1_PagerEvent; - gridView1.CustomDrawRowIndicator += (s, e) => + this.txt_fSubsidiary.EditChanged += (s, e) => { - if (e.Info.IsRowIndicator && e.RowHandle >= 0) - { - e.Info.DisplayText = (e.RowHandle + 1).ToString(); - } + string _orgId = txt_fSubsidiary.GetId(); + if (string.IsNullOrEmpty(_orgId)) + return; + txt_suppId.getSuppler(_orgId); + txt_itemId.getSuppler(_orgId); }; - gridView1.CustomDrawEmptyForeground += (s, e) => - { - string str = "鏆傛湭鏌ユ壘鍒板尮閰嶇殑鏁版嵁!"; - Font f = new Font("寰蒋闆呴粦", 16); - Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); - e.Graphics.DrawString(str, f, Brushes.Gray, r); - }; - _setIno(); - } - private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) - { - _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); - await Task.Delay(100); - getPageList(1); - } - private void _setIno() - { txt_itemId.EditChanged += (s, e) => { - txt_itemNo.Text = this.txt_itemId.GetCode(); - //var ItemId = this.txt_itemId.GetId(); - //var ItemName = this.txt_itemId.GetName(); - //GetCount(ItemId, ItemName); + if (!string.IsNullOrEmpty(this.txt_itemId.GetCode())) + txt_itemNo.Text = this.txt_itemId.GetCode(); + }; + txt_suppId.EditChanged += (s, e) => + { + if (!string.IsNullOrEmpty(this.txt_suppId.GetCode())) + txt_suppNo.Text = this.txt_suppId.GetCode(); }; } - /// <summary> - /// 鍙屽嚮浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e) + private void GridView1_ColumnFilterChanged(object sender, EventArgs e) { - string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid"); - if (!string.IsNullOrEmpty(rowGuid)) - getModel(rowGuid, false, 999); + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); + Task.Delay(100); + getPageList(1); } + + /// <summary> /// 鍒嗛〉浜嬩欢 /// </summary> @@ -98,7 +89,7 @@ gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; gridView1.ActiveFilter.Clear(); gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; - var frm = new ShowFilter(gridView1.Columns, _filterList); + var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } @@ -120,7 +111,7 @@ /// <param name="e"></param> private void ToolBarMenu1_btnEscClick(object sender, EventArgs e) { - UtilityHelper.JumpToTab(xtraTabControl1, 0); + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1); } /// <summary> @@ -148,8 +139,11 @@ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { - UtilityHelper.JumpToTab(xtraTabControl1, 0); - getPageList(1); + if (xtraTabControl1.SelectedTabPageIndex == 0) + { } + else + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2); + getPageList(this.pageBar1.CurrentPage); } ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } @@ -166,19 +160,19 @@ /// <param name="e"></param> private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { - if (xtraTabControl1.SelectedTabPageIndex == 1) - getModel(lbGuid.Text.Trim(), false, 999); + 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> @@ -195,7 +189,8 @@ ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - getModel(rowGuid, true, 1); + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); + UtilityHelper.ChangeEnableByControl(panel1.Controls, true); } /// <summary> /// 鏂板浜嬩欢 @@ -204,16 +199,9 @@ /// <param name="e"></param> private void ToolBarMenu1_btnAddClick(object sender, EventArgs e) { - UtilityHelper.JumpToTab(xtraTabControl1, 1); lbGuid.Text = ""; - UtilityHelper.CleanValueByControl(this.panel1.Controls, true); - txt_createBy.Enabled = false; - txt_createDate.Enabled = false; - txt_lastupdateBy.Enabled = false; - txt_lastupdateDate.Enabled = false; - txt_checkUser.Enabled = false; - txt_checkDate.Enabled = false; - txt_status.Enabled = false; + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4); + UtilityHelper.CleanValueByControl(panel1.Controls, true); } /// <summary> /// 淇濆瓨浜嬩欢 @@ -225,6 +213,13 @@ toolBarMenu1.isSetBtn = false; string _ItemId = txt_itemId.GetId(); string _suppNo = txt_suppId.GetId(); + string _orgId = txt_fSubsidiary.GetId(); + //if (string.IsNullOrEmpty(_orgId)) + //{ + // Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨缁勭粐锛�"); + // txt_OrgName.Focus(); + // return; + //} if (string.IsNullOrEmpty(_ItemId)) { Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨鐗╂枡锛�"); @@ -267,15 +262,15 @@ /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private async void getPageList(int curPage) + private void getPageList(int curPage) { - UcLoading _loading = new UcLoading(); var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); - PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.create_date", "asc", "", _sbSqlWhere.ToString()); + _sbSqlWhere += " and b.guid is not null"; + PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "org.FNumber asc ,b.ITEM_NO", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { - var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); + var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { @@ -286,6 +281,7 @@ { gcMain.DataSource = dt; gcMain.ForceInitialize(); + gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } else UtilityHelper.SetDefaultTable(gcMain, gridView1); @@ -303,7 +299,7 @@ { ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } - _loading.Stop(); + } /// <summary> /// @@ -311,14 +307,16 @@ /// <param name="strGuid">涓婚敭</param> /// <param name="isEdit">鏄惁鍙紪杈�</param> /// <param name="tabIdx">閫夐」鍗″簭鍙�</param> - private void getModel(string strGuid, bool isEdit, int tabIdx) + private void getModel(string strGuid) { + bool isEdit = false; + if (toolBarMenu1.currentAction == "add") return; + if (toolBarMenu1.currentAction == "edit") isEdit = true; if (string.IsNullOrEmpty(strGuid)) { ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); var _obj = new { guid = strGuid,//涓诲缓 @@ -332,7 +330,6 @@ dynamic dy = _rtn.rtnData; lbGuid.Text = strGuid; UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit); - } else ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); @@ -352,11 +349,7 @@ /// <exception cref="NotImplementedException"></exception> private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e) { - toolBarMenu1.guidKey = ""; - string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, - lbGuid, txt_itemNo, gridView1); - toolBarMenu1.guidKey = rowGuid; + _toolCk(0); } /// <summary> @@ -366,11 +359,63 @@ /// <param name="e"></param> private void ToolBarMenu1_btnChkClick(object sender, EventArgs e) { + _toolCk(1); + } + + /// <summary> + /// 宸ュ叿鏉′簨浠� + /// </summary> + /// <param name="inFieldValue"></param> + private void _toolCk(int _inFieldValue) + { + string strMsg = ""; + switch (_inFieldValue) + { + case 1: + strMsg = "瀹℃牳"; + break; + case 0: + strMsg = "鍙嶅鏍�"; + break; + }; toolBarMenu1.guidKey = ""; string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, - lbGuid, txt_itemNo, gridView1); - toolBarMenu1.guidKey = rowGuid; + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_itemNo, gridView1, "itemName"); + if (string.IsNullOrEmpty(rowGuid)) + { + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵")) + return; + + var _obj = new + { + guid = rowGuid, + ckValue = _inFieldValue, + parameter = "MES_QA_MJ,CHECK_DATE,STATUS,CHECK_USER" + }; + try + { + var strJson = UtilityHelper.HttpPost("", "General/GeneralCheck", + JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + MsgHelper.Warning(_rtn.rtnData.outMsg.ToString()); + if (_rtn.rtnCode > 0) + { + if (xtraTabControl1.SelectedTabPageIndex == 1) + getModel(lbGuid.Text.Trim()); + else + getPageList(this.pageBar1.CurrentPage); + UtilityHelper.SetCheckIco(gridView1, "status", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString()); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } } + + } } \ No newline at end of file -- Gitblit v1.9.3