Esempio n. 1
0
 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)
     {
     }
 }
Esempio n. 2
0
        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)";
        }