From d926c24ea66c8c5f4e3f6a90092a3b91f89b2ae1 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 25 十月 2024 09:42:00 +0800 Subject: [PATCH] 修改分页 --- DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs | 239 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 157 insertions(+), 82 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs b/DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs index d8bdca8..2356000 100644 --- a/DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs +++ b/DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs @@ -2,6 +2,7 @@ using DevExpress.Utils.DirectXPaint; using DevExpress.XtraBars; using DevExpress.XtraLayout.Customization; +using DevExpress.XtraReports.Design; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; @@ -78,6 +79,16 @@ /// </summary> public event EventHandler btnFChkClick; + + /// <summary> + /// 妫�楠� + /// </summary> + public event EventHandler btnJianYanClick; + /// <summary> + /// 鍙嶆楠� + /// </summary> + public event EventHandler btnFjianYanClick; + #endregion #region 鍏叡灞炴�� @@ -96,22 +107,22 @@ public List<string> actions { get; } /// <summary> - /// 鎶ヨ〃绫诲瀷锛屽湪鏁版嵁搴撲腑瑕佸敮涓�锛屽惁鍒欎細淇濆瓨涓嶄簡鎶ヨ〃璁捐 + /// 鎶ヨ〃锛屽湪鏁版嵁搴撲腑瑕佸敮涓�,濡傦細瀛樺偍杩囩▼鍚峽鍏ュ弬1鍚峾鍏ュ弬鍊�,鍏ュ弬2鍚峾鍏ュ弬鍊紏 /// </summary> - public string rptService { get; set; } + public string rptParameter { get; set; } /// <summary> - /// 瀵煎嚭鏈嶅姟鍚� + /// 瀵煎嚭锛岃鍥惧悕,濡傦細瑙嗗浘鍚峽鍏ュ弬1鍚峾鍏ュ弬鍊�,鍏ュ弬2鍚峾鍏ュ弬鍊紏 /// </summary> - public string xlsOutView { get; set; } + public string xlsOutParameter { get; set; } /// <summary> - /// 瀵煎叆鏈嶅姟鍚� + /// 瀵煎叆 /// </summary> public string xlsInService { get; set; } /// <summary> - /// 瀹℃牳鍙傛暟,褰㈠锛歁ES_HOLIDAY,check_date,check_status,check_by + /// 瀹℃牳鍙傛暟,琛ㄥ悕,瀛楁鍚嶏紝濡傦細MES_HOLIDAY,check_date,check_status,check_by /// </summary> public string chkParameter { get; set; } #endregion @@ -135,6 +146,8 @@ this.btnIn.ItemClick += BtnIn_ItemClick; this.btnChk.ItemClick += BtnChk_ItemClick; this.btnFchk.ItemClick += BtnFchk_ItemClick; + this.btnJianYan.ItemClick += BtnJianYan_ItemClick; + this.btnFjianYan.ItemClick += BtnFjianYan_ItemClick; List<string> lst = new List<string>(); foreach (BarItem item in barManager1.Items) { @@ -146,6 +159,7 @@ } this.actions = lst; } + /// <summary> /// 鍒濆鍖栨寜閽姸鎬� @@ -179,24 +193,8 @@ } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜�1鏉℃暟鎹紝纭畾鍙嶅鏍稿悧锛�")) return; - var _obj = new - { - guid = this.guidKey, - parameter = this.chkParameter - }; - string strJson = UtilityHelper.HttpPost("", "General/GeneralFCheck", JsonConvert.SerializeObject(_obj)); - ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnData["outMsg"].ToString()); - } - else - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - } + _ckService(0.ToString()); } - - private void BtnChk_ItemClick(object sender, ItemClickEventArgs e) { if (btnChkClick != null) @@ -218,22 +216,62 @@ } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜�1鏉℃暟鎹紝纭畾瀹℃牳鍚楋紵")) return; + _ckService(1.ToString()); + } + + private void BtnFjianYan_ItemClick(object sender, ItemClickEventArgs e) + { + if (btnFjianYanClick != null) + { + btnFjianYanClick(this, e); + } + else + return; + + if (string.IsNullOrEmpty(this.guidKey)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (string.IsNullOrEmpty(this.chkParameter)) + { + ToolBox.MsgHelper.ShowError("娌℃湁鎸囧畾妫�楠屽弬鏁帮紝璇疯仈绯诲紑鍙戜汉鍛樿幏鍙栨敮鎸侊紒"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜�1鏉℃暟鎹紝纭畾鍙嶆楠屽悧锛�")) + return; + _ckService(0.ToString()); + } + + private void BtnJianYan_ItemClick(object sender, ItemClickEventArgs e) + { + if (btnJianYanClick != null) + { + btnJianYanClick(this, e); + } + else + return; + + if (string.IsNullOrEmpty(this.guidKey)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (string.IsNullOrEmpty(this.chkParameter)) + { + ToolBox.MsgHelper.ShowError("娌℃湁鎸囧畾妫�楠屽弬鏁帮紝璇疯仈绯诲紑鍙戜汉鍛樿幏鍙栨敮鎸侊紒"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜�1鏉℃暟鎹紝纭畾鎻愪氦妫�楠屽悧锛�")) + return; var _obj = new { guid = this.guidKey, parameter = this.chkParameter }; - string strJson = UtilityHelper.HttpPost("", "General/GeneralCheck", JsonConvert.SerializeObject(_obj)); - ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnData["outMsg"].ToString()); - } - else - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - } + _ckService(1.ToString()); } + private async void BtnIn_ItemClick(object sender, ItemClickEventArgs e) { if (string.IsNullOrEmpty(this.xlsInService)) @@ -271,81 +309,82 @@ private void BtnOut_ItemClick(object sender, ItemClickEventArgs e) { - if (string.IsNullOrEmpty(this.xlsOutView)) - { - ToolBox.MsgHelper.ShowError("娌℃湁鎸囧畾瀵煎嚭鏈嶅姟锛岃鑱旂郴寮�鍙戜汉鍛樿幏鍙栨敮鎸侊紒"); - return; - } - using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) - { - folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�"; - DialogResult dialogResult = folderBrowserDialog.ShowDialog(); - if (dialogResult == DialogResult.OK) - { - string _folder = folderBrowserDialog.SelectedPath; - var _obj = new Gs.DevApp.Entity.XlsOutModel(this.xlsOutView); - try - { - string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView", JsonConvert.SerializeObject(_obj)); - ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) - { - string _file = _rtn.rtnData.fileUrl.ToString(); - string _folderName = _folder + "\\" + _file.Replace("down/", ""); - string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file; - using (WebClient client = new WebClient()) - { - client.DownloadFile(_url, _folderName); - } - ToolBox.MsgHelper.ShowInformation("瀵煎嚭鎴愬姛锛�"); - } - else - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - } - } - catch (Exception ex) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - } - } + //if (string.IsNullOrEmpty(this.xlsOutView)) + //{ + // ToolBox.MsgHelper.ShowError("娌℃湁鎸囧畾瀵煎嚭鏈嶅姟锛岃鑱旂郴寮�鍙戜汉鍛樿幏鍙栨敮鎸侊紒"); + // return; + //} + //using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) + //{ + // folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�"; + // DialogResult dialogResult = folderBrowserDialog.ShowDialog(); + // if (dialogResult == DialogResult.OK) + // { + // string _folder = folderBrowserDialog.SelectedPath; + // var _obj = new Gs.DevApp.Entity.XlsOutModel(this.xlsOutView); + // try + // { + // string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView", JsonConvert.SerializeObject(_obj)); + // ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + // if (_rtn.rtnCode > 0) + // { + // string _file = _rtn.rtnData.fileUrl.ToString(); + // string _folderName = _folder + "\\" + _file.Replace("down/", ""); + // string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file; + // using (WebClient client = new WebClient()) + // { + // client.DownloadFile(_url, _folderName); + // } + // ToolBox.MsgHelper.ShowInformation("瀵煎嚭鎴愬姛锛�"); + // } + // else + // { + // ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + // } + // } + // catch (Exception ex) + // { + // ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + // } + // } + //} } private void BtnReport_ItemClick(object sender, ItemClickEventArgs e) { - if (string.IsNullOrEmpty(this.rptService)) + if (string.IsNullOrEmpty(this.rptParameter)) { - ToolBox.MsgHelper.ShowError("娌℃湁鎸囧畾鎶ヨ〃绫诲瀷锛岃鑱旂郴寮�鍙戜汉鍛樿幏鍙栨敮鎸侊紒"); + ToolBox.MsgHelper.ShowError("娌℃湁鎸囧畾鎶ヨ〃鍙傛暟锛岃鑱旂郴鎶�鏈紑鍙戜汉鍛橈紒"); return; } bool _bl = false; _bl = _ckRptService(); if (_bl) { - Gs.DevApp.DevFrm.Rpt.RptPreview frm = new Gs.DevApp.DevFrm.Rpt.RptPreview(this.rptService); + Gs.DevApp.DevFrm.Rpt.RptPreview frm = new Gs.DevApp.DevFrm.Rpt.RptPreview(this.rptParameter); frm.Show(); return; } - ToolBox.MsgHelper.ShowError("杩樻病鏈夎璁℃ā鏉匡紝璇峰厛璁捐妯℃澘锛�"); + ToolBox.MsgHelper.ShowError("娌℃湁璁捐妯℃澘锛岃鍏堣璁℃ā鏉匡紒"); + return; } private void BtnDesign_ItemClick(object sender, ItemClickEventArgs e) { - if (string.IsNullOrEmpty(this.rptService)) + if (string.IsNullOrEmpty(this.rptParameter)) { - ToolBox.MsgHelper.ShowError("娌℃湁鎸囧畾鎶ヨ〃绫诲瀷锛岃鑱旂郴寮�鍙戜汉鍛樿幏鍙栨敮鎸侊紒"); + ToolBox.MsgHelper.ShowError("娌℃湁鎸囧畾鎶ヨ〃鍙傛暟锛岃鑱旂郴鎶�鏈紑鍙戜汉鍛橈紒"); return; } bool _bl = false; _bl = _ckRptService(); - //濡傛灉宸茬粡鏈夋ā鏉夸簡锛岀洿鎺ユ墦寮� + //濡傛灉宸茬粡鏈夋ā鏉夸簡锛岀洿鎺ユ墦寮�璁剧疆妯℃澘 if (_bl) { - Gs.DevApp.DevFrm.Sys.EasyRptDesign frm = new Gs.DevApp.DevFrm.Sys.EasyRptDesign(this.rptService); + Gs.DevApp.DevFrm.Sys.EasyRptDesign frm = new Gs.DevApp.DevFrm.Sys.EasyRptDesign(this.rptParameter); frm.Show(); return; } //鍚﹀垯鍚戝璁捐妯℃澘 - UserControl.ShowRptWizard rptWizard = new ShowRptWizard(this.rptService); + UserControl.ShowRptWizard rptWizard = new ShowRptWizard(this.rptParameter); rptWizard.ShowDialog(); } @@ -519,6 +558,7 @@ ); if (ld1 == true) { + btnEsc.Visibility = btnSave.Visibility = btnLoad.Visibility = BarItemVisibility.Always; btnAdd.Visibility = BarItemVisibility.Always; _enabledList.Add(item.Name); @@ -547,6 +587,19 @@ { item.Visibility = BarItemVisibility.Always; //鍑嗗鍚敤 + _enabledList.Add(item.Name); + continue; + } + } + ///鍏锋湁鑱斿姩鍏崇郴鐨勬寜閽�(鎻愪氦妫�楠�)锛� + if (item.Caption == "鎻愪氦妫�楠�") + { + bool ld1 = dt.AsEnumerable().Any(row => row.Field<string>("name") == "鎻愪氦妫�楠�" + ); + if (ld1 == true) + { + btnJianYan.Visibility = btnFjianYan.Visibility = btnLoad.Visibility = BarItemVisibility.Always; + btnJianYan.Visibility = BarItemVisibility.Always; _enabledList.Add(item.Name); continue; } @@ -596,7 +649,7 @@ { var _obj = new { - reportType = this.rptService, + rptParameter = this.rptParameter, }; string strJson = UtilityHelper.HttpPost("", "Report/GetTemplate", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); @@ -611,6 +664,28 @@ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); return true; } + return false; + } + + private void _ckService(string _ckValue) + { + var _obj = new + { + guid = this.guidKey, + parameter = this.chkParameter, + ckValue = _ckValue + }; + string strJson = UtilityHelper.HttpPost("", "General/GeneralCheck", JsonConvert.SerializeObject(_obj)); + ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnData["outMsg"].ToString()); + if (_rtn.rtnCode > 0) + { + + } + else + { + + } } } } -- Gitblit v1.9.3