private void _processOWC(object[] dataSource) { //update by Seven 2011-01-12 if (dataSource != null) { this.lineChart.Visible = true; NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length]; NewReportDomainObject item; for (int i = 0; i < dataSource.Length; i++) { item = new NewReportDomainObject(); item.EAttribute1 = "SDR"; item.ItemCode = (dataSource[i] as OQCSDR).ItemCode.ToString(); item.PeriodCode = (dataSource[i] as OQCSDR).DateGroup.ToString(); item.TempValue = (dataSource[i] as OQCSDR).SDR.ToString(); dateSourceForOWC[i] = item; } this.lineChart.ChartGroupByString = "itemcode"; this.lineChart.ChartTextFormatString = "<DATA_VALUE:0>"; this.lineChart.YLabelFormatString = "<DATA_VALUE:0>"; this.lineChart.DataType = true; this.lineChart.DataSource = dateSourceForOWC; this.lineChart.DataBind(); } else { this.lineChart.Visible = false; } //end }
private NewReportDomainObject[] newreportdomanobject(object[] dataSource) { if (dataSource != null) { dataSource = this.AddOtherInfo(dataSource); List <NewReportDomainObject> list = new List <NewReportDomainObject>(); foreach (QDOTSInfo obj in dataSource) { NewReportDomainObject reportobj = new NewReportDomainObject(); reportobj.TempValue = obj.Percent.ToString(); reportobj.EAttribute1 = this.languageComponent1.GetString("Percent"); if (this.rblSummaryTargetQuery.SelectedValue == TSInfoSummaryTarget.ErrorCause) { reportobj.PeriodCode = obj.ErrorCause.ToString(); reportobj.DutyCode = this.rblSummaryTargetQuery.SelectedValue; } else if (this.rblSummaryTargetQuery.SelectedValue == TSInfoSummaryTarget.ErrorCauseGroup) { reportobj.PeriodCode = obj.ErrorCauseGroup.ToString(); reportobj.DutyCode = this.rblSummaryTargetQuery.SelectedValue; } else if (this.rblSummaryTargetQuery.SelectedValue == TSInfoSummaryTarget.ErrorCodeGroup) { reportobj.PeriodCode = obj.ErrorCodeGroup.ToString(); reportobj.DutyCode = this.rblSummaryTargetQuery.SelectedValue; } else if (this.rblSummaryTargetQuery.SelectedValue == TSInfoSummaryTarget.ErrorLocation) { reportobj.PeriodCode = obj.ErrorLocation.ToString(); reportobj.DutyCode = this.rblSummaryTargetQuery.SelectedValue; } else if (this.rblSummaryTargetQuery.SelectedValue == TSInfoSummaryTarget.Duty) { reportobj.PeriodCode = obj.Duty.ToString(); reportobj.DutyCode = this.rblSummaryTargetQuery.SelectedValue; } else if (this.rblSummaryTargetQuery.SelectedValue == TSInfoSummaryTarget.ErrorCode) { reportobj.PeriodCode = obj.ErrorCode.ToString(); reportobj.DutyCode = this.rblSummaryTargetQuery.SelectedValue; } else if (this.rblSummaryTargetQuery.SelectedValue == TSInfoSummaryTarget.Errorcomponent) { reportobj.PeriodCode = obj.ErrorComponent.ToString(); reportobj.DutyCode = this.rblSummaryTargetQuery.SelectedValue; } list.Add(reportobj); } return(list.ToArray()); } return(null); }
private NewReportDomainObject[] ToNewReportDomainObject(object[] dateSource) { NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length]; NewReportDomainObject item; for (int i = 0; i < dateSource.Length; i++) { item = new NewReportDomainObject(); //item.EAttribute1 = "Quantity"; item.InputQty = (dateSource[i] as HistroyQuantitySummary).InputQty; item.ItemCode = (dateSource[i] as HistroyQuantitySummary).ItemCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).ItemCode.ToString(); item.MOCode = (dateSource[i] as HistroyQuantitySummary).MoCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).MoCode.ToString(); item.ModelCode = (dateSource[i] as HistroyQuantitySummary).ModelCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).ModelCode.ToString(); item.Month = (dateSource[i] as HistroyQuantitySummary).Month == null ? "" : (dateSource[i] as HistroyQuantitySummary).Month.ToString(); //(dateSource[i] as HistroyQuantitySummary).NatureDate.ToString(); item.OPCode = (dateSource[i] as HistroyQuantitySummary).OperationCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).OperationCode.ToString(); item.OutputQty = (dateSource[i] as HistroyQuantitySummary).Quantity; item.ResCode = (dateSource[i] as HistroyQuantitySummary).ResourceCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).ResourceCode.ToString(); item.SegCode = (dateSource[i] as HistroyQuantitySummary).SegmentCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).SegmentCode.ToString(); item.ShiftCode = (dateSource[i] as HistroyQuantitySummary).ShiftCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).ShiftCode.ToString(); item.ShiftDay = (dateSource[i] as HistroyQuantitySummary).ShiftDay.ToString(); item.SSCode = (dateSource[i] as HistroyQuantitySummary).StepSequenceCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).StepSequenceCode.ToString(); item.PeriodCode = (dateSource[i] as HistroyQuantitySummary).TimePeriodCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).TimePeriodCode.ToString(); item.Week = (dateSource[i] as HistroyQuantitySummary).Week == null ? "" : (dateSource[i] as HistroyQuantitySummary).Week.ToString(); if (this.rblTimingType.SelectedValue.ToUpper() == TimingType.TimePeriod.ToUpper()) { item.TimeString = (dateSource[i] as HistroyQuantitySummary).TimePeriodCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).TimePeriodCode.ToString(); } else if (this.rblTimingType.SelectedValue.ToUpper() == TimingType.Shift.ToUpper()) { item.TimeString = (dateSource[i] as HistroyQuantitySummary).ShiftCode == null ? "" : (dateSource[i] as HistroyQuantitySummary).ShiftCode.ToString(); } else if (this.rblTimingType.SelectedValue.ToUpper() == TimingType.Day.ToUpper()) { item.TimeString = (dateSource[i] as HistroyQuantitySummary).ShiftDay.ToString(); } else if (this.rblTimingType.SelectedValue.ToUpper() == TimingType.Week.ToUpper()) { item.TimeString = (dateSource[i] as HistroyQuantitySummary).Week.ToString(); } else if (this.rblTimingType.SelectedValue.ToUpper() == TimingType.Month.ToUpper()) { item.TimeString = (dateSource[i] as HistroyQuantitySummary).Month.ToString(); } dateSourceForOWC[i] = item; } return(dateSourceForOWC); }
private NewReportDomainObject[] newreportdomanobject1(object[] dataSource) { if (dataSource != null) { //dataSource = this.AddOtherInfo(dataSource); List <NewReportDomainObject> list = new List <NewReportDomainObject>(); foreach (QDORMACustomerDis obj in dataSource) { NewReportDomainObject reportobj = new NewReportDomainObject(); reportobj.TempValue = obj.Quantity.ToString(); reportobj.EAttribute1 = this.languageComponent1.GetString("QTY"); reportobj.PeriodCode = obj.CustomerCode; list.Add(reportobj); } return(list.ToArray()); } return(null); }
private NewReportDomainObject[] ToNewReportDomainObject(object[] dateSource) { NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length]; NewReportDomainObject item; for (int i = 0; i < dateSource.Length; i++) { item = new NewReportDomainObject(); item.InputQty = Convert.ToInt32((dateSource[i] as HistoryYieldPercent).InputQuantity); item.ItemCode = (dateSource[i] as HistoryYieldPercent).ItemCode == null ? "" : (dateSource[i] as HistoryYieldPercent).ItemCode.ToString(); item.NGTimes = Convert.ToInt32((dateSource[i] as HistoryYieldPercent).NGTimes); item.NotYieldPercent = (dateSource[i] as HistoryYieldPercent).NotYieldPercent; item.AllGoodQuantity = Convert.ToInt32((dateSource[i] as HistoryYieldPercent).AllGoodQuantity); item.AllGoodYieldPercent = (dateSource[i] as HistoryYieldPercent).AllGoodYieldPercent; item.PPM = (dateSource[i] as HistoryYieldPercent).PPM; item.TotalLocation = (dateSource[i] as HistoryYieldPercent).TotalLocation; item.NotYieldLocation = (dateSource[i] as HistoryYieldPercent).NotYieldLocation; item.YieldPercent = (dateSource[i] as HistoryYieldPercent).YieldPercent; item.AllTimes = (dateSource[i] as HistoryYieldPercent).AllTimes; item.NatureDate = (dateSource[i] as HistoryYieldPercent).NatureDate; item.MOCode = (dateSource[i] as HistoryYieldPercent).MoCode == null ? "" : (dateSource[i] as HistoryYieldPercent).MoCode.ToString(); item.ModelCode = (dateSource[i] as HistoryYieldPercent).ModelCode == null ? "" : (dateSource[i] as HistoryYieldPercent).ModelCode.ToString(); item.Month = (dateSource[i] as HistoryYieldPercent).Month == null ? "" : (dateSource[i] as HistoryYieldPercent).Month.ToString(); item.OPCode = (dateSource[i] as HistoryYieldPercent).OperationCode == null ? "" : (dateSource[i] as HistoryYieldPercent).OperationCode.ToString(); item.Quantity = Convert.ToInt32((dateSource[i] as HistoryYieldPercent).Quantity); item.ResCode = (dateSource[i] as HistoryYieldPercent).ResourceCode == null ? "" : (dateSource[i] as HistoryYieldPercent).ResourceCode.ToString(); item.SegCode = (dateSource[i] as HistoryYieldPercent).SegmentCode == null ? "" : (dateSource[i] as HistoryYieldPercent).SegmentCode.ToString(); item.ShiftCode = (dateSource[i] as HistoryYieldPercent).ShiftCode == null ? "" : (dateSource[i] as HistoryYieldPercent).ShiftCode.ToString(); item.ShiftDay = (dateSource[i] as HistoryYieldPercent).ShiftDay.ToString(); item.SSCode = (dateSource[i] as HistoryYieldPercent).StepSequenceCode == null ? "" : (dateSource[i] as HistoryYieldPercent).StepSequenceCode.ToString(); item.PeriodCode = (dateSource[i] as HistoryYieldPercent).TimePeriodCode == null ? "" : (dateSource[i] as HistoryYieldPercent).TimePeriodCode.ToString(); item.Week = (dateSource[i] as HistoryYieldPercent).Week == null ? "" : (dateSource[i] as HistoryYieldPercent).Week.ToString(); dateSourceForOWC[i] = item; } return(dateSourceForOWC); }
private void _processOWC(object[] dataSource) { //update by Seven 2011-01-06 if (dataSource != null) { this.lineChart.Visible = true; this.LableControls(true); NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length]; NewReportDomainObject item; for (int i = 0; i < dataSource.Length; i++) { item = new NewReportDomainObject(); item.EAttribute1 = "LRR"; item.MaterialModelCode = (dataSource[i] as OQCLRR).ModelCode.ToString(); item.PeriodCode = (dataSource[i] as OQCLRR).DateGroup.ToString(); item.TempValue = (dataSource[i] as OQCLRR).LRR.ToString(); dateSourceForOWC[i] = item; } this.lineChart.Width = 800; //this.lineChart.Legend = false; this.lineChart.ChartGroupByString = "mmodelcode"; this.lineChart.ChartTextFormatString = "<DATA_VALUE:0.##%>"; this.lineChart.YLabelFormatString = "<DATA_VALUE:0.##%>"; this.lineChart.DataType = true; this.lineChart.DataSource = dateSourceForOWC; this.lineChart.DataBind(); } else { this.lineChart.Visible = false; this.LableControls(false); } //end }
private void ProcessOWC(object[] dataSource) { if (dataSource != null) { this.columnChart.Visible = true; NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length]; string propertyName = this.languageComponent1.GetString("AchievingRate"); NewReportDomainObject item; //decimal temp = (dataSource[0] as RptAchievingRate).AchievingRate; for (int i = 0; i < dataSource.Length; i++) { item = new NewReportDomainObject(); item.EAttribute1 = propertyName; item.PeriodCode = FormatHelper.ToDateString((dataSource[i] as RptAchievingRate).ShiftDay) + "."; item.TempValue = (dataSource[i] as RptAchievingRate).AchievingRate.ToString(); dateSourceForOWC[i] = item; //if (temp < (dataSource[i] as RptAchievingRate).AchievingRate) //{ // temp = (dataSource[i] as RptAchievingRate).AchievingRate; //} } //this.columnChart.YRangeMin = 0; //this.columnChart.YRangeMax = Convert.ToDouble(temp); this.columnChart.ChartGroupByString = ""; this.columnChart.ChartTextFormatString = "<DATA_VALUE:0.00%>"; this.columnChart.YLabelFormatString = "<DATA_VALUE:0.##%>"; this.columnChart.DataType = true; this.columnChart.DataSource = dateSourceForOWC; this.columnChart.DataBind(); } else { this.columnChart.Visible = false; } //this.OWCChartSpace1.ClearCharts(); //if (dataSource != null) //{ // string serieName = this.languageComponent1.GetString("AchievingRate"); // List<string> categoryArray = new List<string>(); // List<object> valueArray = new List<object>(); // foreach (RptAchievingRate rptAchievingRate in dataSource) // { // categoryArray.Add(FormatHelper.ToDateString(rptAchievingRate.ShiftDay) + "."); // valueArray.Add(rptAchievingRate.AchievingRate); // } // this.OWCChartSpace1.AddChart(true, serieName, categoryArray.ToArray(), valueArray.ToArray(), string.Empty); // this.OWCChartSpace1.ChartType = OWCChartType.ColumnClustered; // this.OWCChartSpace1.AxesLeftNumberFormat = "0%"; // this.OWCChartSpace1.ChartLeftMaximum = 1; // this.OWCChartSpace1.Display = true; //} }
private void SetBarChartValue(object[] FinishedBarDataSource, object[] SemimanuBarDataSource, bool isFristLoad) { #region 成品 Hashtable bigLineHashtable = new Hashtable(); //如果是刷新数据,删除先前刷新的Series if (!isFristLoad && FinishedBarDataSource != null) { int addCount = 0; //得到产线个数 foreach (NewReportDomainObject obj in FinishedBarDataSource) { if (!bigLineHashtable.ContainsValue(obj.BigSSCode)) { bigLineHashtable.Add(addCount, obj.BigSSCode); addCount += 1; } } for (int i = 0; i < bigLineHashtable.Count; i++) { this.tChartData.Series.RemoveAt(6); } } if (!isFristLoad && SemimanuBarDataSource != null) { bigLineHashtable.Clear(); int addCount = 0; foreach (NewReportDomainObject obj in SemimanuBarDataSource) { if (!bigLineHashtable.ContainsValue(obj.BigSSCode)) { bigLineHashtable.Add(addCount, obj.BigSSCode); addCount += 1; } } for (int i = 0; i < bigLineHashtable.Count; i++) { this.tChartData.Series.RemoveAt(6); } } //end //添加Series if (FinishedBarDataSource != null) { bigLineHashtable.Clear(); int addCount = 0; //得到产线个数 foreach (NewReportDomainObject obj in FinishedBarDataSource) { if (!bigLineHashtable.ContainsValue(obj.BigSSCode)) { bigLineHashtable.Add(addCount, obj.BigSSCode); addCount += 1; } } for (int i = 0; i < bigLineHashtable.Count; i++) { object[] BarDataSource = new object[objectList.Count]; for (int j = 0; j < objectList.Count; j++) { bool isHave = false; foreach (NewReportDomainObject obj in FinishedBarDataSource) { if (bigLineHashtable[i].ToString() == obj.BigSSCode) { if (objectList[j].ToString() == obj.PeriodCode) { isHave = true; BarDataSource[j] = obj; break; } } if (isHave) { break; } } if (!isHave) { NewReportDomainObject NewReportDomainObject1 = new NewReportDomainObject(); NewReportDomainObject1.PeriodCode = objectList[j].ToString(); NewReportDomainObject1.Output = 0; BarDataSource[j] = NewReportDomainObject1; } } DataTable finishedBar_DataTable = new DataTable(); finishedBar_DataTable.Columns.Add("TimePeriodCode", typeof(string)); finishedBar_DataTable.Columns.Add("OutPutQty", typeof(int)); finishedBar_DataTable.AcceptChanges(); if (FinishedBarDataSource != null) { foreach (NewReportDomainObject obj in BarDataSource) { DataRow newRow = finishedBar_DataTable.NewRow(); newRow["TimePeriodCode"] = obj.PeriodCode; newRow["OutPutQty"] = obj.Output; finishedBar_DataTable.Rows.Add(newRow); } finishedBar_DataTable.AcceptChanges(); } Steema.TeeChart.Styles.Bar FinishedDataBar1 = new Steema.TeeChart.Styles.Bar(); FinishedDataBar1.YValues.DataMember = finishedBar_DataTable.Columns["OutPutQty"].ToString(); FinishedDataBar1.LabelMember = finishedBar_DataTable.Columns["TimePeriodCode"].ToString(); FinishedDataBar1.Title = bigLineHashtable[i].ToString(); FinishedDataBar1.Marks.Visible = false; FinishedDataBar1.DataSource = finishedBar_DataTable; FinishedDataBar1.StackGroup = 1; this.tChartData.Series.Add(FinishedDataBar1); } } #endregion #region 半成品 bigLineHashtable.Clear(); if (SemimanuBarDataSource != null) { int addCount = 0; //得到产线个数 foreach (NewReportDomainObject obj in SemimanuBarDataSource) { if (!bigLineHashtable.ContainsValue(obj.BigSSCode)) { bigLineHashtable.Add(addCount, obj.BigSSCode); addCount += 1; } } //每条产线绑定Tchart for (int i = 0; i < bigLineHashtable.Count; i++) { object[] BarDataSource = new object[objectList.Count]; for (int j = 0; j < objectList.Count; j++) { bool isHave = false; foreach (NewReportDomainObject obj in SemimanuBarDataSource) { if (bigLineHashtable[i].ToString() == obj.BigSSCode) { if (objectList[j].ToString() == obj.PeriodCode) { isHave = true; BarDataSource[j] = obj; break; } } if (isHave) { break; } } if (!isHave) { NewReportDomainObject NewReportDomainObject1 = new NewReportDomainObject(); NewReportDomainObject1.PeriodCode = objectList[j].ToString(); NewReportDomainObject1.Output = 0; BarDataSource[j] = NewReportDomainObject1; } } DataTable semimanuBar_DataTable = new DataTable(); semimanuBar_DataTable.Columns.Add("TimePeriodCode", typeof(string)); semimanuBar_DataTable.Columns.Add("OutPutQty", typeof(int)); semimanuBar_DataTable.AcceptChanges(); if (SemimanuBarDataSource != null) { DataRow newRow; foreach (NewReportDomainObject obj in BarDataSource) { newRow = semimanuBar_DataTable.NewRow(); newRow["TimePeriodCode"] = obj.PeriodCode; newRow["OutPutQty"] = obj.Output; semimanuBar_DataTable.Rows.Add(newRow); } semimanuBar_DataTable.AcceptChanges(); } Steema.TeeChart.Styles.Bar FinishedDataBar2 = new Steema.TeeChart.Styles.Bar(); FinishedDataBar2.YValues.DataMember = semimanuBar_DataTable.Columns["OutPutQty"].ToString(); FinishedDataBar2.LabelMember = semimanuBar_DataTable.Columns["TimePeriodCode"].ToString(); FinishedDataBar2.Title = bigLineHashtable[i].ToString(); FinishedDataBar2.Marks.Visible = false; FinishedDataBar2.StackGroup = 2; FinishedDataBar2.DataSource = semimanuBar_DataTable; this.tChartData.Series.Add(FinishedDataBar2); } } #endregion }
private void SetProductDateLineChartValue(object[] FinishedProductDateLineDataSource, object[] SemimanuProductDateLineDataSource, bool isFristLoad) { #region 成品 if (!isFristLoad) { for (int i = 0; i < 2; i++) { this.tChartData.Series.RemoveAt(6); } } DataTable finishedProductDateLine_Table = new DataTable(); finishedProductDateLine_Table.Columns.Add("TimePeriodCode", typeof(string)); finishedProductDateLine_Table.Columns.Add("OutPutQty", typeof(int)); finishedProductDateLine_Table.AcceptChanges(); if (objectList.Count > 0) { NewReportDomainObject[] FinishedRateLineObject = new NewReportDomainObject[objectList.Count]; for (int i = 0; i < objectList.Count; i++) { bool isFind = false; if (FinishedProductDateLineDataSource != null) { foreach (NewReportDomainObject obj in FinishedProductDateLineDataSource) { if (obj.PeriodCode.Trim().ToUpper() == objectList[i].ToString().Trim().ToUpper()) { FinishedRateLineObject[i] = obj; isFind = true; break; } } } if (!isFind) { NewReportDomainObject NewReportDomainObject1 = new NewReportDomainObject(); NewReportDomainObject1.PeriodCode = objectList[i].ToString(); NewReportDomainObject1.PassRcardRate = 0; FinishedRateLineObject[i] = NewReportDomainObject1; } } if (FinishedRateLineObject != null) { DataRow newRow; foreach (NewReportDomainObject obj in FinishedRateLineObject) { newRow = finishedProductDateLine_Table.NewRow(); newRow["TimePeriodCode"] = obj.PeriodCode; newRow["OutPutQty"] = obj.Output; finishedProductDateLine_Table.Rows.Add(newRow); } finishedProductDateLine_Table.AcceptChanges(); } } Steema.TeeChart.Styles.FastLine FinishedProductDateLine1 = new Steema.TeeChart.Styles.FastLine(); FinishedProductDateLine1.YValues.DataMember = finishedProductDateLine_Table.Columns["OutPutQty"].ToString(); FinishedProductDateLine1.LabelMember = finishedProductDateLine_Table.Columns["TimePeriodCode"].ToString(); FinishedProductDateLine1.Color = Color.LightCoral; FinishedProductDateLine1.LinePen.Width = 2; FinishedProductDateLine1.ShowInLegend = false; FinishedProductDateLine1.Marks.Visible = true; FinishedProductDateLine1.Marks.Font.Size = 10; FinishedProductDateLine1.Marks.ArrowLength = 5; FinishedProductDateLine1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value; FinishedProductDateLine1.DataSource = finishedProductDateLine_Table; this.tChartData.Series.Add(FinishedProductDateLine1); #endregion #region 半成品 DataTable semimanuProductDateLine_Table = new DataTable(); semimanuProductDateLine_Table.Columns.Add("TimePeriodCode", typeof(string)); semimanuProductDateLine_Table.Columns.Add("OutPutQty", typeof(int)); semimanuProductDateLine_Table.AcceptChanges(); if (objectList.Count > 0) { NewReportDomainObject[] FinishedRateLineObject = new NewReportDomainObject[objectList.Count]; for (int i = 0; i < objectList.Count; i++) { bool isFind = false; if (SemimanuProductDateLineDataSource != null) { foreach (NewReportDomainObject obj in SemimanuProductDateLineDataSource) { if (obj.PeriodCode.Trim().ToUpper() == objectList[i].ToString().Trim().ToUpper()) { FinishedRateLineObject[i] = obj; isFind = true; break; } } } if (!isFind) { NewReportDomainObject NewReportDomainObject1 = new NewReportDomainObject(); NewReportDomainObject1.PeriodCode = objectList[i].ToString(); NewReportDomainObject1.PassRcardRate = 0; FinishedRateLineObject[i] = NewReportDomainObject1; } } if (FinishedRateLineObject != null) { foreach (NewReportDomainObject obj in FinishedRateLineObject) { DataRow newRow = semimanuProductDateLine_Table.NewRow(); newRow["TimePeriodCode"] = obj.PeriodCode; newRow["OutPutQty"] = obj.Output; semimanuProductDateLine_Table.Rows.Add(newRow); } semimanuProductDateLine_Table.AcceptChanges(); } } Steema.TeeChart.Styles.FastLine FinishedProductDateLine2 = new Steema.TeeChart.Styles.FastLine(); FinishedProductDateLine2.YValues.DataMember = semimanuProductDateLine_Table.Columns["OutPutQty"].ToString(); FinishedProductDateLine2.LabelMember = semimanuProductDateLine_Table.Columns["TimePeriodCode"].ToString(); FinishedProductDateLine2.Color = Color.CornflowerBlue; FinishedProductDateLine2.LinePen.Width = 2; FinishedProductDateLine2.Marks.Visible = true; FinishedProductDateLine2.Marks.Font.Color = Color.White; FinishedProductDateLine2.Marks.Transparent = true; FinishedProductDateLine2.Marks.Font.Size = 10; FinishedProductDateLine2.Marks.ArrowLength = 8; FinishedProductDateLine2.ShowInLegend = false; FinishedProductDateLine2.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value; FinishedProductDateLine2.DataSource = semimanuProductDateLine_Table; this.tChartData.Series.Add(FinishedProductDateLine2); #endregion }
private void SetRateLineChartValue(object[] FinishedRateLineDataSource, object[] SemimanuRateLineDataSource) { #region 成品 DataTable finishedRateLine_RateTable = new DataTable(); finishedRateLine_RateTable.Columns.Add("TimePeriodCode", typeof(string)); finishedRateLine_RateTable.Columns.Add("PassRate", typeof(double)); finishedRateLine_RateTable.AcceptChanges(); if (objectList.Count > 0) { NewReportDomainObject[] FinishedRateLineObject = new NewReportDomainObject[objectList.Count]; for (int i = 0; i < objectList.Count; i++) { bool isFind = false; if (FinishedRateLineDataSource != null) { foreach (NewReportDomainObject obj in FinishedRateLineDataSource) { if (obj.PeriodCode.Trim().ToUpper() == objectList[i].ToString().Trim().ToUpper()) { FinishedRateLineObject[i] = obj; isFind = true; break; } } } if (!isFind) { NewReportDomainObject NewReportDomainObject1 = new NewReportDomainObject(); NewReportDomainObject1.PeriodCode = objectList[i].ToString(); NewReportDomainObject1.PassRcardRate = 0; FinishedRateLineObject[i] = NewReportDomainObject1; } } if (FinishedRateLineObject != null) { foreach (NewReportDomainObject obj in FinishedRateLineObject) { DataRow newRow = finishedRateLine_RateTable.NewRow(); newRow["TimePeriodCode"] = obj.PeriodCode; newRow["PassRate"] = Math.Round(obj.PassRcardRate * 100, 2); finishedRateLine_RateTable.Rows.Add(newRow); } finishedRateLine_RateTable.AcceptChanges(); } } FinishedRateLine.Color = Color.LightCoral; FinishedRateLine.LinePen.Width = 2; FinishedRateLine.YValues.DataMember = finishedRateLine_RateTable.Columns["PassRate"].ToString(); FinishedRateLine.LabelMember = finishedRateLine_RateTable.Columns["TimePeriodCode"].ToString(); FinishedRateLine.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value; FinishedRateLine.DataSource = finishedRateLine_RateTable; #endregion #region 半成品 DataTable semimanuRateLine_RateTable = new DataTable(); semimanuRateLine_RateTable.Columns.Add("TimePeriodCode", typeof(string)); semimanuRateLine_RateTable.Columns.Add("PassRate", typeof(double)); semimanuRateLine_RateTable.AcceptChanges(); if (objectList.Count > 0) { NewReportDomainObject[] FinishedRateLineObject = new NewReportDomainObject[objectList.Count]; for (int i = 0; i < objectList.Count; i++) { bool isFind = false; if (SemimanuRateLineDataSource != null) { foreach (NewReportDomainObject obj in SemimanuRateLineDataSource) { if (obj.PeriodCode.Trim().ToUpper() == objectList[i].ToString().Trim().ToUpper()) { FinishedRateLineObject[i] = obj; isFind = true; break; } } } if (!isFind) { NewReportDomainObject NewReportDomainObject1 = new NewReportDomainObject(); NewReportDomainObject1.PeriodCode = objectList[i].ToString(); NewReportDomainObject1.PassRcardRate = 0; FinishedRateLineObject[i] = NewReportDomainObject1; } } if (FinishedRateLineObject != null) { DataRow newRow; foreach (NewReportDomainObject obj in FinishedRateLineObject) { newRow = semimanuRateLine_RateTable.NewRow(); newRow["TimePeriodCode"] = obj.PeriodCode; newRow["PassRate"] = Math.Round(obj.PassRcardRate * 100, 2); semimanuRateLine_RateTable.Rows.Add(newRow); } semimanuRateLine_RateTable.AcceptChanges(); } } SemimanuRateLine.Color = Color.CornflowerBlue; SemimanuRateLine.LinePen.Width = 2; SemimanuRateLine.YValues.DataMember = semimanuRateLine_RateTable.Columns["PassRate"].ToString(); SemimanuRateLine.LabelMember = semimanuRateLine_RateTable.Columns["TimePeriodCode"].ToString(); SemimanuRateLine.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value; SemimanuRateLine.DataSource = semimanuRateLine_RateTable; #endregion }
private void _helper_LoadGridDataSource(object sender, EventArgs e) { if (!_checkRequireFields()) { return; } this.ViewState["ItemCode"] = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)); this.ViewState["MoCode"] = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)); FacadeFactory facadeFactory = new FacadeFactory(base.DataProvider); object[] dataSource = facadeFactory.CreateQueryTSInfoFacade().QueryTSLocECode( this.ViewState["ItemCode"].ToString(), this.ViewState["MoCode"].ToString(), FormatHelper.TODateInt(this.dateStartDateQuery.Text), FormatHelper.TODateInt(this.dateEndDateQuery.Text), 1, int.MaxValue); //chart List <string> fixedColumnList = new List <string>(); fixedColumnList.Add("ErrorLocation"); if (dataSource == null || dataSource.Length <= 0) { this.gridWebGrid.Visible = false; this.columnChart.Visible = false; return; } NewReportDomainObject[] newReportDomainObject = new NewReportDomainObject[dataSource.Length]; for (int i = 0; i < dataSource.Length; i++) { NewReportDomainObject domainObject = new NewReportDomainObject(); domainObject.ErrorCause = ((QDOTSInfo)dataSource[i]).ErrorCauseDesc; domainObject.ErrorLocation = ((QDOTSInfo)dataSource[i]).ErrorLocation; domainObject.Quantity = ((QDOTSInfo)dataSource[i]).Quantity; newReportDomainObject[i] = domainObject; } if (this.rblVisibleStyle.SelectedValue.ToUpper() == VisibleStyle.Pivot.ToUpper()) { this.columnChart.Visible = false; List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>(); dim3PropertyList.Add(new ReportGridDim3Property("Quantity", "0", "SUM", "SUM", false)); ReportGridHelper reportGridHelper = new ReportGridHelper(this.DataProvider, this.languageComponent1, this.gridWebGrid); reportGridHelper.DataSource = newReportDomainObject; reportGridHelper.Dim1PropertyList = fixedColumnList; reportGridHelper.Dim3PropertyList = dim3PropertyList; reportGridHelper.HasDim3PropertyNameRowColumn = true; reportGridHelper.ShowGrid(); this.gridWebGrid.Columns[2].Header.Caption = languageComponent1.GetString("ErrorCauseDesc"); this.gridWebGrid.Visible = true; } if (this.rblVisibleStyle.SelectedValue.ToUpper() == VisibleStyle.Chart.ToUpper()) { this.gridWebGrid.Visible = false; //设置首页报表的大小 if (ViewState["Width"] != null) { columnChart.Width = int.Parse(ViewState["Width"].ToString()); } if (ViewState["Height"] != null) { columnChart.Height = int.Parse(ViewState["Height"].ToString()); } //end DataTable dataTableColumn = new DataTable(); dataTableColumn.Columns.Add("Names", typeof(System.String)); dataTableColumn.Columns.Add(" ", typeof(System.Int32)); for (int i = 0; i < newReportDomainObject.Length; i++) { dataTableColumn.Rows.Add(new object[] { newReportDomainObject[i].ErrorLocation, newReportDomainObject[i].Quantity }); } this.columnChart.DataType = true; this.columnChart.YLabelFormatString = "<DATA_VALUE:0.##>"; this.columnChart.ChartTextFormatString = "<DATA_VALUE:0.##>"; this.columnChart.ColumnDataSource = dataTableColumn; this.columnChart.DataBindTable(); this.columnChart.Visible = true; } }
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; } }
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 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; } }
/// <summary> /// 将数据转换为相对应X轴、Y轴的DataTable /// </summary> public DataTable ConvertDataTableNewQty(string planQtyName) { DataTable dt = new DataTable(); //此列用来显示时间 dt.Columns.Add(new DataColumn("Time", typeof(string))); ArrayList columnNameList = new ArrayList(); ArrayList ColumnQtyList = new ArrayList(); #region //其他ColunmName string name = string.Empty; string qtyName = string.Empty; string[] groupColumns = m_ChartGroupByString.Split(','); ArrayList allNameList = new ArrayList(); ArrayList allQtyNameList = new ArrayList(); foreach (NewReportDomainObject domainObject in DataSource) { name = string.Empty; qtyName = string.Empty; #region if (groupColumns.Length > 0) { for (int i = 0; i < groupColumns.Length; i++) { if (groupColumns[i].Trim().ToLower() == "sscode") { name += domainObject.SSCode + "-"; qtyName += domainObject.SSCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "opcode") { name += domainObject.OPCode + "-"; qtyName += domainObject.OPCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "rescode") { name += domainObject.ResCode + "-"; qtyName += domainObject.ResCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "bigsscode") { name += domainObject.BigSSCode + "-"; name += domainObject.BigSSCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "segcode") { name += domainObject.SegCode + "-"; qtyName += domainObject.SegCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "faccode") { name += domainObject.FacCode + "-"; qtyName += domainObject.FacCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "momemo") { name += domainObject.MOMemo + "-"; qtyName += domainObject.MOMemo + "-"; } else if (groupColumns[i].Trim().ToLower() == "newmass") { name += domainObject.NewMass + "-"; qtyName += domainObject.NewMass + "-"; } else if (groupColumns[i].Trim().ToLower() == "itemcode") { name += domainObject.ItemCode + "-"; qtyName += domainObject.ItemCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "mmodelcode" || groupColumns[i].Trim().ToLower() == "materialmodelcode") { name += domainObject.MaterialModelCode + "-"; qtyName += domainObject.MaterialModelCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "mmachinetype" || groupColumns[i].Trim().ToLower() == "materialmachinetype") { name += domainObject.MaterialMachineType + "-"; qtyName += domainObject.MaterialMachineType + "-"; } else if (groupColumns[i].Trim().ToLower() == "mexportimport" || groupColumns[i].Trim().ToLower() == "materialexportimport") { name += domainObject.MaterialExportImport + "-"; qtyName += domainObject.MaterialExportImport + "-"; } else if (groupColumns[i].Trim().ToLower() == "mocode") { name += domainObject.MOCode + "-"; qtyName += domainObject.MOCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "firstclass") { name += domainObject.FirstClass + "-"; qtyName += domainObject.FirstClass + "-"; } else if (groupColumns[i].Trim().ToLower() == "secondclass") { name += domainObject.SecondClass + "-"; qtyName += domainObject.SecondClass + "-"; } else if (groupColumns[i].Trim().ToLower() == "thirdclass") { name += domainObject.SSCode + "-"; qtyName += domainObject.SSCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "lotno") { name += domainObject.LotNo + "-"; qtyName += domainObject.LotNo + "-"; } else if (groupColumns[i].Trim().ToLower() == "productiontype") { name += domainObject.ProductionType + "-"; qtyName += domainObject.ProductionType + "-"; } else if (groupColumns[i].Trim().ToLower() == "oqclottype") { name += domainObject.OQCLotType + "-"; qtyName += domainObject.OQCLotType + "-"; } else if (groupColumns[i].Trim().ToLower() == "inspectorandname") { name += domainObject.InspectorAndName + "-"; qtyName += domainObject.InspectorAndName + "-"; } else if (groupColumns[i].Trim().ToLower() == "iqclineitemtype") { name += domainObject.IQCLineItemType + "-"; qtyName += domainObject.IQCLineItemType + "-"; } else if (groupColumns[i].Trim().ToLower() == "iqcitemtype") { name += domainObject.IQCItemType + "-"; qtyName += domainObject.IQCItemType + "-"; } else if (groupColumns[i].Trim().ToLower() == "rohs") { name += domainObject.Rohs + "-"; qtyName += domainObject.Rohs + "-"; } else if (groupColumns[i].Trim().ToLower() == "concessionstatus") { name += domainObject.ConcessionStatus + "-"; qtyName += domainObject.ConcessionStatus + "-"; } else if (groupColumns[i].Trim().ToLower() == "vendorcode") { name += domainObject.VendorCode + "-"; qtyName += domainObject.VendorCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "materialcode") { name += domainObject.MaterialCode + "-"; qtyName += domainObject.MaterialCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "tpcode") { name += domainObject.PeriodCode + "-"; qtyName += domainObject.PeriodCode + "-"; } else if (groupColumns[i].Trim().ToUpper() == "shiftcode") { name += domainObject.ShiftCode + "-"; qtyName += domainObject.ShiftCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "shiftday") { name += domainObject.ShiftDay + "-"; qtyName += domainObject.ShiftDay + "-"; } else if (groupColumns[i].Trim().ToLower() == "dweek") { name += domainObject.Week + "-"; qtyName += domainObject.Week + "-"; } else if (groupColumns[i].Trim().ToLower() == "dmonth") { name += domainObject.Month + "-"; qtyName += domainObject.Month + "-"; } else if (groupColumns[i].Trim().ToLower() == "year") { name += domainObject.Year + "-"; qtyName += domainObject.Year + "-"; } else if (groupColumns[i].Trim().ToLower() == "goodsemigood") { name += domainObject.GoodSemiGood + "-"; qtyName += domainObject.GoodSemiGood + "-"; } else if (groupColumns[i].Trim().ToLower() == "crewcode") { name += domainObject.CrewCode + "-"; qtyName += domainObject.CrewCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "projectname") { name += domainObject.ProjectCode + "-"; qtyName += domainObject.ProjectCode + "-"; } } #endregion name += domainObject.EAttribute1; qtyName += "计划"; } if (!columnNameList.Contains(name)) { columnNameList.Add(name); } if (!ColumnQtyList.Contains(qtyName)) { ColumnQtyList.Add(qtyName); } allNameList.Add(name); allQtyNameList.Add(qtyName); } #endregion //排序名称 columnNameList.Sort(); ColumnQtyList.Sort(); //dt.Columns.Add(new DataColumn(planQtyName, typeof(double))); for (int i = 0; i < ColumnQtyList.Count; i++) { dt.Columns.Add(new DataColumn(ColumnQtyList[i].ToString(), typeof(double))); dt.Columns.Add(new DataColumn(columnNameList[i].ToString(), typeof(double))); } //for (int i = 0; i < columnNameList.Count; i++) //{ // dt.Columns.Add(new DataColumn(columnNameList[i].ToString(), typeof(double))); //} ArrayList columnValueList = new ArrayList(); foreach (NewReportDomainObject domainObject in DataSource) //Y轴 { if (!columnValueList.Contains(domainObject.PeriodCode)) { columnValueList.Add(domainObject.PeriodCode); } } columnValueList.Sort(); foreach (string value in columnValueList) { DataRow dr = dt.NewRow(); dr[0] = value; for (int i = 1; i < columnNameList.Count + ColumnQtyList.Count + 1; i++) { dr[i] = 0; } for (int m = 0; m < DataSource.Length; m++) { NewReportDomainObject domainObject = DataSource[m] as NewReportDomainObject; if (value == domainObject.PeriodCode) { //dr[planQtyName] = domainObject.PlanQty; dr[allQtyNameList[m].ToString()] = domainObject.PlanQty; dr[allNameList[m].ToString()] = domainObject.TempValue; } } dt.Rows.Add(dr); } return(dt); }
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; } }
private void _helper_LoadGridDataSource(object sender, EventArgs e) { if (!_checkRequireFields()) { return; } this.ViewState["ItemCode"] = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)); this.ViewState["MoCode"] = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)); //this.OWCChartSpace1.ClearCharts(); FacadeFactory facadeFactory = new FacadeFactory(base.DataProvider); object[] dataSource = facadeFactory.CreateQueryFacade3().QueryOnWipInfoOnOperation( this.ViewState["ItemCode"].ToString(), this.ViewState["MoCode"].ToString(), //this.dFactoryCode.SelectedValue, FormatHelper.TODateInt(this.dateStartDateQuery.Text), FormatHelper.TODateInt(this.dateEndDateQuery.Text), (e as WebQueryEventArgsNew).StartRow, (e as WebQueryEventArgsNew).EndRow); (e as WebQueryEventArgsNew).GridDataSource = dataSource; (e as WebQueryEventArgsNew).RowCount = facadeFactory.CreateQueryFacade3().QueryOnWipInfoOnOperationCount( this.ViewState["ItemCode"].ToString(), this.ViewState["MoCode"].ToString(), FormatHelper.TODateInt(this.dateStartDateQuery.Text), FormatHelper.TODateInt(this.dateEndDateQuery.Text) ); //update by Seven 2011-01-06 if (dataSource != null) { this.columnChart.Visible = true; NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length]; string propertyName = "Operation"; NewReportDomainObject item; for (int i = 0; i < dataSource.Length; i++) { item = new NewReportDomainObject(); item.EAttribute1 = propertyName; item.PeriodCode = (dataSource[i] as OnWipInfoOnOperation).OperationCode; item.TempValue = (dataSource[i] as OnWipInfoOnOperation).OnWipQuantityOnOperation.ToString(); dateSourceForOWC[i] = item; } this.columnChart.ChartGroupByString = ""; 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; } //end }
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); //((NewReportDomainObject)dateSource[0]).YR=((NewReportDomainObject)dateSource[0]).YR *100%; if (dateSource == null || dateSource.Length <= 0) { this.gridWebGrid.Visible = false; this.cmdGridExport.Visible = false; ReportPageHelper.SetPageScrollToBottom(this); return; } //环比/同期比数据 if (compareType.Trim().Length > 0) { dateSourceCompare = this.LoadDataSource(true, true); } if (dateSourceCompare == null) { dateSourceCompare = new NewReportDomainObject[0] { }; } //获得查询的工序 string parameterGroupCode = string.Empty; if (UCWhereConditions1.UserSelectGoodSemiGood.Trim() == ItemType.ITEMTYPE_FINISHEDPRODUCT) { parameterGroupCode = "FINISHEDSTR"; } if (UCWhereConditions1.UserSelectGoodSemiGood.Trim() == ItemType.ITEMTYPE_SEMIMANUFACTURE) { parameterGroupCode = "SEMIFINISHEDSTR"; } SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider); Object[] parameterList = systemSettingFacade.GetAllParametersOrderByEattribute1(parameterGroupCode); if (parameterList == null) { WebInfoPublish.Publish(this.Page, "$BS_Pelease_Maintenance_QueryOP", this.languageComponent1); return; } List <string> fixedHeadOPList = new List <string>(); List <string> fixedHeadOPDescList = new List <string>(); foreach (eMES.Domain.BaseSetting.Parameter parameter in parameterList) { fixedHeadOPList.Add(parameter.ParameterAlias); fixedHeadOPDescList.Add(parameter.ParameterDescription); } fixedHeadOPDescList.Add("直通率"); //数据加载到Grid List <string> fixedColumnList = GetRows(); fixedColumnList = OrderfixedColumnList(fixedColumnList); if (byTimeType == NewReportByTimeType.ShiftDay) { fixedColumnList.Add("ShiftDay"); } if (byTimeType == NewReportByTimeType.Week) { fixedColumnList.Add("Week"); } if (byTimeType == NewReportByTimeType.Month) { fixedColumnList.Add("Month"); } if (byTimeType == NewReportByTimeType.Year) { fixedColumnList.Add("Year"); } List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>(); 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.FixedHeadDefaultValueList = fixedHeadOPList; reportGridHelper.FixedHeadDescDefaultValueList = fixedHeadOPDescList; reportGridHelper.HasDim3PropertyNameRowColumn = true; reportGridHelper.CompareType = compareType; reportGridHelper.ByTimeType = byTimeType; reportGridHelper.ShowGridWithFixedOPHead(); 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; } 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 compareType = this.UCGroupConditions1.UserSelectCompareType.Trim().ToLower(); string byTimeType = this.UCGroupConditions1.UserSelectByTimeType.Trim().ToLower(); object[] dateSource = null; object[] dateSourceCompare = null; //一般数据 dateSource = this.LoadDataSource(false, compareType.Trim().Length > 0); if (dateSource == null || dateSource.Length <= 0) { this.gridWebGrid.Visible = false; //this.OWCChartSpace1.Display = false; this.cmdGridExport.Visible = false; this.columnChart.Visible = false; this.lineChart.Visible = false; ReportPageHelper.SetPageScrollToBottom(this); return; } //环比/同期比数据 if (compareType.Trim().Length > 0) { dateSourceCompare = this.LoadDataSource(true, true); } if (dateSourceCompare == null) { dateSourceCompare = new NewReportDomainObject[0] { }; } //数据加载到Grid List <string> fixedColumnList = GetRows(); List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>(); dim3PropertyList.Add(new ReportGridDim3Property("OQCSampleSize", "0", "SUM", "SUM", false)); dim3PropertyList.Add(new ReportGridDim3Property("OQCNGCount", "0", "SUM", "SUM", false)); dim3PropertyList.Add(new ReportGridDim3Property("OQCSampleNGRatePPM", "0.00", "PPM({-1},{-2})", "PPM({-1},{-2})", false)); ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, this.DtSource); reportGridHelper.DataSource = dateSource; reportGridHelper.DataSourceForCompare = dateSourceCompare; reportGridHelper.Dim1PropertyList = fixedColumnList; reportGridHelper.Dim3PropertyList = dim3PropertyList; reportGridHelper.HasDim3PropertyNameRowColumn = true; reportGridHelper.CompareType = compareType; reportGridHelper.ByTimeType = byTimeType; reportGridHelper.ShowGrid(); base.InitWebGrid(); this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false; this.gridWebGrid.Behaviors.Sorting.Enabled = false; //获取表格和图示 if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid) { this.gridWebGrid.Visible = true; //this.OWCChartSpace1.Display = false; this.cmdGridExport.Visible = true; this.columnChart.Visible = false; this.lineChart.Visible = false; } else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart || UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart || UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart) { List <string> rowPropertyList = GetColumns(); List <string> columnPropertyList = GetRows(); columnPropertyList.Add("EAttribute1"); List <string> dataPropertyList = new List <string>(); dataPropertyList.Add("OQCSampleNGRatePPM"); NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dateSource.Length + dateSourceCompare.Length]; dateSource.CopyTo(dateSourceForOWC, 0); for (int i = 0; i < dateSourceCompare.Length; i++) { dateSourceForOWC[dateSource.Length + i] = (NewReportDomainObject)dateSourceCompare[i]; } string propertyName = this.languageComponent1.GetString(dataPropertyList[0]); foreach (NewReportDomainObject domainObject in dateSourceForOWC) { domainObject.EAttribute1 = propertyName + domainObject.EAttribute1; } //ReportChartHelper reportChartHelper = new ReportChartHelper(this.OWCPivotTable1, this.OWCChartSpace1, this.languageComponent1); //reportChartHelper.DataSource = dateSourceForOWC; //reportChartHelper.RowPropertyList = rowPropertyList.ToArray(); //reportChartHelper.ColumnPropertyList = columnPropertyList.ToArray(); //reportChartHelper.DataPropertyList = dataPropertyList.ToArray(); //reportChartHelper.UserOWCChartType = UCDisplayConditions1.GetDisplayType().Trim().ToLower(); //reportChartHelper.IsPercent = false; //reportChartHelper.LoadOWCChart(); foreach (NewReportDomainObject obj in dateSourceForOWC) { obj.TempValue = obj.OQCSampleNGRatePPM.ToString(); if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Period) { obj.PeriodCode = obj.PeriodCode.ToString(); } if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Shift) { obj.PeriodCode = obj.ShiftCode.ToString(); } if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.ShiftDay) { obj.PeriodCode = obj.ShiftDay.ToString(); } if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Week) { obj.PeriodCode = obj.Week.ToString(); } if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Month) { obj.PeriodCode = obj.Month.ToString(); } if (UCGroupConditions1.UserSelectByTimeType == NewReportByTimeType.Year) { obj.PeriodCode = obj.Year.ToString(); } } if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart) { this.columnChart.Visible = false; this.lineChart.Visible = true; lineChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString(); //设置首页报表的大小 if (ViewState["Width"] != null) { lineChart.Width = int.Parse(ViewState["Width"].ToString()); } if (ViewState["Height"] != null) { lineChart.Height = int.Parse(ViewState["Height"].ToString()); } //end this.lineChart.ChartTextFormatString = "<DATA_VALUE:0.##>"; this.lineChart.YLabelFormatString = "<DATA_VALUE:0.##>"; this.lineChart.DataType = true; this.lineChart.DataSource = dateSourceForOWC; this.lineChart.DataBind(); } else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart) { this.columnChart.Visible = true; this.lineChart.Visible = false; columnChart.ChartGroupByString = UCGroupConditions1.GetCheckedColumnsString(); //设置首页报表的大小 if (ViewState["Width"] != null) { columnChart.Width = int.Parse(ViewState["Width"].ToString()); } if (ViewState["Height"] != null) { columnChart.Height = int.Parse(ViewState["Height"].ToString()); } //end this.columnChart.ChartTextFormatString = "<DATA_VALUE:#0.##>"; this.columnChart.YLabelFormatString = "<DATA_VALUE:#0.##>"; this.columnChart.DataType = true; this.columnChart.DataSource = dateSourceForOWC; this.columnChart.DataBind(); } else { this.columnChart.Visible = false; this.lineChart.Visible = false; } this.gridWebGrid.Visible = false; //this.OWCChartSpace1.Display = true; this.cmdGridExport.Visible = false; } ReportPageHelper.SetPageScrollToBottom(this); } else { this.chbRefreshAuto.Checked = false; this.AutoRefresh = false; } }
private void _DoQuery() { DtSource = new DataTable(); this.gridWebGrid.ClearDataSource(); this.gridWebGrid.Columns.Clear(); this.gridHelper = new GridHelperNew(this.gridWebGrid, this.DtSource); if (this._checkRequireFields()) { this.AutoRefresh = this.chbRefreshAuto.Checked; string byTimeType = TimingType.ParserAttributeTimingType3(this.rblTimingType.SelectedValue); //一般数据 object[] dateSource = this._loadDataSource(); if (dateSource == null || dateSource.Length <= 0) { this.gridWebGrid.Visible = false; this.cmdGridExport.Visible = false; this.lineChart.Visible = false; this.columnChart.Visible = false; ReportPageHelper.SetPageScrollToBottom(this); return; } NewReportDomainObject[] dateSourceForOWC = this.ToNewReportDomainObject(dateSource); object[] dateSourceCompare = new NewReportDomainObject[0] { }; //数据加载到Grid List <string> fixedColumnList = new List <string>(); string ColumnList = SummaryTarget.ParserAttributeSummaryTarget3(this.rblSummaryTarget.SelectedValue); fixedColumnList.Add(ColumnList); this.txtColumn.Text = ColumnList; List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>(); dim3PropertyList.Add(new ReportGridDim3Property("InputQty", "0", "SUM", "SUM", false)); dim3PropertyList.Add(new ReportGridDim3Property("OutputQty", "0", "SUM", "SUM", false)); ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, DtSource); reportGridHelper.DataSource = dateSourceForOWC; reportGridHelper.DataSourceForCompare = dateSourceCompare; reportGridHelper.Dim1PropertyList = fixedColumnList; reportGridHelper.Dim3PropertyList = dim3PropertyList; reportGridHelper.HasDim3PropertyNameRowColumn = true; reportGridHelper.CompareType = ""; reportGridHelper.ByTimeType = byTimeType; reportGridHelper.ShowGrid(); base.InitWebGrid(); //获取表格和图示 if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid) { this.gridWebGrid.Visible = true; this.cmdGridExport.Visible = true; this.lineChart.Visible = false; this.columnChart.Visible = false; } else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart || UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.PieChart || UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart) { string propertyName = this.languageComponent1.GetString(dim3PropertyList[0].Name); foreach (NewReportDomainObject domainObject in dateSourceForOWC) { domainObject.EAttribute1 = propertyName + domainObject.EAttribute1; } List <string> rowPropertyList = new List <string>(); string[] rows = TimingType.ParserAttributeTimingType2(this.rblTimingType.SelectedValue); if (rows != null) { foreach (string row in rows) { rowPropertyList.Add(row); } } List <string> columnPropertyList = new List <string>(); string[] columns = SummaryTarget.ParserAttributeSummaryTarget2(this.rblSummaryTarget.SelectedValue); if (columns != null) { foreach (string column in columns) { columnPropertyList.Add(column); } } columnPropertyList.Add("EAttribute1"); List <string> valuePropertyList = new List <string>(); foreach (ReportGridDim3Property property in dim3PropertyList) { if (!property.Hidden) { valuePropertyList.Add(property.Name); } } List <string> dataPropertyList = valuePropertyList; foreach (NewReportDomainObject obj in dateSourceForOWC) { obj.TempValue = obj.InputQty.ToString(); //时段、班次、天、周、月、年 if (this.rblTimingType.SelectedValue == TimingType.TimePeriod.ToString()) { obj.PeriodCode = obj.PeriodCode.ToString(); } if (this.rblTimingType.SelectedValue == TimingType.Shift.ToString()) { obj.PeriodCode = obj.ShiftCode.ToString(); } if (this.rblTimingType.SelectedValue == TimingType.Day.ToString()) { obj.PeriodCode = obj.ShiftDay.ToString(); } if (this.rblTimingType.SelectedValue == TimingType.Week.ToString()) { obj.PeriodCode = obj.Week.ToString(); } if (this.rblTimingType.SelectedValue == TimingType.Month.ToString()) { obj.PeriodCode = obj.Month.ToString(); } //end } if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.LineChart) { this.columnChart.Visible = false; this.lineChart.Visible = true; lineChart.ChartGroupByString = ColumnList; //设置首页报表的大小 if (ViewState["Width"] != null) { lineChart.Width = int.Parse(ViewState["Width"].ToString()); } if (ViewState["Height"] != null) { lineChart.Height = int.Parse(ViewState["Height"].ToString()); } //end this.lineChart.ChartTextFormatString = "<DATA_VALUE:0.##>"; this.lineChart.YLabelFormatString = "<DATA_VALUE:0.##>"; this.lineChart.DataType = true; this.lineChart.DataSource = dateSourceForOWC; this.lineChart.DataBind(); } else if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.HistogramChart) { this.columnChart.Visible = true; this.lineChart.Visible = false; columnChart.ChartGroupByString = ColumnList; //设置首页报表的大小 if (ViewState["Width"] != null) { columnChart.Width = int.Parse(ViewState["Width"].ToString()); } if (ViewState["Height"] != null) { columnChart.Height = int.Parse(ViewState["Height"].ToString()); } //end this.columnChart.ChartTextFormatString = "<DATA_VALUE:0.##>"; this.columnChart.YLabelFormatString = "<DATA_VALUE:0.##>"; this.columnChart.DataType = true; this.columnChart.DataSource = dateSourceForOWC; this.columnChart.DataBind(); } else { this.columnChart.Visible = false; this.lineChart.Visible = false; } this.gridWebGrid.Visible = false; this.cmdGridExport.Visible = false; } ReportPageHelper.SetPageScrollToBottom(this); } else { this.chbRefreshAuto.Checked = false; this.AutoRefresh = false; } this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false; this.gridWebGrid.Behaviors.Sorting.Enabled = false; }
/// <summary> /// 将数据转换为相对应X轴、Y轴的DataTable /// </summary> public DataTable ConvertDataTableActiveRate(string planQtyName) { DataTable dt = new DataTable(); //此列用来显示有变描述 dt.Columns.Add(new DataColumn("Name", typeof(string))); ArrayList columnName = new ArrayList(); foreach (NewReportDomainObject domainObject in DataSource) //X轴 { if (!columnName.Contains(domainObject.PeriodCode)) { columnName.Add(domainObject.PeriodCode); } } //排序名称 columnName.Sort(); for (int i = 0; i < columnName.Count; i++) { if (columnName[i].ToString().Trim() == string.Empty) { dt.Columns.Add(new DataColumn(" ", typeof(double))); } else { dt.Columns.Add(new DataColumn(columnName[i].ToString(), typeof(double))); } } Hashtable nameColumn = new Hashtable(); string name = string.Empty; //Y轴 string[] groupColumns = m_ChartGroupByString.Split(','); ArrayList nameList = new ArrayList(); foreach (NewReportDomainObject domainObject in DataSource) { name = string.Empty; if (groupColumns.Length > 0) { for (int i = 0; i < groupColumns.Length; i++) { if (groupColumns[i].Trim().ToLower() == "sscode") { name += domainObject.SSCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "opcode") { name += domainObject.OPCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "rescode") { name += domainObject.ResCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "bigsscode") { name += domainObject.BigSSCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "segcode") { name += domainObject.SegCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "faccode") { name += domainObject.FacCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "momemo") { name += domainObject.MOMemo + "-"; } else if (groupColumns[i].Trim().ToLower() == "newmass") { name += domainObject.NewMass + "-"; } else if (groupColumns[i].Trim().ToLower() == "itemcode") { name += domainObject.ItemCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "modelcode") { name += domainObject.ModelCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "mmodelcode" || groupColumns[i].Trim().ToLower() == "materialmodelcode") { name += domainObject.MaterialModelCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "mmachinetype" || groupColumns[i].Trim().ToLower() == "materialmachinetype") { name += domainObject.MaterialMachineType + "-"; } else if (groupColumns[i].Trim().ToLower() == "mexportimport" || groupColumns[i].Trim().ToLower() == "materialexportimport") { name += domainObject.MaterialExportImport + "-"; } else if (groupColumns[i].Trim().ToLower() == "mocode") { name += domainObject.MOCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "firstclass") { name += domainObject.FirstClass + "-"; } else if (groupColumns[i].Trim().ToLower() == "secondclass") { name += domainObject.SecondClass + "-"; } else if (groupColumns[i].Trim().ToLower() == "thirdclass") { name += domainObject.SSCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "lotno") { name += domainObject.LotNo + "-"; } else if (groupColumns[i].Trim().ToLower() == "productiontype") { name += domainObject.ProductionType + "-"; } else if (groupColumns[i].Trim().ToLower() == "oqclottype") { name += domainObject.OQCLotType + "-"; } else if (groupColumns[i].Trim().ToLower() == "inspectorandname") { name += domainObject.InspectorAndName + "-"; } else if (groupColumns[i].Trim().ToLower() == "iqclineitemtype") { name += domainObject.IQCLineItemType + "-"; } else if (groupColumns[i].Trim().ToLower() == "iqcitemtype") { name += domainObject.IQCItemType + "-"; } else if (groupColumns[i].Trim().ToLower() == "rohs") { name += domainObject.Rohs + "-"; } else if (groupColumns[i].Trim().ToLower() == "concessionstatus") { name += domainObject.ConcessionStatus + "-"; } else if (groupColumns[i].Trim().ToLower() == "vendorcode") { name += domainObject.VendorCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "materialcode") { name += domainObject.MaterialCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "tpcode") { name += domainObject.PeriodCode + "-"; } else if (groupColumns[i].Trim().ToUpper() == "shiftcode") { name += domainObject.ShiftCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "shiftday") { name += domainObject.ShiftDay + "-"; } else if (groupColumns[i].Trim().ToLower() == "dweek") { name += domainObject.Week + "-"; } else if (groupColumns[i].Trim().ToLower() == "dmonth") { name += domainObject.Month + "-"; } else if (groupColumns[i].Trim().ToLower() == "year") { name += domainObject.Year + "-"; } else if (groupColumns[i].Trim().ToLower() == "goodsemigood") { name += domainObject.GoodSemiGood + "-"; } else if (groupColumns[i].Trim().ToLower() == "crewcode") { name += domainObject.CrewCode + "-"; } else if (groupColumns[i].Trim().ToLower() == "projectname") { name += domainObject.ProjectCode + "-"; } } name += domainObject.EAttribute1; } if (!nameColumn.Contains(name)) { nameColumn.Add(name, name); } nameList.Add(name); } foreach (System.Collections.DictionaryEntry objDE in nameColumn) { DataRow dr = dt.NewRow(); dr[0] = objDE.Value.ToString(); for (int m = 0; m < DataSource.Length; m++) { NewReportDomainObject domainObject = DataSource[m] as NewReportDomainObject; if (objDE.Value.ToString() == nameList[m].ToString()) { if (domainObject.PeriodCode.Trim() == string.Empty) { dr[" "] = domainObject.TempValue; } else { if (domainObject.PlanQty != 0) { dr[domainObject.PeriodCode] = decimal.Parse(domainObject.TempValue) / decimal.Parse(domainObject.PlanQty.ToString());; //domainObject.TempValue; } } } } dt.Rows.Add(dr); } return(dt); }
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; } }
private void ProcessOWC(object[] dataSource) { if (dataSource != null) { List <string> serieNameList = new List <string>(); this.columnChart.Visible = true; //NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length + dataSource.Length]; //NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length * 2]; NewReportDomainObject item; NewReportDomainObject item1; int i = 0; foreach (ProductInvPeriod productInvPeriod in dataSource) { if (productInvPeriod.IsForTitle) { continue; } foreach (ProductInvPeriod data in productInvPeriod.DataToGrid) { string serieName = data.DateFrom.ToString() + " ~ " + data.DateTo.ToString(); if (!serieNameList.Contains(serieName)) { serieNameList.Add(serieName); } } } int count = 0; foreach (string serieName in serieNameList) { List <string> categoryArray = new List <string>(); List <object> valueArray = new List <object>(); foreach (ProductInvPeriod productInvPeriod in dataSource) { if (productInvPeriod.IsForTitle) { continue; } foreach (ProductInvPeriod data in productInvPeriod.DataToGrid) { string currSerieName = data.DateFrom.ToString() + " ~ " + data.DateTo.ToString(); double rate = 0; if (productInvPeriod.ProductCount > 0) { rate = data.ProductCount * 1.0 / productInvPeriod.ProductCount; } if (serieName == currSerieName) { count += 2; } } } } if (count > 0) { NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[count]; foreach (string serieName in serieNameList) { foreach (ProductInvPeriod productInvPeriod in dataSource) { if (productInvPeriod.IsForTitle) { continue; } foreach (ProductInvPeriod data in productInvPeriod.DataToGrid) { string currSerieName = data.DateFrom.ToString() + " ~ " + data.DateTo.ToString(); double rate = 0; if (productInvPeriod.ProductCount > 0) { rate = data.ProductCount * 1.0 / productInvPeriod.ProductCount; } if (serieName == currSerieName) { item = new NewReportDomainObject(); item1 = new NewReportDomainObject(); item.EAttribute1 = serieName; item.PeriodCode = data.InventoryType; item.TempValue = Convert.ToSingle(rate).ToString(); dateSourceForOWC[i++] = item; item1.EAttribute1 = serieName; item1.PeriodCode = data.InventoryType + this.languageComponent1.GetString("Norm"); item1.TempValue = Convert.ToSingle(data.PercentageStandard).ToString(); dateSourceForOWC[i++] = item1; } } } } this.columnChart.ChartGroupByString = ""; this.columnChart.ChartTextFormatString = "<DATA_VALUE:0.00%>"; this.columnChart.YLabelFormatString = "<DATA_VALUE:0.##%>"; this.columnChart.DataType = true; this.columnChart.DataSource = dateSourceForOWC; this.columnChart.DataBindProductInvPeriod(); } else { this.columnChart.Visible = false; } } else { this.columnChart.Visible = false; } //this.OWCChartSpace1.ClearCharts(); //if (dataSource != null) //{ // List<string> serieNameList = new List<string>(); // foreach (ProductInvPeriod productInvPeriod in dataSource) // { // if (productInvPeriod.IsForTitle) // { // continue; // } // foreach (ProductInvPeriod data in productInvPeriod.DataToGrid) // { // string serieName = data.DateFrom.ToString() + " ~ " + data.DateTo.ToString(); // if (!serieNameList.Contains(serieName)) // { // serieNameList.Add(serieName); // } // } // } // foreach (string serieName in serieNameList) // { // List<string> categoryArray = new List<string>(); // List<object> valueArray = new List<object>(); // foreach (ProductInvPeriod productInvPeriod in dataSource) // { // if (productInvPeriod.IsForTitle) // { // continue; // } // foreach (ProductInvPeriod data in productInvPeriod.DataToGrid) // { // string currSerieName = data.DateFrom.ToString() + " ~ " + data.DateTo.ToString(); // double rate = 0; // if (productInvPeriod.ProductCount > 0) // { // rate = data.ProductCount * 1.0 / productInvPeriod.ProductCount; // } // if (serieName == currSerieName) // { // categoryArray.Add(data.InventoryType); // valueArray.Add(Convert.ToSingle(rate)); // categoryArray.Add(data.InventoryType + this.languageComponent1.GetString("Norm")); // valueArray.Add(Convert.ToSingle(data.PercentageStandard)); // } // } // } // this.OWCChartSpace1.AddChart(true, serieName, categoryArray.ToArray(), valueArray.ToArray(), string.Empty); // } // this.OWCChartSpace1.ChartType = OWCChartType.ColumnStacked; // this.OWCChartSpace1.AxesLeftNumberFormat = "0%"; // this.OWCChartSpace1.ChartLeftMaximum = 1; // this.OWCChartSpace1.Display = true; //} }
private void ProcessCloseRateOWC(object[] dataSource) { if (dataSource != null) { this.lineChart.Visible = true; NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length]; string propertyName = this.languageComponent1.GetString("MOCloseRate"); NewReportDomainObject item; for (int i = 0; i < dataSource.Length; i++) { item = new NewReportDomainObject(); item.EAttribute1 = propertyName; if (this.rblByTimeTypeQuery.SelectedValue == NewReportByTimeType.Week) { item.PeriodCode = (dataSource[i] as RptMOCloseRate).Year.ToString() + "/" + (dataSource[i] as RptMOCloseRate).Week.ToString(); } else { item.PeriodCode = (dataSource[i] as RptMOCloseRate).Year.ToString() + "/" + (dataSource[i] as RptMOCloseRate).Month.ToString(); } item.TempValue = (dataSource[i] as RptMOCloseRate).CloseRate.ToString(); dateSourceForOWC[i] = item; } this.lineChart.ChartGroupByString = ""; this.lineChart.ChartTextFormatString = "<DATA_VALUE:0.00%>"; this.lineChart.YLabelFormatString = "<DATA_VALUE:##%>"; this.lineChart.DataType = true; this.lineChart.DataSource = dateSourceForOWC; this.lineChart.DataBind(); } else { this.lineChart.Visible = false; } //if (dataSource != null) //{ // string serieName = this.languageComponent1.GetString("MOCloseRate"); // List<string> categoryArray = new List<string>(); // List<object> valueArray = new List<object>(); // foreach (RptMOCloseRate moCloseRate in dataSource) // { // string currCategory = string.Empty; // if (this.rblByTimeTypeQuery.SelectedValue == NewReportByTimeType.Week) // { // currCategory = moCloseRate.Year.ToString() + "/" + moCloseRate.Week.ToString(); // } // else // { // currCategory = moCloseRate.Year.ToString() + "/" + moCloseRate.Month.ToString(); // } // categoryArray.Add(currCategory); // valueArray.Add(Convert.ToSingle(moCloseRate.CloseRate)); // } // this.OWCChartSpace1.AddChart(true, serieName, categoryArray.ToArray(), valueArray.ToArray(), string.Empty); // this.OWCChartSpace1.ChartType = OWCChartType.Line; // this.OWCChartSpace1.AxesLeftNumberFormat = "0%"; // //this.OWCChartSpace1.ChartLeftMaximum = 1; // this.OWCChartSpace1.Display = true; //} }
private void ProcessMOPeriodOWC(object[] dataSource) { if (dataSource != null) { this.columnChart.Visible = true; NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length]; string propertyName = this.languageComponent1.GetString("MOPeriod"); NewReportDomainObject item; //int temp = (dataSource[0] as ProductInvPeriod).ProductCount; for (int i = 0; i < dataSource.Length; i++) { item = new NewReportDomainObject(); item.EAttribute1 = propertyName; item.PeriodCode = (dataSource[i] as ProductInvPeriod).DateFrom.ToString() + "~" + (dataSource[i] as ProductInvPeriod).DateTo.ToString(); item.TempValue = (dataSource[i] as ProductInvPeriod).ProductCount.ToString(); dateSourceForOWC[i] = item; //if (temp < (dataSource[i] as ProductInvPeriod).ProductCount) //{ // temp = (dataSource[i] as ProductInvPeriod).ProductCount; //} } //this.columnChart.YRangeMin = 0; //this.columnChart.YRangeMax = Convert.ToDouble(temp); this.columnChart.ChartGroupByString = ""; 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.OWCChartSpace2.ClearCharts(); //if (dataSource != null) //{ // string serieName = this.languageComponent1.GetString("MOPeriod"); // List<string> categoryArray = new List<string>(); // List<object> valueArray = new List<object>(); // foreach (ProductInvPeriod moPeriod in dataSource) // { // categoryArray.Add(moPeriod.DateFrom.ToString() + " ~ " + moPeriod.DateTo.ToString()); // valueArray.Add(moPeriod.ProductCount); // } // this.OWCChartSpace2.AddChart(false, serieName, categoryArray.ToArray(), valueArray.ToArray(), string.Empty); // this.OWCChartSpace2.ChartType = OWCChartType.ColumnClustered; // this.OWCChartSpace2.AxesLeftNumberFormat = "0"; // this.OWCChartSpace2.Display = true; //} }
private void _processOWC(object[] dataSource) { //this.OWCChartSpace1.ClearCharts(); //if( dataSource != null ) //{ // string[] categories = new string[ dataSource.Length ]; // object[] values = new object[ dataSource.Length ]; // object[] ParetoValues = new object[ dataSource.Length ]; // for(int i = 0;i<dataSource.Length;i++) // { // string timeType = ""; // switch( this.rblSummaryTargetQuery.SelectedValue ) // { // case RMATimeKide.Day: // timeType = FormatHelper.ToDateString((dataSource[i] as QDORMADefect).TimeType); // break; // case RMATimeKide.Week: // timeType = (dataSource[i] as QDORMADefect).TimeType.ToString(); // break; // case RMATimeKide.Month: // timeType = (dataSource[i] as QDORMADefect).TimeType.ToString(); // break; // default: // timeType = ""; // break; // } // categories[i] = timeType; // values[i] = (dataSource[i] as QDORMADefect).TotalQty; // ParetoValues[i] = (dataSource[i] as QDORMADefect).RMAQuantity.ToString(); // } // //this.OWCChartSpace1.ChartCombinationType = OWCChartCombinationType.OWCCombinationPareto; // this.OWCChartSpace1.AddChart(this.languageComponent1.GetString("RMATotalQty"), categories, values ); // this.OWCChartSpace1.AddChart(this.languageComponent1.GetString("RMAQuantity"), categories, ParetoValues, OWCChartType.LineMarkers, true); // this.OWCChartSpace1.Display = true; //} if (dataSource != null) { string[] categories = new string[dataSource.Length]; object[] values = new object[dataSource.Length]; object[] ParetoValues = new object[dataSource.Length]; for (int i = 0; i < dataSource.Length; i++) { categories[i] = (dataSource[i] as QDORMADefect).TimeType.ToString(); values[i] = (dataSource[i] as QDORMADefect).TotalQty; ParetoValues[i] = (dataSource[i] as QDORMADefect).RMAQuantity; } //设置首页报表的大小 if (ViewState["Width"] != null) { UCColumnChartProcess1.Width = int.Parse(ViewState["Width"].ToString()); } if (ViewState["Height"] != null) { UCColumnChartProcess1.Height = int.Parse(ViewState["Height"].ToString()); } //end NewReportDomainObject[] dateSourceForOWC = new NewReportDomainObject[dataSource.Length]; for (int i = 0; i < dateSourceForOWC.Length; i++) { dateSourceForOWC[i] = new NewReportDomainObject(); } for (int i = 0; i < dateSourceForOWC.Length; i++) { int j = 0; if (i < dateSourceForOWC.Length) { dateSourceForOWC[i].PeriodCode = (dataSource[i] as QDORMADefect).TimeType.ToString(); dateSourceForOWC[i].TempValue = (dataSource[i] as QDORMADefect).RMAQuantity.ToString(); dateSourceForOWC[i].PlanQty = (dataSource[i] as QDORMADefect).TotalQty; dateSourceForOWC[i].EAttribute1 = this.languageComponent1.GetString("RMAQuantity"); dateSourceForOWC[i].TimeString = (dataSource[i] as QDORMADefect).TimeType.ToString(); } } switch (this.rblSummaryTargetQuery.SelectedValue) { case RMATimeKide.Day: this.UCColumnChartProcess1.ChartGroupByString = "shiftday"; break; case RMATimeKide.Week: this.UCColumnChartProcess1.ChartGroupByString = "dweek"; break; case RMATimeKide.Month: this.UCColumnChartProcess1.ChartGroupByString = "dmonth"; break; } this.UCColumnChartProcess1.DataType = true; this.UCColumnChartProcess1.YLabelFormatString = "<DATA_VALUE:0.##>"; this.UCColumnChartProcess1.ChartTextFormatString = "<DATA_VALUE:0.##>"; this.UCColumnChartProcess1.DataSource = dateSourceForOWC; this.UCColumnChartProcess1.DataBindQty(this.languageComponent1.GetString("TotalRMAQty")); this.UCColumnChartProcess1.Visible = true; } else { this.UCColumnChartProcess1.Visible = false; } }