Beispiel #1
0
        protected override void DoQuery()
        {
            base.DoQuery();

            if (this.CheckBeforeQuery())
            {
                this.AutoRefresh = this.chbRefreshAuto.Checked;

                string   byTimeType = this.UCGroupConditions1.UserSelectByTimeType.Trim().ToLower();
                object[] dateSource = null;

                //一般数据
                dateSource = this.LoadDataSource();
                if (dateSource == null || dateSource.Length <= 0)
                {
                    this.gridWebGrid.Visible = false;
                    //this.OWCChartSpace1.Display = false;
                    this.cmdGridExport.Visible = false;

                    this.columnChart.Visible = false;
                    this.lineChart.Visible   = false;

                    ReportPageHelper.SetPageScrollToBottom(this);
                    return;
                }

                //数据加载到Grid
                List <string> fixedColumnList = GetRows();
                List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>();

                dim3PropertyList.Add(new ReportGridDim3Property("ManHourSum", "0.0000", "SUM", "SUM", false));
                dim3PropertyList.Add(new ReportGridDim3Property("StandardQty", "0.0000", "SUM", "SUM", false));
                if (this.UCGroupConditions1.ExcludeLostManHourChecked)
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("InvalidManHour", "0.0000", "SUM", "SUM", false));
                }
                if (this.UCGroupConditions1.ShowIncludeIndirectManHour && this.UCGroupConditions1.IncludeIndirectManHourChecked)
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("IndirectManHour", "0.0000", "SUM", "SUM", false));
                }
                dim3PropertyList.Add(new ReportGridDim3Property("ManHourPerProduct", "0.0000", "SUM", "SUM", false));

                ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, DtSource);

                reportGridHelper.DataSource                   = dateSource;
                reportGridHelper.DataSourceForCompare         = null;
                reportGridHelper.Dim1PropertyList             = fixedColumnList;
                reportGridHelper.Dim3PropertyList             = dim3PropertyList;
                reportGridHelper.HasDim3PropertyNameRowColumn = true;
                reportGridHelper.ByTimeType                   = byTimeType;

                reportGridHelper.ShowGrid();
                base.InitWebGrid();

                this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false;
                this.gridWebGrid.Behaviors.Sorting.Enabled           = false;


                //修饰汇总行和汇总列
                ModifySummaryItems();

                //获取表格和图示
                if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid)
                {
                    this.gridWebGrid.Visible = true;
                    //this.OWCChartSpace1.Display = false;
                    this.cmdGridExport.Visible = true;

                    this.columnChart.Visible = false;
                    this.lineChart.Visible   = false;
                }
                else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                {
                    List <string> rowPropertyList    = GetColumns();
                    List <string> columnPropertyList = GetRows();
                    columnPropertyList.Add("EAttribute1");
                    List <string> dataPropertyList = new List <string>();
                    dataPropertyList.Add("ManHourPerProduct");

                    NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length];
                    dateSource.CopyTo(dateSourceForOWC, 0);

                    string propertyName = this.languageComponent1.GetString(dataPropertyList[0]);
                    foreach (NewReportDomainObject domainObject in dateSourceForOWC)
                    {
                        domainObject.EAttribute1 = propertyName + domainObject.EAttribute1;
                    }

                    foreach (NewReportDomainObject obj in dateSourceForOWC)
                    {
                        obj.TempValue = obj.ManHourPerProduct.ToString();
                        //时段、班次、天、周、月、年
                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Period)
                        {
                            obj.PeriodCode = obj.PeriodCode.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Shift)
                        {
                            obj.PeriodCode = obj.ShiftCode.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.ShiftDay)
                        {
                            obj.PeriodCode = obj.ShiftDay.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Week)
                        {
                            obj.PeriodCode = obj.Week.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Month)
                        {
                            obj.PeriodCode = obj.Month.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Year)
                        {
                            obj.PeriodCode = obj.Year.ToString();
                        }
                    }

                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart)
                    {
                        this.columnChart.Visible = false;
                        this.lineChart.Visible   = true;

                        lineChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            lineChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            lineChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.lineChart.ChartTextFormatString = "<DATA_VALUE:0.0000>";
                        this.lineChart.YLabelFormatString    = "<DATA_VALUE:0.0000>";
                        this.lineChart.DataType   = true;
                        this.lineChart.DataSource = dateSourceForOWC;
                        this.lineChart.DataBind();
                    }
                    else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                    {
                        this.columnChart.Visible = true;
                        this.lineChart.Visible   = false;

                        columnChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            columnChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            columnChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.columnChart.ChartTextFormatString = "<DATA_VALUE:0.##%>";
                        this.columnChart.YLabelFormatString    = "<DATA_VALUE:#0.##%>";
                        this.columnChart.DataType   = true;
                        this.columnChart.DataSource = dateSourceForOWC;
                        this.columnChart.DataBind();
                    }
                    else
                    {
                        this.columnChart.Visible = false;
                        this.lineChart.Visible   = false;
                    }

                    this.gridWebGrid.Visible   = false;
                    this.cmdGridExport.Visible = false;

                    //List<string> rowPropertyList = GetColumns();
                    //List<string> columnPropertyList = GetRows();
                    //columnPropertyList.Add("EAttribute1");
                    //List<string> dataPropertyList = new List<string>();
                    //dataPropertyList.Add("ManHourPerProduct");

                    //NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length];
                    //dateSource.CopyTo(dateSourceForOWC, 0);

                    //string propertyName = this.languageComponent1.GetString(dataPropertyList[0]);
                    //foreach (NewReportDomainObject domainObject in dateSourceForOWC)
                    //{
                    //    domainObject.EAttribute1 = propertyName + domainObject.EAttribute1;
                    //}

                    //ReportChartHelper reportChartHelper = new ReportChartHelper(this.OWCPivotTable1, this.OWCChartSpace1, this.languageComponent1);
                    //reportChartHelper.DataSource = dateSourceForOWC;
                    //reportChartHelper.RowPropertyList = rowPropertyList.ToArray();
                    //reportChartHelper.ColumnPropertyList = columnPropertyList.ToArray();
                    //reportChartHelper.DataPropertyList = dataPropertyList.ToArray();
                    //reportChartHelper.DataPropertyFormatList = new string[] { "0.0000" };
                    //reportChartHelper.UserOWCChartType = UCDisplayConditions1.GetDisplayType().Trim().ToLower();

                    //reportChartHelper.LoadOWCChart();

                    //this.gridWebGrid.Visible = false;
                    //this.OWCChartSpace1.Display = true;
                    //this.cmdGridExport.Visible = false;
                }

                ReportPageHelper.SetPageScrollToBottom(this);
            }
            else
            {
                this.chbRefreshAuto.Checked = false;
                this.AutoRefresh            = false;
            }
        }
Beispiel #2
0
        protected override void DoQuery()
        {
            base.DoQuery();
            if (this.CheckBeforeQuery())
            {
                this.AutoRefresh = this.chbRefreshAuto.Checked;

                string   compareType       = this.UCGroupConditions1.UserSelectCompareType.Trim().ToLower();
                string   byTimeType        = this.UCGroupConditions1.UserSelectByTimeType.Trim().ToLower();
                string   inputOutput       = this.UCWhereConditions1.UserSelectInputOutput.Trim().ToLower();
                object[] dateSource        = null;
                object[] dateSourceCompare = null;

                //一般数据
                dateSource = this.LoadDataSource(false, compareType.Trim().Length > 0);
                if (dateSource == null || dateSource.Length <= 0)
                {
                    this.gridWebGrid.Visible   = false;
                    this.cmdGridExport.Visible = false;
                    this.lineChart.Visible     = false;
                    this.columnChart.Visible   = false;


                    ReportPageHelper.SetPageScrollToBottom(this);
                    return;
                }

                //环比/同期比数据
                if (compareType.Trim().Length > 0)
                {
                    dateSourceCompare = this.LoadDataSource(true, true);
                }
                if (dateSourceCompare == null)
                {
                    dateSourceCompare = new NewReportDomainObject[0] {
                    };
                }

                //数据加载到Grid
                List <string> fixedColumnList = GetRows();
                List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>();

                if (inputOutput.Trim().Length == 0)
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("Input", "0", "SUM", "SUM", false));
                    dim3PropertyList.Add(new ReportGridDim3Property("Output", "0", "SUM", "SUM", false));
                    dim3PropertyList.Add(new ReportGridDim3Property("CompeletePut", "0", "SUM", "SUM", false));
                }
                else if (string.Compare(inputOutput.Trim(), "Input", true) == 0)
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("Input", "0", "SUM", "SUM", false));
                }
                else if (string.Compare(inputOutput.Trim(), "Output", true) == 0)
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("Output", "0", "SUM", "SUM", false));
                }
                else if (string.Compare(inputOutput.Trim(), "CompeletePut", true) == 0)
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("CompeletePut", "0", "SUM", "SUM", false));
                }

                ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, DtSource);

                reportGridHelper.DataSource                   = dateSource;
                reportGridHelper.DataSourceForCompare         = dateSourceCompare;
                reportGridHelper.Dim1PropertyList             = fixedColumnList;
                reportGridHelper.Dim3PropertyList             = dim3PropertyList;
                reportGridHelper.HasDim3PropertyNameRowColumn = true;
                reportGridHelper.CompareType                  = compareType;
                reportGridHelper.ByTimeType                   = byTimeType;
                reportGridHelper.ShowGrid();
                base.InitWebGrid();
                this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false;
                this.gridWebGrid.Behaviors.Sorting.Enabled           = false;

                //获取表格和图示
                if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid)
                {
                    this.gridWebGrid.Visible   = true;
                    this.cmdGridExport.Visible = true;
                    this.lineChart.Visible     = false;
                    this.columnChart.Visible   = false;
                }
                else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                {
                    NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length + dateSourceCompare.Length];
                    dateSource.CopyTo(dateSourceForOWC, 0);
                    for (int i = 0; i < dateSourceCompare.Length; i++)
                    {
                        dateSourceForOWC[dateSource.Length + i] = (NewReportDomainObject)dateSourceCompare[i];
                    }
                    string propertyName = this.languageComponent1.GetString(dim3PropertyList[0].Name);
                    foreach (NewReportDomainObject domainObject in dateSourceForOWC)
                    {
                        domainObject.EAttribute1 = propertyName + domainObject.EAttribute1;
                    }

                    List <string> rowPropertyList    = GetColumns();
                    List <string> columnPropertyList = GetRows();
                    columnPropertyList.Add("EAttribute1");
                    List <string> valuePropertyList = new List <string>();
                    foreach (ReportGridDim3Property property in dim3PropertyList)
                    {
                        if (!property.Hidden)
                        {
                            valuePropertyList.Add(property.Name);
                        }
                    }
                    List <string> dataPropertyList = valuePropertyList;

                    foreach (NewReportDomainObject obj in dateSourceForOWC)
                    {
                        if (UCWhereConditions1.UserSelectInputOutput == "input")
                        {
                            obj.TempValue = obj.Input.ToString();
                        }
                        if (UCWhereConditions1.UserSelectInputOutput == "output")
                        {
                            obj.TempValue = obj.Output.ToString();
                        }
                        if (UCWhereConditions1.UserSelectInputOutput == "CompeletePut")
                        {
                            obj.TempValue = obj.CompeletePut.ToString();
                        }
                        //added by Alex hu
                        //时段、班次、天、周、月、年
                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Period)
                        {
                            obj.PeriodCode = obj.PeriodCode.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Shift)
                        {
                            obj.PeriodCode = obj.ShiftCode.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.ShiftDay)
                        {
                            obj.PeriodCode = obj.ShiftDay.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Week)
                        {
                            obj.PeriodCode = obj.Week.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Month)
                        {
                            obj.PeriodCode = obj.Month.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Year)
                        {
                            obj.PeriodCode = obj.Year.ToString();
                        }
                        //end
                    }

                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart)
                    {
                        this.columnChart.Visible = false;
                        this.lineChart.Visible   = true;

                        lineChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            lineChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            lineChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.lineChart.ChartTextFormatString = "<DATA_VALUE:0.##>";
                        this.lineChart.YLabelFormatString    = "<DATA_VALUE:0.##>";
                        this.lineChart.DataType   = true;
                        this.lineChart.DataSource = dateSourceForOWC;
                        this.lineChart.DataBind();
                    }
                    else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                    {
                        this.columnChart.Visible = true;
                        this.lineChart.Visible   = false;

                        columnChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();
                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            columnChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            columnChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end
                        this.columnChart.ChartTextFormatString = "<DATA_VALUE:0.##>";
                        this.columnChart.YLabelFormatString    = "<DATA_VALUE:0.##>";
                        this.columnChart.DataType   = true;
                        this.columnChart.DataSource = dateSourceForOWC;
                        this.columnChart.DataBind();
                    }
                    else
                    {
                        this.columnChart.Visible = false;
                        this.lineChart.Visible   = false;
                    }

                    this.gridWebGrid.Visible = false;

                    this.cmdGridExport.Visible = false;
                }

                ReportPageHelper.SetPageScrollToBottom(this);
            }
            else
            {
                this.chbRefreshAuto.Checked = false;
                this.AutoRefresh            = false;
            }
        }
        private void _doQuery()
        {
            if (this._checkRequireFields())
            {
                object[] dateSource = this._loadDataSource();

                if (dateSource == null || dateSource.Length <= 0)
                {
                    this.gridWebGrid.Visible   = false;
                    this.cmdGridExport.Visible = false;
                    this.lineChart.Visible     = false;
                    this.columnChart.Visible   = false;

                    return;
                }
                NewReportDomainObject[] dateSourceForOWC = this.ToNewReportDomainObject(dateSource);
                //数据加载到Grid
                List <string> fixedColumnList = new List <string>();
                string[]      fixedColumn     = TimingType.ParserAttributeTimingType4(this.rblTimingType.SelectedValue);
                if (fixedColumn != null)
                {
                    foreach (string row in fixedColumn)
                    {
                        fixedColumnList.Add(row);
                    }
                }

                List <string> dim2PropertyList = new List <string>();
                string        dim2Columns      = SummaryTarget.ParserAttributeSummaryTarget3(this.rblSummaryTarget.SelectedValue);
                if (dim2Columns != null)
                {
                    dim2PropertyList.Add(dim2Columns);
                }


                List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>();


                if (this.rblYieldCatalog.SelectedValue.ToUpper() == "yieldcatalog_ppm".ToUpper())
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("TotalLocation", "0", "SUM", "SUM", false));
                    dim3PropertyList.Add(new ReportGridDim3Property("NotYieldLocation", "0", "SUM", "SUM", false));
                    dim3PropertyList.Add(new ReportGridDim3Property("PPM", "0.00%", "DIV({-1},{-2})", "DIV({-1},{-2})", false));
                }
                else if (this.rblYieldCatalog.SelectedValue.ToUpper() == "yieldcatalog_allgood".ToUpper())
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("Quantity", "0", "SUM", "SUM", false));
                    dim3PropertyList.Add(new ReportGridDim3Property("AllGoodQuantity", "0", "SUM", "SUM", false));
                    dim3PropertyList.Add(new ReportGridDim3Property("AllGoodYieldPercent", "0.00%", "DIV({-1},{-2})", "DIV({-1},{-2})", false));
                }
                else if (this.rblYieldCatalog.SelectedValue.ToUpper() == "yieldcatalog_notyield".ToUpper())
                {
                    if (string.Compare(this.V_SummaryTarget, SummaryTarget.Operation, true) == 0 ||
                        string.Compare(this.V_SummaryTarget, SummaryTarget.Resource, true) == 0)
                    {
                        dim3PropertyList.Add(new ReportGridDim3Property("AllTimes", "0", "SUM", "SUM", false));
                        dim3PropertyList.Add(new ReportGridDim3Property("NGTimes", "0", "SUM", "SUM", false));
                        dim3PropertyList.Add(new ReportGridDim3Property("NotYieldPercent", "0.00%", "DIV({-1},{-2})", "DIV({-1},{-2})", false));
                    }
                    else
                    {
                        dim3PropertyList.Add(new ReportGridDim3Property("InputQty", "0", "SUM", "SUM", false));
                        dim3PropertyList.Add(new ReportGridDim3Property("NGTimes", "0", "SUM", "SUM", false));
                        dim3PropertyList.Add(new ReportGridDim3Property("NotYieldPercent", "0.00%", "DIV({-1},{-2})", "DIV({-1},{-2})", false));
                    }
                }

                //visible style : pivot or chart
                if (this.rblVisibleStyle.SelectedValue.ToUpper() == VisibleStyle.Pivot.ToUpper())
                {
                    ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, this.DtSource);

                    reportGridHelper.DataSource                   = dateSourceForOWC;
                    reportGridHelper.Dim1PropertyList             = fixedColumnList;
                    reportGridHelper.Dim2PropertyList             = dim2PropertyList;
                    reportGridHelper.Dim3PropertyList             = dim3PropertyList;
                    reportGridHelper.HasDim3PropertyNameRowColumn = true;
                    reportGridHelper.ShowGrid();

                    this.gridWebGrid.Visible   = true;
                    this.cmdGridExport.Visible = true;
                    this.lineChart.Visible     = false;
                    this.columnChart.Visible   = false;
                }
                if (this.rblVisibleStyle.SelectedValue.ToUpper() == VisibleStyle.Chart.ToUpper())
                {
                    string[] fields       = YieldCatalog.ParserTotalFields(this.V_SummaryTarget, this.rblYieldCatalog.SelectedValue);
                    string   propertyName = this.languageComponent1.GetString(dim3PropertyList[0].Name);

                    List <string> rowPropertyList = new List <string>();
                    string[]      listRows        = TimingType.ParserAttributeTimingType4(this.rblTimingType.SelectedValue);
                    if (listRows != null)
                    {
                        foreach (string row in listRows)
                        {
                            rowPropertyList.Add(row);
                        }
                    }

                    List <string> valuePropertyList = new List <string>();
                    foreach (ReportGridDim3Property property in dim3PropertyList)
                    {
                        if (!property.Hidden)
                        {
                            valuePropertyList.Add(property.Name);
                        }
                    }
                    List <string> dataPropertyList = valuePropertyList;

                    foreach (NewReportDomainObject obj in dateSourceForOWC)
                    {
                        if (fields != null)
                        {
                            foreach (string field in fields)
                            {
                                if (field.ToUpper() == "NotYieldPercent".ToUpper())
                                {
                                    obj.TempValue = obj.NotYieldPercent.ToString();
                                }
                                else if (field.ToUpper() == "PPM".ToUpper())
                                {
                                    obj.TempValue = obj.PPM.ToString();
                                }
                                else if (field.ToUpper() == "AllGoodYieldPercent".ToUpper())
                                {
                                    obj.TempValue = obj.AllGoodYieldPercent.ToString();
                                }
                            }
                        }

                        //时段、班次、天、周、月、年
                        if (this.rblTimingType.SelectedValue == TimingType.TimePeriod.ToString())
                        {
                            obj.PeriodCode = obj.PeriodCode.ToString();
                        }

                        if (this.rblTimingType.SelectedValue == TimingType.Shift.ToString())
                        {
                            obj.PeriodCode = obj.ShiftCode.ToString();
                        }

                        if (this.rblTimingType.SelectedValue == TimingType.Day.ToString())
                        {
                            obj.PeriodCode = obj.ShiftDay.ToString();
                        }

                        if (this.rblTimingType.SelectedValue == TimingType.Week.ToString())
                        {
                            obj.PeriodCode = obj.Week.ToString();
                        }

                        if (this.rblTimingType.SelectedValue == TimingType.Month.ToString())
                        {
                            obj.PeriodCode = obj.Month.ToString();
                        }
                        //end
                    }

                    //chart display : histogram or line
                    if (this.rblChartType.SelectedValue.ToUpper() == ChartStyle.Histogram.ToUpper())
                    {
                        this.columnChart.Visible = true;
                        this.lineChart.Visible   = false;

                        columnChart.ChartGroupByString = dim2Columns;
                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            columnChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            columnChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end
                        this.columnChart.ChartTextFormatString = "<DATA_VALUE:#0.##%>";
                        this.columnChart.YLabelFormatString    = "<DATA_VALUE:#0.##%>";
                        this.columnChart.DataType   = true;
                        this.columnChart.DataSource = dateSourceForOWC;
                        this.columnChart.DataBind();
                    }
                    if (this.rblChartType.SelectedValue.ToUpper() == ChartStyle.Line.ToUpper())
                    {
                        this.columnChart.Visible = false;
                        this.lineChart.Visible   = true;

                        lineChart.ChartGroupByString = dim2Columns;

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            lineChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            lineChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.lineChart.ChartTextFormatString = "<DATA_VALUE:#0.##%>";
                        this.lineChart.YLabelFormatString    = "<DATA_VALUE:#0.##%>";
                        this.lineChart.DataType   = true;
                        this.lineChart.DataSource = dateSourceForOWC;
                        this.lineChart.DataBind();
                    }
                    this.gridWebGrid.Visible   = false;
                    this.cmdGridExport.Visible = false;
                    Response.Write("<script type='text/javascript'>scrollToBottom=true;</script>");
                }
            }
        }
        protected override void DoQuery()
        {
            base.DoQuery();

            if (this.CheckBeforeQuery())
            {
                this.AutoRefresh = this.chbRefreshAuto.Checked;

                string byTimeType      = this.UCGroupConditions1.UserSelectByTimeType.Trim().ToLower();
                string exceptionOrDuty = UCGroupConditions1.UserExceptionOrDuty;
                string dataField       = "ExceptionCode";
                if (exceptionOrDuty == NewReportExceptionOrDuty.Exception)
                {
                    dataField = "ExceptionDesc";
                }
                else if (exceptionOrDuty == NewReportExceptionOrDuty.Duty)
                {
                    dataField = "DutyDesc";
                }

                object[] dateSource = null;

                //一般数据
                dateSource = this.LoadDataSource();
                if (dateSource == null || dateSource.Length <= 0)
                {
                    this.gridWebGrid.Visible = false;
                    //this.OWCChartSpace1.Display = false;
                    this.columnChart.Visible   = false;
                    this.pieChart.Visible      = false;
                    this.cmdGridExport.Visible = false;

                    ReportPageHelper.SetPageScrollToBottom(this);
                    return;
                }

                //数据加载到Grid
                List <string> fixedColumnList = GetRows();
                fixedColumnList.AddRange(GetColumns());

                List <string> columnPropertyListForGrid        = new List <string>();
                List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>();

                columnPropertyListForGrid.Add(dataField);

                if (UCQueryDataType1.GetQueryDataType() == NewReportQueryDataType.DataNumber)
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("LostManHour", "0.0000", "SUM", "SUM", false));
                }
                else
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("LostManHourPercent", "0.00%", "SUM", "SUM", false));
                }

                ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, DtSource);

                reportGridHelper.DataSource                   = dateSource;
                reportGridHelper.Dim1PropertyList             = fixedColumnList;
                reportGridHelper.Dim2PropertyList             = columnPropertyListForGrid;
                reportGridHelper.Dim3PropertyList             = dim3PropertyList;
                reportGridHelper.HasDim3PropertyNameRowColumn = true;
                reportGridHelper.ByTimeType                   = byTimeType;

                reportGridHelper.ShowGrid();
                reportGridHelper.AddPercentByRow(false, "0.00%");
                base.InitWebGrid();

                this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false;
                this.gridWebGrid.Behaviors.Sorting.Enabled           = false;

                //修正最后的汇总列里面数据(接近100修改为100)
                if (UCQueryDataType1.GetQueryDataType() == NewReportQueryDataType.DataRate)
                {
                    if (this.gridWebGrid.Rows.Count > 0 && this.gridWebGrid.Columns.Count > 0)
                    {
                        string sumCellText = this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[this.gridWebGrid.Columns.Count - 1].Text.Trim();
                        if (sumCellText.Length > 0 && sumCellText.IndexOf("%") == sumCellText.Length - 1)
                        {
                            this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[this.gridWebGrid.Columns.Count - 1].Text = "100.00%";
                        }
                    }

                    if (this.gridWebGrid.Rows.Count == 2 && this.gridWebGrid.Columns.Count > 0)
                    {
                        string sumCellText = this.gridWebGrid.Rows[0].Items[this.gridWebGrid.Columns.Count - 1].Text.Trim();
                        if (sumCellText.Length > 0 && sumCellText.IndexOf("%") == sumCellText.Length - 1)
                        {
                            this.gridWebGrid.Rows[0].Items[this.gridWebGrid.Columns.Count - 1].Text = "100.00%";
                        }
                    }
                }

                //获取表格和图示
                if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid)
                {
                    this.gridWebGrid.Visible = true;
                    //this.OWCChartSpace1.Display = false;
                    this.pieChart.Visible      = false;
                    this.columnChart.Visible   = false;
                    this.cmdGridExport.Visible = true;
                }
                else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                {
                    List <string> rowPropertyList = new List <string>();
                    rowPropertyList.Add(dataField);

                    List <string> columnPropertyList = GetRows();
                    columnPropertyList.AddRange(GetColumns());

                    List <string> dataPropertyList = new List <string>();
                    dataPropertyList.Add("LostManHourPercent");

                    NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length];
                    dateSource.CopyTo(dateSourceForOWC, 0);



                    //针对于饼图,数据源只使用最下面的汇总行的数据
                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart)
                    {
                        int count = this.gridWebGrid.Columns.Count - fixedColumnList.Count - 2;
                        dateSourceForOWC = new NewReportDomainObject[count];

                        float totalErrorCount = GetFloatFromGrid(this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[this.gridWebGrid.Columns.Count - 1].Text);
                        for (int i = fixedColumnList.Count + 1; i < this.gridWebGrid.Columns.Count - 1; i++)
                        {
                            NewReportDomainObject domainObject = new NewReportDomainObject();

                            if (exceptionOrDuty == NewReportExceptionOrDuty.Exception)
                            {
                                domainObject.ExceptionDesc = this.gridWebGrid.Columns[i].Header.Text;
                            }
                            else if (exceptionOrDuty == NewReportExceptionOrDuty.Duty)
                            {
                                domainObject.DutyDesc = this.gridWebGrid.Columns[i].Header.Text;
                            }

                            if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Period)
                            {
                                domainObject.PeriodCode = this.gridWebGrid.Columns[i].Header.Text;;
                            }

                            if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Shift)
                            {
                                domainObject.ShiftCode = this.gridWebGrid.Columns[i].Header.Text;;
                            }

                            if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.ShiftDay)
                            {
                                domainObject.ShiftDay = this.gridWebGrid.Columns[i].Header.Text;;
                            }

                            if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Week)
                            {
                                domainObject.Week = this.gridWebGrid.Columns[i].Header.Text;;
                            }

                            if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Month)
                            {
                                domainObject.Month = this.gridWebGrid.Columns[i].Header.Text;;
                            }

                            if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Year)
                            {
                                domainObject.Year = this.gridWebGrid.Columns[i].Header.Text;;
                            }

                            float errorCount = GetFloatFromGrid(this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[i].Text);
                            domainObject.LostManHourPercent = errorCount / totalErrorCount;

                            dateSourceForOWC[i - fixedColumnList.Count - 1] = domainObject;
                        }

                        columnPropertyList.Clear();
                        rowPropertyList.Clear();
                        rowPropertyList.Add(dataField);
                    }
                    else
                    {
                        int countRow    = this.gridWebGrid.Rows.Count - 1;
                        int countColumn = this.gridWebGrid.Columns.Count - fixedColumnList.Count - 2;
                        dateSourceForOWC = new NewReportDomainObject[countRow * countColumn];

                        Type t = typeof(NewReportDomainObject);

                        for (int i = 0; i < this.gridWebGrid.Rows.Count - 1; i++)
                        {
                            float totalErrorCount = GetFloatFromGrid(this.gridWebGrid.Rows[i].Items[this.gridWebGrid.Columns.Count - 1].Text);

                            for (int j = fixedColumnList.Count + 1; j < this.gridWebGrid.Columns.Count - 1; j++)
                            {
                                //NewReportDomainObject domainObject = (NewReportDomainObject)dateSourceForOWC[i * countColumn + (j - fixedColumnList.Count - 1)];//new NewReportDomainObject();

                                NewReportDomainObject domainObject = new NewReportDomainObject();

                                for (int k = 0; k < fixedColumnList.Count; k++)
                                {
                                    t.GetField(fixedColumnList[k]).SetValue(domainObject, this.gridWebGrid.Rows[i].Items[k].Text);
                                }

                                if (exceptionOrDuty == NewReportExceptionOrDuty.Exception)
                                {
                                    domainObject.ExceptionDesc = this.gridWebGrid.Columns[j].Header.Text;
                                }
                                else if (exceptionOrDuty == NewReportExceptionOrDuty.Duty)
                                {
                                    domainObject.DutyDesc = this.gridWebGrid.Columns[j].Header.Text;
                                }


                                if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Period)
                                {
                                    domainObject.PeriodCode = this.gridWebGrid.Columns[j].Header.Text;;
                                }

                                if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Shift)
                                {
                                    domainObject.ShiftCode = this.gridWebGrid.Columns[j].Header.Text;;
                                }

                                if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.ShiftDay)
                                {
                                    domainObject.ShiftDay = this.gridWebGrid.Columns[j].Header.Text;;
                                }

                                if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Week)
                                {
                                    domainObject.Week = this.gridWebGrid.Columns[j].Header.Text;;
                                }

                                if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Month)
                                {
                                    domainObject.Month = this.gridWebGrid.Columns[j].Header.Text;;
                                }

                                if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Year)
                                {
                                    domainObject.Year = this.gridWebGrid.Columns[j].Header.Text;;
                                }


                                float errorCount = GetFloatFromGrid(this.gridWebGrid.Rows[i].Items[j].Text);
                                domainObject.LostManHourPercent = errorCount / totalErrorCount;

                                //dateSourceForOWC[i - fixedColumnList.Count - 1] = domainObject;
                                dateSourceForOWC[i * countColumn + (j - fixedColumnList.Count - 1)] = domainObject;
                            }
                        }
                    }

                    string propertyName = this.languageComponent1.GetString(dataPropertyList[0]);
                    foreach (NewReportDomainObject domainObject in dateSourceForOWC)
                    {
                        domainObject.EAttribute1 = propertyName + domainObject.EAttribute1;
                    }

                    foreach (NewReportDomainObject obj in dateSourceForOWC)
                    {
                        obj.TempValue = obj.LostManHourPercent.ToString();

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Period)
                        {
                            obj.PeriodCode = obj.PeriodCode.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Shift)
                        {
                            obj.PeriodCode = obj.ShiftCode.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.ShiftDay)
                        {
                            obj.PeriodCode = obj.ShiftDay.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Week)
                        {
                            obj.PeriodCode = obj.Week.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Month)
                        {
                            obj.PeriodCode = obj.Month.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Year)
                        {
                            obj.PeriodCode = obj.Year.ToString();
                        }
                    }



                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart)
                    {
                        this.columnChart.Visible = false;
                        this.pieChart.Visible    = true;

                        pieChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            pieChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            pieChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.pieChart.ChartTextFormatString = "<DATA_VALUE:0.00%>";
                        this.pieChart.YLabelFormatString    = "<DATA_VALUE:0.##%>";
                        this.pieChart.DataType   = true;
                        this.pieChart.DataSource = dateSourceForOWC;
                        this.pieChart.DataBind();
                    }
                    else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                    {
                        this.columnChart.Visible = true;
                        this.pieChart.Visible    = false;

                        columnChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            columnChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            columnChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.columnChart.ChartTextFormatString = "<DATA_VALUE:#0.##%>";
                        this.columnChart.YLabelFormatString    = "<DATA_VALUE:#0.##%>";
                        this.columnChart.DataType   = true;
                        this.columnChart.DataSource = dateSourceForOWC;
                        this.columnChart.DataBind();
                    }
                    else
                    {
                        this.columnChart.Visible = false;
                        this.pieChart.Visible    = false;
                    }

                    this.gridWebGrid.Visible = false;
                    //this.OWCChartSpace1.Display = true;

                    this.cmdGridExport.Visible = false;
                }

                ReportPageHelper.SetPageScrollToBottom(this);
            }
            else
            {
                this.chbRefreshAuto.Checked = false;
                this.AutoRefresh            = false;
            }
        }
Beispiel #5
0
        protected override void DoQuery()
        {
            base.DoQuery();

            if (this.CheckBeforeQuery())
            {
                this.AutoRefresh = this.chbRefreshAuto.Checked;

                string   compareType       = this.UCGroupConditions1.UserSelectCompareType.Trim().ToLower();
                string   byTimeType        = this.UCGroupConditions1.UserSelectByTimeType.Trim().ToLower();
                object[] dateSource        = null;
                object[] dateSourceCompare = null;

                //一般数据
                dateSource = this.LoadDataSource(false, compareType.Trim().Length > 0);

                if (dateSource == null || dateSource.Length <= 0)
                {
                    this.gridWebGrid.Visible   = false;
                    this.cmdGridExport.Visible = false;
                    this.columnChart.Visible   = false;
                    this.pieChart.Visible      = false;

                    ReportPageHelper.SetPageScrollToBottom(this);
                    return;
                }

                //环比/同期比数据
                if (compareType.Trim().Length > 0)
                {
                    dateSourceCompare = this.LoadDataSource(true, true);
                }
                if (dateSourceCompare == null)
                {
                    dateSourceCompare = new NewReportDomainObject[0] {
                    };
                }

                //数据加载到Grid
                List <string> dim1PropertyList = GetRows();
                dim1PropertyList.Add("OQCSampleSize");
                dim1PropertyList.Add("TotalGradeTimes");
                dim1PropertyList.Add("ZGradeTimes");
                dim1PropertyList.Add("AGradeTimes");
                dim1PropertyList.Add("BGradeTimes");
                dim1PropertyList.Add("CGradeTimes");

                List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>();
                dim3PropertyList.Add(new ReportGridDim3Property("Input", "0", "SUM", "SUM", false));

                ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, this.DtSource);
                reportGridHelper.DataSource                   = dateSource;
                reportGridHelper.DataSourceForCompare         = dateSourceCompare;
                reportGridHelper.Dim1PropertyList             = dim1PropertyList;
                reportGridHelper.Dim3PropertyList             = dim3PropertyList;
                reportGridHelper.HasDim3PropertyNameRowColumn = true;
                reportGridHelper.CompareType                  = compareType;
                reportGridHelper.ByTimeType                   = byTimeType;

                reportGridHelper.ShowGrid();


                this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false;
                this.gridWebGrid.Behaviors.Sorting.Enabled           = false;


                #region 非正规操作
                DataTable dtGrid = gridWebGrid.DataSource as DataTable;

                for (int i = this.gridWebGrid.Columns.Count - 8; i < this.gridWebGrid.Columns.Count - 2; i++)
                {
                    //数字汇总
                    string sum = "0";
                    for (int j = 0; j < this.gridWebGrid.Rows.Count - 1; j++)
                    {
                        try
                        {
                            sum = ReportGridHelper.StringCalc("ADD", sum, this.gridWebGrid.Rows[j].Items[i].Text);
                        }
                        catch
                        {
                            continue;
                        }
                    }
                    dtGrid.Rows[this.gridWebGrid.Rows.Count - 1][i] = sum;
                    this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[i].Text = sum;

                    //数字右对齐
                    for (int j = 0; j < this.gridWebGrid.Rows.Count; j++)
                    {
                        this.gridWebGrid.Rows[j].Items[i].CssClass = "TextAlignRight";
                    }
                }

                if (UCQueryDataType1.GetQueryDataType() == NewReportQueryDataType.DataRate)
                {
                    for (int i = this.gridWebGrid.Columns.Count - 7; i < this.gridWebGrid.Columns.Count - 2; i++)
                    {
                        //换算成百分比
                        string percent = "0";
                        for (int j = 0; j < this.gridWebGrid.Rows.Count; j++)
                        {
                            percent           = ReportGridHelper.StringCalc("DIV", this.gridWebGrid.Rows[j].Items[i].Text, this.gridWebGrid.Rows[j].Items[this.gridWebGrid.Columns.Count - 5].Text + ".00");
                            percent           = ReportGridHelper.StringCalc("MUL", percent, "100");
                            dtGrid.Rows[j][i] = float.Parse(percent).ToString("0.00");;
                            this.gridWebGrid.Rows[j].Items[i].Text = float.Parse(percent).ToString("0.00");
                        }
                    }
                }

                //dtGrid.Columns.RemoveAt(this.gridWebGrid.Columns.Count - 1);
                //dtGrid.Columns.RemoveAt(this.gridWebGrid.Columns.Count - 2);
                ((BoundDataField)this.gridWebGrid.Columns[this.gridWebGrid.Columns.Count - 1]).Hidden = true;
                ((BoundDataField)this.gridWebGrid.Columns[this.gridWebGrid.Columns.Count - 2]).Hidden = true;
                this.gridWebGrid.DataSource = dtGrid;
                this.gridWebGrid.DataBind();
                base.InitWebGrid();
                #endregion

                //获取表格和图示
                if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid)
                {
                    this.gridWebGrid.Visible   = true;
                    this.cmdGridExport.Visible = true;
                    this.columnChart.Visible   = false;
                    this.pieChart.Visible      = false;
                }
                else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                {
                    List <string> rowPropertyList = new List <string>();
                    rowPropertyList.Add("EAttribute1");

                    List <string> columnPropertyList = new List <string>();

                    List <string> dataPropertyList = new List <string>();
                    if (UCQueryDataType1.GetQueryDataType() == NewReportQueryDataType.DataNumber)
                    {
                        dataPropertyList.Add("TotalGradeTimes");
                    }
                    else
                    {
                        dataPropertyList.Add("GradeTimesPercent");
                    }

                    NewReportDomainObject[] dateSourceForOWC = null;

                    //针对于饼图和饼图,数据源只使用最下面的汇总行的数据
                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart)
                    {
                        dateSourceForOWC = new NewReportDomainObject[4];

                        for (int i = this.gridWebGrid.Columns.Count - 6; i < this.gridWebGrid.Columns.Count - 2; i++)
                        {
                            NewReportDomainObject domainObject = new NewReportDomainObject();
                            domainObject.EAttribute1 = this.gridWebGrid.Columns[i].Header.Text;
                            if (UCQueryDataType1.GetQueryDataType() == NewReportQueryDataType.DataNumber)
                            {
                                domainObject.TotalGradeTimes = int.Parse(this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[i].Text);
                            }
                            else
                            {
                                domainObject.GradeTimesPercent = float.Parse(this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[i].Text.Replace("%", "")) / 100;
                            }

                            dateSourceForOWC[i - this.gridWebGrid.Columns.Count + 6] = domainObject;
                        }
                    }
                    else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                    {
                        columnPropertyList = GetRows();

                        dateSourceForOWC = new NewReportDomainObject[4 * (this.gridWebGrid.Rows.Count - 1)];

                        for (int i = this.gridWebGrid.Columns.Count - 6; i < this.gridWebGrid.Columns.Count - 2; i++)
                        {
                            for (int j = 0; j < this.gridWebGrid.Rows.Count - 1; j++)
                            {
                                NewReportDomainObject domainObject = new NewReportDomainObject();

                                foreach (string property in columnPropertyList)
                                {
                                    ReportGridHelper.SetValueByPropertyName(domainObject, property, this.gridWebGrid.Rows[j].Items.FindItemByKey(property).Text);
                                }

                                domainObject.EAttribute1 = this.gridWebGrid.Columns[i].Header.Text;
                                if (UCQueryDataType1.GetQueryDataType() == NewReportQueryDataType.DataNumber)
                                {
                                    domainObject.TotalGradeTimes = int.Parse(this.gridWebGrid.Rows[j].Items[i].Text);
                                }
                                else
                                {
                                    domainObject.GradeTimesPercent = float.Parse(this.gridWebGrid.Rows[j].Items[i].Text.Replace("%", "")) / 100;
                                }

                                dateSourceForOWC[(i - this.gridWebGrid.Columns.Count + 6) * (this.gridWebGrid.Rows.Count - 1) + j] = domainObject;
                            }
                        }
                    }


                    //add by seven 20110111
                    foreach (NewReportDomainObject obj in dateSourceForOWC)
                    {
                        if (UCQueryDataType1.GetQueryDataType().Trim().ToLower() == NewReportQueryDataType.DataNumber)
                        {
                            obj.TempValue = obj.TotalGradeTimes.ToString();
                        }
                        else
                        {
                            obj.TempValue = obj.GradeTimesPercent.ToString();
                        }
                        obj.PeriodCode = obj.EAttribute1.ToString();
                    }

                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                    {
                        this.columnChart.Visible = true;
                        this.pieChart.Visible    = false;

                        columnChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            columnChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            columnChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        if (UCQueryDataType1.GetQueryDataType().Trim().ToLower() == NewReportQueryDataType.DataNumber)
                        {
                            this.columnChart.ChartTextFormatString = "<DATA_VALUE:#0.##>";
                            this.columnChart.YLabelFormatString    = "<DATA_VALUE:#0.##>";
                        }
                        else
                        {
                            this.columnChart.ChartTextFormatString = "<DATA_VALUE:#0.##%>";
                            this.columnChart.YLabelFormatString    = "<DATA_VALUE:#0.##%>";
                        }
                        this.columnChart.DataType   = true;
                        this.columnChart.DataSource = dateSourceForOWC;
                        this.columnChart.DataBindOQC();
                    }
                    else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart)
                    {
                        this.columnChart.Visible    = false;
                        this.pieChart.Visible       = true;
                        pieChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            pieChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            pieChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        if (UCQueryDataType1.GetQueryDataType().Trim().ToLower() == NewReportQueryDataType.DataNumber)
                        {
                            this.pieChart.ChartTextFormatString = "<DATA_VALUE:#0.##>";
                            this.pieChart.YLabelFormatString    = "<DATA_VALUE:#0.##>";
                        }
                        else
                        {
                            this.pieChart.ChartTextFormatString = "<DATA_VALUE:#0.##%>";
                            this.pieChart.YLabelFormatString    = "<DATA_VALUE:#0.##%>";
                        }
                        this.pieChart.DataType   = true;
                        this.pieChart.DataSource = dateSourceForOWC;
                        this.pieChart.DataBindOQC();
                    }
                    else
                    {
                        this.columnChart.Visible = false;
                        this.pieChart.Visible    = false;
                    }

                    this.gridWebGrid.Visible   = false;
                    this.cmdGridExport.Visible = false;
                }
                ReportPageHelper.SetPageScrollToBottom(this);


                //this.gridWebGrid.Columns.RemoveAt(this.gridWebGrid.Columns.Count - 1);
                //this.gridWebGrid.Columns.RemoveAt(this.gridWebGrid.Columns.Count - 1);
                //this.gridWebGrid.Columns.RemoveAt(this.gridWebGrid.Columns.Count - 1);
            }
            else
            {
                this.chbRefreshAuto.Checked = false;
                this.AutoRefresh            = false;
            }
        }
        private void DoQuery()
        {
            if (this.CheckBeforeQuery())
            {
                this.AutoRefresh = this.chbRefreshAuto.Checked;

                string   compareType       = this.UCGroupConditions1.UserSelectCompareType.Trim().ToLower();
                string   byTimeType        = this.UCGroupConditions1.UserSelectByTimeType.Trim().ToLower();
                string   inputOutput       = this.UCWhereConditions1.UserSelectInputOutput.Trim().ToLower();
                object[] dateSource        = null;
                object[] dateSourceCompare = null;



                //一般数据
                dateSource = this.LoadDataSource(false, compareType.Trim().Length > 0);
                if (dateSource == null || dateSource.Length <= 0)
                {
                    this.gridWebGrid.Visible = false;
                    //this.OWCChartSpace1.Display = false;
                    this.cmdGridExport.Visible = false;
                    this.columnChart.Visible   = false;
                    this.pieChart.Visible      = false;

                    ReportPageHelper.SetPageScrollToBottom(this);
                    return;
                }

                //环比/同期比数据
                if (compareType.Trim().Length > 0)
                {
                    dateSourceCompare = this.LoadDataSource(true, true);
                }
                if (dateSourceCompare == null)
                {
                    dateSourceCompare = new NewReportDomainObject[0] {
                    };
                }

                //数据加载到Grid
                List <string> fixedColumnList                  = GetRows();
                List <string> columnPropertyListForGrid        = new List <string>();
                List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>();

                columnPropertyListForGrid.Add("DutyDesc");

                if (UCQueryDataType1.GetQueryDataType() == NewReportQueryDataType.DataNumber)
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("ErrorCount", "0", "SUM", "SUM", false));
                }
                else
                {
                    dim3PropertyList.Add(new ReportGridDim3Property("ErrorPercent", "0.00%", "SUM", "SUM", false));
                }

                ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, DtSource);

                reportGridHelper.DataSource                   = dateSource;
                reportGridHelper.DataSourceForCompare         = dateSourceCompare;
                reportGridHelper.Dim1PropertyList             = fixedColumnList;
                reportGridHelper.Dim2PropertyList             = columnPropertyListForGrid;
                reportGridHelper.Dim3PropertyList             = dim3PropertyList;
                reportGridHelper.HasDim3PropertyNameRowColumn = true;
                reportGridHelper.CompareType                  = compareType;
                reportGridHelper.ByTimeType                   = byTimeType;

                reportGridHelper.ShowGrid();
                reportGridHelper.AddPercentByRow(false, "0.00%");

                //修正最后的汇总列里面数据(接近100修改为100)
                if (UCQueryDataType1.GetQueryDataType() == NewReportQueryDataType.DataRate)
                {
                    if (this.gridWebGrid.Rows.Count > 0 && this.gridWebGrid.Columns.Count > 0)
                    {
                        string sumCellText = this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[this.gridWebGrid.Columns.Count - 1].Text.Trim();
                        if (sumCellText.Length > 0 && sumCellText.IndexOf("%") == sumCellText.Length - 1)
                        {
                            this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[this.gridWebGrid.Columns.Count - 1].Text = "100.00%";
                        }
                    }

                    if (this.gridWebGrid.Rows.Count == 2 && this.gridWebGrid.Columns.Count > 0)
                    {
                        string sumCellText = this.gridWebGrid.Rows[0].Items[this.gridWebGrid.Columns.Count - 1].Text.Trim();
                        if (sumCellText.Length > 0 && sumCellText.IndexOf("%") == sumCellText.Length - 1)
                        {
                            this.gridWebGrid.Rows[0].Items[this.gridWebGrid.Columns.Count - 1].Text = "100.00%";
                        }
                    }
                }

                //获取表格和图示
                if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid)
                {
                    this.gridWebGrid.Visible = true;
                    //this.OWCChartSpace1.Display = false;
                    this.cmdGridExport.Visible = true;
                    this.columnChart.Visible   = false;
                    this.pieChart.Visible      = false;
                }
                else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                {
                    List <string> rowPropertyList = GetColumns();
                    rowPropertyList.Add("DutyDesc");
                    List <string> columnPropertyList = GetRows();
                    columnPropertyList.Add("EAttribute1");
                    List <string> dataPropertyList = new List <string>();
                    dataPropertyList.Add("ErrorPercent");

                    NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length + dateSourceCompare.Length];
                    dateSource.CopyTo(dateSourceForOWC, 0);
                    for (int i = 0; i < dateSourceCompare.Length; i++)
                    {
                        dateSourceForOWC[dateSource.Length + i] = (NewReportDomainObject)dateSourceCompare[i];
                    }

                    //针对于饼图,数据源只使用最下面的汇总行的数据
                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart)
                    {
                        int count = this.gridWebGrid.Columns.Count - fixedColumnList.Count - 2;
                        dateSourceForOWC = new NewReportDomainObject[count];

                        float totalErrorCount = GetFloatFromGrid(this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[this.gridWebGrid.Columns.Count - 1].Text);
                        for (int i = fixedColumnList.Count + 1; i < this.gridWebGrid.Columns.Count - 1; i++)
                        {
                            NewReportDomainObject domainObject = new NewReportDomainObject();

                            domainObject.DutyDesc = this.gridWebGrid.Columns[i].Header.Text;
                            float errorCount = GetFloatFromGrid(this.gridWebGrid.Rows[this.gridWebGrid.Rows.Count - 1].Items[i].Text);
                            domainObject.ErrorPercent = errorCount / totalErrorCount;

                            dateSourceForOWC[i - fixedColumnList.Count - 1] = domainObject;
                        }

                        columnPropertyList.Clear();
                        rowPropertyList.Clear();
                        rowPropertyList.Add("DutyDesc");
                    }
                    else
                    {
                        int countRow    = this.gridWebGrid.Rows.Count - 1;
                        int countColumn = this.gridWebGrid.Columns.Count - fixedColumnList.Count - 2;
                        dateSourceForOWC = new NewReportDomainObject[countRow * countColumn];

                        Type t = typeof(NewReportDomainObject);

                        for (int i = 0; i < this.gridWebGrid.Rows.Count - 1; i++)
                        {
                            float totalErrorCount = GetFloatFromGrid(this.gridWebGrid.Rows[i].Items[this.gridWebGrid.Columns.Count - 1].Text);

                            for (int j = fixedColumnList.Count + 1; j < this.gridWebGrid.Columns.Count - 1; j++)
                            {
                                NewReportDomainObject domainObject = new NewReportDomainObject();

                                for (int k = 0; k < fixedColumnList.Count; k++)
                                {
                                    t.GetField(fixedColumnList[k]).SetValue(domainObject, this.gridWebGrid.Rows[i].Items[k].Text);
                                }
                                domainObject.DutyDesc = this.gridWebGrid.Columns[j].Header.Text;

                                float errorCount = GetFloatFromGrid(this.gridWebGrid.Rows[i].Items[j].Text);
                                domainObject.ErrorPercent = errorCount / totalErrorCount;

                                dateSourceForOWC[i * countColumn + (j - fixedColumnList.Count - 1)] = domainObject;
                            }
                        }
                    }

                    string propertyName = this.languageComponent1.GetString(dataPropertyList[0]);
                    foreach (NewReportDomainObject domainObject in dateSourceForOWC)
                    {
                        domainObject.EAttribute1 = propertyName + domainObject.EAttribute1;
                    }

                    //ReportChartHelper reportChartHelper = new ReportChartHelper(this.OWCPivotTable1, this.OWCChartSpace1, this.languageComponent1);
                    //reportChartHelper.DataSource = dateSourceForOWC;
                    //reportChartHelper.RowPropertyList = rowPropertyList.ToArray();
                    //reportChartHelper.ColumnPropertyList = columnPropertyList.ToArray();
                    //reportChartHelper.DataPropertyList = dataPropertyList.ToArray();
                    //reportChartHelper.UserOWCChartType = UCDisplayConditions1.GetDisplayType().Trim().ToLower();
                    //reportChartHelper.IsPercent = true;

                    //reportChartHelper.LoadOWCChart();

                    foreach (NewReportDomainObject obj in dateSourceForOWC)
                    {
                        obj.TempValue = obj.ErrorPercent.ToString();

                        obj.PeriodCode = obj.DutyDesc.ToString();
                    }

                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                    {
                        this.columnChart.Visible = true;
                        this.pieChart.Visible    = false;

                        columnChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            columnChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            columnChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.columnChart.ChartTextFormatString = "<DATA_VALUE:#0.##%>";
                        this.columnChart.YLabelFormatString    = "<DATA_VALUE:#0.##%>";
                        this.columnChart.DataType   = true;
                        this.columnChart.DataSource = dateSourceForOWC;
                        this.columnChart.DataBind();
                    }
                    else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart)
                    {
                        this.columnChart.Visible    = false;
                        this.pieChart.Visible       = true;
                        pieChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            pieChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            pieChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.pieChart.ChartTextFormatString = "<DATA_VALUE:#0.##%>";
                        this.pieChart.YLabelFormatString    = "<DATA_VALUE:#0.##%>";
                        this.pieChart.DataType   = true;
                        this.pieChart.DataSource = dateSourceForOWC;
                        this.pieChart.DataBind();
                    }
                    else
                    {
                        this.columnChart.Visible = false;
                        this.pieChart.Visible    = false;
                    }

                    this.gridWebGrid.Visible = false;
                    //this.OWCChartSpace1.Display = true;
                    this.cmdGridExport.Visible = false;
                }

                ReportPageHelper.SetPageScrollToBottom(this);
            }
            else
            {
                this.chbRefreshAuto.Checked = false;
                this.AutoRefresh            = false;
            }
        }
Beispiel #7
0
        protected override void DoQuery()
        {
            base.DoQuery();

            if (this.CheckBeforeQuery())
            {
                this.AutoRefresh = this.chbRefreshAuto.Checked;

                string   compareType       = this.UCGroupConditions1.UserSelectCompareType.Trim().ToLower();
                string   byTimeType        = this.UCGroupConditions1.UserSelectByTimeType.Trim().ToLower();
                object[] dateSource        = null;
                object[] dateSourceCompare = null;

                //一般数据
                dateSource = this.LoadDataSource(false, compareType.Trim().Length > 0);

                if (dateSource == null || dateSource.Length <= 0)
                {
                    this.gridWebGrid.Visible = false;
                    //this.OWCChartSpace1.Display = false;
                    this.cmdGridExport.Visible = false;
                    this.columnChart.Visible   = false;
                    this.lineChart.Visible     = false;

                    ReportPageHelper.SetPageScrollToBottom(this);
                    return;
                }

                //环比/同期比数据
                if (compareType.Trim().Length > 0)
                {
                    dateSourceCompare = this.LoadDataSource(true, true);
                }
                if (dateSourceCompare == null)
                {
                    dateSourceCompare = new NewReportDomainObject[0] {
                    };
                }

                //数据加载到Grid
                List <string> fixedColumnList = GetRows();
                List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>();

                dim3PropertyList.Add(new ReportGridDim3Property("OQCSampleSize", "0", "SUM", "SUM", false));
                dim3PropertyList.Add(new ReportGridDim3Property("OQCNGCount", "0", "SUM", "SUM", false));
                dim3PropertyList.Add(new ReportGridDim3Property("OQCSampleNGRatePPM", "0.00", "PPM({-1},{-2})", "PPM({-1},{-2})", false));

                ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, this.DtSource);
                reportGridHelper.DataSource                   = dateSource;
                reportGridHelper.DataSourceForCompare         = dateSourceCompare;
                reportGridHelper.Dim1PropertyList             = fixedColumnList;
                reportGridHelper.Dim3PropertyList             = dim3PropertyList;
                reportGridHelper.HasDim3PropertyNameRowColumn = true;
                reportGridHelper.CompareType                  = compareType;
                reportGridHelper.ByTimeType                   = byTimeType;

                reportGridHelper.ShowGrid();
                base.InitWebGrid();

                this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false;
                this.gridWebGrid.Behaviors.Sorting.Enabled           = false;

                //获取表格和图示
                if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid)
                {
                    this.gridWebGrid.Visible = true;
                    //this.OWCChartSpace1.Display = false;
                    this.cmdGridExport.Visible = true;
                    this.columnChart.Visible   = false;
                    this.lineChart.Visible     = false;
                }
                else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                {
                    List <string> rowPropertyList    = GetColumns();
                    List <string> columnPropertyList = GetRows();
                    columnPropertyList.Add("EAttribute1");
                    List <string> dataPropertyList = new List <string>();
                    dataPropertyList.Add("OQCSampleNGRatePPM");

                    NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length + dateSourceCompare.Length];
                    dateSource.CopyTo(dateSourceForOWC, 0);
                    for (int i = 0; i < dateSourceCompare.Length; i++)
                    {
                        dateSourceForOWC[dateSource.Length + i] = (NewReportDomainObject)dateSourceCompare[i];
                    }
                    string propertyName = this.languageComponent1.GetString(dataPropertyList[0]);
                    foreach (NewReportDomainObject domainObject in dateSourceForOWC)
                    {
                        domainObject.EAttribute1 = propertyName + domainObject.EAttribute1;
                    }

                    //ReportChartHelper reportChartHelper = new ReportChartHelper(this.OWCPivotTable1, this.OWCChartSpace1, this.languageComponent1);
                    //reportChartHelper.DataSource = dateSourceForOWC;
                    //reportChartHelper.RowPropertyList = rowPropertyList.ToArray();
                    //reportChartHelper.ColumnPropertyList = columnPropertyList.ToArray();
                    //reportChartHelper.DataPropertyList = dataPropertyList.ToArray();
                    //reportChartHelper.UserOWCChartType = UCDisplayConditions1.GetDisplayType().Trim().ToLower();
                    //reportChartHelper.IsPercent = false;

                    //reportChartHelper.LoadOWCChart();

                    foreach (NewReportDomainObject obj in dateSourceForOWC)
                    {
                        obj.TempValue = obj.OQCSampleNGRatePPM.ToString();
                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Period)
                        {
                            obj.PeriodCode = obj.PeriodCode.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Shift)
                        {
                            obj.PeriodCode = obj.ShiftCode.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.ShiftDay)
                        {
                            obj.PeriodCode = obj.ShiftDay.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Week)
                        {
                            obj.PeriodCode = obj.Week.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Month)
                        {
                            obj.PeriodCode = obj.Month.ToString();
                        }

                        if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Year)
                        {
                            obj.PeriodCode = obj.Year.ToString();
                        }
                    }

                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart)
                    {
                        this.columnChart.Visible     = false;
                        this.lineChart.Visible       = true;
                        lineChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            lineChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            lineChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.lineChart.ChartTextFormatString = "<DATA_VALUE:0.##>";
                        this.lineChart.YLabelFormatString    = "<DATA_VALUE:0.##>";
                        this.lineChart.DataType   = true;
                        this.lineChart.DataSource = dateSourceForOWC;
                        this.lineChart.DataBind();
                    }
                    else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                    {
                        this.columnChart.Visible = true;
                        this.lineChart.Visible   = false;

                        columnChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString();

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            columnChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            columnChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.columnChart.ChartTextFormatString = "<DATA_VALUE:#0.##>";
                        this.columnChart.YLabelFormatString    = "<DATA_VALUE:#0.##>";
                        this.columnChart.DataType   = true;
                        this.columnChart.DataSource = dateSourceForOWC;
                        this.columnChart.DataBind();
                    }
                    else
                    {
                        this.columnChart.Visible = false;
                        this.lineChart.Visible   = false;
                    }
                    this.gridWebGrid.Visible = false;
                    //this.OWCChartSpace1.Display = true;
                    this.cmdGridExport.Visible = false;
                }

                ReportPageHelper.SetPageScrollToBottom(this);
            }
            else
            {
                this.chbRefreshAuto.Checked = false;
                this.AutoRefresh            = false;
            }
        }
        private void _DoQuery()
        {
            DtSource = new DataTable();
            this.gridWebGrid.ClearDataSource();
            this.gridWebGrid.Columns.Clear();
            this.gridHelper = new GridHelperNew(this.gridWebGrid, this.DtSource);

            if (this._checkRequireFields())
            {
                this.AutoRefresh = this.chbRefreshAuto.Checked;

                string byTimeType = TimingType.ParserAttributeTimingType3(this.rblTimingType.SelectedValue);


                //一般数据
                object[] dateSource = this._loadDataSource();

                if (dateSource == null || dateSource.Length <= 0)
                {
                    this.gridWebGrid.Visible   = false;
                    this.cmdGridExport.Visible = false;
                    this.lineChart.Visible     = false;
                    this.columnChart.Visible   = false;

                    ReportPageHelper.SetPageScrollToBottom(this);
                    return;
                }

                NewReportDomainObject[] dateSourceForOWC = this.ToNewReportDomainObject(dateSource);
                object[] dateSourceCompare = new NewReportDomainObject[0] {
                };

                //数据加载到Grid
                List <string> fixedColumnList = new List <string>();
                string        ColumnList      = SummaryTarget.ParserAttributeSummaryTarget3(this.rblSummaryTarget.SelectedValue);
                fixedColumnList.Add(ColumnList);
                this.txtColumn.Text = ColumnList;

                List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>();

                dim3PropertyList.Add(new ReportGridDim3Property("InputQty", "0", "SUM", "SUM", false));
                dim3PropertyList.Add(new ReportGridDim3Property("OutputQty", "0", "SUM", "SUM", false));


                ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, DtSource);

                reportGridHelper.DataSource                   = dateSourceForOWC;
                reportGridHelper.DataSourceForCompare         = dateSourceCompare;
                reportGridHelper.Dim1PropertyList             = fixedColumnList;
                reportGridHelper.Dim3PropertyList             = dim3PropertyList;
                reportGridHelper.HasDim3PropertyNameRowColumn = true;
                reportGridHelper.CompareType                  = "";
                reportGridHelper.ByTimeType                   = byTimeType;

                reportGridHelper.ShowGrid();
                base.InitWebGrid();


                //获取表格和图示
                if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid)
                {
                    this.gridWebGrid.Visible   = true;
                    this.cmdGridExport.Visible = true;
                    this.lineChart.Visible     = false;
                    this.columnChart.Visible   = false;
                }
                else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart ||
                         UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                {
                    string propertyName = this.languageComponent1.GetString(dim3PropertyList[0].Name);
                    foreach (NewReportDomainObject domainObject in dateSourceForOWC)
                    {
                        domainObject.EAttribute1 = propertyName + domainObject.EAttribute1;
                    }

                    List <string> rowPropertyList = new List <string>();
                    string[]      rows            = TimingType.ParserAttributeTimingType2(this.rblTimingType.SelectedValue);
                    if (rows != null)
                    {
                        foreach (string row in rows)
                        {
                            rowPropertyList.Add(row);
                        }
                    }

                    List <string> columnPropertyList = new List <string>();
                    string[]      columns            = SummaryTarget.ParserAttributeSummaryTarget2(this.rblSummaryTarget.SelectedValue);
                    if (columns != null)
                    {
                        foreach (string column in columns)
                        {
                            columnPropertyList.Add(column);
                        }
                    }
                    columnPropertyList.Add("EAttribute1");
                    List <string> valuePropertyList = new List <string>();
                    foreach (ReportGridDim3Property property in dim3PropertyList)
                    {
                        if (!property.Hidden)
                        {
                            valuePropertyList.Add(property.Name);
                        }
                    }
                    List <string> dataPropertyList = valuePropertyList;

                    foreach (NewReportDomainObject obj in dateSourceForOWC)
                    {
                        obj.TempValue = obj.InputQty.ToString();

                        //时段、班次、天、周、月、年
                        if (this.rblTimingType.SelectedValue == TimingType.TimePeriod.ToString())
                        {
                            obj.PeriodCode = obj.PeriodCode.ToString();
                        }

                        if (this.rblTimingType.SelectedValue == TimingType.Shift.ToString())
                        {
                            obj.PeriodCode = obj.ShiftCode.ToString();
                        }

                        if (this.rblTimingType.SelectedValue == TimingType.Day.ToString())
                        {
                            obj.PeriodCode = obj.ShiftDay.ToString();
                        }

                        if (this.rblTimingType.SelectedValue == TimingType.Week.ToString())
                        {
                            obj.PeriodCode = obj.Week.ToString();
                        }

                        if (this.rblTimingType.SelectedValue == TimingType.Month.ToString())
                        {
                            obj.PeriodCode = obj.Month.ToString();
                        }
                        //end
                    }

                    if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart)
                    {
                        this.columnChart.Visible = false;
                        this.lineChart.Visible   = true;

                        lineChart.ChartGroupByString = ColumnList;

                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            lineChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            lineChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end

                        this.lineChart.ChartTextFormatString = "<DATA_VALUE:0.##>";
                        this.lineChart.YLabelFormatString    = "<DATA_VALUE:0.##>";
                        this.lineChart.DataType   = true;
                        this.lineChart.DataSource = dateSourceForOWC;
                        this.lineChart.DataBind();
                    }
                    else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart)
                    {
                        this.columnChart.Visible = true;
                        this.lineChart.Visible   = false;

                        columnChart.ChartGroupByString = ColumnList;
                        //设置首页报表的大小
                        if (ViewState["Width"] != null)
                        {
                            columnChart.Width = int.Parse(ViewState["Width"].ToString());
                        }

                        if (ViewState["Height"] != null)
                        {
                            columnChart.Height = int.Parse(ViewState["Height"].ToString());
                        }
                        //end
                        this.columnChart.ChartTextFormatString = "<DATA_VALUE:0.##>";
                        this.columnChart.YLabelFormatString    = "<DATA_VALUE:0.##>";
                        this.columnChart.DataType   = true;
                        this.columnChart.DataSource = dateSourceForOWC;
                        this.columnChart.DataBind();
                    }
                    else
                    {
                        this.columnChart.Visible = false;
                        this.lineChart.Visible   = false;
                    }

                    this.gridWebGrid.Visible = false;

                    this.cmdGridExport.Visible = false;
                }

                ReportPageHelper.SetPageScrollToBottom(this);
            }
            else
            {
                this.chbRefreshAuto.Checked = false;
                this.AutoRefresh            = false;
            }
            this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false;
            this.gridWebGrid.Behaviors.Sorting.Enabled           = false;
        }