public static void InsertWl() { LV_Interface test = new LV_Interface(); test.NewSpectrumEntry("11-4501"); Stopwatch sw = new Stopwatch(); TEST_AREA[] area = { TEST_AREA.CENTERA, TEST_AREA.CENTERB, TEST_AREA.CENTERC, TEST_AREA.RIGHT, TEST_AREA.TOP, TEST_AREA.LEFT }; string[] files = { "CenterA_20sp_Initial.dat", "CenterB_20sp_Initial.dat", "CenterC_20sp_Initial.dat", "Right_20sp_Initial.dat", "Top_20sp_Initial.dat", "Left_20sp_Initial.dat" }; long[] times = new long[files.Length]; for (int i = 0; i < files.Length; i++) { string path = @"\\172.20.4.11\Data\Characterization Raw Data\Quick EL Test\B01-0997-15\" + files[i]; FileInfo info = new FileInfo(path); if (info.Exists && info.Length != 0) { string[] lines = System.IO.File.ReadAllLines(@"\\172.20.4.11\Data\Characterization Raw Data\Quick EL Test\B01-0997-15\" + files[i]); double[] wl = new double[lines.Length]; double[] spect = new double[lines.Length]; for (int x = 0; x < lines.Length; x++) { var col = lines[x].Split('\t'); if (col.Length == 2) { wl[x] = Convert.ToDouble(col[0]); spect[x] = Convert.ToDouble(col[1]); } } sw.Reset(); sw.Start(); test.UpdateSpectrum("11-4500", TEST_TYPE.INITIAL, area[i], wl, spect, wl, spect); sw.Stop(); times[i] = sw.ElapsedMilliseconds; Console.WriteLine(files[i] + " done"); } else { times[i] = 0; } } for (int i = 0; i < times.Length; i++) { Console.WriteLine("Time: " + times[i].ToString()); } Console.WriteLine("Total: " + times.Sum()); Console.WriteLine("Press any ket to export to excel"); Console.ReadKey(); }
public static void GetSpectrum() { LV_Interface test = new LV_Interface(); DataTable tbl = test.GetSpectrum("BO2-0116-05", TEST_TYPE.INITIAL); Dictionary <string, double[]> values = new Dictionary <string, double[]>(); List <double> wlArrs = new List <double>(); List <double> spectArrs = new List <double>(); DataTable tblNew = new DataTable(); foreach (DataRow row in tbl.Rows) { foreach (DataColumn col in tbl.Columns) { tblNew.Columns.Add(col.ColumnName); if (!DBNull.Value.Equals(row[col])) { values.Add(col.ColumnName, JsonConvert.DeserializeObject <double[]>((string)row[col])); Console.WriteLine(row[col]); } else { values.Add(col.ColumnName, new double[2048]); } } } foreach (KeyValuePair <string, double[]> item in values) { for (int i = 0; i < item.Value.Length; i++) { tblNew.Rows.Add(); } } for (int y = 0; y < tblNew.Columns.Count; y++) { for (int i = 0; i < values[tblNew.Columns[y].ColumnName].Length; i++) { tblNew.Rows[i][y] = values[tblNew.Columns[y].ColumnName][i]; } } tblNew.ExportToExcel(@"C:\dtToExcel4"); Console.ReadKey(); }
public static void Main(string[] args) { LV_Interface db = new LV_Interface(); string server, uid, password, database, connectionString; server = "172.20.4.20"; uid = "aelmendorf"; password = "******"; database = "epi"; connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD="******";" + "SslMode=none"; //string wafer = "AE-ReverseTest-03"; //db.NewWaferEntry(wafer); //db.LogData(wafer, TEST_TYPE.INITIAL, TEST_AREA.CENTERA, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData(wafer, TEST_TYPE.INITIAL, TEST_AREA.LEFT, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData(wafer, TEST_TYPE.INITIAL, TEST_AREA.RIGHT, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData(wafer, TEST_TYPE.AFTER, TEST_AREA.CENTERB, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData(wafer, TEST_TYPE.AFTER, TEST_AREA.CENTERC, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData(wafer, TEST_TYPE.AFTER, TEST_AREA.TOP, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData50mA(wafer, TEST_TYPE.INITIAL, TEST_AREA.CENTERA, 275.65, 900.45, 52.25, 2.45,-.00010052); //db.LogData50mA(wafer, TEST_TYPE.INITIAL, TEST_AREA.LEFT, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData50mA(wafer, TEST_TYPE.INITIAL, TEST_AREA.RIGHT, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData50mA(wafer, TEST_TYPE.AFTER, TEST_AREA.CENTERB, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData50mA(wafer, TEST_TYPE.AFTER, TEST_AREA.CENTERC, 275.65, 900.45, 52.25, 2.45, -.00010052); //db.LogData50mA(wafer, TEST_TYPE.AFTER, TEST_AREA.TOP, 275.65, 900.45, 52.25, 2.45, -.00010052); Table table = db.GetWaferData("AE-ReverseTest-09", TEST_TYPE.INITIAL); Console.WriteLine("Initial Data"); foreach (TestData row in table) { Console.WriteLine(row.ToString()); } //int okay = db.CopyNewName("B02-0152-10", "B05-222-555"); //if(okay == 0) { // Table init = db.GetWaferData("B05-222-555", TEST_TYPE.INITIAL); // Table after = db.GetWaferData("B05-222-555", TEST_TYPE.AFTER); // Console.WriteLine("Initial Data"); // foreach(TestData row in init) { // Console.WriteLine(row.ToString()); // } // Console.WriteLine("After Data"); // foreach(TestData row in after) { // Console.WriteLine(row.ToString()); // } //} else { // string error=(okay<0) ? "MYSQL Exception":"Already exist"; // Console.WriteLine("Error: "+error); //} Console.WriteLine("Press any key to exit"); Console.Read(); }