| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using UAS_MES_NEW.DataOperate;
- using UAS_MES_NEW.Entity;
- using UAS_MES_NEW.PublicMethod;
- namespace UAS_MES_NEW.Query
- {
- public partial class Query_DateRate : Form
- {
- DataHelper dh = SystemInf.dh;
- public Query_DateRate()
- {
- InitializeComponent();
- }
- private void Export_Click(object sender, EventArgs e)
- {
- if (EndDate.Value < BeginDate.Value)
- {
- MessageBox.Show("结束日期不能小于起始日期");
- }
- ExcelExport("");
- }
- //选择导出Excel时是选择导出数据的还是模板
- private void ExcelExport(string DataOrTemplet)
- {
- folderBrowserDialog1.Description = "选择导出的路径";
- DialogResult result = folderBrowserDialog1.ShowDialog();
- if (result == DialogResult.OK)
- {
- LogStringBuilder sql = new LogStringBuilder();
- sql.Append("select * from MES_OKNG_DATE where sp_date between ");
- sql.Append("to_date('" + BeginDate.Value.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') and ");
- sql.Append("to_date('" + EndDate.Value.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') order by sp_date");
- DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- string FolderPath = folderBrowserDialog1.SelectedPath;
- ExcelHandler eh = new ExcelHandler();
- string begindate = BeginDate.Value.ToString("yyyy-mm-dd");
- string enddate = EndDate.Value.ToString("yyyy-mm-dd");
- string path = eh.ExportExcel_BAIDU(dt, BeginDate.Value, (EndDate.Value - BeginDate.Value).Days + 1, FolderPath);
- string close = MessageBox.Show(this.ParentForm, "导出成功,是否打开文件", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
- if (close.ToString() == "Yes")
- System.Diagnostics.Process.Start(path);
- }
- }
- private void Query_SpecialReport_Load(object sender, EventArgs e)
- {
- }
- }
- }
|