Example #1
0
        private void _doQuery()
        {
            if (this._checkRequireFields())
            {
                this.OWCPivotTable1.ClearFieldSet();

                object[] dateSource = this._loadDataSource();

                //统一使用透视表处理数据
                this.OWCPivotTable1.SetDataSource(
                    dateSource, this.getOWCSchema2());

                //visible style : pivot or chart
                if (this.rblVisibleStyle.SelectedValue.ToUpper() == VisibleStyle.Pivot.ToUpper())
                {
                    //categories
                    string[] rows = TimingType.ParserAttributeTimingType(this.rblTimingType.SelectedValue);
                    if (rows != null)
                    {
                        foreach (string row in rows)
                        {
                            this.OWCPivotTable1.AddRowFieldSet(row, false);
                        }
                    }

//					this.OWCPivotTable1.AddColumnFieldSet(
//						SummaryTarget.ParserAttributeSummaryTarget( this.V_SummaryTarget ),
//						true);
                    string[] columns = SummaryTarget.ParserAttributeSummaryTarget2(this.rblSummaryTarget.SelectedValue, this.rblYieldCatalog.SelectedValue);
                    if (columns != null)
                    {
                        foreach (string column in columns)
                        {
                            this.OWCPivotTable1.AddColumnFieldSet(column, false);
                        }
                    }

                    //values
                    string[] fields = YieldCatalog.ParserTotalFields(this.V_SummaryTarget, this.rblYieldCatalog.SelectedValue);
                    if (fields != null)
                    {
                        foreach (string field in fields)
                        {
                            if (field.ToUpper() == "YieldPercent".ToUpper())
                            {
                                this.OWCPivotTable1.AddTotalField(
                                    this.languageComponent1.GetString(field),
                                    field,
                                    PivotTotalFunctionType.Average, NumberFormat.Percent);
                            }
                            else if (field.ToUpper() == "PPM".ToUpper())
                            {
                                this.OWCPivotTable1.AddCalculatedTotalField(
                                    "PPM",
                                    "PPM",
                                    "round( [" + this.languageComponent1.GetString("NotYieldNum") + "]/[" + this.languageComponent1.GetString("TotalLocation") + "]*1000000 , 0 )",
                                    PivotTotalFunctionType.Calculated);
                            }
                            else if (field.ToUpper() == "AllGoodYieldPercent".ToUpper())
                            {
                                this.OWCPivotTable1.AddCalculatedTotalField(
                                    this.languageComponent1.GetString(field),
                                    this.languageComponent1.GetString(field),
                                    "[" + this.languageComponent1.GetString("AllGoodQuantity") + "]/[" + this.languageComponent1.GetString("Quantity") + "]",
                                    PivotTotalFunctionType.Calculated,
                                    NumberFormat.Percent);
                            }
                            else if (field.ToUpper() == "NotYieldPercent".ToUpper())
                            {
                                if (string.Compare(this.V_SummaryTarget, SummaryTarget.Operation, true) == 0 ||
                                    string.Compare(this.V_SummaryTarget, SummaryTarget.Resource, true) == 0)
                                {
                                    this.OWCPivotTable1.AddCalculatedTotalField(
                                        this.languageComponent1.GetString(field),
                                        this.languageComponent1.GetString(field),
                                        "[" + this.languageComponent1.GetString("NGTimes") + "]/[" + this.languageComponent1.GetString("AllTimes") + "]",
                                        PivotTotalFunctionType.Calculated,
                                        NumberFormat.Percent);
                                }
                                else
                                {
                                    this.OWCPivotTable1.AddCalculatedTotalField(
                                        this.languageComponent1.GetString(field),
                                        this.languageComponent1.GetString(field),
                                        "[" + this.languageComponent1.GetString("NGTimes") + "]/[" + this.languageComponent1.GetString("InputQty") + "]",
                                        PivotTotalFunctionType.Calculated,
                                        NumberFormat.Percent);
                                }
                            }
                            else
                            {
                                this.OWCPivotTable1.AddTotalField(
                                    this.languageComponent1.GetString(field),
                                    field,
                                    PivotTotalFunctionType.Sum);
                            }
                        }
                    }

                    this.OWCPivotTable1.Display = true;
                    this.OWCChartSpace1.Display = false;
                }
                if (this.rblVisibleStyle.SelectedValue.ToUpper() == VisibleStyle.Chart.ToUpper())
                {
                    //categories
                    string[] rows = TimingType.ParserAttributeTimingType2(this.rblTimingType.SelectedValue);
                    if (rows != null)
                    {
                        foreach (string row in rows)
                        {
                            this.OWCPivotTable1.AddRowFieldSet(row, true);
                        }
                    }

                    this.OWCPivotTable1.AddColumnFieldSet(
                        SummaryTarget.ParserAttributeSummaryTarget(this.V_SummaryTarget),
                        true);

                    //values
                    this.OWCPivotTable1.RemoveAllTotalField();

                    string[] fields = YieldCatalog.ParserTotalFields(this.V_SummaryTarget, this.rblYieldCatalog.SelectedValue);
                    if (fields != null)
                    {
                        foreach (string field in fields)
                        {
                            if (field.ToUpper() == "YieldPercent".ToUpper())
                            {
                                this.OWCPivotTable1.AddTotalField(
                                    this.languageComponent1.GetString(field),
                                    field,
                                    PivotTotalFunctionType.Average, NumberFormat.Percent);
                            }
                            else if (field.ToUpper() == "PPM".ToUpper())
                            {
                                this.OWCPivotTable1.AddCalculatedTotalField(
                                    "PPM",
                                    "PPM",
                                    "round( [" + this.languageComponent1.GetString("NotYieldNum") + "]/[" + this.languageComponent1.GetString("TotalLocation") + "]*1000000 , 0 )",
                                    PivotTotalFunctionType.Calculated);
                            }
                            else if (field.ToUpper() == "AllGoodYieldPercent".ToUpper())
                            {
                                this.OWCPivotTable1.AddCalculatedTotalField(
                                    this.languageComponent1.GetString(field),
                                    this.languageComponent1.GetString(field),
                                    "[" + this.languageComponent1.GetString("AllGoodQuantity") + "]/[" + this.languageComponent1.GetString("Quantity") + "]",
                                    PivotTotalFunctionType.Calculated,
                                    NumberFormat.Percent);
                            }
                            else if (field.ToUpper() == "NotYieldPercent".ToUpper())
                            {
                                if (string.Compare(this.V_SummaryTarget, SummaryTarget.Operation, true) == 0 ||
                                    string.Compare(this.V_SummaryTarget, SummaryTarget.Resource, true) == 0)
                                {
                                    this.OWCPivotTable1.AddCalculatedTotalField(
                                        this.languageComponent1.GetString(field),
                                        this.languageComponent1.GetString(field),
                                        "[" + this.languageComponent1.GetString("NGTimes") + "]/[" + this.languageComponent1.GetString("AllTimes") + "]",
                                        PivotTotalFunctionType.Calculated,
                                        NumberFormat.Percent);
                                }
                                else
                                {
                                    this.OWCPivotTable1.AddCalculatedTotalField(
                                        this.languageComponent1.GetString(field),
                                        this.languageComponent1.GetString(field),
                                        "[" + this.languageComponent1.GetString("NGTimes") + "]/[" + this.languageComponent1.GetString("InputQty") + "]",
                                        PivotTotalFunctionType.Calculated,
                                        NumberFormat.Percent);
                                }
                            }
                            else
                            {
                                /*	Removed by Icyer 2007/01/17		在后面添加
                                 * this.OWCPivotTable1.AddTotalField(
                                 *      this.languageComponent1.GetString(field),
                                 *      field,
                                 *      PivotTotalFunctionType.Sum);
                                 */
                            }
                        }
                        // Added by Icyer 2007/01/17	将统计栏位提后
                        foreach (string field in fields)
                        {
                            if (field.ToUpper() == "YieldPercent".ToUpper() ||
                                field.ToUpper() == "PPM".ToUpper() ||
                                field.ToUpper() == "AllGoodYieldPercent".ToUpper() ||
                                field.ToUpper() == "NotYieldPercent".ToUpper())
                            {
                            }
                            else
                            {
                                this.OWCPivotTable1.AddTotalField(
                                    this.languageComponent1.GetString(field),
                                    field,
                                    PivotTotalFunctionType.Sum);
                            }
                        }
                        // Added end
                    }

                    this.OWCChartSpace1.DataSource = this.OWCPivotTable1.PivotTableName;

                    //chart display : histogram or line
                    if (this.rblChartType.SelectedValue.ToUpper() == ChartStyle.Histogram.ToUpper())
                    {
                        this.OWCChartSpace1.ChartType = OWCChartType.ColumnClustered;
                    }
                    if (this.rblChartType.SelectedValue.ToUpper() == ChartStyle.Line.ToUpper())
                    {
                        //this.OWCChartSpace1.ChartType = OWCChartType.Line;
                        this.OWCChartSpace1.ChartType = OWCChartType.LineMarkers;
                    }
                    this.OWCPivotTable1.Display = false;
                    this.OWCChartSpace1.Display = true;
                }
            }
        }
        private void _doQuery()
        {
            if (this._checkRequireFields())
            {
                this.OWCPivotTable1.ClearFieldSet();

                object[] dateSource = this._loadDataSource();

                //统一使用透视表处理数据
                this.OWCPivotTable1.SetDataSource(
                    dateSource,
                    this.getOWCSchema2());


                //visible style : pivot or chart
                if (this.rblVisibleStyle.SelectedValue.ToUpper() == VisibleStyle.Pivot.ToUpper())
                {
                    string[] rows = TimingType.ParserAttributeTimingType(this.rblTimingType.SelectedValue);
                    if (rows != null)
                    {
                        foreach (string row in rows)
                        {
                            this.OWCPivotTable1.AddRowFieldSet(row, false);
                        }
                    }
                    //categories
                    string[] columns = SummaryTarget.ParserAttributeSummaryTarget2(this.rblSummaryTarget.SelectedValue);
                    if (columns != null)
                    {
                        foreach (string column in columns)
                        {
                            this.OWCPivotTable1.AddColumnFieldSet(column, false);
                        }
                    }
                    //values
                    //投入数
                    this.OWCPivotTable1.AddTotalField(
                        this.languageComponent1.GetString("InputQty"),
                        "InputQty",
                        PivotTotalFunctionType.Sum);

                    //产出数(产量)
                    this.OWCPivotTable1.AddTotalField(
                        this.languageComponent1.GetString("Quantity1"),
                        "Quantity",
                        PivotTotalFunctionType.Sum);
                    this.OWCChartSpace1.Display = false;
                    this.OWCPivotTable1.Display = true;
                }
                if (this.rblVisibleStyle.SelectedValue.ToUpper() == VisibleStyle.Chart.ToUpper())
                {
                    string[] rows = TimingType.ParserAttributeTimingType2(this.rblTimingType.SelectedValue);
                    if (rows != null)
                    {
                        foreach (string row in rows)
                        {
                            this.OWCPivotTable1.AddRowFieldSet(row, true);
                        }
                    }

                    //categories
//					string[] columns = SummaryTarget.ParserAttributeSummaryTarget2( this.rblSummaryTarget.SelectedValue );
//					if( columns != null )
//					{
//						foreach(string column in columns)
//						{
//							this.OWCPivotTable1.AddColumnFieldSet(column,false);
//						}
//					}
                    this.OWCPivotTable1.AddColumnFieldSet(
                        SummaryTarget.ParserAttributeSummaryTarget(this.rblSummaryTarget.SelectedValue),
                        true);

                    //values
                    //投入数
                    this.OWCPivotTable1.AddTotalField(
                        this.languageComponent1.GetString("InputQty"),
                        "InputQty",
                        PivotTotalFunctionType.Sum);

                    //产出数(产量)
                    this.OWCPivotTable1.AddTotalField(
                        this.languageComponent1.GetString("Quantity1"),
                        "Quantity",
                        PivotTotalFunctionType.Sum);
                    this.OWCChartSpace1.Display    = false;
                    this.OWCPivotTable1.Display    = true;
                    this.OWCChartSpace1.DataSource = this.OWCPivotTable1.PivotTableName;

                    //chart display : histogram or line
                    if (this.rblChartType.SelectedValue.ToUpper() == ChartStyle.Histogram.ToUpper())
                    {
                        this.OWCChartSpace1.ChartType = OWCChartType.ColumnClustered;
                    }
                    if (this.rblChartType.SelectedValue.ToUpper() == ChartStyle.Line.ToUpper())
                    {
                        //this.OWCChartSpace1.ChartType = OWCChartType.Line;
                        this.OWCChartSpace1.ChartType = OWCChartType.LineMarkers;
                    }

                    this.OWCPivotTable1.Display = false;
                    this.OWCChartSpace1.Display = true;
                }
            }
        }
        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;
        }