From 3cf7cd4d37f38a60a65f2a066f6403db9d24e6e0 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期二, 24 十二月 2024 08:50:41 +0800 Subject: [PATCH] 细节 --- DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs | 302 +++++++++++++++++++++++++------------------------- 1 files changed, 151 insertions(+), 151 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs index 72a76f5..6da5873 100644 --- a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs +++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs @@ -3,14 +3,11 @@ using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Gs.DevApp.UserControl; -using MES.Service.Modes; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; -using System.Drawing; -using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -32,28 +29,23 @@ this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; - gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fstatus", "", (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; - Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); - 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); - }; txt_pba013.EditChanged += (s, e) => { string workGuid = this.txt_pba013.GetGuid(); - txt_pba016.getSuppler(workGuid); _getListJybz(workGuid); }; //閫夋嫨闇�瑕佸叆搴撶殑鏄庣粏 @@ -95,26 +87,14 @@ }; frm.ShowDialog(); }; - - } - private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + private void GridView1_ColumnFilterChanged(object sender, EventArgs e) { _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); - await Task.Delay(100); + Task.Delay(100); getPageList(1); } - /// <summary> - /// 鍙屽嚮浜嬩欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e) - { - string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid"); - if (!string.IsNullOrEmpty(rowGuid)) - getModel(rowGuid, false, 999); - } + /// <summary> /// 鍒嗛〉浜嬩欢 /// </summary> @@ -154,45 +134,9 @@ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> - private async void ToolBarMenu1_btnChkClick(object sender, EventArgs e) + private void ToolBarMenu1_btnChkClick(object sender, EventArgs e) { - toolBarMenu1.guidKey = ""; - string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, - lbGuid, txt_hNo, gridView1, "hNo"); - //toolBarMenu1.guidKey = rowGuid; - if (string.IsNullOrEmpty(rowGuid)) - { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); - return; - } - if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾瀹℃牳鍚楋紵")) - return; - UcLoading _loading = new UcLoading(); - var _obj = new - { - guid = rowGuid, - }; - try - { - var strJson = await UtilityHelper.HttpPostAsync("", - _webServiceName + "EditModelSubmit", - 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(), false, 999); - else - getPageList(1); - } - } - catch (Exception ex) - { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - _loading.Stop(); + _toolCk(1, "EditModelSubmit"); } /// <summary> @@ -201,47 +145,9 @@ /// <param name="sender"></param> /// <param name="e"></param> /// <exception cref="NotImplementedException"></exception> - private async void ToolBarMenu1_btnFChkClick(object sender, EventArgs e) + private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e) { - toolBarMenu1.guidKey = ""; - string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, - lbGuid, txt_hNo, gridView1); - // toolBarMenu1.guidKey = rowGuid; - if (string.IsNullOrEmpty(rowGuid)) - { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); - return; - } - //MsgHelper.Warning(rowGuid); - UcLoading _loading = new UcLoading(); - var _obj = new - { - guid = rowGuid, - }; - try - { - var strJson = await UtilityHelper.HttpPostAsync("", - _webServiceName + "DeApprove", - JsonConvert.SerializeObject(_obj)); - var _rtn = UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) - { - if (xtraTabControl1.SelectedTabPageIndex == 1) - getModel(lbGuid.Text.Trim(), false, 999); - else - getPageList(1); - } - else - { - MsgHelper.Warning(_rtn.rtnMsg); - } - } - catch (Exception ex) - { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - _loading.Stop(); + _toolCk(0, "EditModelSubmitFSH"); } /// <summary> @@ -251,7 +157,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> @@ -284,10 +190,11 @@ var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { - UtilityHelper.JumpToTab(xtraTabControl1, 0); - getPageList(1); + if (xtraTabControl1.SelectedTabPageIndex == 0) + getPageList(this.pageBar1.CurrentPage); + else + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2); } - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) @@ -304,7 +211,7 @@ 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(); @@ -331,7 +238,10 @@ ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - getModel(rowGuid, true, 1); + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); + List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gvList.Add(gvMx1); + UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList); } /// <summary> /// 鏂板浜嬩欢 @@ -340,11 +250,9 @@ /// <param name="e"></param> private void ToolBarMenu1_btnAddClick(object sender, EventArgs e) { - UtilityHelper.JumpToTab(xtraTabControl1, 1); lbGuid.Text = ""; - List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); - gridViews.Add(gvMx1); - UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews); + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4); + UtilityHelper.CleanValueByControl(panel1.Controls, true); Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); } /// <summary> @@ -362,26 +270,11 @@ txt_pba013.Focus(); return; } - string lineId = txt_pba016.GetId(); - if (string.IsNullOrEmpty(lineId.Trim())) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨浜х嚎锛�"); - txt_pba016.Focus(); - return; - } - if (string.IsNullOrEmpty(txt_pba015.Text.Trim())) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("璁″垝浜烘暟涓嶈兘涓虹┖锛�"); - txt_pba015.Focus(); - return; - } var _obj = new { guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓 bz = txt_pba009.Text.Trim(), cjId = workId, - cxId = lineId, - jhrs = txt_pba015.Text.Trim(), list = new List<dynamic>(), }; gvMx1.CloseEditor(); @@ -397,23 +290,66 @@ if (row != null) { Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString()); - //string _msl = row["quantity"].ToString(); - //if (string.IsNullOrEmpty(_msl)) + //string _LineId = row["daa015"].ToString(); + //if (string.IsNullOrEmpty(_LineId)) //{ - // MsgHelper.ShowError("鏁伴噺涓嶈兘涓虹┖锛�"); + // MsgHelper.ShowError("浜х嚎缂栫爜涓嶈兘涓虹┖锛�"); + // return; + //} + string _Pcsl = row["daa008"].ToString(); + if (string.IsNullOrEmpty(_Pcsl)) + { + MsgHelper.ShowError("鎺掍骇鏁伴噺涓嶈兘涓虹┖锛�"); + return; + } + string _Yjkgsj = row["mesStartProd"].ToString(); + if (string.IsNullOrEmpty(_Yjkgsj)) + { + 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, AboutGuid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(row["caaGuid"].ToString()), - LineId = int.Parse(row["daa015"].ToString()),//浜х嚎id + LineId = row["daa015"].ToString(),//浜х嚎id Yjkgsj = (row["mesStartProd"].ToString()),//棰勮寮�宸ユ椂闂� Jhrs = row["planPersonnel"].ToString(),//璁″垝浜烘暟 Hxsj = row["changeLinetime"].ToString(),//鎹㈢嚎鏃堕棿 Bz = row["daa009"].ToString(),//澶囨敞 Blsj = row["prepareTime"].ToString(),//棰勮澶囨枡鏃堕棿 - Pcsl = row["daa008"].ToString()//鎺掍骇鏁伴噺 + Pcsl = row["daa008"].ToString(),//鎺掍骇鏁伴噺 + Yjwgsj = row["mesEndProd"].ToString()//棰勮瀹屽伐鏃堕棿 }); } } @@ -426,7 +362,9 @@ { lbGuid.Text = _rtn.rtnData; toolBarMenu1.isSetBtn = true; - UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false); + List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gvList.Add(gvMx1); + UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gvList); } } catch (Exception ex) @@ -440,15 +378,14 @@ /// </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, "create_date", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { - var strReturn = await UtilityHelper.HttpPostAsync("", + var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) @@ -477,16 +414,21 @@ { ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } - _loading.Stop(); + } - private void getModel(string strGuid, bool isEdit, int tabIdx) + private void getModel(string strGuid) { + bool isEdit = false; + if (toolBarMenu1.currentAction == "add") { + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + return; + }; + if (toolBarMenu1.currentAction == "edit") isEdit = true; if (string.IsNullOrEmpty(strGuid)) { ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); var _obj = new { guid = strGuid,//涓诲缓 @@ -558,7 +500,7 @@ var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { - if (_rtn.rtnCode > 0) getModel(lbGuid.Text, true, 1); + if (_rtn.rtnCode > 0) getModel(lbGuid.Text); } MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } @@ -569,6 +511,10 @@ } } + /// <summary> + /// 鏍规嵁杞﹂棿璇讳骇绾� + /// </summary> + /// <param name="workGuid"></param> private void _getListJybz(string workGuid) { if (string.IsNullOrEmpty(workGuid)) @@ -614,5 +560,59 @@ gvMx1.SetRowCellValue(dataIndex, "daa015", _val); } } + + + /// <summary> + /// 宸ュ叿鏉′簨浠� + /// </summary> + /// <param name="inFieldValue"></param> + private void _toolCk(int _inFieldValue,string _mth) + { + string strMsg = ""; + switch (_inFieldValue) + { + case 1: + strMsg = "瀹℃牳"; + break; + case 0: + strMsg = "鍙嶅鏍�"; + break; + }; + toolBarMenu1.guidKey = ""; + string rowGuid, rowName; + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_hNo, gridView1, "hNo"); + if (string.IsNullOrEmpty(rowGuid)) + { + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵")) + return; + var _obj = new + { + guid = rowGuid, + inFieldValue = _inFieldValue, + }; + try + { + var strJson = UtilityHelper.HttpPost("", + _webServiceName + _mth, + 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