Exemplo n.º 1
0
        public static void ReLoadSmtTab(
            DataGridView dataGridViewSmtProduction,
            DataGridView dataGridViewChangeOvers,
            DataGridView dataGridViewSmtLedDropped,
            DataGridView dataGridViewSmtLedWasteByModel,
            DataGridView dataGridViewSmtWasteTotal,
            DataGridView dataGridViewSmtLedWasteTotalPerLine,
            DataGridView dataGridViewSmtStencilUsage,
            DataTable smtRecords,
            ref Dictionary <string, Dictionary <string, List <durationQuantity> > > smtModelLineQuantity,
            RadioButton radioButtonSmtShowAllModels,
            Dictionary <string, MesModels> mesModels,
            ComboBox comboBoxSmtModels,
            ComboBox comboBoxSmtLedWasteLine,
            ComboBox comboBoxSmtLewWasteFreq,
            ComboBox comboBoxSmtLedWasteLines,
            Dictionary <string, Color> lineColors,
            Chart chartLedWasteChart,
            Panel panelSmtLedWasteCheckContainer)
        {
            SortedDictionary <DateTime, SortedDictionary <int, DataTable> > sortedTableByDayAndShift = SMTOperations.sortTableByDayAndShift(smtRecords, "DataCzasKoniec");

            SMTOperations.shiftSummaryDataSource(sortedTableByDayAndShift, dataGridViewSmtProduction);

            smtModelLineQuantity = SMTOperations.smtQtyPerModelPerLine(smtRecords, radioButtonSmtShowAllModels.Checked, mesModels);
            comboBoxSmtModels.Items.AddRange(smtModelLineQuantity.Select(m => m.Key).OrderBy(m => m).ToArray());

            ChangeOverTools.BuildSmtChangeOverGrid(ChangeOverTools.BuildDateShiftLineDictionary(smtRecords), dataGridViewChangeOvers);

            ledWasteDictionary = LedWasteDictionary(sortedTableByDayAndShift, mesModels);
            SMTOperations.FillOutDailyLedWaste(ledWasteDictionary, dataGridViewSmtLedDropped);
            SMTOperations.FillOutLedWasteByModel(ledWasteDictionary, dataGridViewSmtLedWasteByModel, comboBoxSmtLedWasteLine.Text);
            SMTOperations.FillOutLedWasteTotalWeekly(ledWasteDictionary, dataGridViewSmtWasteTotal);
            Dictionary <string, bool> lineOptions = new Dictionary <string, bool>();

            lineColors = new Dictionary <string, Color>();

            foreach (Control c in panelSmtLedWasteCheckContainer.Controls)
            {
                if ((c is CheckBox))
                {
                    lineOptions.Add(c.Text.Trim(), ((CheckBox)c).Checked);
                    lineColors.Add(c.Text.Trim(), c.BackColor);
                }
            }

            Charting.DrawLedWasteChart(ledWasteDictionary, chartLedWasteChart, comboBoxSmtLewWasteFreq.Text, lineOptions, lineColors);

            comboBoxSmtLedWasteLine.Items.Add("Wszystkie");
            comboBoxSmtLedWasteLine.Items.AddRange(smtModelLineQuantity.SelectMany(m => m.Value).Select(l => l.Key).Distinct().OrderBy(l => l).ToArray());
            comboBoxSmtLedWasteLine.Text = "Wszystkie";
            comboBoxSmtLedWasteLines.Items.AddRange(ledWasteDictionary.SelectMany(date => date.Value).SelectMany(shift => shift.Value).Select(l => l.model).Distinct().OrderBy(l => l).ToArray());
            comboBoxSmtLedWasteLines.Items.Insert(0, "Wszystkie");
            comboBoxSmtLedWasteLines.Text = "Wszystkie";
            SMTOperations.FillOutLedWasteTotalByLine(ledWasteDictionary, dataGridViewSmtLedWasteTotalPerLine, comboBoxSmtLedWasteLines.Text);
            FillOutStencilTable(dataGridViewSmtStencilUsage, mesModels);
        }