From ecb7a60de1639f520712ce95f99414b0dd2c9713 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期一, 14 四月 2025 08:30:40 +0800 Subject: [PATCH] 自动打印 --- DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs | 227 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 138 insertions(+), 89 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs index 2b46c9a..97c2959 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,59 +27,47 @@ this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; - gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - gridView1.FocusedRowChanged += (s, e) => + this.toolBarMenu1.getXmlConfig(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "status", "", (value) => { - UtilityHelper.SetCheckIco(s, picCheckBox, this, "status", ""); - }; + 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); - 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() - { - this.txt_itemId.KeyFile = "id"; - this.txt_suppId.KeyFile = "id"; 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> @@ -100,7 +87,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(); } @@ -122,7 +109,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> @@ -150,8 +137,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); } @@ -168,19 +158,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> @@ -197,7 +187,16 @@ ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - getModel(rowGuid, true, 1); + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); + if (xtraTabControl1.SelectedTabPageIndex == 1) + { + getModel(rowGuid); + } + else + { + UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true); + } + } /// <summary> /// 鏂板浜嬩欢 @@ -206,16 +205,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(this.layoutMx1.Controls, true); } /// <summary> /// 淇濆瓨浜嬩欢 @@ -227,6 +219,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("璇烽�夋嫨鐗╂枡锛�"); @@ -255,7 +254,9 @@ { lbGuid.Text = _rtn.rtnData; toolBarMenu1.isSetBtn = true; - UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false); + UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false); + toolBarMenu1.currentAction = ""; + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); } } catch (Exception ex) @@ -269,28 +270,29 @@ /// </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) { DataTable dt = dd.rtnData.list; - gcMain.BindingContext = new BindingContext(); + gcMain1.BindingContext = new BindingContext(); gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; 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); + UtilityHelper.SetDefaultTable(gcMain1, gridView1); gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� @@ -305,7 +307,7 @@ { ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } - _loading.Stop(); + } /// <summary> /// @@ -313,14 +315,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,//涓诲缓 @@ -333,8 +337,7 @@ { dynamic dy = _rtn.rtnData; lbGuid.Text = strGuid; - UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit); - + UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit); } else ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); @@ -354,11 +357,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> @@ -368,11 +367,61 @@ /// <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