private void Form1_Load(object sender, EventArgs e) { modelSPecification = excelOperations.loadExcel(); modelSPecification = SqlOperations.AddModelOpticalSpecFromDb(modelSPecification); System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fvi.FileVersion; this.Text = "SDCM check ver." + version; }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { pictureBox1.Visible = true; timer1.Enabled = true; threadDone = false; new Thread(() => { Thread.CurrentThread.IsBackground = true; Dictionary <string, PcbTesterMeasurements> testedPcbs = new Dictionary <string, PcbTesterMeasurements>(); if (useArvhivedData) { testedPcbs = dataTableToDict(SqlOperations.GetArchivedMeasurementsForLot(textBoxLot.Text)); } else { DataTable testTable = SqlOperations.GetMeasurementsForLot(textBoxLot.Text); if (testTable.Rows.Count > 0) { testedPcbs = dataTableToDict(testTable); } } if (testedPcbs.Count > 0) { sourceTable = SdcmCalculation.makeSdcmTable(testedPcbs, modelSPecification, ref currentModel); } else { currentModel = ""; } threadDone = true; }).Start(); } }
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); }