From 4b40e0d9657203dd45baa1e6358547f1080491cc Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期二, 02 十二月 2025 16:20:13 +0800
Subject: [PATCH] 采购退货增加向下复制按钮

---
 DevApp/Gs.DevApp/DevFrm/Rpt/CkKuCun.cs |   61 +++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Rpt/CkKuCun.cs b/DevApp/Gs.DevApp/DevFrm/Rpt/CkKuCun.cs
index e809354..ab077b5 100644
--- a/DevApp/Gs.DevApp/DevFrm/Rpt/CkKuCun.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Rpt/CkKuCun.cs
@@ -5,14 +5,11 @@
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
+using System.Configuration;
 using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
+using System.Net;
 using System.Threading.Tasks;
 using System.Windows.Forms;
-
 namespace Gs.DevApp.DevFrm.Rpt
 {
     public partial class CkKuCun : DevExpress.XtraEditors.XtraForm
@@ -24,6 +21,7 @@
             InitializeComponent();
             this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
+            this.toolBarMenu1.btnOutClick += ToolBarMenu1_btnOutClick;
             this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, this, "", "", (value) =>
             {
@@ -136,6 +134,57 @@
                 ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
-     
+
+        private void ToolBarMenu1_btnOutClick(object sender, EventArgs e)
+        {
+            using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
+            {
+                folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�";
+                DialogResult dialogResult = folderBrowserDialog.ShowDialog();
+                if (dialogResult == DialogResult.OK)
+                {
+                    string _folder = folderBrowserDialog.SelectedPath;
+                    System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+                    _sbSqlWhere.Append(" and org.fid in");
+                    _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+                    _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
+                    var _params = new
+                    {
+                        inQueryWhere = _sbSqlWhere.ToString(),//涓诲缓
+                        inFid = "",
+                        inP1 = "",
+                        inP2 = "",
+                        inP3 = "",
+                        inP4 = ""
+                    };
+                    var _obj = new Gs.DevApp.Entity.XlsOutModel("xlsOut_jskc", "", "", "", _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