public static void RetrievePjWaferAllData(Controller ctrl, ProjectViewModels vm) { var vtab = new List <string>(); vtab.Add("dbo.PRLL_VcselInfoSummary_2016"); vtab.Add("dbo.PRLL_VcselInfoSummary_2017"); foreach (var vt in vtab) { try { var wafers = BITestData.RetrieveAllWafer(vm.ProjectKey); if (vm.PNList.Count > 0 && wafers.Count > 0) { var failurelist = new List <BITestData>(); var failuredict = new Dictionary <string, bool>(); var passlist = new List <BITestData>(); var starttime = vm.StartDate.ToString(); var sql = "select ModuleSerialNum,Step,ModuleType,ErrAbbr,TestTimeStamp,TestStation,ModulePartNum,wafer,waferpn from " + vt + "(nolock) where wafer in <WAFERCOND> and waferpn <> 'NULL' and ErrAbbr <> 'NULL' and ModulePartNum in <PNCOND> and TestTimeStamp <= '<TIMECOND>' order by TestTimeStamp Desc,ModuleSerialNum"; var pncond = PNCondition(vm.PNList); if (string.IsNullOrEmpty(pncond)) { return; } var wafercond = "('"; foreach (var w in wafers) { wafercond = wafercond + w + "','"; } wafercond = wafercond.Substring(0, wafercond.Length - 2) + ")"; sql = sql.Replace("<PNCOND>", pncond).Replace("<TIMECOND>", starttime).Replace("<WAFERCOND>", wafercond); var dbret = DBUtility.ExePRLSqlWithRes(ctrl, sql); if (dbret.Count > 0) { var bondeddatadict = BITestData.RetrieveAllDataIDASC(vm.ProjectKey); var tempdataiddict = new Dictionary <string, BITestData>(); foreach (var line in dbret) { var tempid = ConvertString(line[0]) + "_" + ConvertString(line[1]); if (!bondeddatadict.ContainsKey(tempid)) { if (tempdataiddict.ContainsKey(tempid)) { if (DateTime.Parse(ConvertString(line[4])) == tempdataiddict[tempid].TestTimeStamp) { if (string.Compare(ConvertString(line[3]), "Pass", true) != 0) { tempdataiddict[tempid].ErrAbbr = ConvertString(line[3]); if (!failuredict.ContainsKey(tempdataiddict[tempid].ModuleSerialNum)) { failuredict.Add(tempdataiddict[tempid].ModuleSerialNum, true); failurelist.Add(tempdataiddict[tempid]); var ekey = ProjectErrorViewModels.GetUniqKey(); var pjerror = new ProjectErrorViewModels(ProjectErrorViewModels.BURNIN, ekey, ConvertString(line[3]), "", 1); pjerror.Reporter = "System"; pjerror.Description = ""; pjerror.AddandUpdateProjectError(); } } } //same time } else { var tempdata = new BITestData(); tempdata.DataID = GetUniqKey(); tempdata.ProjectKey = vm.ProjectKey; tempdata.ModuleSerialNum = ConvertString(line[0]); tempdata.WhichTest = ConvertString(line[1]); tempdata.ModuleType = ConvertString(line[2]); tempdata.ErrAbbr = ConvertString(line[3]); tempdata.TestTimeStamp = DateTime.Parse(ConvertString(line[4])); tempdata.TestStation = ConvertString(line[5]); tempdata.PN = ConvertString(line[6]); tempdata.Wafer = ConvertString(line[7]); tempdata.Waferpn = ConvertString(line[8]); tempdataiddict.Add(tempid, tempdata); } } //end if (!bondeddatadict.ContainsKey(tempid)) } //end foreach foreach (var kv in tempdataiddict) { kv.Value.StoreBIData(); } //end foreach } //end if (dbret.Count > 0) } //end if pn > 0 } catch (Exception ex) { } } }
public static void StartProjectBonding(Controller ctrl, ProjectViewModels vm) { var vtab = new List <string>(); vtab.Add("dbo.PRLL_VcselInfoSummary_2016"); vtab.Add("dbo.PRLL_VcselInfoSummary_2017"); foreach (var vt in vtab) { try { if (BITestData.UpdatePJLockUsing(vm.ProjectKey)) { return; } if (vm.PNList.Count > 0) { var bondeddatadict = BITestData.RetrieveAllDataID(vm.ProjectKey); //var failurelist = new List<BITestData>(); var sql = "select ModuleSerialNum,Step,ModuleType,ErrAbbr,TestTimeStamp,TestStation,ModulePartNum,wafer,waferpn from " + vt + "(nolock) where wafer <> 'NULL' and waferpn <> 'NULL' and ErrAbbr <> 'NULL' and ModulePartNum in <PNCOND> and TestTimeStamp > '<TIMECOND>' and TestTimeStamp < '" + DateTime.Now.ToString() + "' order by TestTimeStamp Desc,ModuleSerialNum"; var pncond = PNCondition(vm.PNList); if (string.IsNullOrEmpty(pncond)) { BITestData.ResetUpdatePJLock(vm.ProjectKey); return; } sql = sql.Replace("<PNCOND>", pncond).Replace("<TIMECOND>", vm.StartDate.ToString()); var tempdataiddict = new Dictionary <string, BITestData>(); var dbret = DBUtility.ExePRLSqlWithRes(ctrl, sql); foreach (var line in dbret) { var tempid = ConvertString(line[0]) + "_" + ConvertString(line[1]); if (bondeddatadict.ContainsKey(tempid)) { if (DateTime.Parse(ConvertString(line[4])) <= bondeddatadict[tempid]) { continue; } } if (tempdataiddict.ContainsKey(tempid)) { if (DateTime.Parse(ConvertString(line[4])) == tempdataiddict[tempid].TestTimeStamp) { if (string.Compare(ConvertString(line[3]), "Pass", true) != 0) { tempdataiddict[tempid].ErrAbbr = ConvertString(line[3]); var ekey = ProjectErrorViewModels.GetUniqKey(); var pjerror = new ProjectErrorViewModels(ProjectErrorViewModels.BURNIN, ekey, ConvertString(line[3]), "", 1); pjerror.Reporter = "System"; pjerror.Description = ""; pjerror.AddandUpdateProjectError(); } } //same time } else { var tempdata = new BITestData(); tempdata.DataID = GetUniqKey(); tempdata.ProjectKey = vm.ProjectKey; tempdata.ModuleSerialNum = ConvertString(line[0]); tempdata.WhichTest = ConvertString(line[1]); tempdata.ModuleType = ConvertString(line[2]); tempdata.ErrAbbr = ConvertString(line[3]); tempdata.TestTimeStamp = DateTime.Parse(ConvertString(line[4])); tempdata.TestStation = ConvertString(line[5]); tempdata.PN = ConvertString(line[6]); tempdata.Wafer = ConvertString(line[7]); tempdata.Waferpn = ConvertString(line[8]); tempdataiddict.Add(tempid, tempdata); } } //end foreach foreach (var kv in tempdataiddict) { kv.Value.StoreBIData(); } //end foreach } BITestData.ResetUpdatePJLock(vm.ProjectKey); } catch (Exception ex) { BITestData.ResetUpdatePJLock(vm.ProjectKey); } } }