| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- 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;
- DataTable Dbfind;
- public Query_DateRate()
- {
- InitializeComponent();
- }
- private void Export_Click(object sender, EventArgs e)
- {
- if (pr_code.Text == "")
- {
- MessageBox.Show("请输入产品代码");
- return;
- }
- 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') and sp_prodcode='" + pr_code.Text + "' 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)
- {
- //工单号放大镜配置
- pr_code.TableName = " product ";
- pr_code.SelectField = "pr_code # 产品编号,pr_detail # 产品名称,pr_spec # 型号";
- pr_code.FormName = Name;
- pr_code.SetValueField = new string[] { "pr_code" };
- pr_code.Condition = "pr_statuscode='AUDITED'";
- pr_code.DbChange += pr_code_DbChange;
- }
- private void pr_code_DbChange(object sender, EventArgs e)
- {
- Dbfind = pr_code.ReturnData;
- BaseUtil.SetFormValue(this.Controls, Dbfind);
- }
- }
- }
|