From a65db7881a97bd0bb2411d78003978809498dac3 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 25 十月 2024 14:33:40 +0800 Subject: [PATCH] 1 --- DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs | 81 ++++++++++++++++++++-------------------- 1 files changed, 41 insertions(+), 40 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs b/DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs index 3e13490..931efa9 100644 --- a/DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs +++ b/DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs @@ -3,6 +3,7 @@ using System.Configuration; using System.Data; using System.Linq; +using System.Net; using System.Windows.Forms; using DevExpress.XtraBars; using DevExpress.XtraEditors; @@ -198,45 +199,45 @@ 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.xlsOutParameter)) + { + 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.xlsOutParameter); + 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) @@ -652,7 +653,7 @@ public string rptParameter { get; set; } /// <summary> - /// 瀵煎嚭锛岃鍥惧悕,濡傦細瑙嗗浘鍚峽鍏ュ弬1鍚峾鍏ュ弬鍊�,鍏ュ弬2鍚峾鍏ュ弬鍊紏 + /// 瀵煎嚭锛岃鍥惧悕,濡傦細瀛樺偍杩囩▼鍚峽鍏ュ弬1鍚峾鍏ュ弬鍊�,鍏ュ弬2鍚峾鍏ュ弬鍊紏 /// </summary> public string xlsOutParameter { get; set; } -- Gitblit v1.9.3