Esempio n. 1
0
        public static UserBlogVM RetrieveBlogDoc(string dockey, Controller ctrl)
        {
            var ret = new UserBlogVM();

            ret.CommentList = ProjectErrorViewModels.RetrieveErrorComments(dockey, ctrl);

            var sql = "select UserName,APVal1,APVal2,APVal3,APVal4,APVal5,APVal9 from UserBlog where APVal2='<APVal2>'";

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

            foreach (var line in dbret)
            {
                ret.UserName    = Convert.ToString(line[0]);
                ret.ContentType = Convert.ToString(line[1]);
                ret.DocKey      = Convert.ToString(line[2]);
                ret.dbTitle     = Convert.ToString(line[3]);
                ret.dbContent   = Convert.ToString(line[4]);
                ret.Tag         = Convert.ToString(line[5]);
                ret.CreateDate  = DateTime.Parse(Convert.ToString(line[6]));

                //if (string.Compare(ret.ContentType, UserBlogContentType.COMMENT) == 0)
                //{
                ret.DocURL = "/User/WebDoc?DocKey=" + ret.DocKey;
                //}

                //if (string.Compare(ret.ContentType, UserBlogContentType.ATTACH) == 0)
                //{
                //ret.DocURL = "/User/WebDoc?DocKey=" + ret.DocKey;
                //}
            }

            return(ret);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
        public static List <ProjectErrorViewModels> RetrieveErrorByErrorKey(string ekey, Controller ctrl)
        {
            var ret = new List <ProjectErrorViewModels>();
            var sql = "select  ProjectKey,ErrorKey,OrignalCode,ShortDesc,ErrorCount from ProjectError where ErrorKey = '<ErrorKey>'";

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

            foreach (var line in dbret)
            {
                var temperror = new ProjectErrorViewModels(Convert.ToString(line[0]), Convert.ToString(line[1]), Convert.ToString(line[2]), Convert.ToString(line[3]), Convert.ToInt32(line[4]));
                temperror.CommentList = RetrieveErrorComments(temperror.ErrorKey, ctrl);
                temperror.RetrieveAttachment(temperror.ErrorKey);
                ret.Add(temperror);
            }
            return(ret);
        }
Esempio n. 5
0
        public static void RetrievePjWaferAllData(Controller ctrl, ProjectViewModels vm)
        {
            var vtab = new List <string>();

            vtab.Add("dbo.PRLL_VcselInfoSummary_2016");
            vtab.Add("dbo.PRLL_VcselInfoSummary_2017");
            foreach (var vt in vtab)
            {
                try
                {
                    var wafers = BITestData.RetrieveAllWafer(vm.ProjectKey);
                    if (vm.PNList.Count > 0 && wafers.Count > 0)
                    {
                        var failurelist = new List <BITestData>();
                        var failuredict = new Dictionary <string, bool>();
                        var passlist    = new List <BITestData>();

                        var starttime = vm.StartDate.ToString();

                        var sql    = "select ModuleSerialNum,Step,ModuleType,ErrAbbr,TestTimeStamp,TestStation,ModulePartNum,wafer,waferpn from  " + vt + "(nolock) where wafer in <WAFERCOND> and waferpn  <> 'NULL' and ErrAbbr  <> 'NULL' and ModulePartNum in <PNCOND> and TestTimeStamp <= '<TIMECOND>' order by TestTimeStamp Desc,ModuleSerialNum";
                        var pncond = PNCondition(vm.PNList);
                        if (string.IsNullOrEmpty(pncond))
                        {
                            return;
                        }
                        var wafercond = "('";
                        foreach (var w in wafers)
                        {
                            wafercond = wafercond + w + "','";
                        }
                        wafercond = wafercond.Substring(0, wafercond.Length - 2) + ")";

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

                        var dbret = DBUtility.ExePRLSqlWithRes(ctrl, sql);
                        if (dbret.Count > 0)
                        {
                            var bondeddatadict = BITestData.RetrieveAllDataIDASC(vm.ProjectKey);
                            var tempdataiddict = new Dictionary <string, BITestData>();

                            foreach (var line in dbret)
                            {
                                var tempid = ConvertString(line[0]) + "_" + ConvertString(line[1]);

                                if (!bondeddatadict.ContainsKey(tempid))
                                {
                                    if (tempdataiddict.ContainsKey(tempid))
                                    {
                                        if (DateTime.Parse(ConvertString(line[4])) == tempdataiddict[tempid].TestTimeStamp)
                                        {
                                            if (string.Compare(ConvertString(line[3]), "Pass", true) != 0)
                                            {
                                                tempdataiddict[tempid].ErrAbbr = ConvertString(line[3]);

                                                if (!failuredict.ContainsKey(tempdataiddict[tempid].ModuleSerialNum))
                                                {
                                                    failuredict.Add(tempdataiddict[tempid].ModuleSerialNum, true);
                                                    failurelist.Add(tempdataiddict[tempid]);

                                                    var ekey    = ProjectErrorViewModels.GetUniqKey();
                                                    var pjerror = new ProjectErrorViewModels(ProjectErrorViewModels.BURNIN, ekey, ConvertString(line[3]), "", 1);
                                                    pjerror.Reporter    = "System";
                                                    pjerror.Description = "";
                                                    pjerror.AddandUpdateProjectError();
                                                }
                                            }
                                        }    //same time
                                    }
                                    else
                                    {
                                        var tempdata = new BITestData();
                                        tempdata.DataID          = GetUniqKey();
                                        tempdata.ProjectKey      = vm.ProjectKey;
                                        tempdata.ModuleSerialNum = ConvertString(line[0]);
                                        tempdata.WhichTest       = ConvertString(line[1]);
                                        tempdata.ModuleType      = ConvertString(line[2]);
                                        tempdata.ErrAbbr         = ConvertString(line[3]);
                                        tempdata.TestTimeStamp   = DateTime.Parse(ConvertString(line[4]));
                                        tempdata.TestStation     = ConvertString(line[5]);
                                        tempdata.PN      = ConvertString(line[6]);
                                        tempdata.Wafer   = ConvertString(line[7]);
                                        tempdata.Waferpn = ConvertString(line[8]);

                                        tempdataiddict.Add(tempid, tempdata);
                                    }
                                } //end if (!bondeddatadict.ContainsKey(tempid))
                            }     //end foreach

                            foreach (var kv in tempdataiddict)
                            {
                                kv.Value.StoreBIData();
                            } //end foreach
                        }     //end if (dbret.Count > 0)
                    }         //end if pn > 0
                }
                catch (Exception ex)
                {
                }
            }
        }
Esempio n. 6
0
        public static void StartProjectBonding(Controller ctrl, ProjectViewModels vm)
        {
            var vtab = new List <string>();

            vtab.Add("dbo.PRLL_VcselInfoSummary_2016");
            vtab.Add("dbo.PRLL_VcselInfoSummary_2017");
            foreach (var vt in vtab)
            {
                try
                {
                    if (BITestData.UpdatePJLockUsing(vm.ProjectKey))
                    {
                        return;
                    }

                    if (vm.PNList.Count > 0)
                    {
                        var bondeddatadict = BITestData.RetrieveAllDataID(vm.ProjectKey);

                        //var failurelist = new List<BITestData>();
                        var sql    = "select ModuleSerialNum,Step,ModuleType,ErrAbbr,TestTimeStamp,TestStation,ModulePartNum,wafer,waferpn from  " + vt + "(nolock) where wafer <> 'NULL' and waferpn  <> 'NULL' and ErrAbbr  <> 'NULL' and ModulePartNum in <PNCOND> and TestTimeStamp > '<TIMECOND>'  and TestTimeStamp < '" + DateTime.Now.ToString() + "' order by TestTimeStamp Desc,ModuleSerialNum";
                        var pncond = PNCondition(vm.PNList);

                        if (string.IsNullOrEmpty(pncond))
                        {
                            BITestData.ResetUpdatePJLock(vm.ProjectKey);
                            return;
                        }

                        sql = sql.Replace("<PNCOND>", pncond).Replace("<TIMECOND>", vm.StartDate.ToString());

                        var tempdataiddict = new Dictionary <string, BITestData>();
                        var dbret          = DBUtility.ExePRLSqlWithRes(ctrl, sql);
                        foreach (var line in dbret)
                        {
                            var tempid = ConvertString(line[0]) + "_" + ConvertString(line[1]);

                            if (bondeddatadict.ContainsKey(tempid))
                            {
                                if (DateTime.Parse(ConvertString(line[4])) <= bondeddatadict[tempid])
                                {
                                    continue;
                                }
                            }

                            if (tempdataiddict.ContainsKey(tempid))
                            {
                                if (DateTime.Parse(ConvertString(line[4])) == tempdataiddict[tempid].TestTimeStamp)
                                {
                                    if (string.Compare(ConvertString(line[3]), "Pass", true) != 0)
                                    {
                                        tempdataiddict[tempid].ErrAbbr = ConvertString(line[3]);

                                        var ekey    = ProjectErrorViewModels.GetUniqKey();
                                        var pjerror = new ProjectErrorViewModels(ProjectErrorViewModels.BURNIN, ekey, ConvertString(line[3]), "", 1);
                                        pjerror.Reporter    = "System";
                                        pjerror.Description = "";
                                        pjerror.AddandUpdateProjectError();
                                    }
                                }    //same time
                            }
                            else
                            {
                                var tempdata = new BITestData();
                                tempdata.DataID          = GetUniqKey();
                                tempdata.ProjectKey      = vm.ProjectKey;
                                tempdata.ModuleSerialNum = ConvertString(line[0]);
                                tempdata.WhichTest       = ConvertString(line[1]);
                                tempdata.ModuleType      = ConvertString(line[2]);
                                tempdata.ErrAbbr         = ConvertString(line[3]);
                                tempdata.TestTimeStamp   = DateTime.Parse(ConvertString(line[4]));
                                tempdata.TestStation     = ConvertString(line[5]);
                                tempdata.PN      = ConvertString(line[6]);
                                tempdata.Wafer   = ConvertString(line[7]);
                                tempdata.Waferpn = ConvertString(line[8]);

                                tempdataiddict.Add(tempid, tempdata);
                            }
                        }    //end foreach

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

                    BITestData.ResetUpdatePJLock(vm.ProjectKey);
                }
                catch (Exception ex)
                {
                    BITestData.ResetUpdatePJLock(vm.ProjectKey);
                }
            }
        }
Esempio n. 7
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)
            {
            }
        }
Esempio n. 8
0
        public static void StartProjectBonding(ProjectViewModels vm)
        {
            try
            {
                if (ProjectTestData.UpdatePJLockUsing(vm.ProjectKey))
                {
                    return;
                }


                if (vm.StationList.Count > 0 &&
                    vm.TabList.Count > 0 &&
                    vm.PNList.Count > 0)
                {
                    var failurelist = 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 > '" + vm.StartDate.ToString() + "' and TestTimeStamp < '" + DateTime.Now.ToString() + "'");
                        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
                                {
                                    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);
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            { }
                        }
                    }

                    //if (vm.FinishRating < 90)
                    //{
                    //    CreateSystemIssues(failurelist);
                    //}
                }

                ProjectTestData.ResetUpdatePJLock(vm.ProjectKey);
            }
            catch (Exception ex)
            {
                ProjectTestData.ResetUpdatePJLock(vm.ProjectKey);
            }
        }
Esempio n. 9
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);
                }
            }
        }
Esempio n. 10
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);
        }
Esempio n. 11
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);
                }
            }
        }
Esempio n. 12
0
        public static void StartProjectBonding(ProjectViewModels vm)
        {
            try
            {
                if (ProjectTestData.UpdatePJLockUsing(vm.ProjectKey))
                {
                    return;
                }


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


                    //(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>", vm.StartDate.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);
                                        }
                                    }
                                }//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);
                            }
                        }
                    } //end if (tempdata != null)
                }     // if model list > 0

                ProjectTestData.ResetUpdatePJLock(vm.ProjectKey);
            }
            catch (Exception ex)
            {
                ProjectTestData.ResetUpdatePJLock(vm.ProjectKey);
            }
        }