示例#1
0
        private static void UpdateDMRSN(string prodline, Controller ctrl)
        {
            var dict = new Dictionary <string, string>();
            var sql  = "SELECT distinct [DMR_ID],[Prod_Line],[Created_at],[Created_By],[File_URL]  FROM [eDMR].[dbo].[DMR_Detail_List_View] where Prod_Line =  @Prod_Line and File_URL is not null order by [Created_at] asc";

            dict.Add("@Prod_Line", prodline);
            var latestdate = RetrieveLatestDMRDate(prodline);

            if (!string.IsNullOrEmpty(latestdate))
            {
                sql = @"SELECT distinct [DMR_ID],[Prod_Line],[Created_at],[Created_By],[File_URL]  FROM [eDMR].[dbo].[DMR_Detail_List_View] 
                        where Prod_Line =  @Prod_Line and Created_at > @StartDate and Created_at <= @EndDate and File_URL is not null";
                dict.Add("@StartDate", latestdate);
                dict.Add("@EndDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            }

            var dmrlist = new List <DMRSNVM>();

            var dbret = DBUtility.ExeDMRSqlWithRes(sql, dict);

            foreach (var line in dbret)
            {
                try
                {
                    var tempvm = new DMRSNVM();
                    tempvm.DMRID       = Convert.ToString(line[0]);
                    tempvm.DMRProdLine = Convert.ToString(line[1]);
                    tempvm.DMRDate     = Convert.ToDateTime(line[2]).ToString("yyyy-MM-dd HH:mm:ss");
                    tempvm.DMRCreater  = Convert.ToString(line[3]);
                    tempvm.DMRFileURL  = Convert.ToString(line[4]);
                    dmrlist.Add(tempvm);
                }
                catch (Exception ex) { }
            }

            sql = @"insert into DMRSNVM(DMRID,DMRProdLine,DMRDate,DMRCreater,SN,SNFailure) values(@DMRID,@DMRProdLine,@DMRDate,@DMRCreater,@SN,@SNFailure)";

            foreach (var vm in dmrlist)
            {
                var lfs = ExternalDataCollector.DownloadShareFile(vm.DMRFileURL, ctrl);
                if (!string.IsNullOrEmpty(lfs) && ExternalDataCollector.FileExist(ctrl, lfs))
                {
                    var sndatalist = ExternalDataCollector.RetrieveDataFromExcelWithAuth(ctrl, lfs, null, 5);
                    foreach (var l in sndatalist)
                    {
                        var sn = l[0];
                        if (sn.Length != 7)
                        {
                            continue;
                        }
                        var failure = "N/A";
                        if (l.Count >= 3)
                        {
                            failure = l[2];
                        }

                        dict = new Dictionary <string, string>();
                        dict.Add("@DMRID", vm.DMRID);
                        dict.Add("@DMRProdLine", vm.DMRProdLine);
                        dict.Add("@DMRDate", vm.DMRDate);
                        dict.Add("@DMRCreater", vm.DMRCreater);
                        dict.Add("@SN", sn);
                        dict.Add("@SNFailure", failure);
                        DBUtility.ExeLocalSqlNoRes(sql, dict);
                    }
                }
            }
        }
示例#2
0
        public static List <SNApertureSizeVM> LoadData(List <string> snlist, Controller ctrl)
        {
            var syscfg   = CfgUtility.GetSysConfig(ctrl);
            var bifolder = syscfg["BIITHFOLDER"];
            var allfiles = GetAllFiles(bifolder, ctrl);
            var snwfdict = UT.GetWaferFromSN(snlist);

            var ret = new List <SNApertureSizeVM>();

            foreach (var sn in snlist)
            {
                SNApertureSizeVM tempvm = null;

                var fs = "";
                foreach (var f in allfiles)
                {
                    if (f.ToUpper().Contains(sn.ToUpper()) && f.ToUpper().Contains("_PRE.TXT"))
                    {
                        fs = f;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(fs))
                {
                    continue;
                }

                var bifile = ExternalDataCollector.DownloadShareFile(fs, ctrl);
                if (!string.IsNullOrEmpty(bifile))
                {
                    var alline = System.IO.File.ReadAllLines(bifile);
                    var idx    = 1;
                    foreach (var line in alline)
                    {
                        if (line.ToUpper().Contains("CHANNEL"))
                        {
                            tempvm    = new SNApertureSizeVM();
                            tempvm.SN = sn.ToUpper();
                            tempvm.CH = "CH" + idx;
                            if (snwfdict.ContainsKey(tempvm.SN))
                            {
                                tempvm.Wafer = snwfdict[tempvm.SN];
                            }

                            ret.Add(tempvm);
                            idx++;
                            continue;
                        }

                        if (tempvm != null && tempvm.IthList.Count < 14)
                        {
                            var items = line.Split(new string[] { " ", "\t" }, StringSplitOptions.RemoveEmptyEntries);
                            tempvm.IthList.Add(UT.O2D(items[1]));
                            tempvm.PwrList.Add(UT.O2D(items[2]));
                        }
                    } //end foreach
                }     //end if

                foreach (var item in ret)
                {
                    if (item.IthList.Count == 14 && item.PwrList.Count == 14)
                    {
                        var rest = Fit.Line(item.IthList.ToArray(), item.PwrList.ToArray());
                        item.Intercept = rest.Item1.ToString();
                        item.IthSlope  = rest.Item2.ToString();
                        item.Ith       = (Math.Abs(rest.Item1 / rest.Item2) / 1000.0).ToString();
                    }
                }

                var wflist = new List <string>();
                foreach (var kv in snwfdict)
                {
                    var wf = kv.Value.ToUpper().Trim();
                    if (!wflist.Contains(wf))
                    {
                        wflist.Add(wf);
                    }
                }

                var wfapdict = new Dictionary <string, string>();
                foreach (var w in wflist)
                {
                    var apconst = ProbeTestData.PrepareAPConst2162(w);
                    wfapdict.Add(w, apconst);
                }

                foreach (var item in ret)
                {
                    if (!string.IsNullOrEmpty(item.Wafer) && wfapdict.ContainsKey(item.Wafer))
                    {
                        item.ApertureConst = wfapdict[item.Wafer];
                        if (!string.IsNullOrEmpty(item.ApertureConst) && !string.IsNullOrEmpty(item.Ith))
                        {
                            var apconst = UT.O2D(item.ApertureConst);
                            var ith     = UT.O2D(item.Ith);
                            item.ApertureSize = (ith * 7996.8 + apconst).ToString();
                        }
                    }
                }
            }
            return(ret);
        }