protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //记录页面使用次数
            //DB.RecordPageUseCount("Plant_PageUseCount");

            OracleConnection conn = DB.createConn();
            try
            {
                OracleDataAdapter da = new OracleDataAdapter();
                if (newdate)
                {
                    CrystalReportViewer1.ResetReportPartNavigation();
                    newdate = false;
                }

                conn.Open();
                DataSet ds = new DataSet();

                string strSQL = "Select * from PAGE_USE_COUNT ORDER BY  PAGE_NAME";
                da.SelectCommand = new OracleCommand(strSQL, conn);
                da.Fill(ds, "PAGE_USE_COUNT");

                rdt.Load(this.Server.MapPath("").ToString() + "\\PageUseCount.rpt");

                rdt.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = rdt;
                CrystalReportViewer1.DataBind();

                ds.Dispose();
            }
            catch (Exception ee)
            {
                Response.Write(ee.ToString());//"出错");
            }
            finally
            {
                conn.Close();
            }
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //记录页面使用次数
            DB.RecordPageUseCount("Quality_frmPlantDaily");

            date1   = "1910-01";
            newdate = false;

            int CurrentYear = Convert.ToInt32(DateTime.Now.Year);
            int i;
            for (i = CurrentYear - 5; i <= CurrentYear; i++)
            {
                ListItem Year = new ListItem();
                Year.Text  = Convert.ToString(i);
                Year.Value = Convert.ToString(i);
                if (i == CurrentYear)
                {
                    Year.Selected = true;
                }
                else
                {
                    Year.Selected = false;
                }
                ddlYear.Items.Add(Year);
                //EndYear.Items.Add(Year);
            }

            string CurrentDate = Convert.ToString(DateTime.Now.Month);
            if (CurrentDate.Length == 1)
            {
                CurrentDate = "0" + CurrentDate;
            }
            foreach (ListItem Month in ddlMonth.Items)
            {
                if (Month.Text == CurrentDate)
                {
                    Month.Selected = true;
                    ddlMonth.Text  = Month.Text;
                    //EndMonth.Text = Month.Text;
                    break;
                }
                else
                {
                    Month.Selected = false;
                }
            }
            AddDate(sender, e);
            CurrentDate = Convert.ToString(DateTime.Now.Day);
            if (CurrentDate.Length == 1)
            {
                CurrentDate = "0" + CurrentDate;
            }
            foreach (ListItem day in ddlDay.Items)
            {
                if (day.Text == CurrentDate)
                {
                    day.Selected = true;
                    ddlDay.Text  = day.Text;
                    //EndDay.Text = day.Text;
                    break;
                }
                else
                {
                    day.Selected = false;
                }
            }
        }
        else
        {
            date1 = ddlYear.SelectedValue.ToString() + '-' + ddlMonth.SelectedValue.ToString() + '-' + ddlDay.SelectedValue.ToString();

            string strCurrentDate = date1;

            OracleConnection conn = DB.createConn();
            try
            {
                OracleDataAdapter da = new OracleDataAdapter();
                if (newdate)
                {
                    CrystalReportViewer1.ResetReportPartNavigation();
                    newdate = false;
                }
                conn.Open();
                string strSQL = "Select * from TQ_LF_INDICATOR where LOGTIME = '" + strCurrentDate + "'  order by Team";
                da.SelectCommand = new OracleCommand(strSQL, conn);
                DataSet ds = new DataSet();
                da.Fill(ds, "TQ_LF_INDICATOR");

                strSQL           = "Select * from TQ_BOF_VARSTEEL_INDICATOR  where LOGTIME = '" + strCurrentDate + "'order by Team";
                da.SelectCommand = new OracleCommand(strSQL, conn);
                da.Fill(ds, "TQ_BOF_VARSTEEL_INDICATOR");

                strSQL           = "Select * from TQ_RH_INDICATOR where LOGTIME = '" + strCurrentDate + "'  order by Team";
                da.SelectCommand = new OracleCommand(strSQL, conn);
                da.Fill(ds, "TQ_RH_INDICATOR");

                rdt.Load(this.Server.MapPath("").ToString() + "\\rptPlantDaily.rpt");

                //rdt.PrintOptions.PrinterName = "Microsoft Office Document Image Writer";
                rdt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperEsheet;

                rdt.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = rdt;
                CrystalReportViewer1.DataBind();

                ds.Dispose();
            }
            catch (Exception ee)
            {
                Response.Write(ee.ToString());//"出错");
            }
            finally
            {
                conn.Close();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //记录页面使用次数
            DB.RecordPageUseCount("BOF_Iron_Weight");

            date1   = "1910-01";
            newdate = false;

            int CurrentYear = Convert.ToInt32(DateTime.Now.Year);
            int i;
            for (i = CurrentYear - 5; i <= CurrentYear; i++)
            {
                ListItem Year = new ListItem();
                Year.Text  = Convert.ToString(i);
                Year.Value = Convert.ToString(i);
                if (i == CurrentYear)
                {
                    Year.Selected = true;
                }
                else
                {
                    Year.Selected = false;
                }
                ddlYear.Items.Add(Year);
            }

            string CurrentDate = Convert.ToString(DateTime.Now.Month);
            if (CurrentDate.Length == 1)
            {
                CurrentDate = "0" + CurrentDate;
            }
            foreach (ListItem Month in ddlMonth.Items)
            {
                if (Month.Text == CurrentDate)
                {
                    Month.Selected = true;
                    ddlMonth.Text  = Month.Text;
                    //EndMonth.Text = Month.Text;
                    break;
                }
                else
                {
                    Month.Selected = false;
                }
            }
        }
        else
        {
            strCurrentDate = ddlYear.SelectedValue.ToString() + '-' + ddlMonth.SelectedValue.ToString();

            OracleConnection  conn   = DB.createConn();
            OracleDataAdapter da     = new OracleDataAdapter();
            DataSet           ds     = new DataSet();
            string            strSQL = "";
            try
            {
                if (newdate)
                {
                    CrystalReportViewer1.ResetReportPartNavigation();
                    newdate = false;
                }
                conn.Open();
                string j = Quality.SelectedValue.ToString();
                if (j == "0")
                {
                    strSQL           = "Select * from TS_IN_IRON_ELE_WEIGHT where substr(LOGTIME,1,7) = '" + strCurrentDate + "' order by LOGTIME";
                    da.SelectCommand = new OracleCommand(strSQL, conn);
                    da.Fill(ds, "TS_IN_IRON_ELE_WEIGHT");

                    strSQL           = "Select * from VIEW_TS_IN_IRON_WEIGHT where LOGTIME = '" + strCurrentDate + "' order by LOGTIME ";
                    da.SelectCommand = new OracleCommand(strSQL, conn);
                    da.Fill(ds, "VIEW_TS_IN_IRON_WEIGHT");

                    rdt.Load(this.Server.MapPath("").ToString() + "\\Iron_In_Weight.rpt");

                    //rdt.PrintOptions.PrinterName = "Microsoft Office Document Image Writer";
                    rdt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;

                    rdt.SetDataSource(ds);

                    CrystalReportViewer1.ReportSource = rdt;
                    CrystalReportViewer1.DataBind();
                }
                else
                {
                    strSQL           = "Select * from TS_OutIron where substr(LOGTIME,1,7)  = '" + strCurrentDate + "' order by LogTime,Shift";
                    da.SelectCommand = new OracleCommand(strSQL, conn);
                    da.Fill(ds, "TS_OutIron");

                    rdt.Load(this.Server.MapPath("").ToString() + "\\\\OutIron.rpt");

                    //rdt.PrintOptions.PrinterName = "Microsoft Office Document Image Writer";
                    rdt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA3;

                    rdt.SetDataSource(ds);
                    CrystalReportViewer1.ReportSource = rdt;
                    CrystalReportViewer1.DataBind();
                }
            }
            catch (Exception ee)
            {
                Response.Write(ee.ToString());//"出错");
            }
            finally
            {
                ds.Dispose();
                conn.Close();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //记录页面使用次数
            //DB.RecordPageUseCount("Plant_TEST_AUGUST1ST");

            date1   = "1910-01";
            newdate = false;

            int CurrentYear = Convert.ToInt32(DateTime.Now.Year);
            int i;
            for (i = CurrentYear - 5; i <= CurrentYear; i++)
            {
                ListItem Year = new ListItem();
                Year.Text  = Convert.ToString(i);
                Year.Value = Convert.ToString(i);
                if (i == CurrentYear)
                {
                    Year.Selected = true;
                }
                else
                {
                    Year.Selected = false;
                }
                ddlYear.Items.Add(Year);
                //EndYear.Items.Add(Year);
            }

            string CurrentDate = Convert.ToString(DateTime.Now.Month);
            if (CurrentDate.Length == 1)
            {
                CurrentDate = "0" + CurrentDate;
            }
            foreach (ListItem Month in ddlMonth.Items)
            {
                if (Month.Text == CurrentDate)
                {
                    Month.Selected = true;
                    ddlMonth.Text  = Month.Text;
                    //EndMonth.Text = Month.Text;
                    break;
                }
                else
                {
                    Month.Selected = false;
                }
            }
            AddDate(sender, e);
            CurrentDate = Convert.ToString(DateTime.Now.Day);
            if (CurrentDate.Length == 1)
            {
                CurrentDate = "0" + CurrentDate;
            }
            foreach (ListItem day in ddlDay.Items)
            {
                if (day.Text == CurrentDate)
                {
                    day.Selected = true;
                    ddlDay.Text  = day.Text;
                    //EndDay.Text = day.Text;
                    break;
                }
                else
                {
                    day.Selected = false;
                }
            }
        }
        else
        {
            date1 = ddlYear.SelectedValue.ToString() + '-' + ddlMonth.SelectedValue.ToString() + '-' + ddlDay.SelectedValue.ToString();
            string           strCurrentDate = date1;
            OracleConnection conn           = DB.createConn();
            try
            {
                OracleDataAdapter da = new OracleDataAdapter();
                if (newdate)
                {
                    CrystalReportViewer1.ResetReportPartNavigation();
                    newdate = false;
                }

                conn.Open();
                DataSet ds = new DataSet();

                string strSQL = "Select * from TP_ALLOY_COST where LOGTIME='" + strCurrentDate + "'and MONTH_FLAG=" + ddalloy_cost.SelectedValue + " ORDER BY shift,team,bofid, steelgrade_type ,steelgrade,alloy_order";
                da.SelectCommand = new OracleCommand(strSQL, conn);
                da.Fill(ds, "TP_ALLOY_COST");

                rdt.Load(this.Server.MapPath("").ToString() + "\\alloy_cost.rpt");

                rdt.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = rdt;
                CrystalReportViewer1.DataBind();

                ds.Dispose();
            }
            catch (Exception ee)
            {
                Response.Write(ee.ToString());//"出错");
            }
            finally
            {
                conn.Close();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //记录页面使用次数
            DB.RecordPageUseCount("BOF_Cost_Ladle");

            date1   = "1910-01";
            newdate = false;

            int CurrentYear = Convert.ToInt32(DateTime.Now.Year);
            int i;
            for (i = CurrentYear - 5; i <= CurrentYear; i++)
            {
                ListItem Year = new ListItem();
                Year.Text  = Convert.ToString(i);
                Year.Value = Convert.ToString(i);
                if (i == CurrentYear)
                {
                    Year.Selected = true;
                }
                else
                {
                    Year.Selected = false;
                }
                ddlYear.Items.Add(Year);
                //EndYear.Items.Add(Year);
            }

            string CurrentDate = Convert.ToString(DateTime.Now.Month);
            if (CurrentDate.Length == 1)
            {
                CurrentDate = "0" + CurrentDate;
            }
            foreach (ListItem Month in ddlMonth.Items)
            {
                if (Month.Text == CurrentDate)
                {
                    Month.Selected = true;
                    ddlMonth.Text  = Month.Text;
                    //EndMonth.Text = Month.Text;
                    break;
                }
                else
                {
                    Month.Selected = false;
                }
            }
            AddDate(sender, e);
            CurrentDate = Convert.ToString(DateTime.Now.Day);
            if (CurrentDate.Length == 1)
            {
                CurrentDate = "0" + CurrentDate;
            }
            foreach (ListItem day in ddlDay.Items)
            {
                if (day.Text == CurrentDate)
                {
                    day.Selected = true;
                    ddlDay.Text  = day.Text;
                    //EndDay.Text = day.Text;
                    break;
                }
                else
                {
                    day.Selected = false;
                }
            }
        }
        else
        {
            date1 = ddlYear.SelectedValue.ToString() + '-' + ddlMonth.SelectedValue.ToString() + '-' + ddlDay.SelectedValue.ToString();

            string strCurrentDate = date1;
            int    iLadleType     = Convert.ToInt16(ddlLadleType.SelectedValue);
            int    iPriceType     = Convert.ToInt16(ddlPriceType.SelectedValue);

            OracleConnection conn = DB.createConn();
            try
            {
                OracleDataAdapter da = new OracleDataAdapter();
                if (newdate)
                {
                    CrystalReportViewer1.ResetReportPartNavigation();
                    newdate = false;
                }
                conn.Open();
                DataSet ds = new DataSet();

                string strSQL = "Select * from TS_COST_LADLE where LOGTIME = '" + strCurrentDate + "' and LADLETYPE = " + iLadleType + "  order by logtime";
                da.SelectCommand = new OracleCommand(strSQL, conn);

                da.Fill(ds, "TS_COST_LADLE");

                //报表类型
                string strRptRoute   = "";
                string strRptDisplay = "";

                if (iLadleType == 1)
                {
                    strRptDisplay = "常规钢包";
                }
                if (iLadleType == 2)
                {
                    strRptDisplay = "50T精练钢包";
                }
                if (iLadleType == 3)
                {
                    strRptDisplay = "80T精练钢包";
                }
                if (iPriceType == 1)
                {
                    strRptRoute    = "Cost_Ladle_N.rpt";
                    strRptDisplay += "最新成本";
                }
                if (iPriceType == 2)
                {
                    strRptRoute    = "Cost_Ladle_M.rpt";
                    strRptDisplay += "月成本";
                }
                if (iPriceType == 3)
                {
                    strRptRoute    = "Cost_Ladle_Y.rpt";
                    strRptDisplay += "年成本";
                }
                rdt.Load(this.Server.MapPath("").ToString() + "\\\\" + strRptRoute);
                rdt.SetDataSource(ds);

                CrystalReportViewer1.ReportSource = rdt;
                CrystalReportViewer1.DataBind();
                rdt.SetParameterValue("LadleName_New", strRptDisplay);
                ds.Dispose();
            }
            catch (Exception ee)
            {
                Response.Write(ee.ToString());//"出错");
            }
            finally
            {
                conn.Close();
            }
        }
    }