private void LoadLayoutWS() { try { tblMain.Visible = false; int iTable = 1; DatabaseTMS db = new DatabaseTMS(); DataTable dt = db.GetPlant("VJ", ComVar.Var._strValue3, ComVar.Var._strValue4, DateTime.Now.ToString("yyyyMMdd")); //GetPlant khi load lên xem cần khởi tạo bao nhiêu User Controls. for (int i = 0; i < 3; i++) //loop dòng { for (int j = 0; j < 8; j++) //loop cột { if (iTable <= dt.Rows.Count) //21 cell được load layout { UC.UC_WS_INFO UC_WS = new UC.UC_WS_INFO(); UC_WS.OnButtonClick += OnbuttonUCClick; UC_WS.OnLabelPlantClick += OnLabelPlantClick; tblMain.Controls.Add(UC_WS, j, i); } iTable++; } } tblMain.Visible = true; } catch (Exception ex) { } }
public void BingdingData(string Style_Cd, string Cs_size, string Line_Cd) { DatabaseTMS db = new DatabaseTMS(); DataTable dt = db.getSetDetailPopupV1("POPPUP", "", ComVar.Var._strValue3, ComVar.Var._strValue4, Line_Cd, Style_Cd, Cs_size); // PivotDataTable(dt); if (dt.Rows.Count > 0) { lblTotal.Text = string.Concat("Total: ", string.Format("{0:n0}", Math.Round(Convert.ToDouble(dt.Compute("SUM(QTY)", "")), 1)), " Prs"); } else { lblTotal.Text = "Total: 0 Prs"; } gridControl1.DataSource = dt; for (int i = 0; i < gridView1.Columns.Count; i++) { gridView1.Columns[i].OptionsColumn.ReadOnly = true; gridView1.Columns[i].OptionsColumn.AllowEdit = false; gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; gridView1.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False; if (i > 1) { gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Far; gridView1.Columns[i].DisplayFormat.FormatType = FormatType.Numeric; gridView1.Columns[i].DisplayFormat.FormatString = "#,#"; } else if (i == 0) { gridView1.Columns[i].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center; gridView1.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; } } }
private void BindingData(string Qtype) { DatabaseTMS db = new DatabaseTMS(); try { while (gridView1.Columns.Count > 0) { gridView1.Columns.RemoveAt(0); } DataTable dtSource = new DataTable(); DataTable dt1 = db.getSetStatus(Qtype, ComVar.Var._strValue3, ComVar.Var._strValue4, "", ComVar.Var._strValue1); if (dt1 != null && dt1.Rows.Count > 0) { if (buildHeader_detail(dtSource, dt1)) { if (bindingDataSource_detail(dtSource, dt1)) { gridControl1.DataSource = dtSource; formatgrid(); } } } else { gridControl1.DataSource = null; } } catch { } }
private void GetDataINV_Chart() { try { DatabaseTMS db = new DatabaseTMS(); DataTable dtTemp = new DataTable(); DataTable dtLabel = new DataTable(); lblOS_INV.Text = "0 Prs"; int InvQty = 0; DataTable dt = ds.Tables[2]; if (dt.Rows.Count > 0) { if (dt.Select("STYLE_CD <> 'TOTAL'").Count() > 0) { dtTemp = dt.Select("STYLE_CD <> 'TOTAL'").CopyToDataTable(); } if (dt.Select("STYLE_CD = 'TOTAL'").Count() > 0) { dtLabel = dt.Select("STYLE_CD = 'TOTAL'").CopyToDataTable(); for (int i = 0; i < dtLabel.Rows.Count; i++) { InvQty += Convert.ToInt32(dtLabel.Rows[i]["WIP_QTY"]); } } lblOS_INV.Text = string.Format("{0:n0}", InvQty) + " Prs"; } chartControl2.DataSource = dtTemp; chartControl2.Series[0].ArgumentDataMember = "STYLE_CD"; chartControl2.Series[0].ValueDataMembers.AddRange(new string[] { "WIP_QTY" }); gridControl2.DataSource = dt; for (int i = 0; i < gridView2.Columns.Count; i++) { gridView2.Columns[i].OptionsColumn.ReadOnly = true; gridView2.Columns[i].OptionsColumn.AllowEdit = false; if (i < 2) { gridView2.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; } else { gridView2.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False; } if (i > 1) { gridView2.Columns[i].DisplayFormat.FormatType = FormatType.Numeric; gridView2.Columns[i].DisplayFormat.FormatString = "#,#"; } gridView2.Columns[i].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Far; } gridView2.Columns["STYLE_CD"].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center; gridView2.Columns["MODEL"].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; } catch (Exception ex) { chartControl2.DataSource = null; gridControl2.DataSource = null; } }
private void GetDataGridSetBalanceChart() { DatabaseTMS db = new DatabaseTMS(); try { } catch (Exception ex) { } }
private void GetData() { DatabaseTMS db = new DatabaseTMS(); ds = db.TMS_DELIVERY_DETAIL("MES.PKG_TMS_DASHBOARD.TMS_DELIVERY_DETAIL", "VJ", "20190927", ComVar.Var._strValue1); GetDataOutgoing_Chart(); GetDataOutgoing_Grid(); GetDataINV_Chart(); GetChartShortageByAsyDate(); GetChartShortageByComponent(); }
private void GetData() { DatabaseTMS db = new DatabaseTMS(); ds = db.TMS_DELIVERY_DETAIL("MES.PKG_TMS_DASHBOARD.TMS_DELIVERY_DETAIL_V1", "VJ", ComVar.Var._strValue3, ComVar.Var._strValue4, DateTime.Now.ToString("yyyyMMdd"), string.IsNullOrEmpty(ComVar.Var._strValue1) ? "ALL" : ComVar.Var._strValue1); GetDataOutgoing_Chart(); GetDataOutgoing_Grid(); GetDataINV_Chart(); GetChartOverall(); GetChartShortageByAsyDate(); GetChartShortageByComponent(); }
private void btnDetailSet_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; DatabaseTMS db = new DatabaseTMS(); DataTable dt = db.GetDeliveryDetail("VJ", "20190927", ComVar.Var._strValue1); FRM_POPUP_SQM_TRACKING_BT POPUP = new FRM_POPUP_SQM_TRACKING_BT(((DevExpress.XtraEditors.SimpleButton)sender), dt, true); POPUP.ShowBeakForm(); this.Cursor = Cursors.Default; }
private void GetDataGridSetBalanceChart() { DatabaseTMS db = new DatabaseTMS(); try { lblOS_SetAVG.Text = "0%"; DataTable dt = db.GetDeliveryDetail("VJ", "NoNeed", ComVar.Var._strValue1); if (dt != null && dt.Rows.Count > 0) { lblOS_SetAVG.Text = Math.Round(Convert.ToDouble(dt.Compute("AVG(RATIO)", "")), 1).ToString() + "%"; } gridControl4.DataSource = dt; for (int i = 0; i < gridView1.Columns.Count; i++) { gridView4.Columns[i].OptionsColumn.ReadOnly = true; gridView4.Columns[i].OptionsColumn.AllowEdit = false; if (gridView4.Columns[i].FieldName == "STYLE_CD") { gridView4.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True; } else { gridView4.Columns[i].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False; } if (i > 1) { gridView4.Columns[i].DisplayFormat.FormatType = FormatType.Numeric; gridView4.Columns[i].DisplayFormat.FormatString = "#,#"; } gridView4.Columns[i].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Far; } gridView4.Columns["COMP_NM"].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; gridView4.Columns["STYLE_CD"].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center; //BindingChart chartControl3.DataSource = dt; chartControl3.SeriesDataMember = "COMP_NM"; chartControl3.SeriesTemplate.ArgumentDataMember = "STYLE_CD"; chartControl3.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "RATIO" }); chartControl3.SeriesTemplate.Label.TextPattern = "{S}: {V:#,#}"; chartControl3.SeriesTemplate.Label.Font = new System.Drawing.Font("Calibri", 11, FontStyle.Bold); chartControl3.CrosshairOptions.CrosshairLabelMode = CrosshairLabelMode.ShowCommonForAllSeries; chartControl3.SeriesTemplate.CrosshairLabelPattern = "{S}: {V:#,#}"; // chartControl3.SeriesTemplate.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; // chartControl3.SeriesTemplate.Label.TextOrientation = TextOrientation.Horizontal; chartControl3.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; ((XYDiagram)chartControl3.Diagram).AxisY.Title.Visibility = DefaultBoolean.True; ((XYDiagram)chartControl3.Diagram).AxisY.Title.Text = "Percentage"; } catch (Exception ex) { } }
private void GetData() { DatabaseTMS db = new DatabaseTMS(); ds = db.TMS_DELIVERY_GETDATA("MES.PKG_TMS_DASHBOARD.TMS_DELIVERY_SEL", "VJ", "20190927", ComVar.Var._strValue1); BindingDataInfoTop(); //LẤY DỮ LIỆU CHO INFO TOP GetChartComponentByStyle(true); //LẤY DỮ LIỆU CHO CHART COMPONENT SET BY STYLE. GetChartRatoComponentByStyle(true); GetChartShortageByComponent(); GetChartShortageByAsyDate(); }
private void GetData() { DatabaseTMS db = new DatabaseTMS(); //for test //ComVar.Var._strValue1 = "201"; ds = db.TMS_DELIVERY_DETAIL("MES.PKG_TMS_DASHBOARD.TMS_DELIVERY_DETAIL_V1", "VJ", OP_CD, CMP_CD, DateTime.Now.ToString("yyyyMMdd"), ComVar.Var._strValue1); GetDataOutgoing_Chart(); GetDataOutgoing_Grid(); GetDataINV_Chart(); GetChartOverall(); GetChartShortageByAsyDate(); GetChartShortageByComponent(); }
private void GetDataOutgoing_Chart() { DatabaseTMS db = new DatabaseTMS(); DataTable dtTemp = new DataTable(); DataTable dt = db.GetOutScnByDay("VJ", "OS", DateTime.Now.ToString("yyyyMMdd"), ComVar.Var._strValue1); lblOS_Outgoing.Text = "0 Prs"; if (dt.Rows.Count > 0) { lblOS_Outgoing.Text = string.Format("{0:n0}", dt.Rows[dt.Rows.Count - 1]["O_QTY"]) + " Prs"; } if (dt.Select("DAYDAY IS NOT NULL").Count() > 0) { dtTemp = dt.Select("DAYDAY IS NOT NULL", "DD").CopyToDataTable(); } chartControl1.DataSource = dtTemp; chartControl1.Series[0].ArgumentDataMember = "DAYDAY"; chartControl1.Series[0].ValueDataMembers.AddRange(new string[] { "O_QTY" }); }
private void BindingOutScnByDay(string LINE_CD) { try { DatabaseTMS db = new DatabaseTMS(); DataTable dt = dtChartTemp = db.GetOutScnByDay("VJ", ComVar.Var._strValue3, ComVar.Var._strValue4, DateTime.Now.ToString("yyyyMMdd"), LINE_CD); lblO_SCN_OVER.Text = ""; lblO_SCN_D2.Text = ""; lblO_SCN_D1.Text = ""; lblO_SCN_DD.Text = ""; lblTotalDelivery_ByDay.Text = ""; lblO_SCN_OVER.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[0]["O_QTY"])) + " Prs"; lblO_SCN_D2.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[1]["O_QTY"])) + " Prs"; lblO_SCN_D1.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[2]["O_QTY"])) + " Prs"; lblO_SCN_DD.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[3]["O_QTY"])) + " Prs"; lblTotalDelivery_ByDay.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[4]["O_QTY"])) + " Prs"; } catch (Exception ex) { } }
private void BindingDataUC() { int iTable = 1; lblPlanTot.Text = ""; lblInvTot.Text = ""; lblLeadTimeTot.Text = ""; PlanQty = 0; InvQty = 0; DatabaseTMS db = new DatabaseTMS(); DataTable dt = dtUCTemp = db.GetPlant("VJ", ComVar.Var._strValue3, ComVar.Var._strValue4, DateTime.Now.ToString("yyyyMMdd")); layOutCount = dt.Rows.Count; for (int i = 0; i < 3; i++) { for (int j = 0; j < 8; j++) { if (iTable <= dt.Rows.Count) //21 cell được load layout { UC.UC_WS_INFO UC_WS = (UC.UC_WS_INFO)tblMain.GetControlFromPosition(j, i); if (!string.IsNullOrEmpty(dt.Rows[iTable - 1]["LT"].ToString())) { UC_WS.BindingData(dt.Rows[iTable - 1]["LINE_CD"].ToString(), dt.Rows[iTable - 1]["LINE_NAME"].ToString(), dt.Rows[iTable - 1]["PLAN_QTY"].ToString(), dt.Rows[iTable - 1]["WIP_QTY"].ToString(), dt.Rows[iTable - 1]["RATE"].ToString(), Convert.ToDouble(dt.Rows[iTable - 1]["LT"]), Convert.ToDouble(dt.Rows[iTable - 1]["SET_RATIO"])); } else { UC_WS.BindingData(dt.Rows[iTable - 1]["LINE_CD"].ToString(), dt.Rows[iTable - 1]["LINE_NAME"].ToString(), dt.Rows[iTable - 1]["PLAN_QTY"].ToString(), dt.Rows[iTable - 1]["WIP_QTY"].ToString(), dt.Rows[iTable - 1]["RATE"].ToString(), 0, 0); } PlanQty += string.IsNullOrEmpty(dt.Rows[iTable - 1]["PLAN_QTY"].ToString()) ? 0 : Convert.ToInt32(dt.Rows[iTable - 1]["PLAN_QTY"]); InvQty += string.IsNullOrEmpty(dt.Rows[iTable - 1]["WIP_QTY"].ToString()) ? 0 : Convert.ToInt32(dt.Rows[iTable - 1]["WIP_QTY"]); } iTable++; } } lblPlanTot.Text = "Plan: " + string.Format("{0:n0}", PlanQty) + " Prs"; lblInvTot.Text = "Inv: " + string.Format("{0:n0}", InvQty) + " Prs"; double LeadTime = Math.Round(Convert.ToDouble(InvQty) / Convert.ToDouble(PlanQty), 1); lblLeadTimeTot.Text = LeadTime.ToString() + " Day(s)"; }
private void BindingOutScanByTrip() { try { lbl_O_TRIP1.Text = "0 Prs"; lbl_O_TRIP2.Text = "0 Prs"; lbl_O_TRIP3.Text = "0 Prs"; lbl_O_TRIP4.Text = "0 Prs"; lblTotalTodayDeli.Text = "0 Prs"; DatabaseTMS db = new DatabaseTMS(); DataTable dt = db.GetOutScnByTrip(DateTime.Now.ToString("yyyyMMdd"), ComVar.Var._strValue3, ComVar.Var._strValue4, "ALL"); lbl_O_TRIP1.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[0]["O_QTY"])) + " Prs"; lbl_O_TRIP2.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[1]["O_QTY"])) + " Prs"; lbl_O_TRIP3.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[2]["O_QTY"])) + " Prs"; lbl_O_TRIP4.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[3]["O_QTY"])) + " Prs"; lblTotalTodayDeli.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[4]["O_QTY"])) + " Prs"; double RateDelivery = Math.Round(Convert.ToDouble(lblTotalTodayDeli.Text.Replace("Prs", "").Replace(",", "").Trim()) / Convert.ToDouble(lblPlanTot.Text.Replace("Prs", "").Replace(",", "").Replace("Plan: ", "").Trim()) * 100, 1); lblRatioDelivery.Text = RateDelivery.ToString() + "%"; } catch { } }
private void btnBT_Click(object sender, EventArgs e) { foreach (DevExpress.XtraEditors.SimpleButton button in groupBoxEx1.Controls) { if (button.Tag.ToString().Equals(((DevExpress.XtraEditors.SimpleButton)sender).Tag.ToString())) { try { splashScreenManager1.ShowWaitForm(); this.Cursor = Cursors.WaitCursor; OP_CD = ((DevExpress.XtraEditors.SimpleButton)sender).Tag.ToString().Split('|')[0]; CMP_CD = ((DevExpress.XtraEditors.SimpleButton)sender).Tag.ToString().Split('|')[1]; CMP_NM = ((DevExpress.XtraEditors.SimpleButton)sender).Tag.ToString().Split('|')[2]; lblTitle.Text = string.Concat(ComVar.Var._strValue3, " ", CMP_NM, " - TMS DETAIL"); button.Appearance.BackColor = Color.OrangeRed; button.ForeColor = Color.White; //call data DatabaseTMS db = new DatabaseTMS(); //ComVar.Var._strValue1 = "201"; ds = db.TMS_DELIVERY_DETAIL("MES.PKG_TMS_DASHBOARD.TMS_DELIVERY_DETAIL_V1", "VJ", OP_CD, CMP_CD, DateTime.Now.ToString("yyyyMMdd"), ComVar.Var._strValue1); GetDataOutgoing_Chart(); GetDataOutgoing_Grid(); GetDataINV_Chart(); GetChartOverall(); GetChartShortageByAsyDate(); GetChartShortageByComponent(); this.Cursor = Cursors.Default; splashScreenManager1.CloseWaitForm(); } catch { splashScreenManager1.CloseWaitForm(); this.Cursor = Cursors.Default; } } else { button.Appearance.BackColor = Color.Silver; button.ForeColor = Color.Black; } } }
void OnLabelPlantClick(Label label, string LINE_CD, string LINE_NM, int PLANT_QTY) { try { int iTable = 1; if (!LINE_CD.Equals(LineCD_TEMP)) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 8; j++) { if (iTable <= layOutCount) { UC.UC_WS_INFO UC_WS = (UC.UC_WS_INFO)tblMain.GetControlFromPosition(j, i); UC_WS.ChangeColor(true); } iTable++; } } LineCD_TEMP = LINE_CD; } lbl_O_TRIP1.Text = "0 Prs"; lbl_O_TRIP2.Text = "0 Prs"; lbl_O_TRIP3.Text = "0 Prs"; lbl_O_TRIP4.Text = "0 Prs"; lblTotalTodayDeli.Text = "0 Prs"; DatabaseTMS db = new DatabaseTMS(); if (label.BackColor == Color.Yellow) { label.BackColor = Color.FromArgb(0, 102, 204); label.ForeColor = Color.White; lblDeliveryWS.Text = string.Concat(ComVar.Var._strValue5, " Delivery"); //Data Trip DataTable dt = db.GetOutScnByTrip(DateTime.Now.ToString("yyyyMMdd"), ComVar.Var._strValue3, ComVar.Var._strValue4, "ALL"); lbl_O_TRIP1.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[0]["O_QTY"])) + " Prs"; lbl_O_TRIP2.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[1]["O_QTY"])) + " Prs"; lbl_O_TRIP3.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[2]["O_QTY"])) + " Prs"; lbl_O_TRIP4.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[3]["O_QTY"])) + " Prs"; lblTotalTodayDeli.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[4]["O_QTY"])) + " Prs"; double RateDelivery = Math.Round(Convert.ToDouble(lblTotalTodayDeli.Text.Replace("Prs", "").Replace(",", "").Trim()) / Convert.ToDouble(lblPlanTot.Text.Replace("Prs", "").Replace(",", "").Replace("Plan: ", "").Trim()) * 100, 1); lblRatioDelivery.Text = RateDelivery.ToString() + "%"; LINE = "ALL"; BindingOutScnByDay(LINE); BindingDeliveryChart(); } else { label.BackColor = Color.Yellow; label.ForeColor = Color.Black; lblDeliveryWS.Text = string.Concat(LINE_NM, " Delivery"); //Data Trip DataTable dt = db.GetOutScnByTrip("20190918", ComVar.Var._strValue3, ComVar.Var._strValue4, LINE_CD); lbl_O_TRIP1.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[0]["O_QTY"])) + " Prs"; lbl_O_TRIP2.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[1]["O_QTY"])) + " Prs"; lbl_O_TRIP3.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[2]["O_QTY"])) + " Prs"; lbl_O_TRIP4.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[3]["O_QTY"])) + " Prs"; lblTotalTodayDeli.Text = string.Format("{0:n0}", Convert.ToInt32(dt.Rows[4]["O_QTY"])) + " Prs"; // double RateDelivery = Math.Round(Convert.ToDouble(lblTotalTodayDeli.Text.Replace("Prs", "").Replace(",", "").Trim()) / Convert.ToDouble(lblPlanTot.Text.Replace("Prs", "").Replace(",", "").Replace("Plan: ", "").Trim()) * 100, 1); double RateDelivery = Math.Round(Convert.ToDouble(lblTotalTodayDeli.Text.Replace("Prs", "").Replace(",", "").Trim()) / Convert.ToDouble(PLANT_QTY) * 100, 1); lblRatioDelivery.Text = RateDelivery.ToString() + "%"; LINE = LINE_CD; BindingOutScnByDay(LINE); BindingDeliveryChart(); } } catch (Exception ex) { } }