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 { } }
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) { } }