private void timer1_Tick(object sender, EventArgs e) { if (threadDone) { if (currentModel == "") { currentModel = SqlOperations.GetModelIdFromLot(textBoxLot.Text); } labelSpec.Text = ""; if (currentModel != null) { if (modelSPecification[currentModel].Vf_Min == 0) { labelSpec.Text = "BRAK DANYCH W BAZIE!!!" + Environment.NewLine + Environment.NewLine; panel2.BackColor = Color.Red; panel2.ForeColor = Color.White; } else { panel2.BackColor = Color.LightGray; panel2.ForeColor = Color.Black; } string sdcmMax = modelSPecification[currentModel].MaxSdcm.ToString(); if (modelSPecification[currentModel].MaxSdcm == 0) { sdcmMax = "Brak"; } labelSpec.Text += "Specyfikacja:" + Environment.NewLine + currentModel + Environment.NewLine + "SDCM max: " + sdcmMax + Environment.NewLine + "Vf: " + modelSPecification[currentModel].Vf_Min + " - " + modelSPecification[currentModel].Vf_Max + Environment.NewLine + "Lm: " + modelSPecification[currentModel].Lm_Min + " - " + modelSPecification[currentModel].Lm_Max + Environment.NewLine + "Lm/W min: " + modelSPecification[currentModel].LmW_Min + Environment.NewLine + "CRI min: " + modelSPecification[currentModel].CRI_Min + Environment.NewLine + "CCT: " + modelSPecification[currentModel].CctMin + " - " + modelSPecification[currentModel].CctMax; } else { sourceTable.Rows.Clear(); } dataGridView1.DataSource = sourceTable; string tag = textBoxPcb.Text + textBoxBox.Text + textBoxLot.Text; dataGridView1.Tag = tag; textBoxPcb.Text = ""; textBoxBox.Text = ""; textBoxLot.Text = ""; pictureBox1.Visible = false; timer1.Enabled = false; autoSizeColumns(); CheckTestedValuesVsSpec(); if (dataGridView1.Columns.Count > 0) { dataGridView1.Sort(this.dataGridView1.Columns["WYNIK"], ListSortDirection.Ascending); } } }
private Dictionary <string, PcbTesterMeasurements> dataTableToDict(DataTable sqlTable) { Dictionary <string, PcbTesterMeasurements> result = new Dictionary <string, PcbTesterMeasurements>(); if (sqlTable.Rows.Count > 0) { Dictionary <string, string> lotToModel = new Dictionary <string, string>(); foreach (DataRow row in sqlTable.Rows) { string serial = row["serial_no"].ToString().ToUpper(); if (result.ContainsKey(serial)) { continue; } string lot = row["wip_entity_name"].ToString(); string model = ""; if (!IsInt(lot)) { continue; } if (lotToModel.ContainsKey(lot)) { model = lotToModel[lot]; } else { model = SqlOperations.GetModelIdFromLot(lot); lotToModel.Add(lot, model); } if (model == null) { continue; } string cxString = row["x"].ToString().Replace(".", ","); string cyString = row["y"].ToString().Replace(".", ","); if (cxString == "" || cyString == "") { continue; } if (model == "") { continue; } double cx = Convert.ToDouble(cxString, new CultureInfo("pl-PL")); double cy = double.Parse(row["y"].ToString().Replace(".", ",")); double sdcm = double.Parse(row["sdcm"].ToString()); double cct = double.Parse(row["cct"].ToString()); double vf = double.Parse(row["v"].ToString()); double lm = double.Parse(row["lm"].ToString()); double lmW = double.Parse(row["lm_w"].ToString()); double cri = double.Parse(row["cri"].ToString()); DateTime inspTime = DateTime.Parse(row["inspection_time"].ToString()); PcbTesterMeasurements newPcb = new PcbTesterMeasurements(cx, cy, sdcm, cct, inspTime, model, vf, lm, lmW, cri, cct); result.Add(serial, newPcb); } } return(result); }