123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- 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 BadSn : Form
- {
- DataHelper dh = SystemInf.dh;
- AutoSizeFormClass asc = new AutoSizeFormClass();
- string _linecode;
- string _prodcode;
- string _wccode;
- string _begindate;
- string _enddate;
- string _stepcode;
- string _makind;
- string _badname;
- string _macode;
- public BadSn(string macode,string linecode, string prodcode, string wccode, string begindate, string enddate, string stepcode,string makind,string badname)
- {
- InitializeComponent();
- _macode = macode;
- _linecode = linecode;
- _prodcode = prodcode;
- _wccode = wccode;
- _begindate = begindate;
- _enddate = enddate;
- _stepcode = stepcode;
- _makind = makind;
- _badname = badname;
- }
- private void BadItem_SizeChanged(object sender, EventArgs e)
- {
- asc.controlAutoSize(this);
- }
- private void BadItem_Load(object sender, EventArgs e)
- {
- string condition = " mb_indate between to_date('" + _begindate + "', 'yyyy-mm-dd hh24:mi:ss') and to_date('" + _enddate + "', 'yyyy-mm-dd hh24:mi:ss') ";
- if (_prodcode != "")
- {
- //condition += " and ma_prodcode = '" + _prodcode + "'";
- condition += " and ma_prodcode in ('" + _prodcode.Replace("|", "','") + "')";
- }
- if (_macode != "")
- {
- //condition += " and ma_code = '" + _macode + "'";
- condition += " and ma_code in ('" + _macode.Replace("|", "','") + "')";
- }
- if (_linecode != "")
- {
- //condition += " and mb_linecode = '" + _linecode + "'";
- condition += " and mb_linecode in ('" + _linecode.Replace("|", "','") + "')";
- }
- if (_wccode != "")
- {
- condition += " and ma_wccode = '" + _wccode + "'";
- }
- if (_makind != "")
- {
- // condition += " and ma_kind = '" + _makind + "'";
- condition += " and ma_kind in ('" + _makind.Replace("|", "','") + "')";
- }
- if (_stepcode != "")
- {
- condition += " and mb_stepcode = '" + _stepcode + "'";
- }
- if (_badname != "")
- {
- condition += " and mb_badname = '" + _badname + "'";
- }
- string v_sql = "";
- LogicHandler.GetQuerySQL(condition, "不良明细", out v_sql);
-
- DataTable dt = (DataTable)dh.ExecuteSql(v_sql, "select");
- BaseUtil.FillDgvWithDataTable(Data, dt);
- }
- private void normalButton1_Click(object sender, EventArgs e)
- {
- //Data表示导出数据
- //Templet表示导出模板
- folderBrowserDialog1.Description = "选择导出的路径";
- DialogResult result = folderBrowserDialog1.ShowDialog();
- if (result == DialogResult.OK)
- {
- string FolderPath = folderBrowserDialog1.SelectedPath;
- ExcelHandler eh = new ExcelHandler();
- //DataTable dt = (DataTable)Data.DataSource;
- //导出Excel的时候返回一个文件名,用户选择是否打开
- string filePath = eh.ExportExcel(Data, FolderPath);
- //用户选择导出之后是否立即打开
- MessageBoxButtons messButton = MessageBoxButtons.YesNo;
- string openFile = MessageBox.Show(this.ParentForm, "是否打开文件" + filePath, "提示", messButton).ToString();
- if (openFile == "Yes")
- {
- System.Diagnostics.Process.Start(filePath);
- }
- }
- }
- }
- }
|