private void load_data() { try { load_head(); ClearGrid(axfpSpread); DataTable dt = SEL_SMT_BTS_YEAR("Q", line, mline, opcd, UC_YEAR.GetValue().ToString()); if (dt != null && dt.Rows.Count > 0) { axfpSpread.MaxRows = dt.Rows.Count + 2; for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 1; j < dt.Columns.Count; j++) { axfpSpread.SetText(j + 1, i + 3, dt.Rows[i][j].ToString() == "" ? "" : dt.Rows[i][j].ToString()); //axfpSpread.SetText(j, i + 3, "2,999"); } } } CreateChart(); } catch { } }
private void load_head() { try { DataTable dt = SEL_SMT_YEAR_PROD_STATUS("H", line, mline, UC_YEAR.GetValue().ToString()); int i; if (dt != null && dt.Rows.Count > 0) { //axfpSpread.SetText(1, 1, dt.Rows[0]["MON"].ToString()); axfpSpread.set_ColWidth(1, 16.5); // axfpSpread.set_ColWidth(2, 226); for (i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["CUR"].ToString() == "1") { axfpSpread.Row = 1; axfpSpread.Col = i + 2; axfpSpread.BackColor = Color.Salmon; axfpSpread.Row = 2; axfpSpread.Col = i + 2; axfpSpread.BackColor = Color.Salmon; } //axfpSpread.AddCellSpan(i + 2, 1, 1, 1); axfpSpread.SetText(i + 2, 1, dt.Rows[i]["YEAR"].ToString()); axfpSpread.SetText(i + 2, 2, dt.Rows[i]["MON"].ToString()); axfpSpread.set_ColWidth(i + 2, (double)221 / (double)(dt.Rows.Count)); //axfpSpread.set_ColWidth(i + 2, 240 / 27 + 0.3); //axfpSpread.set_ColWidth(i + 2, (axfpSpread.Width-axfpSpread.get_ColWidth(1))/dt.Rows.Count); } axfpSpread.set_ColWidth(1, 17.7 + 220 - axfpSpread.get_ColWidth(i + 1) * dt.Rows.Count); axfpSpread.AddCellSpan(dt.Rows.Count + 1, 1, 1, 2); axfpSpread.AddCellSpan(dt.Rows.Count, 1, 1, 2); axfpSpread.AddCellSpan(dt.Rows.Count - 1, 1, 1, 2); //axfpSpread.set_ColWidth(1, 16.4 + 0.1 * 25 / dt.Rows.Count ); for (int j = i + 2; j <= axfpSpread.MaxCols; j++) { axfpSpread.set_ColWidth(j, 0); } } } catch { } }
private void load_data() { System.Data.DataSet ds = LOAD_DATA_v2(_line_cd, _mline_cd, UC_YEAR.GetValue().ToString()); axGrid.Hide(); load_data_grid(ds.Tables[0]); AnimateWindow(axGrid.Handle, 300, AW_SLIDE | 0X4); axGrid.Show(); //pn_body.Visible = true; switch (Lang) { case "Vn": CreateChartLine(Chart1, ds.Tables[1], "Cắt"); CreateChartLine(Chart2, ds.Tables[3], "May 1"); CreateChartLine(Chart3, ds.Tables[5], "May 2"); CreateChartLine(Chart4, ds.Tables[2], "Chuẩn bị"); CreateChartLine(Chart5, ds.Tables[4], "Lắp ráp"); break; case "En": CreateChartLine(Chart1, ds.Tables[1], "Cutting"); CreateChartLine(Chart2, ds.Tables[3], "Stitching 1"); CreateChartLine(Chart3, ds.Tables[5], "Stitching 2"); CreateChartLine(Chart4, ds.Tables[2], "Stockfit"); CreateChartLine(Chart5, ds.Tables[4], "Assembly"); break; } //CreateChartLine(Chart1, ds.Tables[1], "Cutting"); //CreateChartLine(Chart2, ds.Tables[3], "Stitching 1"); //CreateChartLine(Chart3, ds.Tables[5], "Stitching 2"); //CreateChartLine(Chart4, ds.Tables[2], "Stockfit"); //CreateChartLine(Chart5, ds.Tables[4], "Assembly"); BindingPOD(ds.Tables[6]); }
private void load_head() { try { DataTable dt = SEL_SMT_BTS_YEAR("H", line, mline, opcd, UC_YEAR.GetValue().ToString()); int i; if (dt != null && dt.Rows.Count > 0) { //axfpSpread.SetText(1, 1, dt.Rows[0]["MON"].ToString()); //axfpSpread.set_ColWidth(1, 16.7); for (i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["CUR"].ToString() == "1") { axfpSpread.Row = 1; axfpSpread.Col = i + 2; axfpSpread.BackColor = Color.Salmon; axfpSpread.Row = 2; axfpSpread.Col = i + 2; axfpSpread.BackColor = Color.Salmon; } axfpSpread.SetText(i + 2, 1, dt.Rows[i]["YEAR"].ToString()); axfpSpread.SetText(i + 2, 2, dt.Rows[i]["MON"].ToString()); //axfpSpread.set_ColWidth(i + 2, (double)221 / (double)(dt.Rows.Count)); } //axfpSpread.set_ColWidth(1, 16.6 + 220 - axfpSpread.get_ColWidth(i + 1) * dt.Rows.Count); //for (int j = i + 2; j <= axfpSpread.MaxCols; j++) //{ // axfpSpread.set_ColWidth(j, 0); //} } } catch { } }
private void CreateChart() { try { //chartBTS.AppearanceNameSerializable = "Chameleon"; Series series1 = new Series("BTS", ViewType.Bar); chartBTS.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesLabel sideBySideBarSeriesLabel1 = new DevExpress.XtraCharts.SideBySideBarSeriesLabel(); Series series2 = new Series("Target", ViewType.Line); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView1.Color = System.Drawing.Color.LimeGreen; sideBySideBarSeriesView1.FillStyle.FillMode = DevExpress.XtraCharts.FillMode.Solid; series1.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series1.Label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); series1.Label.TextPattern = "{V:#,#.0}" + "%"; series1.View = sideBySideBarSeriesView1; series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series2.Label.TextPattern = "{V:#,#.0}" + "%"; lineSeriesView1.Color = System.Drawing.Color.LimeGreen; lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); lineSeriesView1.LineStyle.Thickness = 4; series2.View = lineSeriesView1; DataTable dt = SEL_SMT_BTS_YEAR("C", line, mline, opcd, UC_YEAR.GetValue().ToString()); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["BTS"])); series2.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["TARGET"])); if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) && Convert.ToDouble(dt.Rows[i]["BTS"]) >= Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Yellow; } else if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Red; } else { series1.Points[i].Color = System.Drawing.Color.LimeGreen; } } chartBTS.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1, series2 }; ((XYDiagram)chartBTS.Diagram).AxisX.Label.Font = new System.Drawing.Font("Tahoma", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisX.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); ((XYDiagram)chartBTS.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; ((XYDiagram)chartBTS.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 13F); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Font = new System.Drawing.Font("Calibri", 22F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Text = "BTS (%)"; ((XYDiagram)chartBTS.Diagram).AxisY.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); } } catch (Exception EX) { } }
private void CreateChart() { try { chartBTS.Legends.Clear(); //chartBTS.AppearanceNameSerializable = "Chameleon"; Series series1 = new Series("BTS", ViewType.Bar); chartBTS.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesLabel sideBySideBarSeriesLabel1 = new DevExpress.XtraCharts.SideBySideBarSeriesLabel(); Series series2 = new Series("Target", ViewType.Line); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView1.Color = System.Drawing.Color.LimeGreen; sideBySideBarSeriesView1.FillStyle.FillMode = DevExpress.XtraCharts.FillMode.Solid; series1.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series1.Label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); series1.Label.TextPattern = "{V:#,#.0}" + "%"; series1.View = sideBySideBarSeriesView1; series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series2.Label.TextPattern = "{V:#,#.0}" + "%"; lineSeriesView1.Color = System.Drawing.Color.LimeGreen; lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); lineSeriesView1.LineStyle.Thickness = 4; series2.View = lineSeriesView1; DataTable dt = SEL_SMT_BTS_YEAR("C", line, mline, opcd, UC_YEAR.GetValue().ToString()); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["BTS"])); series2.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["TARGET"])); if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) && Convert.ToDouble(dt.Rows[i]["BTS"]) >= Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Yellow; } else if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Red; } else { series1.Points[i].Color = System.Drawing.Color.LimeGreen; } } chartBTS.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1, series2 }; ((XYDiagram)chartBTS.Diagram).AxisX.Label.Font = new System.Drawing.Font("Tahoma", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisX.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); ((XYDiagram)chartBTS.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; ((XYDiagram)chartBTS.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 13F); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Font = new System.Drawing.Font("Calibri", 22F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Text = "BTS (%)"; ((XYDiagram)chartBTS.Diagram).AxisY.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); DevExpress.XtraCharts.Legend legend1 = new DevExpress.XtraCharts.Legend(); DevExpress.XtraCharts.CustomLegendItem customLegendItem1 = new DevExpress.XtraCharts.CustomLegendItem(); DevExpress.XtraCharts.CustomLegendItem customLegendItem2 = new DevExpress.XtraCharts.CustomLegendItem(); DevExpress.XtraCharts.CustomLegendItem customLegendItem3 = new DevExpress.XtraCharts.CustomLegendItem(); customLegendItem1.MarkerColor = System.Drawing.Color.LimeGreen; customLegendItem1.Name = "GREEN"; customLegendItem1.Text = ">=" + dt.Rows[0]["TARGET"].ToString() + "%"; customLegendItem2.MarkerColor = System.Drawing.Color.Yellow; customLegendItem2.Name = "YELLOW"; customLegendItem2.Text = ">=" + (Convert.ToDouble(dt.Rows[0]["TARGET"].ToString()) - 5).ToString() + "% and <" + dt.Rows[0]["TARGET"].ToString() + "%"; customLegendItem3.MarkerColor = System.Drawing.Color.Red; customLegendItem3.Name = "RED"; customLegendItem3.Text = "<" + (Convert.ToDouble(dt.Rows[0]["TARGET"].ToString()) - 5).ToString() + "%"; legend1.CustomItems.AddRange(new DevExpress.XtraCharts.CustomLegendItem[] { customLegendItem1, customLegendItem2, customLegendItem3 }); legend1.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.Right; legend1.AlignmentVertical = DevExpress.XtraCharts.LegendAlignmentVertical.TopOutside; legend1.Direction = DevExpress.XtraCharts.LegendDirection.LeftToRight; legend1.Font = new System.Drawing.Font("Tahoma", 12F); legend1.Name = "Legend1"; this.chartBTS.Legends.AddRange(new DevExpress.XtraCharts.Legend[] { legend1 }); } } catch (Exception EX) { } }
private void load_data() { try { load_head(); DataTable dt = SEL_SMT_YEAR_PROD_STATUS("Q", line, mline, UC_YEAR.GetValue().ToString()); //DataTable dt1 = SEL_SMT_MON_PROD_STATUS("C1", line, mline, ""); if (dt != null && dt.Rows.Count > 0) { axfpSpread.MaxRows = dt.Rows.Count + 2; ClearGrid(axfpSpread); for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 2; j < dt.Columns.Count; j++) { if (dt.Columns[j].ColumnName.Replace("'", "") == "RATE") { axfpSpread.SetText(j, i + 3, dt.Rows[i][j].ToString() == "" ? "" : Convert.ToDouble(dt.Rows[i][j].ToString()).ToString() + "%"); } else { axfpSpread.SetText(j, i + 3, dt.Rows[i][j].ToString() == "" ? "" : Convert.ToDouble(dt.Rows[i][j].ToString()).ToString("###,###,###")); } if (j == dt.Columns.Count - 1) { axfpSpread.Row = i + 3; axfpSpread.Col = j; if (Convert.ToDouble(GetText(axfpSpread, j, i + 3).Replace("%", "").Trim()) < 95) { axfpSpread.BackColor = Color.Red; axfpSpread.ForeColor = Color.White; } else if (Convert.ToDouble(GetText(axfpSpread, j, i + 3).Replace("%", "").Trim()) > 98) { axfpSpread.BackColor = Color.Green; axfpSpread.ForeColor = Color.White; } else { axfpSpread.BackColor = Color.Yellow; axfpSpread.ForeColor = Color.Black; } } } } } DataTable dt_chart = SEL_SMT_YEAR_PROD_STATUS("C", line, mline, UC_YEAR.GetValue().ToString()); bindingdatachart(chartControl1, dt_chart, "UPC_QTY", "UPC_TAR"); bindingdatachart(chartControl2, dt_chart, "UPS1_QTY", "UPS1_TAR"); bindingdatachart(chartControl3, dt_chart, "UPS2_QTY", "UPS2_TAR"); bindingdatachart(chartControl4, dt_chart, "FSS_QTY", "FSS_TAR"); bindingdatachart(chartControl5, dt_chart, "FGA_QTY", "FGA_TAR"); int i_min = 0, i_max = 100; if (dt != null && dt.Rows.Count > 0) { if (GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim() != "") { if (Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) > 90 && Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) < 100) { i_min = 90; i_max = 100; } else if (Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) < 90) { i_min = 90 - 3; i_max = 100; } else if (Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) > 100) { i_min = 90; i_max = 100 + 3; } else if (Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) == 0) { i_min = 0; i_max = 100; } BindingGauges(circularGauge1, Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()), i_min, i_max, 95, 98); lblRate.Text = Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) + "%"; } } else { BindingGauges(circularGauge1, 0, 0, 100, 95, 98); lblRate.Text = "0%"; } } catch { } }