cdk
2025-09-04 72dc506dbd884fac5011b38d94280bf3e807969a
送货计划增加导出功能
已修改2个文件
109 ■■■■ 文件已修改
DevApp/Gs.DevApp/DevFrm/Rpt/WomShjh.Designer.cs 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Rpt/WomShjh.cs 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Rpt/WomShjh.Designer.cs
@@ -34,6 +34,7 @@
            DevExpress.XtraLayout.ColumnDefinition columnDefinition3 = new DevExpress.XtraLayout.ColumnDefinition();
            DevExpress.XtraLayout.ColumnDefinition columnDefinition4 = new DevExpress.XtraLayout.ColumnDefinition();
            DevExpress.XtraLayout.ColumnDefinition columnDefinition5 = new DevExpress.XtraLayout.ColumnDefinition();
            DevExpress.XtraLayout.ColumnDefinition columnDefinition6 = new DevExpress.XtraLayout.ColumnDefinition();
            DevExpress.XtraLayout.RowDefinition rowDefinition1 = new DevExpress.XtraLayout.RowDefinition();
            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions1 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject();
@@ -42,15 +43,17 @@
            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject4 = new DevExpress.Utils.SerializableAppearanceObject();
            this.splitContainerControl1 = new DevExpress.XtraEditors.SplitContainerControl();
            this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
            this.btnOutput = new DevExpress.XtraEditors.SimpleButton();
            this.ucLookOrg1 = new Gs.DevApp.UserControl.UcLookOrg();
            this.dateEdit1 = new DevExpress.XtraEditors.DateEdit();
            this.dateEdit2 = new DevExpress.XtraEditors.DateEdit();
            this.btnQuery = new DevExpress.XtraEditors.SimpleButton();
            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
            this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
            this.gcMain1 = new DevExpress.XtraGrid.GridControl();
            this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
            this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -77,10 +80,11 @@
            ((System.ComponentModel.ISupportInitialize)(this.dateEdit2.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dateEdit2.Properties.CalendarTimeProperties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gcMain1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.rptBtnView)).BeginInit();
@@ -110,6 +114,7 @@
            // 
            // layoutControl1
            // 
            this.layoutControl1.Controls.Add(this.btnOutput);
            this.layoutControl1.Controls.Add(this.ucLookOrg1);
            this.layoutControl1.Controls.Add(this.dateEdit1);
            this.layoutControl1.Controls.Add(this.dateEdit2);
@@ -122,6 +127,18 @@
            this.layoutControl1.Size = new System.Drawing.Size(1746, 53);
            this.layoutControl1.TabIndex = 0;
            this.layoutControl1.Text = "layoutControl1";
            //
            // btnOutput
            //
            this.btnOutput.ImageOptions.Image = global::Gs.DevApp.Properties.Resources.viewmergeddata_16x16;
            this.btnOutput.Location = new System.Drawing.Point(1074, 12);
            this.btnOutput.Margin = new System.Windows.Forms.Padding(4);
            this.btnOutput.Name = "btnOutput";
            this.btnOutput.Size = new System.Drawing.Size(183, 32);
            this.btnOutput.StyleController = this.layoutControl1;
            this.btnOutput.TabIndex = 8;
            this.btnOutput.Text = "导出";
            this.btnOutput.Click += new System.EventHandler(this.btnOutput_Click);
            // 
            // ucLookOrg1
            // 
@@ -176,10 +193,11 @@
            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
            this.Root.GroupBordersVisible = false;
            this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
            this.layoutControlItem4,
            this.layoutControlItem2,
            this.layoutControlItem1,
            this.layoutControlItem3});
            this.layoutControlItem3,
            this.layoutControlItem5,
            this.layoutControlItem4});
            this.Root.LayoutMode = DevExpress.XtraLayout.Utils.LayoutMode.Table;
            this.Root.Name = "Root";
            columnDefinition1.SizeType = System.Windows.Forms.SizeType.Absolute;
@@ -190,29 +208,23 @@
            columnDefinition3.Width = 250D;
            columnDefinition4.SizeType = System.Windows.Forms.SizeType.Absolute;
            columnDefinition4.Width = 187D;
            columnDefinition5.SizeType = System.Windows.Forms.SizeType.AutoSize;
            columnDefinition5.Width = 638D;
            columnDefinition5.SizeType = System.Windows.Forms.SizeType.Absolute;
            columnDefinition5.Width = 187D;
            columnDefinition6.SizeType = System.Windows.Forms.SizeType.AutoSize;
            columnDefinition6.Width = 451D;
            this.Root.OptionsTableLayoutGroup.ColumnDefinitions.AddRange(new DevExpress.XtraLayout.ColumnDefinition[] {
            columnDefinition1,
            columnDefinition2,
            columnDefinition3,
            columnDefinition4,
            columnDefinition5});
            columnDefinition5,
            columnDefinition6});
            rowDefinition1.Height = 100D;
            rowDefinition1.SizeType = System.Windows.Forms.SizeType.Percent;
            this.Root.OptionsTableLayoutGroup.RowDefinitions.AddRange(new DevExpress.XtraLayout.RowDefinition[] {
            rowDefinition1});
            this.Root.Size = new System.Drawing.Size(1720, 56);
            this.Root.TextVisible = false;
            //
            // layoutControlItem4
            //
            this.layoutControlItem4.Control = this.ucLookOrg1;
            this.layoutControlItem4.Location = new System.Drawing.Point(0, 0);
            this.layoutControlItem4.Name = "layoutControlItem4";
            this.layoutControlItem4.Size = new System.Drawing.Size(375, 36);
            this.layoutControlItem4.Text = "选择组织";
            this.layoutControlItem4.TextSize = new System.Drawing.Size(72, 22);
            // 
            // layoutControlItem2
            // 
@@ -244,6 +256,25 @@
            this.layoutControlItem3.Text = "确定查询";
            this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
            this.layoutControlItem3.TextVisible = false;
            //
            // layoutControlItem5
            //
            this.layoutControlItem5.Control = this.btnOutput;
            this.layoutControlItem5.Location = new System.Drawing.Point(1062, 0);
            this.layoutControlItem5.Name = "layoutControlItem5";
            this.layoutControlItem5.OptionsTableLayoutItem.ColumnIndex = 4;
            this.layoutControlItem5.Size = new System.Drawing.Size(187, 36);
            this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0);
            this.layoutControlItem5.TextVisible = false;
            //
            // layoutControlItem4
            //
            this.layoutControlItem4.Control = this.ucLookOrg1;
            this.layoutControlItem4.Location = new System.Drawing.Point(0, 0);
            this.layoutControlItem4.Name = "layoutControlItem4";
            this.layoutControlItem4.Size = new System.Drawing.Size(375, 36);
            this.layoutControlItem4.Text = "选择组织";
            this.layoutControlItem4.TextSize = new System.Drawing.Size(72, 22);
            // 
            // gcMain1
            // 
@@ -399,10 +430,11 @@
            ((System.ComponentModel.ISupportInitialize)(this.dateEdit2.Properties.CalendarTimeProperties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dateEdit2.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gcMain1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.rptBtnView)).EndInit();
@@ -431,10 +463,12 @@
        private DevExpress.XtraGrid.Columns.GridColumn gridColumn8;
        private DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit rptBtnView;
        private UserControl.UcLookOrg ucLookOrg1;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3;
        private DevExpress.XtraGrid.Columns.GridColumn gridColumn9;
        private DevExpress.XtraEditors.SimpleButton btnOutput;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
    }
}
DevApp/Gs.DevApp/DevFrm/Rpt/WomShjh.cs
@@ -5,8 +5,10 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Net;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.Rpt
@@ -146,5 +148,42 @@
            frm.ShowDialog();
        }
        private void btnOutput_Click(object sender, EventArgs e)
        {
            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("xlsOut_shjh");
                    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);
                    }
                }
            }
        }
    }
}