From f23d33d0cf77a73d449cd7c38effda9e50c8fda4 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期四, 06 三月 2025 08:13:37 +0800 Subject: [PATCH] 版面 --- DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs | 326 ++++++++++++++++++++++++++++++++++------------------- 1 files changed, 209 insertions(+), 117 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs index a253ac4..cd64688 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs @@ -31,33 +31,51 @@ toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick; - gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1, picCheckBox, this, "foneChecked", ""); - Gs.DevApp.ToolBox.UtilityHelper.SetGridSearMx(gvMx1); + 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.SetGridViewParameterMx(gvMx1); + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "foneChecked", "", (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; _setIno(); + btnSelect.Click += (s, e) => + { + var frm = new SelectCheckDt("jyxm"); + frm.UpdateParent += (ss, ee) => + { + var lst = ee.DynamicList; + var json = JsonConvert.SerializeObject(lst); + DataTable _newTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable))); + DataTable _oldTable = (DataTable)gridControl2.DataSource; + DataRow[] sourceRows = _newTable.Select(); + for (int i = 0; i < sourceRows.Length; i++) + { + _oldTable.ImportRow(sourceRows[i]); + } + gridControl2.BindingContext = new BindingContext(); + gridControl2.DataSource = _oldTable; + gridControl2.ForceInitialize(); + }; + frm.ShowDialog(); + }; btnSave.Click += BtnSave_Click; } - private void GridView1_ColumnFilterChanged(object sender, EventArgs e) { - _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); Task.Delay(100); getPageList(1); - } - /// <summary> - /// 鍙屽嚮浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e) - { - var rowGuid = - UtilityHelper.GetCurrentDoubleRow(gridView1, - e, "guid"); - if (!string.IsNullOrEmpty(rowGuid)) - getModel(rowGuid, false, 999); } /// <summary> @@ -142,17 +160,18 @@ 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); } } @@ -170,8 +189,18 @@ MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - getModel(rowGuid, true, 1); - + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); + if (xtraTabControl1.SelectedTabPageIndex == 1) + { + getModel(rowGuid); + } + else + { + List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gvList.Add(gvMx1); + gvList.Add(gridView2); + UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList); + } } /// <summary> @@ -181,13 +210,12 @@ /// <param name="e"></param> private void ToolBarMenu1_btnAddClick(object sender, EventArgs e) { - UtilityHelper.JumpToTab(xtraTabControl1, 1); lbGuid.Text = ""; - var gridViews = - new List<GridView>(); + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4); + var gridViews = new List<GridView>(); gridViews.Add(gvMx1); - UtilityHelper.CleanValueByControl(panel1.Controls, true, - gridViews); + gridViews.Add(gridView2); + UtilityHelper.CleanValueByControl(panel1.Controls, true, gridViews); UtilityHelper.SetDefaultTable(gcMx1, gvMx1); xtraTabPageCopy.PageEnabled = false; } @@ -200,68 +228,141 @@ private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) { toolBarMenu1.isSetBtn = false; - string _ItemId = txt_ItemId.GetId(); + string _ItemId = txt_itemId.GetId(); if (string.IsNullOrEmpty(_ItemId)) { MsgHelper.Warning("璇烽�夋嫨鐗╂枡锛�"); - txt_ItemId.Focus(); + txt_itemId.Focus(); return; } gvMx1.CloseEditor(); gvMx1.UpdateCurrentRow(); - var lst = new List<MesQmCheckitemDt>(); - for (var i = 0; i < gvMx1.DataRowCount; i++) + if (gvMx1.DataRowCount <= 0) { - var row = gvMx1.GetDataRow(i); - if (row != null) - lst.Add(new MesQmCheckitemDt - { - Guid = UtilityHelper.ToGuid(row["guid"].ToString()), - Forder = 1, - FcheckItem = row["FcheckItem"].ToString(), - SampleSizeNo = row["SampleSizeNo"].ToString(), - FcheckTool = row["FcheckTool"].ToString(), - FcheckLevel = row["FcheckLevel"].ToString(), - Fstand = row["Fstand"].ToString(), - FacLevel = row["FacLevel"].ToString(), - FspecRequ = row["FspecRequ"].ToString(), - Memo = row["memo"].ToString(), - FupAllow = row["FupAllow"].ToString(), - FdownAllow = row["FdownAllow"].ToString(), - }); + MsgHelper.Warning("椤圭洰鏄庣粏涓嶈兘涓虹┖锛�"); + return; } - var _obj = new MesQmCheckitem - { - Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), - ItemId = long.Parse(_ItemId), - Memo = txt_memo.Text.Trim(), - ItemNo = txt_itemNo.Text.Trim(), - Ftype = "1", - Fversion = Gs.DevApp.ToolBox.UtilityHelper.ToLong(txt_fversion.Text.Trim()), - list = lst - }; try { - var strJson = UtilityHelper.HttpPost("", - _webServiceName + "EditModel", - JsonConvert.SerializeObject(_obj)); - var _rtn = - UtilityHelper.ReturnToDynamic(strJson); - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - if (_rtn.rtnCode > 0) + var lst = new List<MesQmCheckitemDt>(); + for (var i = 0; i < gvMx1.DataRowCount; i++) { - lbGuid.Text = _rtn.rtnData; - toolBarMenu1.isSetBtn = true; - var gridViews = new List<GridView>(); - gridViews.Add(gvMx1); - UtilityHelper.ChangeEnableByControl(panel1.Controls, false, - gridViews); + var row = gvMx1.GetDataRow(i); + if (row != null) + { + if (string.IsNullOrEmpty(row["forder"].ToString())) + { + MsgHelper.ShowError("椤哄簭涓嶈兘涓虹┖锛�"); + return; + } + if (string.IsNullOrEmpty(row["FcheckItem"].ToString())) + { + MsgHelper.ShowError("妫�楠岄」鐩笉鑳戒负绌猴紒"); + return; + } + if (string.IsNullOrEmpty(row["FcheckTool"].ToString())) + { + MsgHelper.ShowError("妫�楠屽伐鍏蜂笉鑳戒负绌猴紒"); + return; + } + if (string.IsNullOrEmpty(row["SampleSizeNo"].ToString())) + { + MsgHelper.ShowError("妫�楠屾爣鍑嗕笉鑳戒负绌猴紒"); + return; + } + if (string.IsNullOrEmpty(row["FcheckLevel"].ToString())) + { + MsgHelper.ShowError("妫�楠屾按骞充笉鑳戒负绌猴紒"); + return; + } + if (string.IsNullOrEmpty(row["FacLevel"].ToString())) + { + MsgHelper.ShowError("鎺ュ彈姘村钩涓嶈兘涓虹┖锛�"); + return; + } + string _Fstand = row["Fstand"].ToString(); + string _FupAllow = row["FupAllow"].ToString(); + string _FdownAllow = row["FdownAllow"].ToString(); + //鍋囧涓変釜閮戒负绌洪�氳繃 + if (string.IsNullOrEmpty(_Fstand) && string.IsNullOrEmpty(_FupAllow) && string.IsNullOrEmpty(_FdownAllow)) + { + + } + else + { + if (!string.IsNullOrEmpty(_Fstand) && !string.IsNullOrEmpty(_FupAllow) && !string.IsNullOrEmpty(_FdownAllow)) + { + decimal _Fstand_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_Fstand); + decimal _FupAllow_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_FupAllow); + decimal _FdownAllow_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_FdownAllow); + if (_Fstand_f >= _FdownAllow_f && _Fstand_f <= _FupAllow_f) { } + else + { + MsgHelper.ShowError("鏍囧噯鍊煎繀椤诲湪涓婇檺鍜屼笅闄愪箣闂达紒"); + return; + } + } + else + { + MsgHelper.ShowError("璇峰~鍐欐纭殑涓婇檺锛屾爣鍑嗗�硷紝涓嬮檺锛�"); + return; + } + } + lst.Add(new MesQmCheckitemDt + { + Guid = UtilityHelper.ToGuid(row["guid"].ToString()), + Forder = int.Parse(row["forder"].ToString()), + FcheckItem = row["FcheckItem"].ToString(), + SampleSizeNo = row["SampleSizeNo"].ToString(), + FcheckTool = row["FcheckTool"].ToString(), + FcheckLevel = row["FcheckLevel"].ToString(), + Fstand = row["Fstand"].ToString(), + FacLevel = row["FacLevel"].ToString(), + FspecRequ = row["FspecRequ"].ToString(), + Memo = row["memo"].ToString(), + FupAllow = row["FupAllow"].ToString(), + FdownAllow = row["FdownAllow"].ToString(), + }); + } + } + var _obj = new MesQmCheckitem + { + Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), + ItemId = long.Parse(_ItemId), + Memo = txt_memo.Text.Trim(), + ItemNo = txt_itemNo.Text.Trim(), + Ftype = "1", + Fversion = Gs.DevApp.ToolBox.UtilityHelper.ToLong(txt_fversion.Text.Trim()), + list = lst + }; + try + { + var strJson = UtilityHelper.HttpPost("", + _webServiceName + "EditModel", + JsonConvert.SerializeObject(_obj)); + var _rtn = + UtilityHelper.ReturnToDynamic(strJson); + MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + if (_rtn.rtnCode > 0) + { + lbGuid.Text = _rtn.rtnData; + toolBarMenu1.isSetBtn = true; + var gridViews = new List<GridView>(); + gridViews.Add(gvMx1); + gridViews.Add(gridView2); + UtilityHelper.ChangeEnableByControl(panel1.Controls, false, gridViews); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } + } /// <summary> @@ -271,8 +372,9 @@ private void getPageList(int curPage) { var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + _sbSqlWhere += " and b.guid is not null"; var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, - "a.create_date", "asc", "", _sbSqlWhere.ToString()); + "org.FNumber asc ,b.item_no asc,a.FVERSION desc", "", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { @@ -289,6 +391,7 @@ { gcMain.DataSource = dt; gcMain.ForceInitialize(); + gridView1.BestFitColumns(); } else UtilityHelper.SetDefaultTable(gcMain, gridView1); @@ -306,17 +409,18 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } - } - 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)) { MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); xtraTabPageCopy.PageEnabled = !isEdit; var _obj = new { @@ -325,7 +429,6 @@ try { var strJson = UtilityHelper.HttpPost("", - // _webServiceName + "GetModelIQC", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); var _rtn = @@ -350,14 +453,13 @@ gcMx1.BindingContext = new BindingContext(); gcMx1.DataSource = dt; gcMx1.ForceInitialize(); + gvMx1.BestFitColumns(); } else { - UtilityHelper.SetDefaultTable(gcMx1, - gvMx1); + UtilityHelper.SetDefaultTable(gcMx1, gvMx1); } - UtilityHelper.SetDefaultTable(gridControl2, - gridView2); + UtilityHelper.SetDefaultTable(gridControl2, gridView2); } else { @@ -399,7 +501,6 @@ } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵")) return; - var _obj = new { guid = rowGuid, @@ -415,46 +516,38 @@ if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) { if (xtraTabControl1.SelectedTabPageIndex == 1) - getModel(lbGuid.Text.Trim(), false, 999); - else - getPageList(1); + { + getModel(lbGuid.Text.Trim()); + } + int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid); + gridView1.FocusedRowHandle = rowHandle; + UtilityHelper.SetCheckIco(gridView1, "foneChecked", "foneCheckor", "foneCheckdate", picCheckBox, this, _inFieldValue.ToString()); } } catch (Exception ex) { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } - } - #region 浠ヤ笅涓虹绉嶄笅鎷� private void _setIno() { - txt_ItemId.EditChanged += (s, e) => + this.txt_fSubsidiary.EditChanged += (s, e) => { - txt_itemModel.Text = this.txt_ItemId.GetModel(); - txt_itemNo.Text = this.txt_ItemId.GetCode(); + string _orgId = txt_fSubsidiary.GetId(); + if (string.IsNullOrEmpty(_orgId)) + return; + txt_itemId.getSuppler(_orgId); + //txt_gg.Text =""; + //txt_itemNo.Text = ""; }; - btnSelect.Click += (s, e) => + txt_itemId.EditChanged += (s, e) => { - var frm = new SelectCheckDt(); - frm.UpdateParent += (ss, ee) => - { - var lst = ee.DynamicList; - var json = JsonConvert.SerializeObject(lst); - DataTable _newTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable))); - DataTable _oldTable = (DataTable)gridControl2.DataSource; - DataRow[] sourceRows = _newTable.Select(); - for (int i = 0; i < sourceRows.Length; i++) - { - _oldTable.ImportRow(sourceRows[i]); - } - gridControl2.BindingContext = new BindingContext(); - gridControl2.DataSource = _oldTable; - gridControl2.ForceInitialize(); - }; - frm.ShowDialog(); + if (!string.IsNullOrEmpty(this.txt_itemId.GetModel())) + txt_gg.Text = this.txt_itemId.GetModel(); + if (!string.IsNullOrEmpty(this.txt_itemId.GetCode())) + txt_itemNo.Text = this.txt_itemId.GetCode(); }; _getListJyxm(); _getListJygj(); @@ -619,7 +712,7 @@ _webServiceName + "DeleteModelMx", JsonConvert.SerializeObject(lst)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) getModel(lbGuid.Text, true, 1); + if (_rtn.rtnCode > 0) getModel(lbGuid.Text); MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) @@ -696,6 +789,5 @@ MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } - } } \ No newline at end of file -- Gitblit v1.9.3