public static string PrepareWaferAPSizeData(string WaferNum) { if (!AllenHasData(WaferNum)) { AddProbeTrigge2Allen(WaferNum); return("Wait 5 minutes....."); } else { var apconst = PrepareAPConst2162(WaferNum); if (!string.IsNullOrEmpty(apconst)) { var probelist = GetIthFromAllen(WaferNum); var array = GetWaferArray(WaferNum); var dapconst = UT.O2D(apconst); foreach (var item in probelist) { item.APVal1 = array; item.APVal3 = apconst; item.ApSize = (UT.O2D(item.APVal2) * 7996.8 + dapconst).ToString(); item.StoreMoreData(); } return("TRY AGAIN"); } else { return("NO AP CONST"); } } }
private static string GetAPConst2162FromAllen(string WaferNum) { var ConstList = new List <double>(); var dict = new Dictionary <string, string>(); dict.Add("@WaferNum", WaferNum); var sql = "SELECT [ApCalc2162],[Ith] FROM [EngrData].[dbo].[VR_Ox_Pts_Data] where WaferID = @WaferNum"; var dbret = DBUtility.ExeAllenSqlWithRes(sql, dict); if (dbret.Count == 0) { sql = @"select distinct m.Value as APSIZE_Meas,v.Ith from EngrData.dbo.Ox_meas_view m left join AllenDataSQL.AllenData.dbo.Legacy_Oxide_Coordinates_View x on m.product = x.product and x.Fieldname = m.Location left join EngrData.dbo.Wuxi_WAT_VR_Report v on v.WaferID = m.container and v.Xcoord= x.X_coord and v.Ycoord= x.Y_coord where m.container = @WaferNum and v.Ith is not null"; dbret = DBUtility.ExeAllenSqlWithRes(sql, dict); } foreach (var line in dbret) { var apm = UT.O2D(line[0]); var ith = UT.O2D(line[1]); if (apm != 0 && ith != 0) { var c = apm - 7996.8 * ith; ConstList.Add(c); } } if (ConstList.Count > 0) { return(MathNet.Numerics.Statistics.Statistics.Median(ConstList).ToString()); } return(string.Empty); }
public static List <SNApertureSizeVM> LoadData(List <string> snlist, Controller ctrl) { var syscfg = CfgUtility.GetSysConfig(ctrl); var bifolder = syscfg["BIITHFOLDER"]; var allfiles = GetAllFiles(bifolder, ctrl); var snwfdict = UT.GetWaferFromSN(snlist); var ret = new List <SNApertureSizeVM>(); foreach (var sn in snlist) { SNApertureSizeVM tempvm = null; var fs = ""; foreach (var f in allfiles) { if (f.ToUpper().Contains(sn.ToUpper()) && f.ToUpper().Contains("_PRE.TXT")) { fs = f; break; } } if (string.IsNullOrEmpty(fs)) { continue; } var bifile = ExternalDataCollector.DownloadShareFile(fs, ctrl); if (!string.IsNullOrEmpty(bifile)) { var alline = System.IO.File.ReadAllLines(bifile); var idx = 1; foreach (var line in alline) { if (line.ToUpper().Contains("CHANNEL")) { tempvm = new SNApertureSizeVM(); tempvm.SN = sn.ToUpper(); tempvm.CH = "CH" + idx; if (snwfdict.ContainsKey(tempvm.SN)) { tempvm.Wafer = snwfdict[tempvm.SN]; } ret.Add(tempvm); idx++; continue; } if (tempvm != null && tempvm.IthList.Count < 14) { var items = line.Split(new string[] { " ", "\t" }, StringSplitOptions.RemoveEmptyEntries); tempvm.IthList.Add(UT.O2D(items[1])); tempvm.PwrList.Add(UT.O2D(items[2])); } } //end foreach } //end if foreach (var item in ret) { if (item.IthList.Count == 14 && item.PwrList.Count == 14) { var rest = Fit.Line(item.IthList.ToArray(), item.PwrList.ToArray()); item.Intercept = rest.Item1.ToString(); item.IthSlope = rest.Item2.ToString(); item.Ith = (Math.Abs(rest.Item1 / rest.Item2) / 1000.0).ToString(); } } var wflist = new List <string>(); foreach (var kv in snwfdict) { var wf = kv.Value.ToUpper().Trim(); if (!wflist.Contains(wf)) { wflist.Add(wf); } } var wfapdict = new Dictionary <string, string>(); foreach (var w in wflist) { var apconst = ProbeTestData.PrepareAPConst2162(w); wfapdict.Add(w, apconst); } foreach (var item in ret) { if (!string.IsNullOrEmpty(item.Wafer) && wfapdict.ContainsKey(item.Wafer)) { item.ApertureConst = wfapdict[item.Wafer]; if (!string.IsNullOrEmpty(item.ApertureConst) && !string.IsNullOrEmpty(item.Ith)) { var apconst = UT.O2D(item.ApertureConst); var ith = UT.O2D(item.Ith); item.ApertureSize = (ith * 7996.8 + apconst).ToString(); } } } } return(ret); }