Пример #1
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();
                }
            }
        }
Пример #2
0
        public static void LoadBITestDateFromAuto(Controller ctrl)
        {
            var syscfgdict = CfgUtility.GetSysConfig(ctrl);
            var bitables   = syscfgdict["BIAUTOTABLES"].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            var bizerotime = syscfgdict["BIZEROTIME"];

            foreach (var bt in bitables)
            {
                var testresultlist      = new List <BITestResult>();
                var testresultfieldlist = new List <BITestResultDataField>();

                var bilatesttime = RetrieveLatestTimeStampOfAnBITable(bt, bizerotime);

                var sql = "select ContainerName,ProcessStep,DateTime,Failure_Mode,Station,Work_Order,PN,Channel,SLOPE,PO_LD,PO_Uniformity,THOLD,Delta_PO_LD,Delta_SLOPE,Delta_THOLD,Delta_PO_Uniformity from <bitable> where DateTime > '<bilatesttime>' "
                          + " and  ProcessStep is not null and PN is not null and Work_Order is not null and ContainerName is not null and Failure_Mode is not null and ContainerName <> '' and Failure_Mode <> '--' and Failure_Mode <> '' and Failure_Mode is not null order by ContainerName,DateTime";
                sql = sql.Replace("<bitable>", bt).Replace("<bilatesttime>", bilatesttime);

                var dbret = DBUtility.ExeAutoSqlWithRes(sql);
                foreach (var line in dbret)
                {
                    var sn            = Convert.ToString(line[0]);
                    var testname      = Convert.ToString(line[1]);
                    var testtime      = DateTime.Parse(ConvertToDateStr(line[2]));
                    var failure       = Convert.ToString(line[3]);
                    var station       = Convert.ToString(line[4]);
                    var jo            = Convert.ToString(line[5]);
                    var pn            = Convert.ToString(line[6]);
                    var ch            = Convert.ToString(line[7]);
                    var slope         = Convert.ToDouble(line[8]);
                    var pold          = Convert.ToDouble(line[9]);
                    var pouniformity  = Convert.ToDouble(line[10]);
                    var thold         = Convert.ToDouble(line[11]);
                    var dpold         = Convert.ToDouble(line[12]);
                    var dslope        = Convert.ToDouble(line[13]);
                    var dthold        = Convert.ToDouble(line[14]);
                    var dpouniformity = Convert.ToDouble(line[15]);

                    var tempresult = new BITestResult(sn, testname, station, failure, testtime, pn, jo, bt);
                    testresultlist.Add(tempresult);

                    var tempfield = new BITestResultDataField(sn, testname, testtime, pn, jo, ch, slope, pold, pouniformity, thold, dpold, dslope, dthold, dpouniformity);
                    testresultfieldlist.Add(tempfield);
                }//end foreach

                StoreBITestResult(testresultlist);
                StoreBITestResultDateField(testresultfieldlist);
            }//end foreach
        }
Пример #3
0
        public static bool ValueableAttach(string path, Controller ctrl)
        {
            var ext    = System.IO.Path.GetExtension(path).Replace(".", "").ToUpper();
            var syscfg = CfgUtility.GetSysConfig(ctrl);

            try
            {
                if (syscfg["VALUEABLEATTACH"].Contains(ext))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            { return(false); }
        }
Пример #4
0
        public static bool SendEmail(Controller ctrl, string title, List <string> tolist, string content)
        {
            try
            {
                var syscfgdict = CfgUtility.GetSysConfig(ctrl);

                var message = new MailMessage();
                message.From = new MailAddress(syscfgdict["APPEMAILADRESS"]);
                foreach (var item in tolist)
                {
                    if (!item.Contains("@"))
                    {
                        continue;
                    }
                    try
                    {
                        if (item.Contains(";"))
                        {
                            var ts = item.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (var t in ts)
                            {
                                message.To.Add(t);
                            }
                        }
                        else
                        {
                            message.To.Add(item);
                        }
                    }
                    catch (Exception e) { logthdinfo("Address exception: " + e.Message); }
                }

                message.Subject = title;
                message.Body    = content;

                SmtpClient client = new SmtpClient();
                client.Host                  = syscfgdict["EMAILSERVER"];
                client.EnableSsl             = true;
                client.Timeout               = 60000;
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Credentials           = new NetworkCredential(syscfgdict["APPEMAILADRESS"], syscfgdict["APPEMAILPWD"]);

                ServicePointManager.ServerCertificateValidationCallback
                    = delegate(object s, X509Certificate certificate, X509Chain chain
                               , SslPolicyErrors sslPolicyErrors) { return(true); };

                new Thread(() => {
                    try
                    {
                        client.Send(message);
                    }
                    catch (SmtpFailedRecipientsException ex)
                    {
                        logthdinfo("SmtpFailedRecipientsException exception: " + ex.Message);
                        try
                        {
                            message.To.Clear();
                            foreach (var item in tolist)
                            {
                                if (ex.Message.Contains(item))
                                {
                                    try
                                    {
                                        message.To.Add(item);
                                    }
                                    catch (Exception e) { logthdinfo("Address exception2: " + e.Message); }
                                }
                            }
                            client.Send(message);
                        }
                        catch (Exception ex1)
                        {
                            logthdinfo("nest exception1: " + ex1.Message);
                        }
                    }
                    catch (Exception ex)
                    {
                        logthdinfo("send exception: " + ex.Message);
                    }
                }).Start();
            }
            catch (Exception ex)
            {
                logthdinfo("main exception: " + ex.Message);
                return(false);
            }
            return(true);
        }