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