public static List <DMRSNVM> RetrieveDMRSNDataBySN(List <string> snlist) { var ret = new List <DMRSNVM>(); if (snlist.Count == 0) { return(ret); } var sncond = "('" + string.Join("','", snlist) + "')"; var sql = @"SELECT DMRID,DMRProdLine,DMRDate,DMRCreater,SN,SNFailure,SNStatus,JO,PN,WorkFlow,WorkFlowStep ,DMRStartStep,DMRStartTime,DMRStoreStep,DMRStoreTime,DMRRepairStep,DMRRepairTime,DMRReturnStep ,DMRReturnTime,DMROAStep,DMROAStatus FROM DMRSNVM where SN in <sncond> order by SN"; sql = sql.Replace("<sncond>", sncond); var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var l in dbret) { ret.Add(new DMRSNVM(O2S(l[0]), O2S(l[1]), O2T(l[2]), O2S(l[3]), O2S(l[4]), O2S(l[5]) , O2S(l[6]), O2S(l[7]), O2S(l[8]), O2S(l[9]), O2S(l[10]), O2S(l[11]) , O2S(l[12]), O2S(l[13]), O2S(l[14]), O2S(l[15]), O2S(l[16]), O2S(l[17]), O2S(l[18]), O2S(l[19]), O2S(l[20]))); } return(ret); }
public static List <TechVideoVM> RetrieveVideo(string searchkey) { var ret = new List <TechVideoVM>(); var sql = ""; if (string.IsNullOrEmpty(searchkey)) { sql = @"select VID,VSubject,VDescription,VPath,UpdateTime,Updater,tmp_log.ViewCnt from TechVideoVM as tv left join ( select VideoID, count(VideoID) as ViewCnt from VideoLog group by VideoID ) as tmp_log on tmp_log.VideoID = tv.VID order by tmp_log.ViewCnt desc, UpdateTime desc"; } else { sql = @"select VID,VSubject,VDescription,VPath,UpdateTime,Updater,tmp_log.ViewCnt from TechVideoVM as tv left join ( select VideoID, count(VideoID) as ViewCnt from VideoLog group by VideoID ) as tmp_log on tmp_log.VideoID = tv.VID where VSubject like '%<searchkey>%' or VDescription like '%<searchkey>%' order by tmp_log.ViewCnt desc, UpdateTime desc"; sql = sql.Replace("<searchkey>", searchkey); } var dbret = DBUtility.ExeLocalSqlWithRes(sql, null); foreach (var line in dbret) { ret.Add(new TechVideoVM(Convert.ToString(line[0]), Convert.ToString(line[1]), Convert.ToString(line[2]), Convert.ToString(line[3]), Convert.ToDateTime(line[4]).ToString("yyyy-MM-dd"), Convert.ToString(line[5]))); } return(ret); }
public static AssetVM getAsset(List <string> assetlist) { var sql = @"select top(1) * from AssetInfo where CN = @CN"; var param = new Dictionary <string, string>(); param.Add("@CN", assetlist[0]); var dbret = DBUtility.ExeLocalSqlWithRes(sql, param); var res = new AssetVM(); if (dbret.Count > 0) { res.ID = Convert.ToString(dbret[0][0]); PropertyInfo[] properties = typeof(AssetVM).GetProperties(); var title_info = AssetVMProperty(); var idx = 1; foreach (var title in title_info) { SetPropertyValue(title, Convert.ToString(dbret[0][idx]), res); idx++; } } return(res); }
public static Dictionary <string, bool> RetrieveKeyByPNDict(Dictionary <string, bool> pndict) { var pncond = " ('"; foreach (var item in pndict) { if (!string.IsNullOrEmpty(item.Key)) { pncond = pncond + item.Key + "','"; } } pncond = pncond.Substring(0, pncond.Length - 2); pncond = pncond + ") "; var sql = "select PNKey from PnMainVM where PN in <PNCOND>"; sql = sql.Replace("<PNCOND>", pncond); var pnkeydict = new Dictionary <string, bool>(); var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { var pnkey = Convert.ToString(line[0]); if (!pnkeydict.ContainsKey(pnkey)) { pnkeydict.Add(pnkey, true); } } return(pnkeydict); }
public static List <PnMainVM> RetrievePNList(string searchkey) { var ret = new List <PnMainVM>(); var sql = ""; if (!string.IsNullOrEmpty(searchkey)) { sql = "select PNKey,PN,PNPJ,DefaultResult from PnMainVM where PN like '%<searchkey>%' order by PNPJ"; sql = sql.Replace("<searchkey>", searchkey); } else { sql = "select PNKey,PN,PNPJ,DefaultResult from PnMainVM order by PNPJ"; } var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { var tempvm = new PnMainVM(); tempvm.PNKey = Convert.ToString(line[0]); tempvm.PN = Convert.ToString(line[1]); tempvm.PNPJ = Convert.ToString(line[2]); tempvm.DefaultResult = Convert.ToString(line[3]); ret.Add(tempvm); } return(ret); }
public static List <SnapFileVM> RetrieveFileByID(string id, string username) { var sql = "select DocID,FileAddr,Owner,ShareTo,ReviewTimes,UpdateTime from SnapFileVM where DocID=@DocID"; var ret = new List <SnapFileVM>(); var dict = new Dictionary <string, string>(); dict.Add("@DocID", id); var dbret = DBUtility.ExeLocalSqlWithRes(sql, dict); foreach (var line in dbret) { var tempvm = new SnapFileVM(); tempvm.DocID = Convert.ToString(line[0]); tempvm.FileAddr = Convert.ToString(line[1]); tempvm.Owner = Convert.ToString(line[2]); tempvm.ShareTo = Convert.ToString(line[3]); tempvm.ReviewTimes = Convert.ToInt32(line[4]); if (string.Compare(tempvm.ShareTo, username, true) == 0) { ret.Add(tempvm); UpdateReviewTimes(tempvm.DocID, tempvm.ShareTo, (tempvm.ReviewTimes + 1)); return(ret); } if (string.Compare(tempvm.Owner, username, true) == 0) { ret.Add(tempvm); return(ret); } } return(ret); }
public static List <VTestScore> RetrieveSoreWithRank(string username = "", string vid = "") { var ret = new List <VTestScore>(); var sql = @"select MACHINE,v.UserName,VID,VSubject,CorrectiveAnswer,UserAnswer,UserScore,v.UpdateTime,r.UserRank from VTestScore v left join VTestRank r on r.UserName = v.UserName where 1 = 1"; if (!string.IsNullOrEmpty(username)) { sql = sql + " and v.UserName = '******'"; sql = sql.Replace("<UserName>", username); } if (!string.IsNullOrEmpty(vid)) { sql = sql + " and v.VID = '<VID>'"; sql = sql.Replace("<VID>", vid); } var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { ret.Add(new VTestScore(Convert.ToString(line[0]), Convert.ToString(line[1]), Convert.ToString(line[2]) , Convert.ToString(line[3]), Convert.ToString(line[4]), Convert.ToString(line[5]) , Convert.ToString(line[6]), Convert.ToDateTime(line[7]).ToString("yyyy-MM-dd HH:mm:ss"), Convert.ToString(line[8]))); } return(ret); }
public static Dictionary <string, string> RetrieveUserMap(string machine = "", string username = "") { var ret = new Dictionary <string, string>(); var sql = "select machine,username from machineusermap where 1 = 1"; if (!string.IsNullOrEmpty(machine)) { sql = sql + " and machine = '<machine>'"; sql = sql.Replace("<machine>", machine); } if (!string.IsNullOrEmpty(username)) { sql = sql + " and username = '******'"; sql = sql.Replace("<username>", username); } var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { var tempvm = new MachineUserMap(); tempvm.machine = Convert.ToString(line[0]); tempvm.username = Convert.ToString(line[1]); if (!ret.ContainsKey(tempvm.machine)) { ret.Add(tempvm.machine, tempvm.username); } } return(ret); }
public static void UpdateUserRank(string UserName, string UserRank) { var sql = "select UserRank from VTestRank where UserName = '******'"; sql = sql.Replace("<UserName>", UserName); var dbret = DBUtility.ExeLocalSqlWithRes(sql); if (dbret.Count == 0) { sql = "insert into VTestRank(UserName,UserRank,UpdateTime) values(@UserName,@UserRank,@UpdateTime)"; var param = new Dictionary <string, string>(); param.Add("@UserName", UserName); param.Add("@UserRank", UserRank); param.Add("@UpdateTime", DateTime.Now.ToString()); DBUtility.ExeLocalSqlNoRes(sql, param); } else { var rank = Convert.ToInt32(dbret[0][0]); var urank = Convert.ToInt32(UserRank); var totalrank = rank + urank; if (totalrank < 0) { totalrank = 0; } sql = "update VTestRank set UserRank = @UserRank,UpdateTime = @UpdateTime where UserName = @UserName"; var param = new Dictionary <string, string>(); param.Add("@UserName", UserName); param.Add("@UserRank", totalrank.ToString()); param.Add("@UpdateTime", DateTime.Now.ToString()); DBUtility.ExeLocalSqlNoRes(sql, param); } }
public static void UpdataProductLineTestData(string DMRProdLine, Dictionary <string, DateTime> snstoredatedict) { var snlist = snstoredatedict.Keys.ToList(); var sncond = "('" + string.Join("','", snlist) + "')"; var sql = @"select distinct ModuleSerialNum,WhichTest,ErrAbbr,TestTimeStamp FROM [NPITrace].[dbo].[ProjectTestData] where ModuleSerialNum in <sncond> order by ModuleSerialNum,TestTimeStamp desc"; sql = sql.Replace("<sncond>", sncond); var sntestdict = new Dictionary <string, bool>(); var ret = new List <DMRSNTestData>(); var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { var tempvm = new DMRSNTestData(); tempvm.SN = O2S(line[0]).ToUpper().Trim(); tempvm.WhichTest = O2S(line[1]); tempvm.Failure = O2S(line[2]); tempvm.TestTime = O2T(line[3]); var sntestkey = tempvm.SN + ":" + tempvm.WhichTest; if (sntestdict.ContainsKey(sntestkey)) { continue; } else { sntestdict.Add(sntestkey, true); } if (!string.IsNullOrEmpty(tempvm.TestTime) && DateTime.Parse(tempvm.TestTime) > snstoredatedict[tempvm.SN]) { ret.Add(tempvm); } } if (ret.Count > 0) { var dict = new Dictionary <string, string>(); dict.Add("@DMRProdLine", DMRProdLine); sql = "delete from DMRSNTestData where DMRProdLine = @DMRProdLine"; DBUtility.ExeLocalSqlNoRes(sql, dict); sql = "insert into DMRSNTestData(DMRProdLine,SN,WhichTest,Failure,TestTime) values(@DMRProdLine,@SN,@WhichTest,@Failure,@TestTime)"; foreach (var item in ret) { dict = new Dictionary <string, string>(); dict.Add("@DMRProdLine", DMRProdLine); dict.Add("@SN", item.SN); dict.Add("@WhichTest", item.WhichTest); dict.Add("@Failure", item.Failure); dict.Add("@TestTime", item.TestTime); DBUtility.ExeLocalSqlNoRes(sql, dict); } } }
public static List <string> RetrieveAllProjectKey() { var sql = "select ProjectKey from Project order by ProjectKey ASC"; var dbret = DBUtility.ExeLocalSqlWithRes(sql, null); var ret = new List <string>(); foreach (var line in dbret) { ret.Add(Convert.ToString(line[0])); } return(ret); }
public static List <string> RetrieveNGWafer() { var ret = new List <string>(); var sql = "select WaferNo from NGWafer order by WaferNo"; var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { ret.Add(Convert.ToString(line[0])); } return(ret); }
public static List <string> RetrieveAllTestCase() { var ret = new List <string>(); var sql = "select distinct TestCase from PnRulesVM where TestCase <> '' order by TestCase"; var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { ret.Add(Convert.ToString(line[0])); } return(ret); }
public static List <string> WaferList() { var ret = new List <string>(); var sql = "select distinct Wafer from ProbeTestData"; var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { ret.Add(UT.O2S(line[0])); } return(ret); }
public static Dictionary <string, List <AssetCheckHistoryVM> > GetAssetCheckHistory(string cn = "", string name = "", string status = "") { var sql = @"select ach.* from AssetCheckHistory as ach inner join AssetInfo as ai on ach.AssetID = ai.ID where 1 = 1"; var param = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(name)) { sql += " and (ai.EnglishName like @name or ai.ChineseName like @name) "; param.Add("@name", "%" + name + "%"); } if (!string.IsNullOrEmpty(cn)) { sql += " and ai.CN like @CN "; param.Add("@CN", "%" + cn + "%"); } if (!string.IsNullOrEmpty(status)) { sql += " and ai.EquipmentStatus = @Status "; param.Add("@Status", status); } var dbret = DBUtility.ExeLocalSqlWithRes(sql, param); var res = new Dictionary <string, List <AssetCheckHistoryVM> >(); if (dbret.Count > 0) { foreach (var item in dbret) { var tmp = new AssetCheckHistoryVM(); tmp.ID = Convert.ToString(item[0]); tmp.AssetID = Convert.ToString(item[1]); tmp.Status = Convert.ToString(item[2]); tmp.Comment = Convert.ToString(item[3]); tmp.CreateAt = Convert.ToString(item[4]); tmp.UpdateAt = Convert.ToString(item[5]); if (res.ContainsKey(Convert.ToString(item[1]))) { res[Convert.ToString(item[1])].Add(tmp); } else { res.Add(Convert.ToString(item[1]), new List <AssetCheckHistoryVM> { tmp }); } } } return(res); }
public static List <string> RetrievePnWhichTestByPNKey(string pnkey) { var ret = new List <string>(); var sql = "select WhichTest from PnMESVM where PNKey = '<PNKey>'"; sql = sql.Replace("<PNKey>", pnkey); var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { ret.Add(Convert.ToString(line[0])); } return(ret); }
private static string RetrieveLatestDMRDate(string prodline) { var sql = "select top 1 DMRDate from DMRSNVM where DMRProdLine = @DMRProdLine order by DMRDate desc"; var dict = new Dictionary <string, string>(); dict.Add("@DMRProdLine", prodline); var dbret = DBUtility.ExeLocalSqlWithRes(sql, dict); foreach (var line in dbret) { return(Convert.ToDateTime(line[0]).AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss")); } return(string.Empty); }
public static List <string> RetrieveAllUser() { var sql = "select UserName from UserTable"; var dbret = DBUtility.ExeLocalSqlWithRes(sql, null); var ret = new List <string>(); foreach (var line in dbret) { ret.Add(Convert.ToString(line[0])); } ret.Sort(); return(ret); }
private static List <VTestScore> ScoreExist(string username, string vid) { var ret = new List <VTestScore>(); var sql = "select MACHINE from VTestScore where UserName = '******' and VID = '<VID>'"; sql = sql.Replace("<UserName>", username).Replace("<VID>", vid); var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { ret.Add(new VTestScore()); } return(ret); }
public static bool IsNeverShowIE8Modal(string machine) { var ret = false; var sql = "select ReqMachine from MachineLink where LinkName='' and ReqMachine = '<ReqMachine>' and Appv_1 <> ''"; sql = sql.Replace("<ReqMachine>", machine); var dbret = DBUtility.ExeLocalSqlWithRes(sql); if (dbret.Count > 0) { ret = true; } return(ret); }
public static List <ScrapHistoryVM> RetrieveHistory() { var ret = new List <ScrapHistoryVM>(); var sql = "select SN,DateCode,PN,WhichTest,ErrAbbr,MatchRule,Result,CreateDate from ScrapHistoryVM order by CreateDate desc"; var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { ret.Add(new ScrapHistoryVM(Convert.ToString(line[0]), Convert.ToString(line[1]), Convert.ToString(line[2]) , Convert.ToString(line[3]), Convert.ToString(line[4]), Convert.ToString(line[5]) , Convert.ToString(line[6]), Convert.ToDateTime(line[7]))); } return(ret); }
public static bool HasData(string w) { var sql = "select top 1 Wafer from ProbeTestData where Wafer = @Wafer"; var dict = new Dictionary <string, string>(); dict.Add("@Wafer", w); var dbret = DBUtility.ExeLocalSqlWithRes(sql, dict); if (dbret.Count > 0) { return(true); } return(false); }
public static List <TechVideoVM> RetrieveVideoByID(string vid) { var ret = new List <TechVideoVM>(); var sql = @"select VID,VSubject,VDescription,VPath,UpdateTime,Updater from TechVideoVM where VID = '<VID>'"; sql = sql.Replace("<VID>", vid); var dbret = DBUtility.ExeLocalSqlWithRes(sql, null); foreach (var line in dbret) { ret.Add(new TechVideoVM(Convert.ToString(line[0]), Convert.ToString(line[1]), Convert.ToString(line[2]), Convert.ToString(line[3]), Convert.ToDateTime(line[4]).ToString("yyyy-MM-dd"), Convert.ToString(line[5]))); } return(ret); }
public static List <ProbeTestData> GetQueryHistory(string wafer, string x, string y) { var sql = ""; var dict = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(wafer) && !string.IsNullOrEmpty(x) && !string.IsNullOrEmpty(y)) { sql = "select Wafer,X,Y,ApSize,APVal1,APVal7,APVal8,APVal9 from ProbeTestData where Wafer=@wafer and X=@x and Y=@y and APVal8 <> '' order by APVal9 desc"; dict.Add("@wafer", wafer); dict.Add("@x", x); dict.Add("@y", y); } else if (!string.IsNullOrEmpty(wafer) && !string.IsNullOrEmpty(x)) { sql = "select Wafer,X,Y,ApSize,APVal1,APVal7,APVal8,APVal9 from ProbeTestData where Wafer=@wafer and X=@x and APVal8 <> '' order by APVal9 desc"; dict.Add("@wafer", wafer); dict.Add("@x", x); } else if (!string.IsNullOrEmpty(wafer) && !string.IsNullOrEmpty(y)) { sql = "select Wafer,X,Y,ApSize,APVal1,APVal7,APVal8,APVal9 from ProbeTestData where Wafer=@wafer and Y=@y and APVal8 <> '' order by APVal9 desc"; dict.Add("@wafer", wafer); dict.Add("@y", y); } else { sql = "select Wafer,X,Y,ApSize,APVal1,APVal7,APVal8,APVal9 from ProbeTestData where Wafer=@wafer and APVal8 <> '' order by APVal9 desc"; dict.Add("@wafer", wafer); } var ret = new List <ProbeTestData>(); var dbret = DBUtility.ExeLocalSqlWithRes(sql, dict); foreach (var line in dbret) { var tempvm = new ProbeTestData(); tempvm.Wafer = UT.O2S(line[0]); tempvm.X = UT.O2S(line[1]); tempvm.Y = UT.O2S(line[2]); tempvm.ApSize = UT.O2S(line[3]); tempvm.APVal1 = UT.O2S(line[4]); tempvm.APVal7 = UT.O2S(line[5]); tempvm.APVal8 = UT.O2S(line[6]); tempvm.APVal9 = UT.O2T(line[7]); ret.Add(tempvm); } return(ret); }
public static List <SimpleNoteVM> GetNote(string doorcode) { var ret = new List <SimpleNoteVM>(); var dict = new Dictionary <string, string>(); dict.Add("@doorcode", doorcode); var sql = "select top 300 notekey,doorcode,note,notedate from SimpleNoteVM where doorcode=@doorcode order by notedate desc"; var dbret = DBUtility.ExeLocalSqlWithRes(sql, dict); foreach (var line in dbret) { ret.Add(new SimpleNoteVM(UT.O2S(line[0]), UT.O2S(line[1]) , UT.O2S(line[2]), Convert.ToDateTime(line[3]).ToString("yyyy-MM-dd"))); } return(ret); }
public static List <VTestVM> RetrieveTest(string vid) { var ret = new List <VTestVM>(); var sql = "select VID,TestID,TestType,TestContent,Answer,TestNotice,GiftOffer,GiftPath,OptionalAnswers from VTestVM where VID = '<VID>' order by TestID"; sql = sql.Replace("<VID>", vid); var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { var temp = new VTestVM(Convert.ToString(line[0]), Convert.ToString(line[1]), Convert.ToString(line[2]) , Convert.ToString(line[3]), Convert.ToString(line[4]), Convert.ToString(line[5]), Convert.ToString(line[6]), Convert.ToString(line[7]), Convert.ToString(line[8])); ret.Add(temp); } return(ret); }
public static void RemoveCustomLink(string linkname, string link, string logo, string comment, string machine) { var sql = "select Freqence from MachineLink where ReqMachine = '<ReqMachine>' and LinkName = '<LinkName>'"; sql = sql.Replace("<ReqMachine>", machine).Replace("<LinkName>", linkname); var dbret = DBUtility.ExeLocalSqlWithRes(sql); if (dbret.Count == 0) { StoreLink(linkname, link, logo, comment, machine); } sql = "update MachineLink set Action = N'<Action>' where ReqMachine = '<ReqMachine>' and LinkName = '<LinkName>'"; sql = sql.Replace("<ReqMachine>", machine).Replace("<LinkName>", linkname).Replace("<Action>", LINKACTION.DELETE); DBUtility.ExeLocalSqlNoRes(sql); }
public static List <LinkVM> RetrieveLinks() { var ret = new List <LinkVM>(); var sql = "select LinkName,Link,Logo,Comment from LinkVM order by UpdateTime asc"; var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { var temp = new LinkVM(); temp.LinkName = Convert.ToString(line[0]); temp.Link = Convert.ToString(line[1]); temp.Logo = Convert.ToString(line[2]); temp.Comment = Convert.ToString(line[3]); ret.Add(temp); } return(ret); }
public static Dictionary <string, string> PNDefaultResMap() { var ret = new Dictionary <string, string>(); var sql = "select PN,DefaultResult from PnMainVM"; var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { var pn = Convert.ToString(line[0]); var def = Convert.ToString(line[1]); if (!ret.ContainsKey(pn)) { ret.Add(pn, def); } } return(ret); }
public static List <PnRulesVM> RetrieveRule(string pnkey) { var ret = new List <PnRulesVM>(); var sql = "select PnKey,RuleID,WhichTest,ErrAbbr,Param,LowLimit,HighLimit,RuleRes,TestCase from PnRulesVM where PnKey = @PnKey order by CreateDate DESC"; var pa = new Dictionary <string, string>(); pa.Add("@PnKey", pnkey); var dbret = DBUtility.ExeLocalSqlWithRes(sql, pa); foreach (var line in dbret) { ret.Add(new PnRulesVM(Convert.ToString(line[0]), Convert.ToString(line[1]), Convert.ToString(line[2]) , Convert.ToString(line[3]), Convert.ToString(line[4]), Convert.ToString(line[5]) , Convert.ToString(line[6]), Convert.ToString(line[7]), Convert.ToString(line[8]))); } return(ret); }