//protected void Page_UnLoad(object sender, EventArgs e) //{ // if (rdt != null) rdt.Dispose(); //} protected void btnQuery_Click(object sender, EventArgs e) { Page_Load(sender, e); string strCurrentDate = ddlYear.SelectedValue.ToString() + "-" + ddlMonth.SelectedValue.ToString() + "-" + ddlDay.SelectedValue.ToString(); string strCurrentDate1 = ddlStartYear.SelectedValue.ToString() + "-" + ddlStartMonth.SelectedValue.ToString() + "-" + ddlStartDay.SelectedValue.ToString(); DateTime dtStart = Convert.ToDateTime(strCurrentDate1); DateTime dtEnd = Convert.ToDateTime(strCurrentDate); double dStopTime = Math.Round((dtEnd.ToOADate() - dtStart.ToOADate()), 0); if (dStopTime > 31) { ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.Refresh(); Response.Write("<script language='javascript'>if(window.confirm('请查询一个月以内的数据!'))" + this.Page.ClientScript.GetPostBackEventReference(btnQuery, "") + ";</script>"); return; } else { OracleConnection conn = DB.createConn(); OracleDataAdapter da = new OracleDataAdapter(); try { conn.Open(); string strSQL = "";// "Select * from TC_ORIGINALDATA_NO5 where LOGTIME='" + strCurrentDate + "'"; strSQL += " SELECT logtime, "; strSQL += " DECODE (team, "; strSQL += " '1', '甲班', "; strSQL += " '2', '乙班', "; strSQL += " '3', '丙班', "; strSQL += " '4', '丁班', "; strSQL += " '-' "; strSQL += " ) team, "; strSQL += " DECODE (shift, '1', '夜班', '2', '白班', '3', '中班', '-') shift,CCMID,"; strSQL += " log_per, headfurnace, castingno, steel_grade, heatid, block_size, "; strSQL += " ladleid, ladle_grade, steel_weight, temp, TUNDISH_HEATCOUNT, "; strSQL += " DECODE (steeltempupto, '0', '否', '1', '是', '-') steeltempupto, "; strSQL += " arrival_time, casting_start_time, casting_stop_time, remainweight, "; strSQL += " holdtime, DECODE (autoflow, '0', '否', '1', '是', '-') autoflow, "; strSQL += " unautoflow_reason, "; strSQL += " DECODE (PROTECTION, '0', '否', '1', '是', '-') PROTECTION, "; strSQL += " unprotection_reason, FLOW_BLOWAR_PROTECTCASTING,FLOW_BLOWAR_PLUGBAR_1ST ,FLOW_BLOWAR_PLUGBAR_2ND,FLOW_BLOWAR_PLUGBAR_3RD ,FLOW_BLOWAR_PLUGBAR_4TH , off_ladle_time, tundish_carid, tundishid, "; strSQL += " fender_slag_usage_case, thickness, bottom_temp, wall_temp, "; strSQL += " castingstarttime1, castingstoptime1, castingstarttime2, "; strSQL += " castingstoptime2, castingstarttime3, castingstoptime3, "; strSQL += " castingstarttime4, castingstoptime4, tundishtemp5, tundishtemp10, "; strSQL += " tundishtemp15, tundishtemp20, tundishtemp25, tundishtemp30, "; strSQL += " tundishtemp35, tundishtemp40, tundishtemp45, ladlestoptemp, "; strSQL += " DECODE (tundishtempupto, '0', '否', '1', '是', '-') tundishtempupto, "; strSQL += " speed1st, speed2nd, speed3rd, speed4th, speedchange, steelweight, "; strSQL += " tundish_1st_officer, tundish_2nd_officer, tundish_3rd_officer, "; strSQL += " tundish_4th_officer, ladle_operator, control_operator, "; strSQL += " elec_mix_current_1st, elec_mix_current_2nd, elec_mix_current_3rd, "; strSQL += " elec_mix_current_4th, elec_mix_freq_1st, elec_mix_freq_2nd, "; strSQL += " elec_mix_freq_3rd, elec_mix_freq_4th, direction_electmix1, "; strSQL += " direction_electmix2,direction_electmix3,direction_electmix4, "; strSQL += " cooling_meterno, temp_in_cooling, cooling_press, cooling_exception, "; strSQL += " in_temp,IN_TEMP_1, temp_dif_mold1,temp_dif_mold2,temp_dif_mold3,temp_dif_mold4, "; strSQL += " flow_1st, flow_2nd, flow_3rd, flow_4th, "; strSQL += " soft_press_flag1, soft_press_flag2,soft_press_flag3,soft_press_flag4, "; strSQL += " oscillate_meterno, protect_dreg_type, "; strSQL += " protect_dreg_fac, batch_id, cover_type, cover_fac,cover_ID, LENGTH, bloom_count,"; strSQL += " reason_holt_casting, note ,CASTINGTUNDISHWEIGHT ,EXCEPT ,ActProtocol,Protocol,bof_note,lf_note,rh_note,WARD_DREGS_FAC,DRY_FLAP_FAC ,TUNDISHTEMP2 ,CAL_WEIGHT, WATERSPEED1,WATERSPEED2,WATERSPEED3,WATERSPEED4, "; strSQL += " BEFORE_CASTING_TUNDISH_TEMP,BEFORE_CASTING_SHUIKOU_TEMP1,BEFORE_CASTING_SHUIKOU_TEMP2,BEFORE_CASTING_SHUIKOU_TEMP3,BEFORE_CASTING_SHUIKOU_TEMP4 "; strSQL += " FROM tc_originaldata_no5 where LOGTIME>='" + strCurrentDate1 + "'AND LOGTIME<='" + strCurrentDate + "'"; if (TeamDropDownList.SelectedValue.ToString() != "") { strSQL += " and Team = '" + TeamDropDownList.SelectedValue.ToString() + "'"; } strSQL += "order by CCMID,casting_start_time"; da.SelectCommand = new OracleCommand(strSQL, conn); CCMData5 ds = new CCMData5(); da.Fill(ds, "TC_ORIGINALDATA_NO5"); ReportViewer1.Visible = true; ReportDataSource rds = new ReportDataSource("CCMData5_TC_ORIGINALDATA_NO5", ds.Tables[0]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); } catch (Exception ee) { string strMessage = ee.Message.ToString(); } finally { conn.Close(); } } }
protected void btnQuery_Click(object sender, EventArgs e) { //Page_Load(sender, e); string strHeatID = txtHeatID.Text.Trim(); ReportViewer1.Visible = false; //ReportViewer2.Visible = false; //ReportViewer3.Visible = false; OracleConnection conn = DB.createConn(); OracleDataAdapter da = new OracleDataAdapter(); try { conn.Open(); string strSQLBOF = "Select * from TS_ORIGINALDATA where HeatID='" + strHeatID + "'"; da.SelectCommand = new OracleCommand(strSQLBOF, conn); dsBOF ds = new dsBOF(); da.Fill(ds, "TS_ORIGINALDATA"); strSQLBOF = "Select * from TR_LF_ORIGINALDATA where HeatID='" + strHeatID + "'"; da.SelectCommand = new OracleCommand(strSQLBOF, conn); da.Fill(ds, "TR_LF_ORIGINALDATA"); strSQLBOF = "Select * from TR_RH_ORIGINALDATA where HeatID='" + strHeatID + "'"; da.SelectCommand = new OracleCommand(strSQLBOF, conn); da.Fill(ds, "TR_RH_ORIGINALDATA"); //1#CCM strSQLBOF = "Select * from TC_ORIGINALDATA_NO1ANDNO2 where HeatID='" + strHeatID + "'"; da.SelectCommand = new OracleCommand(strSQLBOF, conn); DataTable dtCCM1 = new DataTable(); da.Fill(dtCCM1); //3#CCM strSQLBOF = "Select * from TC_ORIGINALDATA_NO3ANDNO4 where HeatID='" + strHeatID + "'"; da.SelectCommand = new OracleCommand(strSQLBOF, conn); DataTable dtCCM3 = new DataTable(); da.Fill(dtCCM3); //5#CCM strSQLBOF = "Select * from TC_ORIGINALDATA_NO5 where HeatID='" + strHeatID + "'"; da.SelectCommand = new OracleCommand(strSQLBOF, conn); //CCMData5 DataTable dtCCM5 = new DataTable(); // da.Fill(dtCCM5); CCMData5 dsCCMData5 = new CCMData5(); da.Fill(dsCCMData5, "TC_ORIGINALDATA_NO5"); ReportViewer1.Visible = true; ReportViewer2.Visible = true; ReportViewer3.Visible = true; ReportViewer4.Visible = true; //ReportParameter rptParaA = new ReportParameter("rptParaA", "测试报表参数"); //ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rptParaA }); ReportDataSource rdsBOF = new ReportDataSource("dsBOF_TS_ORIGINALDATA", ds.Tables[0]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rdsBOF); ReportViewer1.LocalReport.Refresh(); ReportDataSource rdsLF = new ReportDataSource("dsLF_TR_LF_ORIGINALDATA", ds.Tables[1]); ReportViewer2.LocalReport.DataSources.Clear(); ReportViewer2.LocalReport.DataSources.Add(rdsLF); ReportViewer2.LocalReport.Refresh(); ReportDataSource rdsRH = new ReportDataSource("dsRH_TR_RH_ORIGINALDATA", ds.Tables[2]); ReportViewer3.LocalReport.DataSources.Clear(); ReportViewer3.LocalReport.DataSources.Add(rdsRH); ReportViewer3.LocalReport.Refresh(); if (dtCCM1.Rows.Count > 0) { ReportDataSource rdsCCM1 = new ReportDataSource("CCMData12_TC_ORIGINALDATA_NO1ANDNO2", dtCCM1); ReportViewer4.LocalReport.DataSources.Clear(); ReportViewer4.LocalReport.DataSources.Add(rdsCCM1); ReportViewer4.LocalReport.Refresh(); } if (dtCCM3.Rows.Count > 0) { ReportDataSource rdsCCM3 = new ReportDataSource("CCMData34_TC_ORIGINALDATA_NO3ANDNO4", dtCCM3); ReportViewer4.LocalReport.DataSources.Clear(); ReportViewer4.LocalReport.DataSources.Add(rdsCCM3); ReportViewer4.LocalReport.Refresh(); } if (dsCCMData5.Tables[0].Rows.Count > 0) { ReportDataSource rdsCCM5 = new ReportDataSource("CCMData5_TC_ORIGINALDATA_NO5", dsCCMData5.Tables[0]); ReportViewer4.LocalReport.DataSources.Clear(); ReportViewer4.LocalReport.DataSources.Add(rdsCCM5); ReportViewer4.LocalReport.Refresh(); } } catch (Exception ee) { Response.Write(ee.ToString());//"出错"); } finally { conn.Close(); } }