public static List <SnTestDataVM> RetrieveLatestSNStep(string sn) { var testdatalist = new List <SnTestDataVM>(); var sql = @"select top 1 ProductId,MoveOutTime,WorkflowStepName,Comments,TxnTypeName from PDMSMaster.dbo.HistStepMoveSummary (nolock) where ContainerName = '<ContainerName>' and MFGOrderId is not null order by MoveOutTime desc"; sql = sql.Replace("<ContainerName>", sn.Replace("'", "")); var dbret = DBUtility.ExeMESReportSqlWithRes(sql, null); if (dbret.Count > 0) { var line = dbret[0]; var data = new SnTestDataVM(); data.ModuleSerialNum = sn; data.DataID = Convert.ToString(line[0]); data.TestTime = Convert.ToDateTime(line[1]); data.WhichTest = Convert.ToString(line[2]); data.ErrAbbr = ""; if (!string.IsNullOrEmpty(Convert2Str(line[3]))) { data.ErrAbbr = Convert2Str(line[3]); } testdatalist.Add(data); } return(testdatalist); }
public static void RetrieveTestData(List <ScrapTableItem> scraptable) { foreach (var stab in scraptable) { var mestablist = RetrieveDCTableFromSn(stab.SN); var ret = new List <SnTestDataVM>(); foreach (var tabname in mestablist) { var sql = "select top 1 dc_<DCTABLE>HistoryId,ModuleSerialNum, ErrAbbr, TestTimeStamp,assemblypartnum,WhichTest,TestStation from " + " insite.dc_<DCTABLE> (nolock) where ModuleSerialNum = '<modulesn>'"; sql = sql.Replace("<modulesn>", stab.SN).Replace("<DCTABLE>", tabname); var dbret = DBUtility.ExeRealMESSqlWithRes(sql); foreach (var line in dbret) { var data = new SnTestDataVM(); data.DataID = Convert.ToString(line[0]); data.ModuleSerialNum = Convert.ToString(line[1]); data.ErrAbbr = Convert.ToString(line[2]); data.TestTime = Convert.ToDateTime(line[3]); data.PN = Convert.ToString(line[4]); data.WhichTest = Convert.ToString(line[5]); data.TestStation = Convert.ToString(line[6]); data.MESTab = tabname.ToUpper().Trim(); ret.Add(data); } } ret.Sort(delegate(SnTestDataVM d1, SnTestDataVM d2) { return(DateTime.Compare(d2.TestTime, d1.TestTime)); }); if (ret.Count > 0) { stab.TestData = ret[0]; } else { stab.TestData = new SnTestDataVM(); } } }
public static List <SnTestDataVM> RetrieveLatestSNTestResult(string sn) { var dctablelist = RetrieveDCTableFromSn(sn); var testdatalist = new List <SnTestDataVM>(); foreach (var dctable in dctablelist) { if (dctable.Contains("OQCPARALLEL") || dctable.Contains("AOC_MANUALINSPECTION")) { continue; } var sql = @"select top 1 a.<DCTABLE>HistoryId,a.ModuleSerialNum, a.WhichTest, a.ModuleType, a.ErrAbbr, a.TestTimeStamp, a.TestStation,a.assemblypartnum from insite.<DCTABLE> a (nolock) where a.ModuleSerialNum = '<ModuleSerialNum>' order by testtimestamp DESC"; sql = sql.Replace("<DCTABLE>", dctable).Replace("<ModuleSerialNum>", sn); var dbret = DBUtility.ExeRealMESSqlWithRes(sql); foreach (var item in dbret) { var tempdata = new SnTestDataVM(Convert.ToString(item[0]), Convert.ToString(item[1]), Convert.ToString(item[7]), Convert.ToString(item[2]) , Convert.ToString(item[4]), dctable, Convert.ToDateTime(item[5]), Convert.ToString(item[6])); testdatalist.Add(tempdata); } } testdatalist.Sort(delegate(SnTestDataVM obj1, SnTestDataVM obj2) { return(obj2.TestTime.CompareTo(obj1.TestTime)); }); var ret = new List <SnTestDataVM>(); ret.Add(testdatalist[0]); return(ret); }