Beispiel #1
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;
            }
        }
Beispiel #2
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;
            }
        }
        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 #4
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 #6
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()
        {
            if (true)
            {
                this.AutoRefresh = this.chbRefreshAuto.Checked;
                InitWebGrid();
                this.gridHelper.GridBind(int.MaxValue, int.MaxValue);
                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 (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.HistogramChart)
                {
                    this.columnChart.Visible       = true;
                    this.lineChart.Visible         = false;
                    this.gridWebGrid.Visible       = false;
                    this.cmdGridExport.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 = null;
                    this.columnChart.DataBind();
                }
                else
                {
                    this.columnChart.Visible = false;
                    this.lineChart.Visible   = false;
                }

                ReportPageHelper.SetPageScrollToBottom(this);
            }
            else
            {
                this.chbRefreshAuto.Checked = false;
                this.AutoRefresh            = false;
            }
        }