cdk
2025-12-02 4b40e0d9657203dd45baa1e6358547f1080491cc
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,10 +21,11 @@
            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) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
               // Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            });
            //Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            //{
@@ -96,7 +94,11 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            gcMain1.DataSource = null;
            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
            _sbSqlWhere.Append(" and org.fid in");
            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.INDEP_DATE", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
@@ -112,7 +114,8 @@
                    {
                        gcMain1.DataSource = dt;
                        gcMain1.ForceInitialize();
                        gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
                        gridView1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
                    }
                    else
                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
@@ -131,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);
                    }
                }
            }
        }
    }
}