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_DateRate2 : Form { AutoSizeFormClass asc = new AutoSizeFormClass(); string querysql = ""; DataHelper dh = SystemInf.dh; DataTable Dbfind; string condition; public Query_DateRate2() { InitializeComponent(); } private void Query_SpecialReport_Load(object sender, EventArgs e) { asc.controllInitializeSize(this); //工单号放大镜配置 pr_code.TableName = " product "; pr_code.SelectField = "pr_code # 产品编号,pr_detail # 产品名称,pr_orispeccode # 型号"; pr_code.FormName = Name; pr_code.SetValueField = new string[] { "pr_code" }; pr_code.Condition = "pr_statuscode='AUDITED'"; pr_code.DbChange += pr_code_DbChange; wc_code.TableName = " workcenter "; wc_code.SelectField = "wc_code # 车间编号,wc_name # 车间名称"; wc_code.FormName = Name; wc_code.SetValueField = new string[] { "wc_code" }; wc_code.Condition = "wc_statuscode='AUDITED'"; wc_code.DbChange += pr_code_DbChange; li_code.TableName = " line "; li_code.SelectField = "li_code # 车间编号,li_name # 车间名称"; li_code.FormName = Name; li_code.SetValueField = new string[] { "li_code" }; li_code.Condition = "li_statuscode='AUDITED'"; li_code.DbChange += pr_code_DbChange; ma_code.TableName = " make left join product on ma_prodcode=pr_code left join workcenter on ma_wccode = wc_code"; ma_code.SelectField = "ma_code # 工单编号,ma_prodcode # 产品编号,pr_spec # 型号,wc_code # 工作中心"; ma_code.FormName = Name; ma_code.SetValueField = new string[] { "ma_code", "wc_code" }; ma_code.Condition = "ma_statuscode='STARTED'"; ma_code.DbChange += pr_code_DbChange; //EndDate.Value = DateTime.Now; // BeginDate.Value = DateTime.Now - 1; } private void Export_Click(object sender, EventArgs e) { if (wc_code.Text == "") { MessageBox.Show("请输入车间"); return; } if (EndDate.Value < BeginDate.Value) { MessageBox.Show("结束日期不能小于起始日期"); } condition = ""; condition = " sp_date between to_date('" + BeginDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss') and to_date('" + EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss') "; if (wc_code.Text != "") { condition += " and sp_wccode = '" + wc_code.Text + "'"; } if (pr_code.Text != "") { condition += " and sp_prodcode = '" + pr_code.Text + "'"; } if (ma_code.Text != "") { condition += " and sp_makecode = '" + ma_code.Text + "'"; } if (li_code.Text != "") { condition += " and sp_linecode = '" + li_code.Text + "'"; } string v_sql = ""; //string v_sql1 = ""; LogicHandler.GetQuerySQL(condition, "直通率", out v_sql); DataTable dt = (DataTable)dh.ExecuteSql(v_sql, "select"); DataRow dr = dt.NewRow(); dr[3] = "ALL"; dt.Rows.InsertAt(dr, dt.Rows.Count); BaseUtil.FillDgvWithDataTable(Data, dt); } private void pr_code_DbChange(object sender, EventArgs e) { Dbfind = pr_code.ReturnData; BaseUtil.SetFormValue(this.Controls, Dbfind); } private void Query_DateRate_SizeChanged(object sender, EventArgs e) { asc.controlAutoSize(this); } private void Data_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { Console.WriteLine(Data.Rows[e.RowIndex].Cells["sp_stepname"].Value.ToString()); Console.WriteLine(condition); } } } }