public static ProjectBIYieldViewModule GetYieldByWafer(string pjkey, string wafer) { var ret = new ProjectBIYieldViewModule(); ret.ProjectKey = pjkey; ret.StartDate = DateTime.Now; ret.EndDate = DateTime.Now; var plist = BITestData.RetrieveProjectTestDataByWafer(pjkey, wafer); RetrieveCummYield(ret, plist); return(ret); }
public static ProjectBIYieldViewModule GetYieldByDateRange(string pjkey, string sdate, string edate, ProjectViewModels pvm) { var ret = new ProjectBIYieldViewModule(); ret.ProjectKey = pjkey; ret.StartDate = DateTime.Parse(sdate); ret.EndDate = DateTime.Parse(edate); var startdate = DateTime.Parse(DateTime.Parse(sdate).ToString("yyyy-MM-dd") + " 07:30:00").ToString(); var enddate = DateTime.Parse(DateTime.Parse(edate).ToString("yyyy-MM-dd") + " 07:30:00").ToString(); if (startdate == enddate) { return(ret); } var plist = BITestData.RetrieveProjectTestData(pjkey, startdate, enddate, true); var snlist = BITestData.RetrieveSNBeforeDate(pjkey, startdate); var validatedict = new Dictionary <string, bool>(); foreach (var item in plist) { if (!snlist.ContainsKey(item.ModuleSerialNum + "-" + item.WhichTest)) { if (!validatedict.ContainsKey(item.ModuleSerialNum)) { validatedict.Add(item.ModuleSerialNum, true); } } } plist = BITestData.RetrieveProjectTestData(pjkey, startdate, DateTime.Parse(enddate).AddYears(5).ToString(), false); var filteredPjData2 = new List <BITestData>(); foreach (var item in plist) { if (validatedict.ContainsKey(item.ModuleSerialNum)) { filteredPjData2.Add(item); } } RetrieveCummYield(ret, filteredPjData2); return(ret); }
private static void RetrieveCummYield(ProjectBIYieldViewModule pyvm, List <BITestData> plist) { var yielddict = new Dictionary <string, TestYield>(); var sndict = new Dictionary <string, bool>(); var correctbidict = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(pyvm.ProjectKey)) { correctbidict = IssueViewModels.RetrieveAllBIRootCause(pyvm.ProjectKey); } else { var pjkeydict = new Dictionary <string, bool>(); foreach (var item in plist) { if (!pjkeydict.ContainsKey(item.ProjectKey)) { pjkeydict.Add(item.ProjectKey, true); } } var pjkeylist = pjkeydict.Keys; foreach (var pjkey in pjkeylist) { var tempcorrectdict = IssueViewModels.RetrieveAllBIRootCause(pjkey); foreach (var kvpair in tempcorrectdict) { if (!correctbidict.ContainsKey(kvpair.Key)) { correctbidict.Add(kvpair.Key, kvpair.Value); } } } }//end else foreach (var p in plist) { if (!sndict.ContainsKey(p.WhichTest + ":" + p.ModuleSerialNum)) { sndict.Add(p.WhichTest + ":" + p.ModuleSerialNum, true); if (yielddict.ContainsKey(p.WhichTest)) { if (!yielddict[p.WhichTest].AllSNDict.ContainsKey(p.ModuleSerialNum)) { yielddict[p.WhichTest].AllSNDict.Add(p.ModuleSerialNum, true); } yielddict[p.WhichTest].InputCount = yielddict[p.WhichTest].InputCount + 1; if (string.Compare(p.ErrAbbr, "PASS", true) == 0) { yielddict[p.WhichTest].OutputCount = yielddict[p.WhichTest].OutputCount + 1; yielddict[p.WhichTest].CorrectOutputCount = yielddict[p.WhichTest].CorrectOutputCount + 1; } else { if (correctbidict.ContainsKey(p.ModuleSerialNum) && string.Compare(correctbidict[p.ModuleSerialNum], BIROOTCAUSE.VCSELISSUE) != 0) { yielddict[p.WhichTest].CorrectOutputCount = yielddict[p.WhichTest].CorrectOutputCount + 1; } if (correctbidict.ContainsKey(p.ModuleSerialNum)) { if (!yielddict[p.WhichTest].CorSNDict.ContainsKey(p.ModuleSerialNum)) { yielddict[p.WhichTest].CorSNDict.Add(p.ModuleSerialNum, true); } } if (!yielddict[p.WhichTest].ErrSNDict.ContainsKey(p.ModuleSerialNum)) { yielddict[p.WhichTest].ErrSNDict.Add(p.ModuleSerialNum, true); } } RegisterError(p.ErrAbbr, p.WhichTest, pyvm.LErrorMap); } else { var tempyield = new TestYield(); if (!tempyield.AllSNDict.ContainsKey(p.ModuleSerialNum)) { tempyield.AllSNDict.Add(p.ModuleSerialNum, true); } tempyield.InputCount = 1; if (string.Compare(p.ErrAbbr, "PASS", true) == 0) { tempyield.OutputCount = 1; tempyield.CorrectOutputCount = 1; } else { tempyield.OutputCount = 0; tempyield.CorrectOutputCount = 0; if (correctbidict.ContainsKey(p.ModuleSerialNum) && string.Compare(correctbidict[p.ModuleSerialNum], BIROOTCAUSE.VCSELISSUE) != 0) { tempyield.CorrectOutputCount = 1; } if (correctbidict.ContainsKey(p.ModuleSerialNum)) { if (!tempyield.CorSNDict.ContainsKey(p.ModuleSerialNum)) { tempyield.CorSNDict.Add(p.ModuleSerialNum, true); } } if (!tempyield.ErrSNDict.ContainsKey(p.ModuleSerialNum)) { tempyield.ErrSNDict.Add(p.ModuleSerialNum, true); } } tempyield.WhichTest = p.WhichTest; RegisterError(p.ErrAbbr, p.WhichTest, pyvm.LErrorMap); yielddict.Add(p.WhichTest, tempyield); } } } foreach (var s in yielddict) { pyvm.LastYields.Add(s.Value); } }