private string[] getOWCSchema2() { string[] rows = TimingType.ParserAttributeTimingType(this.rblTimingType.SelectedValue); string[] columns = SummaryTarget.ParserAttributeSummaryTarget2(this.rblSummaryTarget.SelectedValue); ArrayList schemaList = new ArrayList(); foreach (string row in rows) { schemaList.Add(row); } foreach (string column in columns) { schemaList.Add(column); } schemaList.Add("Quantity"); schemaList.Add("InputQty"); return((string[])schemaList.ToArray(typeof(string))); }
private string[] getOWCSchema2() { string[] rows = TimingType.ParserAttributeTimingType(this.rblTimingType.SelectedValue); string[] columns = SummaryTarget.ParserAttributeSummaryTarget2(this.rblSummaryTarget.SelectedValue); string[] fields = YieldCatalog.ParserTotalFields(this.V_SummaryTarget, this.rblYieldCatalog.SelectedValue); ArrayList schemaList = new ArrayList(); foreach (string row in rows) { schemaList.Add(row); } foreach (string column in columns) { schemaList.Add(column); } foreach (string field in fields) { schemaList.Add(field); } return((string[])schemaList.ToArray(typeof(string))); }
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() { 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; } } }