Ejemplo n.º 1
0
        public static List <ProjectFAViewModules> RetrieveFADataWithSN(string ProjectKey, string SN, Controller ctrl)
        {
            var ret     = new List <ProjectFAViewModules>();
            var pjdata  = ProjectTestData.RetrieveProjectTestDataWithSN(100000, ProjectKey, SN);
            var pjdata1 = BITestData.RetrieveProjectTestDataWithSN(100000, ProjectKey, SN);

            if (pjdata1.Count > 0)
            {
                pjdata.AddRange(pjdata1);
            }

            //if (pjdata.Count == 0)
            //{
            //    pjdata = BITestData.RetrieveProjectTestDataWithSN(100000, ProjectKey, SN);
            //}

            foreach (var d in pjdata)
            {
                var im = IssueViewModels.RetrieveIssueByIssueKey(d.DataID, ctrl);
                if (im != null)
                {
                    ret.Add(new ProjectFAViewModules(im, d));
                }
            }
            return(ret);
        }
Ejemplo n.º 2
0
        public static void AddGroup(string grouptag, string groupmember)
        {
            var sql = "insert into UserGroupVM(GroupID,GroupTag,GroupMember,TimeStamp) values('<GroupID>','<GroupTag>','<GroupMember>','<TimeStamp>')";

            sql = sql.Replace("<GroupID>", IssueViewModels.GetUniqKey()).Replace("<GroupTag>", grouptag).Replace("<GroupMember>", groupmember.ToUpper()).Replace("<TimeStamp>", DateTime.Now.ToString());
            DBUtility.ExeLocalSqlNoRes(sql);
        }
Ejemplo n.º 3
0
        public static List <ShareDocVM> RetrieveAllSharedDocs(Controller ctrl)
        {
            var ret   = new List <ShareDocVM>();
            var sql   = "select DOCPJK,DOCType,DOCKey,DOCTag,DOCCreator,DOCDate,DOCFavorTimes,APVal1,BackLink from ShareDoc order by DOCDate";
            var dbret = DBUtility.ExeLocalSqlWithRes(sql, null);

            foreach (var line in dbret)
            {
                var tempvm = new ShareDocVM();
                tempvm.DOCPJK        = Convert.ToString(line[0]);
                tempvm.DOCType       = Convert.ToString(line[1]);
                tempvm.DOCKey        = Convert.ToString(line[2]);
                tempvm.DOCTag        = Convert.ToString(line[3]);
                tempvm.DOCCreator    = Convert.ToString(line[4]);
                tempvm.DOCDate       = DateTime.Parse(Convert.ToString(line[5]));
                tempvm.DOCFavorTimes = Convert.ToInt32(line[6]);
                tempvm.DocID         = Convert.ToString(line[7]);
                tempvm.BACKLink      = Convert.ToString(line[8]);

                if (string.Compare(tempvm.DOCType, ShareDocType.ISSUE, true) == 0)
                {
                    var issue = IssueViewModels.RetrieveIssueByIssueKey(tempvm.DOCKey, ctrl);
                    if (issue == null)
                    {
                        continue;
                    }

                    tempvm.Summary = issue.Summary;
                    tempvm.DocURL  = "/Issue/UpdateIssue?issuekey=" + tempvm.DOCKey;
                }
                else if (string.Compare(tempvm.DOCType, ShareDocType.DEBUG, true) == 0)
                {
                    var debugtree = ProjectErrorViewModels.RetrieveErrorByErrorKey(tempvm.DOCKey, ctrl);
                    tempvm.Summary = debugtree[0].ProjectKey + "-" + debugtree[0].OrignalCode;
                    tempvm.DocURL  = "/Project/UpdateProjectError?ErrorKey=" + tempvm.DOCKey;
                }
                else if (string.Compare(tempvm.DOCType, ShareDocType.BLOG, true) == 0)
                {
                    var blog = UserBlogVM.RetrieveBlogDoc(tempvm.DOCKey, ctrl);
                    if (string.IsNullOrEmpty(blog.DocKey))
                    {
                        continue;
                    }

                    tempvm.Summary = blog.Title;
                    tempvm.DocURL  = blog.DocURL;
                }
                else
                {
                    tempvm.Summary = tempvm.DOCKey;
                    //var tempstrs = tempvm.Summary.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
                    //var datestr = tempstrs[tempstrs.Length - 1].Substring(0, 8);
                    //tempvm.DocURL = "/userfiles/docs/" + datestr + "/" + tempvm.DOCKey;
                    tempvm.DocURL = "/User/WebDoc?DocKey=" + tempvm.DOCKey + "&Creator=" + tempvm.DOCCreator;
                }

                ret.Add(tempvm);
            }
            return(ret);
        }
Ejemplo n.º 4
0
        public static string ShareDoc(string DOCPJK, string DOCType, string DOCKey, string DOCTag, string DOCCreator, string DOCDate, string BackLink)
        {
            var sql = "select APVal1 from ShareDoc where DOCPJK='<DOCPJK>' and DOCKey=N'<DOCKey>'";

            sql = sql.Replace("<DOCPJK>", DOCPJK).Replace("<DOCKey>", DOCKey);
            var dbret = DBUtility.ExeLocalSqlWithRes(sql, null);

            if (dbret.Count > 0)
            {
                var docid1 = Convert.ToString(dbret[0][0]);
                if (string.IsNullOrEmpty(docid1))
                {
                    docid1 = UpdateDocID(DOCPJK, DOCKey);
                }
                return(docid1);
            }

            var docid = IssueViewModels.GetUniqKey();

            sql = "insert into ShareDoc(DOCPJK,DOCType,DOCKey,DOCTag,DOCCreator,DOCDate,APVal1,BackLink) values('<DOCPJK>','<DOCType>',N'<DOCKey>','<DOCTag>','<DOCCreator>','<DOCDate>','<DOCID>','<BackLink>')";
            sql = sql.Replace("<DOCPJK>", DOCPJK).Replace("<DOCType>", DOCType)
                  .Replace("<DOCKey>", DOCKey).Replace("<DOCTag>", DOCTag)
                  .Replace("<DOCCreator>", DOCCreator).Replace("<DOCDate>", DOCDate)
                  .Replace("<DOCID>", docid).Replace("<BackLink>", BackLink);
            DBUtility.ExeLocalSqlNoRes(sql);
            return(docid);
        }
Ejemplo n.º 5
0
        private static void CreateSystemIssues(List <BITestData> failurelist, Controller ctrl)
        {
            if (failurelist.Count > 0)
            {
                foreach (var item in failurelist)
                {
                    var vm = new IssueViewModels();
                    vm.ProjectKey = item.ProjectKey;
                    vm.IssueKey   = item.DataID;
                    vm.IssueType  = ISSUETP.Bug;
                    vm.Summary    = "Module " + item.ModuleSerialNum + " failed for " + item.ErrAbbr + " @Burn-In Step " + item.WhichTest;
                    vm.Priority   = ISSUEPR.Major;
                    vm.DueDate    = DateTime.Now.AddDays(7);
                    vm.ReportDate = item.TestTimeStamp;

                    var syscfgdict = CfgUtility.GetSysConfig(ctrl);
                    vm.Assignee     = syscfgdict["BIADMIN"].ToUpper();
                    vm.Reporter     = "System";
                    vm.Resolution   = Resolute.Pending;
                    vm.ResolvedDate = DateTime.Parse("1982-05-06 01:01:01");
                    vm.Description  = "Module " + item.ModuleSerialNum + " failed for " + item.ErrAbbr + " @Burn-In Step " + item.WhichTest + " on tester " + item.TestStation + " " + item.TestTimeStamp.ToString("yyyy-MM-dd hh:mm:ss");
                    vm.CommentType  = COMMENTTYPE.Description;
                    vm.ModuleSN     = item.ModuleSerialNum;
                    vm.ErrAbbr      = item.ErrAbbr;
                    vm.DataID       = item.DataID;
                    //ProjectEvent.CreateIssueEvent(vm.ProjectKey, "System", vm.Assignee, vm.Summary, vm.IssueKey);
                    vm.StoreIssue();
                }
            }
        }
Ejemplo n.º 6
0
        public static List <ProjectFAViewModules> RetrieveDoneFAData(string pjkey, Controller ctrl)
        {
            var ret = new List <ProjectFAViewModules>();

            var issuedict = IssueViewModels.RRetrieveFAByPjkey(pjkey, Resolute.Done, 2000, ctrl);

            foreach (var d in issuedict)
            {
                if (d.CommentList.Count == 2)
                {
                    bool sameas = false;
                    foreach (var com in d.CommentList)
                    {
                        if (com.Comment.Contains("<p>Issue Same As <a"))
                        {
                            sameas = true;
                            break;
                        }

                        if (com.Comment.Contains("passed") &&
                            string.Compare(com.Reporter, "System", true) == 0)
                        {
                            sameas = true;
                            break;
                        }
                    }
                    if (sameas)
                    {
                        continue;
                    }
                }

                if (d.Summary.Contains("@Burn-In Step"))
                {
                    var pjdata = BITestData.RetrieveProjectTestDataByDataID(d.IssueKey);
                    if (pjdata.Count > 0)
                    {
                        var pd = new ProjectTestData();
                        pd.ModuleSerialNum = pjdata[0].ModuleSerialNum;
                        pd.ErrAbbr         = pjdata[0].ErrAbbr;
                        pd.ProjectKey      = d.ProjectKey;
                        ret.Add(new ProjectFAViewModules(d, pd));
                    }
                }
                else
                {
                    var pjdata = ProjectTestData.RetrieveProjectTestData(d.IssueKey);
                    if (pjdata.Count > 0)
                    {
                        ret.Add(new ProjectFAViewModules(d, pjdata[0]));
                    }
                }
            }

            return(ret);
        }
Ejemplo n.º 7
0
        public static List <ShareDocVM> RetrieveYesterdayDocs(Controller ctrl)
        {
            var    ret       = new List <ShareDocVM>();
            string tempdate  = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
            var    starttime = tempdate + " 00:00:01";
            var    endtime   = tempdate + " 23:59:59";

            var sql = "select DOCPJK,DOCType,DOCKey,DOCTag,DOCCreator,DOCDate,DOCFavorTimes,APVal1,BackLink from ShareDoc where DOCDate >= '<starttime>' and DOCDate <= '<endtime>'";

            sql = sql.Replace("<starttime>", starttime).Replace("<endtime>", endtime);
            var dbret = DBUtility.ExeLocalSqlWithRes(sql, null);

            foreach (var line in dbret)
            {
                var tempvm = new ShareDocVM();
                tempvm.DOCPJK        = Convert.ToString(line[0]);
                tempvm.DOCType       = Convert.ToString(line[1]);
                tempvm.DOCKey        = Convert.ToString(line[2]);
                tempvm.DOCTag        = Convert.ToString(line[3]);
                tempvm.DOCCreator    = Convert.ToString(line[4]);
                tempvm.DOCDate       = DateTime.Parse(Convert.ToString(line[5]));
                tempvm.DOCFavorTimes = Convert.ToInt32(line[6]);
                tempvm.DocID         = Convert.ToString(line[7]);
                tempvm.BACKLink      = Convert.ToString(line[8]);

                if (string.Compare(tempvm.DOCType, ShareDocType.ISSUE, true) == 0)
                {
                    var issue = IssueViewModels.RetrieveIssueByIssueKey(tempvm.DOCKey, ctrl);
                    if (issue == null)
                    {
                        continue;
                    }

                    tempvm.Summary = issue.Summary;
                    tempvm.DocURL  = "/Issue/UpdateIssue?issuekey=" + tempvm.DOCKey;
                }
                else if (string.Compare(tempvm.DOCType, ShareDocType.DEBUG, true) == 0)
                {
                    var debugtree = ProjectErrorViewModels.RetrieveErrorByErrorKey(tempvm.DOCKey, ctrl);
                    tempvm.Summary = debugtree[0].ProjectKey + "-" + debugtree[0].OrignalCode;
                    tempvm.DocURL  = "/Project/UpdateProjectError?ErrorKey=" + tempvm.DOCKey;
                }
                else
                {
                    tempvm.Summary = tempvm.DOCKey;
                    //var tempstrs = tempvm.Summary.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
                    //var datestr = tempstrs[tempstrs.Length - 1].Substring(0, 8);
                    //tempvm.DocURL = "/userfiles/docs/" + datestr + "/" + tempvm.DOCKey;
                    tempvm.DocURL = "/User/WebDoc?DocKey=" + tempvm.DOCKey + "&Creator=" + tempvm.DOCCreator;
                }

                ret.Add(tempvm);
            }
            return(ret);
        }
Ejemplo n.º 8
0
 public static int RetrieveFADataCount(string pjkey, bool pending = true)
 {
     if (pending)
     {
         return(IssueViewModels.RRetrieveFAStatusByPjkey(pjkey, Resolute.Working)
                + IssueViewModels.RRetrieveFAStatusByPjkey(pjkey, Resolute.Pending));
     }
     else
     {
         return(IssueViewModels.RRetrieveFAStatusByPjkey(pjkey, Resolute.Done));
     }
 }
Ejemplo n.º 9
0
        private static string UpdateDocID(string DOCPJK, string DOCKey)
        {
            var docid = IssueViewModels.GetUniqKey();
            var sql   = "Update ShareDoc set APVal1 = '<DocID>' where  DOCPJK = '<DOCPJK>' and DOCKey = N'<DOCKey>'";

            sql = sql.Replace("<DocID>", docid).Replace("<DOCPJK>", DOCPJK).Replace("<DOCKey>", DOCKey);
            DBUtility.ExeLocalSqlNoRes(sql);
            sql = "Update UserLearn set APVal1 = '<DocID>' where  DOCPJK = '<DOCPJK>' and DOCKey = N'<DOCKey>'";
            sql = sql.Replace("<DocID>", docid).Replace("<DOCPJK>", DOCPJK).Replace("<DOCKey>", DOCKey);
            DBUtility.ExeLocalSqlNoRes(sql);
            return(docid);
        }
Ejemplo n.º 10
0
        public List <string> PJFailureTrend(string ProjectKey)
        {
            var ret = new List <string>();

            var edate         = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 07:30:00");
            var sdate         = edate.AddDays(-30);
            var pendingissues = IssueViewModels.RetrieveIssueForIncreaseSummary(ProjectKey, sdate.ToString());

            var datelist = new List <string>();
            var dictlist = new List <Dictionary <string, int> >();


            for (var temptime = sdate; temptime < edate;)
            {
                var tempstime = temptime;
                temptime = temptime.AddDays(10);

                var tempdict = new Dictionary <string, int>();

                foreach (var item in pendingissues)
                {
                    if (item.ReportDate < temptime && item.ReportDate >= tempstime &&
                        string.Compare(item.Reporter, "System", true) == 0)
                    {
                        var errorkey = item.ErrAbbr;//item.Summary.Split(new string[] { "failed for", "@" }, StringSplitOptions.None)[1].Trim();
                        if (tempdict.ContainsKey(errorkey))
                        {
                            tempdict[errorkey] = tempdict[errorkey] + 1;
                        }
                        else
                        {
                            tempdict.Add(errorkey, 1);
                        }
                    }
                }

                dictlist.Add(tempdict);
                datelist.Add(temptime.ToString("yyyy-MM-dd"));
            }

            var idx = 0;

            foreach (var item in dictlist)
            {
                ret.Add(FailurePieChart(item, datelist[idx]));
                idx = idx + 1;
            }

            return(ret);
        }
Ejemplo n.º 11
0
        // GET: DashBoard
        public ActionResult SystemBoard()
        {
            var systemeventlist = ProjectEvent.RetrieveEvent(30);

            ViewBag.assignedtasklist = new List <IssueViewModels>();

            var ckdict = CookieUtility.UnpackCookie(this);

            if (ckdict.ContainsKey("logonuser") && !string.IsNullOrEmpty(ckdict["logonuser"]))
            {
                var usernm = ckdict["logonuser"].Split(new char[] { '|' })[0];
                ViewBag.assignedtasklist = IssueViewModels.RetrieveIssueByAssignee(usernm, Resolute.Pending, 60);
            }

            return(View(systemeventlist));
        }
Ejemplo n.º 12
0
        public static List <ProjectFAViewModules> RetrieveFADataWithErrAbbr(string ProjectKey, string ErrAbbr, Controller ctrl)
        {
            var ret    = new List <ProjectFAViewModules>();
            var pjdata = ProjectTestData.RetrieveProjectTestDataWithErrAbbr(100000, ProjectKey, ErrAbbr);

            if (pjdata.Count == 0)
            {
                pjdata = BITestData.RetrieveProjectTestDataWithErrAbbr(100000, ProjectKey, ErrAbbr);
            }


            foreach (var d in pjdata)
            {
                var im = IssueViewModels.RetrieveIssueByIssueKey(d.DataID, ctrl);
                if (im != null && im.Resolution != Resolute.AutoClose)
                {
                    ret.Add(new ProjectFAViewModules(im, d));
                }
            }
            return(ret);
        }
Ejemplo n.º 13
0
        private static void CreateSystemIssues(List <ProjectTestData> failurelist)
        {
            if (failurelist.Count > 0)
            {
                var pj            = ProjectViewModels.RetrieveOneProject(failurelist[0].ProjectKey);
                var firstengineer = "";
                foreach (var m in pj.MemberList)
                {
                    if (string.Compare(m.Role, ProjectViewModels.ENGROLE) == 0)
                    {
                        firstengineer = m.Name;
                        break;
                    }
                }

                foreach (var item in failurelist)
                {
                    var vm = new IssueViewModels();
                    vm.ProjectKey   = item.ProjectKey;
                    vm.IssueKey     = item.DataID;
                    vm.IssueType    = ISSUETP.Bug;
                    vm.Summary      = "Module " + item.ModuleSerialNum + " failed for " + item.ErrAbbr + " @ " + item.WhichTest;
                    vm.Priority     = ISSUEPR.Major;
                    vm.DueDate      = DateTime.Now.AddDays(7);
                    vm.ReportDate   = item.TestTimeStamp;
                    vm.Assignee     = firstengineer;
                    vm.Reporter     = "System";
                    vm.Resolution   = Resolute.Pending;
                    vm.ResolvedDate = DateTime.Parse("1982-05-06 01:01:01");
                    vm.Description  = "Module " + item.ModuleSerialNum + " failed for " + item.ErrAbbr + " @ " + item.WhichTest + " on tester " + item.TestStation + " " + item.TestTimeStamp.ToString("yyyy-MM-dd hh:mm:ss");
                    vm.CommentType  = COMMENTTYPE.Description;
                    vm.ModuleSN     = item.ModuleSerialNum;
                    vm.ErrAbbr      = item.ErrAbbr;
                    vm.DataID       = item.DataID;
                    //ProjectEvent.CreateIssueEvent(vm.ProjectKey, "System", vm.Assignee, vm.Summary, vm.IssueKey);
                    vm.StoreIssue();
                }
            }
        }
Ejemplo n.º 14
0
        public static void IPushDoc(string DOCPJK, string DOCKey, string ToWho, string Pusher, Controller ctrl, string reason = "")
        {
            var sql = "select DOCPJK,DOCType,DOCKey,DOCTag,DOCCreator,DOCDate,DOCFavorTimes,APVal1,BackLink from ShareDoc where DOCPJK = '<DOCPJK>' and DOCKey = N'<DOCKey>'";

            sql = sql.Replace("<DOCPJK>", DOCPJK).Replace("<DOCKey>", DOCKey);
            var dbret = DBUtility.ExeLocalSqlWithRes(sql, null);

            foreach (var line in dbret)
            {
                var tempvm = new ShareDocVM();
                tempvm.DOCPJK        = Convert.ToString(line[0]);
                tempvm.DOCType       = Convert.ToString(line[1]);
                tempvm.DOCKey        = Convert.ToString(line[2]);
                tempvm.DOCTag        = Convert.ToString(line[3]);
                tempvm.DOCCreator    = Convert.ToString(line[4]);
                tempvm.DOCDate       = DateTime.Parse(Convert.ToString(line[5]));
                tempvm.DOCFavorTimes = Convert.ToInt32(line[6]);
                tempvm.DocID         = Convert.ToString(line[7]);
                tempvm.BACKLink      = Convert.ToString(line[8]);

                if (string.Compare(tempvm.DOCType, ShareDocType.ISSUE, true) == 0)
                {
                    var issue = IssueViewModels.RetrieveIssueByIssueKey(tempvm.DOCKey, ctrl);
                    if (issue == null)
                    {
                        continue;
                    }

                    tempvm.Summary = issue.Summary;
                    tempvm.DocURL  = "/Issue/UpdateIssue?issuekey=" + tempvm.DOCKey;
                }
                else if (string.Compare(tempvm.DOCType, ShareDocType.DEBUG, true) == 0)
                {
                    var debugtree = ProjectErrorViewModels.RetrieveErrorByErrorKey(tempvm.DOCKey, ctrl);
                    tempvm.Summary = debugtree[0].ProjectKey + "-" + debugtree[0].OrignalCode;
                    tempvm.DocURL  = "/Project/UpdateProjectError?ErrorKey=" + tempvm.DOCKey;
                }
                else
                {
                    tempvm.Summary = tempvm.DOCKey;
                    var tempstrs = tempvm.Summary.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
                    var datestr  = tempstrs[tempstrs.Length - 1].Substring(0, 8);
                    tempvm.DocURL = "/userfiles/docs/" + datestr + "/" + tempvm.DOCKey;
                }

                PushDoc(ToWho, tempvm.DOCPJK, tempvm.DOCType, tempvm.DOCKey, tempvm.DOCTag, tempvm.DOCCreator, tempvm.DOCDate.ToString(), Pusher, tempvm.DocID, tempvm.BACKLink);

                if (string.Compare(tempvm.DOCType, ShareDocType.ISSUE, true) == 0)
                {
                    SendPushDocEvent("a new Issue about " + tempvm.DOCTag, tempvm.DocURL, ToWho, Pusher, ctrl, reason);
                }
                else if (string.Compare(tempvm.DOCType, ShareDocType.DEBUG, true) == 0)
                {
                    SendPushDocEvent("a debug about " + tempvm.DOCPJK + "-" + tempvm.Summary, tempvm.DocURL, ToWho, Pusher, ctrl, reason);
                }
                else
                {
                    SendPushDocEvent("a new document about " + tempvm.DOCTag, "/User/WebDoc?DocKey=" + HttpUtility.UrlEncode(tempvm.DOCKey) + "&Creator=" + tempvm.DOCCreator, ToWho, Pusher, ctrl);
                }
            }
        }
Ejemplo n.º 15
0
        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);
            }
        }
Ejemplo n.º 16
0
        private void IssueCountTrend(string ProjectKey)
        {
            var edate         = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 07:30:00");
            var sdate         = edate.AddDays(-30);
            var pendingissues = IssueViewModels.RetrieveIssueForIncreaseSummary(ProjectKey, sdate.ToString());
            var solvedissues  = IssueViewModels.RetrieveIssueForSolveSummary(ProjectKey, sdate.ToString());

            var datelist    = new List <string>();
            var pendinglist = new List <int>();
            var solvedlist  = new List <int>();
            var pendingsum  = 0;
            var slovedsum   = 0;

            for (var temptime = sdate; temptime < edate;)
            {
                var tempstime = temptime;
                temptime = temptime.AddDays(1);

                foreach (var item in pendingissues)
                {
                    if (item.ReportDate < temptime && item.ReportDate >= tempstime)
                    {
                        pendingsum = pendingsum + 1;
                    }
                }

                foreach (var item in solvedissues)
                {
                    if (item.ResolvedDate <= temptime && item.ResolvedDate >= tempstime)
                    {
                        slovedsum = slovedsum + 1;
                    }
                }

                datelist.Add(temptime.ToString());
                pendinglist.Add(pendingsum);
                solvedlist.Add(slovedsum);
            }

            var ChartxAxisValues = "";
            var ChartSearies     = "";

            //xaxis
            foreach (var item in datelist)
            {
                ChartxAxisValues = ChartxAxisValues + "'" + DateTime.Parse(item).ToString("yyyy-MM-dd") + "',";
            }
            ChartxAxisValues = ChartxAxisValues.Substring(0, ChartxAxisValues.Length - 1);


            //yaxis
            ChartSearies = "{name:'Issue Increase',data:[<fvalue>]},{name:'Issue Solved',data:[<cvalue>]}";

            var tempvalue = "";

            foreach (var item in pendinglist)
            {
                tempvalue = tempvalue + item.ToString() + ",";
            }
            tempvalue    = tempvalue.Substring(0, tempvalue.Length - 1);
            ChartSearies = ChartSearies.Replace("<fvalue>", tempvalue);

            tempvalue = "";
            foreach (var item in solvedlist)
            {
                tempvalue = tempvalue + item.ToString("0.00") + ",";
            }
            tempvalue    = tempvalue.Substring(0, tempvalue.Length - 1);
            ChartSearies = ChartSearies.Replace("<cvalue>", tempvalue);

            var tempscript = System.IO.File.ReadAllText(Server.MapPath("~/Scripts/AreaChart.xml"));

            ViewBag.issuetrendscript = tempscript.Replace("#ElementID#", "issuetrendchart")
                                       .Replace("#Title#", "Issue Count Trend")
                                       .Replace("#ChartxAxisValues#", ChartxAxisValues)
                                       .Replace("#NAMEVALUEPAIRS#", ChartSearies);
        }
Ejemplo n.º 17
0
        public static void UpdateProjectData(ProjectViewModels vm, string starttime, string endtime)
        {
            try
            {
                if (vm.StationList.Count > 0 &&
                    vm.TabList.Count > 0 &&
                    vm.PNList.Count > 0)
                {
                    var failurelist = new List <ProjectTestData>();
                    var passlist    = new List <ProjectTestData>();

                    bool bondinged = false;
                    if (ProjectTestData.RetrieveLatestTimeOfLocalProject(vm.ProjectKey) != null)
                    {
                        bondinged = true;
                    }

                    var bondingeddatadict = new Dictionary <string, bool>();
                    if (bondinged)
                    {
                        bondingeddatadict = ProjectTestData.RetrieveAllDataID(vm.ProjectKey);
                    }

                    var sqls = RetrieveSqlFromProjectModel(vm);
                    foreach (var s in sqls)
                    {
                        if (string.IsNullOrEmpty(s.Value))
                        {
                            continue;
                        }

                        var sndict = new Dictionary <string, bool>();
                        var sql    = s.Value.Replace("<TIMECOND>", "and TestTimeStamp > '" + starttime + "' and TestTimeStamp < '" + endtime + "'");
                        var dbret  = DBUtility.ExeMESSqlWithRes(sql);
                        foreach (var item in dbret)
                        {
                            try
                            {
                                var tempdata = new ProjectTestData(vm.ProjectKey, Convert.ToString(item[0]), Convert.ToString(item[1])
                                                                   , s.Key, Convert.ToString(item[3]), Convert.ToString(item[4])
                                                                   , Convert.ToString(item[5]), Convert.ToString(item[6]), Convert.ToString(item[7]));
                                tempdata.JO = Convert.ToString(item[8]);

                                if (!bondinged)
                                {
                                    tempdata.StoreProjectTestData();

                                    if (!sndict.ContainsKey(tempdata.ModuleSerialNum))
                                    {
                                        sndict.Add(tempdata.ModuleSerialNum, true);
                                        if (string.Compare(tempdata.ErrAbbr, "PASS", true) != 0)
                                        {
                                            var ekey    = ProjectErrorViewModels.GetUniqKey();
                                            var pjerror = new ProjectErrorViewModels(vm.ProjectKey, ekey, tempdata.ErrAbbr, "", 1);
                                            pjerror.Reporter    = "System";
                                            pjerror.Description = "";
                                            pjerror.AddandUpdateProjectError();

                                            failurelist.Add(tempdata);
                                        }
                                        else
                                        {
                                            passlist.Add(tempdata);
                                        }
                                    }
                                }
                                else
                                {
                                    if (!bondingeddatadict.ContainsKey(tempdata.DataID))
                                    {
                                        bondingeddatadict.Add(tempdata.DataID, true);

                                        tempdata.StoreProjectTestData();

                                        if (!sndict.ContainsKey(tempdata.ModuleSerialNum))
                                        {
                                            sndict.Add(tempdata.ModuleSerialNum, true);
                                            if (string.Compare(tempdata.ErrAbbr, "PASS", true) != 0)
                                            {
                                                var ekey    = ProjectErrorViewModels.GetUniqKey();
                                                var pjerror = new ProjectErrorViewModels(vm.ProjectKey, ekey, tempdata.ErrAbbr, "", 1);
                                                pjerror.Reporter    = "System";
                                                pjerror.Description = "";
                                                pjerror.AddandUpdateProjectError();

                                                failurelist.Add(tempdata);
                                            }
                                            else
                                            {
                                                passlist.Add(tempdata);
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            { }
                        }
                    }

                    if (vm.FinishRating < 90 && DateTime.Parse(starttime) != vm.StartDate)
                    {
                        //use latest failure cover previous failure
                        foreach (var item in failurelist)
                        {
                            IssueViewModels.CloseIssueAutomaticllyWithFailedSN(item.ProjectKey, item.ModuleSerialNum, item.WhichTest, item.TestStation, item.TestTimeStamp.ToString("yyyy-MM-dd hh:mm:ss"));
                        }

                        CreateSystemIssues(failurelist);
                    }

                    if (vm.FinishRating < 90 && DateTime.Parse(starttime) != vm.StartDate)
                    {
                        //use pass sn cover previous failure
                        foreach (var item in passlist)
                        {
                            IssueViewModels.CloseIssueAutomaticlly(item.ProjectKey, item.ModuleSerialNum, item.WhichTest, item.TestStation, item.TestTimeStamp.ToString("yyyy-MM-dd hh:mm:ss"));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 18
0
 public ProjectFAViewModules(IssueViewModels im, ProjectTestData pd)
 {
     IssueData = im;
     TestData  = pd;
 }
Ejemplo n.º 19
0
        public static void LikeDoc(string DOCKey, string DOCCreator, string updater, Controller ctrl)
        {
            var sql = "select DOCFavor from UserLearn where DOCKey = N'<DOCKey>' and DOCCreator = '<DOCCreator>' and UserName = '******'";

            sql = sql.Replace("<DOCKey>", DOCKey).Replace("<DOCCreator>", DOCCreator).Replace("<UserName>", updater);
            var dbret2 = DBUtility.ExeLocalSqlWithRes(sql, null);

            if (dbret2.Count == 0)
            {
                return;
            }
            if (!string.IsNullOrEmpty(Convert.ToString(dbret2[0][0])))
            {
                return;
            }

            var ret = new List <ShareDocVM>();

            sql = "select a.DOCPJK,a.DOCType,a.DOCKey,a.DOCTag,a.DOCCreator,a.DOCDate,b.DOCPusher,b.DOCFavor,a.DOCFavorTimes,a.APVal1,a.BackLink from ShareDoc a left join UserLearn b ON a.DOCKey = b.DOCKey "
                  + " where  a.DOCKey = N'<DOCKey>' and a.DOCCreator = '<DOCCreator>'  and b.UserName='******'";
            sql = sql.Replace("<DOCKey>", DOCKey).Replace("<DOCCreator>", DOCCreator).Replace("<UserName>", updater);
            var dbret = DBUtility.ExeLocalSqlWithRes(sql, null);

            foreach (var line in dbret)
            {
                var tempvm = new ShareDocVM();
                tempvm.DOCPJK        = Convert.ToString(line[0]);
                tempvm.DOCType       = Convert.ToString(line[1]);
                tempvm.DOCKey        = Convert.ToString(line[2]);
                tempvm.DOCTag        = Convert.ToString(line[3]);
                tempvm.DOCCreator    = Convert.ToString(line[4]);
                tempvm.DOCDate       = DateTime.Parse(Convert.ToString(line[5]));
                tempvm.DOCPusher     = Convert.ToString(line[6]);
                tempvm.DOCFavor      = Convert.ToString(line[7]);
                tempvm.DOCFavorTimes = Convert.ToInt32(line[8]);
                tempvm.DocID         = Convert.ToString(line[9]);
                tempvm.BACKLink      = Convert.ToString(line[10]);
                ret.Add(tempvm);
            }

            if (ret.Count > 0)
            {
                var sql1 = "Update ShareDoc set DOCFavorTimes = <DOCFavorTimes> where DOCKey = N'<DOCKey>' and DOCCreator = '<DOCCreator>'";
                sql1 = sql1.Replace("<DOCKey>", DOCKey).Replace("<DOCCreator>", DOCCreator).Replace("<DOCFavorTimes>", (ret[0].DOCFavorTimes + 1).ToString());
                DBUtility.ExeLocalSqlNoRes(sql1);
            }


            var sql2 = "Update UserLearn set DOCFavor='LIKE' where DOCKey = N'<DOCKey>' and DOCCreator = '<DOCCreator>' and UserName='******'";

            sql2 = sql2.Replace("<DOCKey>", DOCKey).Replace("<DOCCreator>", DOCCreator).Replace("<UserName>", updater);
            DBUtility.ExeLocalSqlNoRes(sql2);

            if (ret.Count > 0)
            {
                if (string.Compare(ret[0].DOCType, ShareDocType.ISSUE, true) == 0)
                {
                    var issue = IssueViewModels.RetrieveIssueByIssueKey(ret[0].DOCKey, ctrl);
                    if (issue != null)
                    {
                        var Summary = issue.Summary;
                        var DocURL  = "/Issue/UpdateIssue?issuekey=" + ret[0].DOCKey;
                        UserKPIVM.AddUserDailyRank(ret[0].DOCKey, issue.Assignee, UserRankType.VOTE, "Like your task analyse: " + Summary, DocURL, 1);
                    }
                }
                else if (string.Compare(ret[0].DOCType, ShareDocType.DEBUG, true) == 0)
                {
                    var debugtree = ProjectErrorViewModels.RetrieveErrorByErrorKey(ret[0].DOCKey, ctrl);
                    var Summary   = debugtree[0].ProjectKey + "-" + debugtree[0].OrignalCode;
                    var DocURL    = "/Project/UpdateProjectError?ErrorKey=" + ret[0].DOCKey;

                    UserKPIVM.AddUserDailyRank(ret[0].DOCKey, ret[0].DOCCreator, UserRankType.VOTE, "Like your Debug Tree analyse: " + Summary, DocURL, 1);
                }
                else if (string.Compare(ret[0].DOCType, ShareDocType.DOCUMENT, true) == 0)
                {
                    var Summary = ret[0].DOCKey;

                    var DocURL = "/User/WebDoc?DocKey=" + ret[0].DOCKey + "&Creator=" + ret[0].DOCCreator;
                    if (!string.IsNullOrEmpty(ret[0].BACKLink))
                    {
                        UserKPIVM.AddUserAttachDailyRank(ret[0].DocID, ret[0].DOCCreator, UserRankType.VOTE, "Like your technical document: " + Summary, ret[0].BACKLink, 1, ret[0].DOCKey, ctrl);
                    }
                    else
                    {
                        UserKPIVM.AddUserAttachDailyRank(ret[0].DocID, ret[0].DOCCreator, UserRankType.VOTE, "Like your technical document: " + Summary, DocURL, 1, ret[0].DOCKey, ctrl);
                    }
                }
                else if (string.Compare(ret[0].DOCType, ShareDocType.BLOG, true) == 0)
                {
                    var vm     = UserBlogVM.RetrieveBlogDoc(ret[0].DOCKey, ctrl);
                    var DocURL = "/User/WebDoc?DocKey=" + ret[0].DOCKey;
                    UserKPIVM.AddUserDailyRank(ret[0].DOCKey, ret[0].DOCCreator, UserRankType.VOTE, "Like your blog: " + vm.Title, DocURL, 1);
                }
            }
        }
Ejemplo n.º 20
0
        public static List <ProjectFAViewModules> RetrievePendingFAData(string pjkey, Controller ctrl)
        {
            var ret        = new List <ProjectFAViewModules>();
            var issuedict  = IssueViewModels.RRetrieveFAByPjkey(pjkey, Resolute.Working, 50, ctrl);
            var issuedict2 = IssueViewModels.RRetrieveFAByPjkey(pjkey, Resolute.Pending, 500, ctrl);

            issuedict.AddRange(issuedict2);

            var bisndict = new Dictionary <string, string>();
            var fasndict = new Dictionary <string, string>();

            foreach (var d in issuedict)
            {
                if (d.Summary.Contains("@Burn-In Step"))
                {
                    var sn     = "";
                    var pjdata = BITestData.RetrieveProjectTestDataByDataID(d.IssueKey);
                    if (pjdata.Count > 0)
                    {
                        sn = pjdata[0].ModuleSerialNum;
                    }

                    if (!string.IsNullOrEmpty(sn) && !bisndict.ContainsKey(sn))
                    {
                        bisndict.Add(sn, d.ReportDate.ToString());
                        var pd = new ProjectTestData();
                        pd.ModuleSerialNum = sn;
                        pd.ErrAbbr         = pjdata[0].ErrAbbr;
                        pd.ProjectKey      = d.ProjectKey;
                        ret.Add(new ProjectFAViewModules(d, pd));
                    }
                    else if (!string.IsNullOrEmpty(sn) && bisndict.ContainsKey(sn))
                    {
                        //close automaticlly
                        IssueViewModels.CloseDupBIIssueAutomaticlly(d.ProjectKey, sn, bisndict[sn]);
                    }
                }
                else
                {
                    var sn     = "";
                    var pjdata = ProjectTestData.RetrieveProjectTestData(d.IssueKey);
                    if (pjdata.Count > 0)
                    {
                        sn = pjdata[0].ModuleSerialNum;
                    }

                    if (!string.IsNullOrEmpty(sn) && !fasndict.ContainsKey(sn))
                    {
                        fasndict.Add(sn, d.ReportDate.ToString());
                        ret.Add(new ProjectFAViewModules(d, pjdata[0]));
                    }
                    else if (!string.IsNullOrEmpty(sn) && fasndict.ContainsKey(sn))
                    {
                        //close automaticlly
                        IssueViewModels.CloseDupIssueAutomaticlly(d.ProjectKey, sn, fasndict[sn]);
                    }
                }
            }

            return(ret);
        }
Ejemplo n.º 21
0
        private static void IssueCountTrend(Controller ctrl, UserActionTrend uservm, string username, int month)
        {
            var edate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 07:30:00");
            var sdate = edate.AddMonths(0 - month);

            var allissue      = IssueViewModels.RetrieveIssueAllByUser(username, sdate.ToString(), ctrl);
            var pendingissues = IssueViewModels.RetrieveIssuePendingByUser(username, sdate.ToString());
            var workingissues = IssueViewModels.RetrieveIssueWorkingByUser(username, sdate.ToString());
            var solvedissues  = IssueViewModels.RetrieveIssueDoneByUser(username, sdate.ToString(), ctrl);

            uservm.PendingIssueCount = pendingissues.Count();
            uservm.WorkingIssueCount = workingissues.Count();
            uservm.DoneIssueCount    = solvedissues.Count();

            var datelist    = new List <string>();
            var pendinglist = new List <int>();
            var solvedlist  = new List <int>();
            var pendingsum  = 0;
            var slovedsum   = 0;

            for (var temptime = sdate; temptime < edate;)
            {
                var tempstime = temptime;
                temptime = temptime.AddDays(1);

                foreach (var item in allissue)
                {
                    if (item.ReportDate < temptime && item.ReportDate >= tempstime)
                    {
                        pendingsum = pendingsum + 1;
                    }
                }

                foreach (var item in solvedissues)
                {
                    if (item.ResolvedDate <= temptime && item.ResolvedDate >= tempstime)
                    {
                        slovedsum = slovedsum + 1;
                    }
                }

                datelist.Add(temptime.ToString());
                pendinglist.Add(pendingsum);
                solvedlist.Add(slovedsum);
            }

            var ChartxAxisValues = "";
            var ChartSearies     = "";

            //xaxis
            foreach (var item in datelist)
            {
                ChartxAxisValues = ChartxAxisValues + "'" + DateTime.Parse(item).ToString("yyyy-MM-dd") + "',";
            }
            ChartxAxisValues = ChartxAxisValues.Substring(0, ChartxAxisValues.Length - 1);


            //yaxis
            ChartSearies = "{name:'Task Increase',data:[<fvalue>]},{name:'Task Solved',data:[<cvalue>]}";

            var tempvalue = "";

            foreach (var item in pendinglist)
            {
                tempvalue = tempvalue + item.ToString() + ",";
            }
            tempvalue    = tempvalue.Substring(0, tempvalue.Length - 1);
            ChartSearies = ChartSearies.Replace("<fvalue>", tempvalue);

            tempvalue = "";
            foreach (var item in solvedlist)
            {
                tempvalue = tempvalue + item.ToString("0.00") + ",";
            }
            tempvalue    = tempvalue.Substring(0, tempvalue.Length - 1);
            ChartSearies = ChartSearies.Replace("<cvalue>", tempvalue);

            var tempscript = System.IO.File.ReadAllText(ctrl.Server.MapPath("~/Scripts/AreaChart.xml"));

            uservm.UserIssueTrend = tempscript.Replace("#ElementID#", (uservm.CurrentUser.Split(new char[] { '@' })[0]).Replace(".", "") + "issuetrendchart")
                                    .Replace("#Title#", "Task Count Trend")
                                    .Replace("#ChartxAxisValues#", ChartxAxisValues)
                                    .Replace("#NAMEVALUEPAIRS#", ChartSearies);
        }
Ejemplo n.º 22
0
        public static void UpdateProjectData(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 (vm.PNList.Count > 0)
                    {
                        var failurelist = new List <BITestData>();
                        var failuredict = new Dictionary <string, bool>();
                        var passlist    = new List <BITestData>();

                        var starttime = BITestData.RetrieveLatestTimeOfLocalBI(vm.ProjectKey);
                        if (string.IsNullOrEmpty(starttime))
                        {
                            starttime = vm.StartDate.ToString();
                        }

                        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>' order by TestTimeStamp Desc,ModuleSerialNum";
                        var pncond = PNCondition(vm.PNList);

                        if (string.IsNullOrEmpty(pncond))
                        {
                            return;
                        }

                        sql = sql.Replace("<PNCOND>", pncond).Replace("<TIMECOND>", starttime);

                        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 (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);

                                if (string.Compare(tempdata.ErrAbbr, "Pass", true) != 0)
                                {
                                    if (!failuredict.ContainsKey(tempdata.ModuleSerialNum))
                                    {
                                        failuredict.Add(tempdata.ModuleSerialNum, true);
                                        failurelist.Add(tempdata);

                                        var ekey    = ProjectErrorViewModels.GetUniqKey();
                                        var pjerror = new ProjectErrorViewModels(ProjectErrorViewModels.BURNIN, ekey, tempdata.ErrAbbr, "", 1);
                                        pjerror.Reporter    = "System";
                                        pjerror.Description = "";
                                        pjerror.AddandUpdateProjectError();
                                    }
                                }
                                else
                                {
                                    passlist.Add(tempdata);
                                }
                            }
                        }    //end foreach

                        foreach (var kv in tempdataiddict)
                        {
                            kv.Value.StoreBIData();
                        }    //end foreach

                        if (DateTime.Parse(starttime) != vm.StartDate)
                        {
                            CreateSystemIssues(failurelist, ctrl);
                            IssueViewModels.CloseBIIssueAutomaticlly(passlist);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Ejemplo n.º 23
0
        public static List <ShareDocVM> RetrieveMyLearn(string UserName, Controller ctrl)
        {
            var ret = new List <ShareDocVM>();
            var sql = "select a.DOCPJK,a.DOCType,a.DOCKey,a.DOCTag,a.DOCCreator,a.DOCDate,a.DOCPusher,a.DOCFavor,b.DOCFavorTimes,b.APVal1,a.BackLink from UserLearn a left join ShareDoc b ON a.DOCKey = b.DOCKey where a.UserName= '******' and a.DOCType <> '<DOCType>' order by a.DOCDate DESC";

            sql = sql.Replace("<UserName>", UserName).Replace("<DOCType>", ShareDocType.BLOG);
            var dbret = DBUtility.ExeLocalSqlWithRes(sql, null);

            foreach (var line in dbret)
            {
                var tempvm = new ShareDocVM();
                tempvm.BookerName    = UserName;
                tempvm.DOCPJK        = Convert.ToString(line[0]);
                tempvm.DOCType       = Convert.ToString(line[1]);
                tempvm.DOCKey        = Convert.ToString(line[2]);
                tempvm.DOCTag        = Convert.ToString(line[3]);
                tempvm.DOCCreator    = Convert.ToString(line[4]);
                tempvm.DOCDate       = DateTime.Parse(Convert.ToString(line[5]));
                tempvm.DOCPusher     = Convert.ToString(line[6]);
                tempvm.DOCFavor      = Convert.ToString(line[7]);
                tempvm.DOCFavorTimes = Convert.ToInt32(line[8]);
                tempvm.DocID         = Convert.ToString(line[9]);
                tempvm.BACKLink      = Convert.ToString(line[10]);

                if (string.Compare(tempvm.DOCType, ShareDocType.ISSUE, true) == 0)
                {
                    var issue = IssueViewModels.RetrieveIssueByIssueKey(tempvm.DOCKey, ctrl);
                    if (issue == null)
                    {
                        continue;
                    }

                    tempvm.Summary = issue.Summary;
                    tempvm.DocURL  = "/Issue/UpdateIssue?issuekey=" + tempvm.DOCKey;
                }
                else if (string.Compare(tempvm.DOCType, ShareDocType.DEBUG, true) == 0)
                {
                    var debugtree = ProjectErrorViewModels.RetrieveErrorByErrorKey(tempvm.DOCKey, ctrl);
                    tempvm.Summary = debugtree[0].ProjectKey + "-" + debugtree[0].OrignalCode;
                    tempvm.DocURL  = "/Project/UpdateProjectError?ErrorKey=" + tempvm.DOCKey;
                }
                else if (string.Compare(tempvm.DOCType, ShareDocType.DOCUMENT, true) == 0)
                {
                    tempvm.Summary = tempvm.DOCKey;
                    tempvm.DocURL  = "/User/WebDoc?DocKey=" + tempvm.DOCKey + "&Creator=" + tempvm.DOCCreator;
                }

                ret.Add(tempvm);
            }

            foreach (var doc in ret)
            {
                if (string.IsNullOrEmpty(doc.DocID))
                {
                    doc.DocID = UpdateDocID(doc.DOCPJK, doc.DOCKey);
                }
            }

            var bloglist = RetrieveMyLearnBlog(UserName, ctrl);

            if (bloglist.Count > 0)
            {
                ret.AddRange(bloglist);
            }

            ret.Sort(delegate(ShareDocVM item1, ShareDocVM item2)
            {
                if (item1.DOCDate > item2.DOCDate)
                {
                    return(-1);
                }
                else if (item1.DOCDate < item2.DOCDate)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            return(ret);
        }
Ejemplo n.º 24
0
        public static void UpdateProjectData(ProjectViewModels vm, string starttime)
        {
            try
            {
                if (vm.MDIDList.Count > 0 &&
                    vm.SumDatasetList.Count > 0)
                {
                    var dsdict = new Dictionary <string, bool>();
                    foreach (var item in vm.SumDatasetList)
                    {
                        dsdict.Add(item.Station, true);
                    }

                    var failurelist = new List <ProjectTestData>();
                    var passlist    = new List <ProjectTestData>();

                    //(c.MODEL_ID like 'FTLX6871%' or c.MODEL_ID like 'FTLX6872%' or c.MODEL_ID like 'FTLX6672%')
                    var mdcond = "(";
                    foreach (var w in vm.MDIDList)
                    {
                        mdcond = mdcond + "c.MODEL_ID like '" + w.Pn.Trim() + "%' or ";
                    }
                    mdcond = mdcond.Substring(0, mdcond.Length - 4) + ")";


                    var s      = "SELECT a.MFR_SN,d.DATASET_NAME,c.FAMILY,d.STATUS,d.END_TIME,d.STATION,a.MFR_PN,d.ROUTE_ID FROM PARTS a INNER JOIN ROUTES b ON a.OPT_INDEX = b.PART_INDEX INNER JOIN BOM_CONTEXT_ID c ON c.BOM_CONTEXT_ID = b.BOM_CONTEXT_ID INNER JOIN DATASETS d ON b.ROUTE_ID = d.ROUTE_ID WHERE <mdcond> and d.END_TIME > '<TIMECOND>'  ORDER BY d.ROUTE_ID,d.END_TIME DESC";
                    var sndict = new Dictionary <string, bool>();
                    var sql    = s.Replace("<TIMECOND>", DateTime.Parse(starttime).ToString("yyyyMMddhhmmss")).Replace("<mdcond>", mdcond);

                    var currentroutid       = "";
                    var currentroutedsnames = new List <ProjectStation>();
                    var pjdatalist          = new List <ProjectTestData>();

                    var dbret = DBUtility.ExeATESqlWithRes(sql);

                    foreach (var item in dbret)
                    {
                        try
                        {
                            var status      = Convert.ToString(item[3]);
                            var ds          = Convert.ToString(item[1]);
                            var temprouteid = Convert.ToString(item[7]);

                            if (string.Compare(currentroutid, temprouteid) != 0)
                            {
                                currentroutid = temprouteid;

                                if (pjdatalist.Count > 0)
                                {
                                    FindErrAbbr(pjdatalist, currentroutedsnames, dsdict);

                                    foreach (var pjdata in pjdatalist)
                                    {
                                        pjdata.StoreProjectTestData();
                                    }

                                    if (string.Compare(pjdatalist[0].ErrAbbr, "PASS", true) != 0)
                                    {
                                        if (!sndict.ContainsKey(pjdatalist[0].ModuleSerialNum))
                                        {
                                            sndict.Add(pjdatalist[0].ModuleSerialNum, true);

                                            failurelist.Add(pjdatalist[0]);

                                            var ekey    = ProjectErrorViewModels.GetUniqKey();
                                            var pjerror = new ProjectErrorViewModels(vm.ProjectKey, ekey, pjdatalist[0].ErrAbbr, "", 1);
                                            pjerror.Reporter    = "System";
                                            pjerror.Description = "";
                                            pjerror.AddandUpdateProjectError();
                                        }
                                    }
                                    else
                                    {
                                        if (!sndict.ContainsKey(pjdatalist[0].ModuleSerialNum))
                                        {
                                            sndict.Add(pjdatalist[0].ModuleSerialNum, true);
                                            passlist.Add(pjdatalist[0]);
                                        }
                                    }
                                }//end if (tempdata != null)

                                pjdatalist.Clear();
                                currentroutedsnames.Clear();
                                currentroutedsnames.Add(new ProjectStation(ds, status));
                            }
                            else //if (tempdata != null)
                            {
                                currentroutedsnames.Add(new ProjectStation(ds, status));
                            }

                            if (dsdict.ContainsKey(ds))
                            {
                                var spdatetime = Convert.ToString(item[4]);
                                var stdtime    = spdatetime.Substring(0, 4) + "-" + spdatetime.Substring(4, 2) + "-" + spdatetime.Substring(6, 2) + " "
                                                 + spdatetime.Substring(8, 2) + ":" + spdatetime.Substring(10, 2) + ":" + spdatetime.Substring(12, 2);

                                //(string pk, string did, string sn, string wtest, string mt, string err, string testtime, string station, string p)
                                var tempdata = new ProjectTestData(vm.ProjectKey, GetUniqKey(), Convert.ToString(item[0])
                                                                   , Convert.ToString(item[1]), Convert.ToString(item[2]), Convert.ToString(item[3]).ToUpper()
                                                                   , stdtime, Convert.ToString(item[5]), Convert.ToString(item[6]));

                                pjdatalist.Add(tempdata);
                            }
                        }
                        catch (Exception ex)
                        { }
                    }//end for each

                    if (pjdatalist.Count > 0)
                    {
                        FindErrAbbr(pjdatalist, currentroutedsnames, dsdict);

                        foreach (var pjdata in pjdatalist)
                        {
                            pjdata.StoreProjectTestData();
                        }

                        if (string.Compare(pjdatalist[0].ErrAbbr, "PASS", true) != 0)
                        {
                            if (!sndict.ContainsKey(pjdatalist[0].ModuleSerialNum))
                            {
                                sndict.Add(pjdatalist[0].ModuleSerialNum, true);

                                failurelist.Add(pjdatalist[0]);

                                var ekey    = ProjectErrorViewModels.GetUniqKey();
                                var pjerror = new ProjectErrorViewModels(vm.ProjectKey, ekey, pjdatalist[0].ErrAbbr, "", 1);
                                pjerror.Reporter    = "System";
                                pjerror.Description = "";
                                pjerror.AddandUpdateProjectError();
                            }
                        }
                        else
                        {
                            if (!sndict.ContainsKey(pjdatalist[0].ModuleSerialNum))
                            {
                                sndict.Add(pjdatalist[0].ModuleSerialNum, true);
                                passlist.Add(pjdatalist[0]);
                            }
                        }
                    }//end if (tempdata != null)

                    if (vm.FinishRating < 90 && DateTime.Parse(starttime) != vm.StartDate)
                    {
                        //use latest failure cover previous failure
                        foreach (var item in failurelist)
                        {
                            IssueViewModels.CloseIssueAutomaticllyWithFailedSN(item.ProjectKey, item.ModuleSerialNum, item.WhichTest, item.TestStation, item.TestTimeStamp.ToString("yyyy-MM-dd hh:mm:ss"));
                        }

                        CreateSystemIssues(failurelist);
                    }

                    if (vm.FinishRating < 90 && DateTime.Parse(starttime) != vm.StartDate)
                    {
                        //use pass sn cover previous failure
                        foreach (var item in passlist)
                        {
                            IssueViewModels.CloseIssueAutomaticlly(item.ProjectKey, item.ModuleSerialNum, item.WhichTest, item.TestStation, item.TestTimeStamp.ToString("yyyy-MM-dd hh:mm:ss"));
                        }
                    }
                }// if model list > 0
            }
            catch (Exception ex)
            {
            }
        }