コード例 #1
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
        }