Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="customerId"></param>
        /// <param name="lineId"></param>
        /// <param name="modelId"></param>
        /// <param name="processName"></param>
        /// <param name="shift"></param>
        private void GetDataForProcessAssembly(string customerId, int lineId, string modelId, string processName, string shift)
        {
            // CS005_1_RM2-8050_Assembly_10-19-2015_Ca_Ngay_0

            //CS005_1_RM2-8051_Assembly_10-21-2015_Ca_Dem_0
            string id = null;

            foreach (var lineProcess in _lineProcessService.GetLinesProcesseses(_line.Id_line))
            {
                if (lineProcess.Id_process == processName)
                {
                    //id = string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}", customerId, lineId, modelId, processName, date, shift, lineProcess.lever_of_process);
                    if (lineProcess.lever_of_process != null)
                    {
                        id = ReportID(customerId, lineId, modelId, processName, shift, (int)lineProcess.lever_of_process);
                    }
                }
                else
                {
                    //id = string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}", customerId, lineId, modelId, processName, date, shift, lineProcess.lever_of_process);
                    if (lineProcess.lever_of_process != null)
                    {
                        id = ReportID(customerId, lineId, modelId, processName, shift, (int)lineProcess.lever_of_process);
                    }
                }

                var result = _showResultService.GetShowResultById(id);
                if (result != null)
                {
                    lblProcessAssembly.Text  = processName;
                    lblTotalAssembly.Text    = result.Total.ToString();
                    lblPassAssembly.Text     = result.Pass.ToString();
                    lblOperatorAssembly.Text = result.Operator_code;
                    lblNGAssembly.Text       = result.NG.ToString();
                    float ng = 0;
                    if (result.NG > 0 || result.Total > 0)
                    {
                        ng = (float.Parse(result.NG.ToString()) / float.Parse(result.Total.ToString())) * 100;
                    }
                    lblNGCountAssembly.Text = string.Format("{0:0} %", Math.Round(ng, 3));
                }
            }
        }
Exemplo n.º 2
0
        private void LoadData()
        {
            lblCustomer.Text = Resources.CustomerName + _customerService.GetCustomerById(_line.Id_customer).Name_customer;
            string modelId = _modelService.GetLineStatusByLineAndCustomer(_line.Id_line, _line.Id_customer).Current_model;
            var    model   = _modelService.GetModelById(modelId);

            lblModelName.Text = model.Name_model;
            lblSetPlan.Text   = model.Set_plan.ToString();

            //int setplan = Convert.ToInt32(model.Set_plan);
            //int pass = Convert.ToInt32(strPass);
            //int balenced = setplan - pass;

            //if (pass > setplan)
            //{
            //    lblBalenced.Text = Math.Abs(balenced).ToString(CultureInfo.InvariantCulture);
            //}
            //else
            //{
            //    lblBalenced.Text = @"- " + balenced.ToString(CultureInfo.InvariantCulture);
            //}


            var processPanels      = new List <ProcessDetailControl>();
            var getProcessByLineId = _processService.GetAllProcesseses(_line.Id_line);

            for (int i = 0; i < getProcessByLineId.Count; i++)
            {
                var    processes    = getProcessByLineId.ElementAtOrDefault(i);
                var    processFirst = getProcessByLineId.ElementAtOrDefault(i - 1);
                var    mp           = new ProcessDetailControl();
                string processName  = null;
                int    x            = 293;
                int    y            = 32;
                if (processes != null)
                {
                    processName = processes.Id_process;
                    processPanels.Add(mp);
                    mp.ProcessName = processName;
                    mp.Name        = "Panel" + processName + i;
                    mp.Location    = new Point(x * i, y);
                }
                if (processFirst != null)
                {
                    if (processName == processFirst.Id_process)
                    {
                        mp.Location = new Point(x * (i - 1), y);
                    }
                    else
                    {
                        mp.Location = new Point(x * (i - 1), y);
                    }
                }

                //if (i < 4)
                //{
                //    //MessageBox.Show("OK");
                //    panelControl1.Left = (this.ClientSize.Width - panelControl1.Width) / 2;
                //    panelControl1.Top = (this.ClientSize.Height - panelControl1.Height) / 2;
                //}
                //else
                //{
                //    mp.Location = new Point(300 * i, 32);
                //}
                string shift = null;
                if (_lineStatus.Shift != null)
                {
                    shift = _shiftService.GetSheetProductionsById((int)_lineStatus.Shift).Name_sheet_production;
                }
                string date   = DateTime.Now.Date.ToString("MM-dd-yyyy");
                string id     = string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}", _line.Id_customer, _line.Id_line, model.Id_model, processName, date, shift, 0);
                var    result = _showResultService.GetShowResultById(id);
                if (result != null)
                {
                    mp.Total        = result.Total.ToString();
                    mp.Pass         = result.Pass.ToString();
                    mp.OperatorCode = result.Operator_code;
                }

                if (i == getProcessByLineId.Count - 1)
                {
                    mp.pictureEdit1.Visible = false;
                }

                processPanels.Add(mp);
            }

            foreach (var p in processPanels)
            {
                panelControl1.SuspendLayout();
                panelControl1.Controls.Add(p);
                panelControl1.ResumeLayout();
            }
        }