From b2db1fbcea11f4dbdbca91f4ebe72e916fb509f2 Mon Sep 17 00:00:00 2001 From: lu <123456> Date: 星期一, 21 七月 2025 16:28:10 +0800 Subject: [PATCH] 增加按钮 --- DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs | 152 ++++++++++++++++++++++++++------------------------ 1 files changed, 79 insertions(+), 73 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs index 9ebbcf0..c9940e3 100644 --- a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs +++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs @@ -30,22 +30,20 @@ this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; - List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); - gvList.Add(gridView1); - gvList.Add(gvMx1); - Gs.DevApp.ToolBox.UtilityHelper.getGridViewConfig(this.GetType().FullName, gvList); + toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick; + this.toolBarMenu1.getXmlConfig(); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fstatus", "", (value) => { 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; //閫夊瓨缁勭粐锛堝彉鏄庣粏涓殑鐗╂枡鍜岃溅闂达級 @@ -92,12 +90,16 @@ } gcMx1.BindingContext = new BindingContext(); gcMx1.DataSource = _oldTable; + gvMx1.CloseEditor(); + gvMx1.PostEditor(); + gvMx1.UpdateCurrentRow(); gcMx1.ForceInitialize(); gvMx1.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); } catch (Exception ex) { - MessageBox.Show(ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } }; frm.ShowDialog(); @@ -105,7 +107,7 @@ } private void GridView1_ColumnFilterChanged(object sender, EventArgs e) { - Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); Task.Delay(100); getPageList(1); } @@ -129,11 +131,11 @@ 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(); } - + /// <summary> /// 鏌ヨ鍥炶皟 /// </summary> @@ -144,7 +146,19 @@ _filterList = e.FilterList; getPageList(1); } - + /// <summary> + /// 鏃ュ織 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnLogClick(object sender, EventArgs e) + { + toolBarMenu1.guidKey = ""; + string rowGuid, rowName; + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, + lbGuid, txt_hNo, gridView1); + toolBarMenu1.guidKey = rowGuid; + } /// <summary> /// 鍙栨秷浜嬩欢 /// </summary> @@ -185,17 +199,19 @@ var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { + MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); if (xtraTabControl1.SelectedTabPageIndex == 0) { } else Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2); getPageList(this.pageBar1.CurrentPage); } - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } /// <summary> @@ -254,7 +270,7 @@ lbGuid, txt_hNo, gridView1); if (string.IsNullOrEmpty(rowGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); @@ -266,8 +282,10 @@ { List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); gvList.Add(gvMx1); - UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList); + UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList); } + //2025/07/12鍔犱笂淇敼鐘舵�佷笅涓嶈兘淇敼 + txt_erpSczz.IsReadly = true; } /// <summary> /// 鏂板浜嬩欢 @@ -280,8 +298,10 @@ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4); List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); gridViews.Add(gvMx1); - UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews); + UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews); Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + //澧炲姞鏃讹紝榛樿缁勭粐 + string deftOrg = UtilityHelper.GetFirstOrg(txt_erpSczz); } /// <summary> /// 淇濆瓨浜嬩欢 @@ -294,7 +314,7 @@ string workId = txt_pba013.GetId(); if (string.IsNullOrEmpty(workId.Trim())) { - Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨杞﹂棿锛�"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨杞﹂棿锛�"); txt_pba013.Focus(); return; } @@ -306,10 +326,11 @@ list = new List<dynamic>(), }; gvMx1.CloseEditor(); + gvMx1.PostEditor(); gvMx1.UpdateCurrentRow(); if (gvMx1.DataRowCount <= 0) { - MsgHelper.ShowError("鏄庣粏涓嶈兘涓虹┖锛岃閫夋嫨浣犵殑鏀舵枡鏄庣粏锛�"); + MsgHelper.ShowError("鏄庣粏涓嶈兘涓虹┖锛岃閫夋嫨鏄庣粏锛�"); return; } for (var i = 0; i < gvMx1.DataRowCount; i++) @@ -318,16 +339,15 @@ if (row != null) { Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString()); - //string _LineId = row["daa015"].ToString(); - //if (string.IsNullOrEmpty(_LineId)) - //{ - // MsgHelper.ShowError("浜х嚎缂栫爜涓嶈兘涓虹┖锛�"); - // return; - //} - string _Pcsl = row["daa008"].ToString(); - if (string.IsNullOrEmpty(_Pcsl)) + string _LineId = row["daa015"].ToString(); + if (string.IsNullOrEmpty(_LineId)) { - MsgHelper.ShowError("鎺掍骇鏁伴噺涓嶈兘涓虹┖锛�"); + MsgHelper.ShowError("绾垮埆涓嶈兘涓虹┖锛�"); + return; + } + if (Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(row["daa008"].ToString()) <= 0) + { + MsgHelper.ShowError("璇疯緭鍏ユ纭殑鎺掍骇鏁伴噺锛�"); return; } string _Yjkgsj = row["mesStartProd"].ToString(); @@ -336,36 +356,12 @@ MsgHelper.ShowError("棰勮寮�宸ユ椂闂翠笉鑳戒负绌猴紒"); return; } - //string _prepareTime = row["prepareTime"].ToString(); - //if (string.IsNullOrEmpty(_prepareTime)) - //{ - // MsgHelper.ShowError("棰勮澶囨枡鏃堕棿涓嶈兘涓虹┖锛�"); - // return; - //} - //string _planPersonnel = row["planPersonnel"].ToString(); - //if (string.IsNullOrEmpty(_planPersonnel)) - //{ - // MsgHelper.ShowError("璁″垝浜烘暟锛�"); - // return; - //} - //string _changeLinetime = row["changeLinetime"].ToString(); - //if (string.IsNullOrEmpty(_changeLinetime)) - //{ - // MsgHelper.ShowError("鎹㈢嚎鏃堕棿涓嶈兘涓虹┖锛�"); - // return; - //} string _mesEndProd = row["mesEndProd"].ToString(); if (string.IsNullOrEmpty(_mesEndProd)) { MsgHelper.ShowError("棰勮瀹屽伐鏃堕棿涓嶈兘涓虹┖锛�"); return; } - //string _restTime = row["restTime"].ToString(); - //if (string.IsNullOrEmpty(_prepareTime)) - //{ - // MsgHelper.ShowError("浼戞伅鏃堕棿涓嶈兘涓虹┖锛�"); - // return; - //} _obj.list.Add(new { Guid = _guid, @@ -385,21 +381,24 @@ { 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.outGuid; txt_hNo.Text = _rtn.rtnData.outNo; toolBarMenu1.isSetBtn = true; List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); gvList.Add(gvMx1); - UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gvList); + UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList); 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); } } @@ -410,7 +409,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 @@ -421,16 +420,16 @@ 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(); - gridView1.BestFitColumns(); + 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;//褰撳墠椤� @@ -443,7 +442,7 @@ } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -454,7 +453,7 @@ if (toolBarMenu1.currentAction == "edit") isEdit = true; if (string.IsNullOrEmpty(strGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } var _obj = new @@ -472,7 +471,7 @@ lbGuid.Text = strGuid; List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); gvList.Add(gvMx1); - UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList); + UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); _cjBm = ""; JObject _job = JObject.Parse(strJson); JArray array = new JArray(); @@ -487,6 +486,7 @@ gcMx1.DataSource = dt; gcMx1.ForceInitialize(); gvMx1.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); } else { @@ -494,11 +494,11 @@ } } else - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) @@ -530,13 +530,15 @@ var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { - if (_rtn.rtnCode > 0) getModel(lbGuid.Text); + MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); + getModel(lbGuid.Text); } - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } } @@ -565,7 +567,7 @@ } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } private void rptJYBZ_SelectedIndexChanged(object sender, EventArgs e) @@ -579,6 +581,7 @@ string _val = _itm.Value.ToString(); string _txt = _itm.Text.ToString(); gvMx1.CloseEditor(); + gvMx1.PostEditor(); gvMx1.UpdateCurrentRow(); gvMx1.SetRowCellValue(dataIndex, "daa015LineName", _txt); gvMx1.SetRowCellValue(dataIndex, "daa015", _val); @@ -600,7 +603,8 @@ case 0: strMsg = "鍙嶅鏍�"; break; - }; + } + ; toolBarMenu1.guidKey = ""; string rowGuid, rowName; (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_hNo, gridView1, "hNo"); @@ -618,11 +622,11 @@ }; try { - var strJson = UtilityHelper.HttpPost("", _webServiceName + _mth,JsonConvert.SerializeObject(_obj)); + var strJson = UtilityHelper.HttpPost("", _webServiceName + _mth, JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - MsgHelper.Warning(_rtn.rtnData.outMsg.ToString()); if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) { + MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString()); if (xtraTabControl1.SelectedTabPageIndex == 1) { getModel(lbGuid.Text.Trim()); @@ -631,10 +635,12 @@ gridView1.FocusedRowHandle = rowHandle; UtilityHelper.SetCheckIco(gridView1, "fstatus", "checkUser", "checkDate", 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