Ejemplo n.º 1
0
        private void EfficiencyTick2()
        {
            if (dataGridViewLg.Rows.Count > 0)
            {
                int lotsThisShift = EfficiencyTools.HowManyLotsThisShift(dataGridViewLg);
                if (lotsThisShift > 0)
                {
                    Tools.dateShiftNo shiftStart            = Tools.whatDayShiftIsit(DateTime.Now);
                    double            minutesFromShiftStart = (DateTime.Now - shiftStart.date).TotalMinutes;
                    double            lotsPerShift          = (480 * (double)lotsThisShift) / minutesFromShiftStart;
                    double            efficiency            = Math.Round(lotsPerShift / normLotsPerShift * 100, 1);

                    labelWasteLed.Text      = "Odpad diody LED: " + EfficiencyTools.CalculateLedDiodeWasteLevel(dataGridViewLg, normPerModel)[0] + "%";
                    labelModuleWaste.Text   = "Odpad modułów: " + EfficiencyTools.CalculateLedDiodeWasteLevel(dataGridViewLg, normPerModel)[1] + "%";
                    labelLotsThisShift.Text = "LOTy od początku zmiany: " + lotsThisShift;
                    labelEfficiency.Text    = "Wydajność: " + efficiency + "%";

                    bool debugOff = true;
#if DEBUG
                    debugOff = false;
#endif

                    if (debugOff)
                    {
                        if (DateTime.Now.Minute == 0 || DateTime.Now.Minute == 30)
                        {
                            Charting.DrawEfficiencyChart(pbChart, (float)efficiency);
                        }
                    }
                    else
                    {
                        Charting.DrawEfficiencyChart(pbChart, (float)efficiency);
                    }
                }
                else
                {
                    labelWasteLed.Text      = "Odpad diody LED: -";
                    labelModuleWaste.Text   = "Odpad modułów: ";
                    labelLotsThisShift.Text = "LOTy od początku zmiany: -";
                    labelEfficiency.Text    = "Wydajność: -";
                }

                if (dataGridViewLg.Rows.Count > 2)
                {
                    EfficiencyTools.QuantityDictionaryToGrid(dataGridView3DaysInfo, EfficiencyTools.quantityPerDayPerShift(SqlOperations.GetSmtRecordsFromDbQuantityOnly(5, smtLine)));
                    Charting.DrawDayByDayEfficiency(dataGridView3DaysInfo, pictureBoxShifts);
                }
            }
        }
Ejemplo n.º 2
0
        private void EfficiencyTick()
        {
            if (dataGridViewLg.Rows.Count > 0)
            {
                var eff           = Math.Round(LgCurrentShiftEfficiency.CalculateCurrentShiftEff(dataGridViewLg), 0);
                int lotsThisShift = EfficiencyTools.HowManyLotsThisShift(dataGridViewLg);

                if (eff > 0)
                {
                    labelWasteLed.Text      = "Odpad diody LED: " + EfficiencyTools.CalculateLedDiodeWasteLevel(dataGridViewLg, normPerModel)[0] + "%";
                    labelModuleWaste.Text   = "Odpad wyrobów: " + EfficiencyTools.CalculateLedDiodeWasteLevel(dataGridViewLg, normPerModel)[1] + "%";
                    labelLotsThisShift.Text = "LOTy od początku zmiany: " + lotsThisShift;
                    labelEfficiency.Text    = "Wydajność: " + eff + "%";

                    bool debugOff = true;
#if DEBUG
                    debugOff = false;
#endif

                    if (debugOff)
                    {
                        if (DateTime.Now.Minute == 0 || DateTime.Now.Minute == 30)
                        {
                            Charting.DrawEfficiencyChart(pbChart, (float)eff);
                        }
                    }
                    else
                    {
                        Charting.DrawEfficiencyChart(pbChart, (float)eff);
                    }
                }
                else
                {
                    labelWasteLed.Text      = "Odpad diody LED: -";
                    labelModuleWaste.Text   = "Odpad modułów: ";
                    labelLotsThisShift.Text = "LOTy od początku zmiany: -";
                    labelEfficiency.Text    = "Wydajność: -";
                }

                if (dataGridViewLg.Rows.Count > 2)
                {
                    EfficiencyTools.QuantityDictionaryToGrid(dataGridView3DaysInfo, EfficiencyTools.quantityPerDayPerShift(SqlOperations.GetSmtRecordsFromDbQuantityOnly(2, smtLine)));
                    Charting.DrawDayByDayEfficiency(dataGridView3DaysInfo, pictureBoxShifts);
                }
                UpdateCurrentModelEffNorm();//remove
            }
        }
Ejemplo n.º 3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            #if DEBUG
            button2.Visible                = true;
            EfficiencyTimer.Interval       = 1000;
            dataGridView3DaysInfo.ReadOnly = false;
            dataGridView3DaysInfo.EditMode = DataGridViewEditMode.EditOnKeystroke;
            smtLine = "SMT2";
            #endif
            angularGauge1.LabelsStep = 10;
            angularGauge1.TickStep   = 5;
            angularGauge1.Sections.Add(new AngularSection
            {
                FromValue = 0,
                ToValue   = 70,
                Fill      = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(220, 20, 60))
            });
            angularGauge1.Sections.Add(new AngularSection
            {
                FromValue = 70,
                ToValue   = 90,
                Fill      = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 215, 0))
            });
            angularGauge1.Sections.Add(new AngularSection
            {
                FromValue = 90,
                ToValue   = 100,
                Fill      = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(127, 255, 0))
            });

            EfficiencyCalculation.smtLine = smtLine;

            string chkMirae = ConfigurationManager.AppSettings["CheckMirae"];
            //checkMirae = Convert.ToBoolean(chkMirae);
            LoadLgRecordsFromDb();
            LoadMstOrdersFromDb(20);
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fvi.FileVersion;
            this.Text = "Karta pracy SMT " + version;
            //panelRight.Width = (int)Math.Round(this.Width * 0.6, 0);
            //pbChart.Width = this.Width-(panelRight.Location.X + 300);
            //dataGridView3DaysInfo.Width = 250;// panelLeft.Width - button1.Width - pictureBoxShifts.Width - 10;
            //dataGridView3DaysInfo.ScrollBars = ScrollBars.None;

            normPerModel = EfficiencyTools.CreateEfficiencyNorm();
            EfficiencyTick();
            if (smtLine == "SMT7" || smtLine == "SMT8" || smtLine == "SMT1")
            {
                normLotsPerShift = 12;
            }

            Charting.DrawEfficiencyChart(pbChart, 0);
            foreach (DataGridViewColumn column in dataGridViewLg.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            tabControl1.SizeMode = TabSizeMode.Fixed;
            tabControl1.ItemSize = new Size(300, 30);

            tableLayoutPanel1.ColumnStyles[1].Width = panel5.Width + buttonMstSaveOrder.Width + panel5.Padding.Left * 2 + buttonMstSaveOrder.Padding.Right;

            panelClock.Parent = this;
            panelClock.BringToFront();
            panelClock.Width    = pbChart.Width;
            panelClock.Location = new Point(this.Width - panelClock.Width - 23, 0);

            //efficiency

            //EfficiencyCalculation.dtDb = MST.MES.Data_structures.DevTools.DevToolsLoader.LoadDevToolsModels();
            //EfficiencyCalculation.mesModels = MST.MES.SqlDataReaderMethods.MesModels.allModels();
        }