From 9702c6a4dc358c7bff2eb18c8426229a0140e34a Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期一, 15 九月 2025 08:29:16 +0800
Subject: [PATCH] bug

---
 DevApp/Gs.DevApp/DevFrm/Rpt/ItemQL.cs |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Rpt/ItemQL.cs b/DevApp/Gs.DevApp/DevFrm/Rpt/ItemQL.cs
index 7808abd..53a09ef 100644
--- a/DevApp/Gs.DevApp/DevFrm/Rpt/ItemQL.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Rpt/ItemQL.cs
@@ -1,10 +1,13 @@
+using DevExpress.XtraEditors;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Gs.DevApp.UserControl;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.Data;
+using System.Net;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -20,6 +23,7 @@
             InitializeComponent();
             this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
+            this.toolBarMenu1.btnOutClick += btnOutput_Click;
             this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, this, "", "", null);
             Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
@@ -129,5 +133,52 @@
                 ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
+
+
+        private void btnOutput_Click(object sender, EventArgs e)
+        {
+            using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
+            {
+                folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�";
+                DialogResult dialogResult = folderBrowserDialog.ShowDialog();
+                if (dialogResult == DialogResult.OK)
+                {
+                    System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+                    _sbSqlWhere.Append(" and c.FSubsidiary in");
+                    _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+                    _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
+                    string _folder = folderBrowserDialog.SelectedPath;
+                    var _params = new
+                    {
+                        inQueryWhere = _sbSqlWhere.ToString()
+                    };
+                    var _obj = new Gs.DevApp.Entity.XlsOutModel("xlsOut_ItemQL", "", "", "", _params);
+                    try
+                    {
+                        string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView_NEW", 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);
+                    }
+                }
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3