From d35bb711f8d3d267b44b4a80c20e31dabf309ae7 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期二, 14 一月 2025 08:17:18 +0800 Subject: [PATCH] 其它入库 --- DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs | 209 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 129 insertions(+), 80 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs index f10e068..535bc2f 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs @@ -1,11 +1,13 @@ using Gs.DevApp.DevFrm.QC.Models; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; +using Gs.DevApp.UserControl; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Drawing; +using System.Threading.Tasks; using System.Windows.Forms; namespace Gs.DevApp.DevFrm.QC @@ -24,49 +26,39 @@ this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1; this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; - toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; - - gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - getPageList(1, UtilityHelper.GetPageSize()); + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "status", "", (value) => + { + 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); pageBar1.PagerEvent += PageBar1_PagerEvent; - gridView1.CustomDrawRowIndicator += (s, e) => - { - if (e.Info.IsRowIndicator && e.RowHandle >= 0) - { - e.Info.DisplayText = (e.RowHandle + 1).ToString(); - } - }; - 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 void _setIno() - { - this.txt_itemId.KeyFile = "id"; - this.txt_suppNo.KeyFile = "suppNo"; txt_itemId.EditChanged += (s, e) => { txt_itemNo.Text = this.txt_itemId.GetCode(); }; + txt_suppId.getSuppler(""); + txt_suppId.EditChanged += (s, e) => + { + txtGysNo.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); + Task.Delay(100); + getPageList(1); } + + /// <summary> /// 鍒嗛〉浜嬩欢 /// </summary> @@ -74,7 +66,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> /// 鏌ヨ浜嬩欢 @@ -83,7 +75,10 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { - Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } @@ -95,7 +90,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> @@ -105,7 +100,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> @@ -134,7 +129,7 @@ if (_rtn.rtnCode > 0) { UtilityHelper.JumpToTab(xtraTabControl1, 0); - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); } ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } @@ -151,8 +146,19 @@ /// <param name="e"></param> private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { - UtilityHelper.JumpToTab(xtraTabControl1, 0); - getPageList(1, UtilityHelper.GetPageSize()); + if (xtraTabControl1.SelectedTabPageIndex == 1) + 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); + } } /// <summary> /// 淇敼浜嬩欢 @@ -168,7 +174,8 @@ ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - getModel(rowGuid, true, 1); + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); + UtilityHelper.ChangeEnableByControl(panel1.Controls, true); } /// <summary> /// 鏂板浜嬩欢 @@ -177,18 +184,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> /// 淇濆瓨浜嬩欢 @@ -199,7 +197,7 @@ { toolBarMenu1.isSetBtn = false; string _ItemId = txt_itemId.GetId(); - string _suppNo = txt_suppNo.GetCode(); + string _suppNo = txt_suppId.GetId(); if (string.IsNullOrEmpty(_ItemId)) { Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨鐗╂枡锛�"); @@ -209,7 +207,7 @@ if (string.IsNullOrEmpty(_suppNo)) { Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨渚涘簲鍟嗭紒"); - txt_suppNo.Focus(); + txt_suppId.Focus(); return; } var _obj = new MesQaMj @@ -217,7 +215,7 @@ Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓 ItemId = Convert.ToInt32(_ItemId), ItemNo = txt_itemId.GetCode(), - SuppNo= _suppNo, + SuppId = _suppNo, }; try { @@ -242,31 +240,32 @@ /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private void getPageList(int curPage) { - System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); - foreach (FilterEntity itm in _filterList) - { - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); - } - PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString()); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + _sbSqlWhere += " and b.guid is not null"; + PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.create_date", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { - string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); + var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -277,6 +276,7 @@ { ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + } /// <summary> /// @@ -284,14 +284,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,//涓诲缓 @@ -325,11 +327,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> @@ -339,11 +337,62 @@ /// <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); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } } + + } } \ No newline at end of file -- Gitblit v1.9.3