public static void MatchRudeRule(List <ScrapTableItem> scraptable) { var pnmesmap = PnMESVM.RetriveMESKey2TestDict(); foreach (var item in scraptable) { if (!string.IsNullOrEmpty(item.TestData.DataID)) { if (pnmesmap.ContainsKey(item.TestData.MESTab + item.PNKey)) { item.WhichTest = pnmesmap[item.TestData.MESTab + item.PNKey]; item.RlueList = PnRulesVM.RetrieveRule(item.PNKey, item.WhichTest, item.TestData.ErrAbbr); } } }//end foreach }
public static List <PnMainVM> RetrieveAllPnSetting(string pn) { var ret = new List <PnMainVM>(); var sql = "select PNKey,PN,PNPJ,DefaultResult from PnMainVM where PN = '<PN>' order by PNPJ"; sql = sql.Replace("<PN>", pn); var dbret = DBUtility.ExeLocalSqlWithRes(sql); foreach (var line in dbret) { var tempvm = new PnMainVM(); tempvm.PNKey = Convert.ToString(line[0]); tempvm.PN = Convert.ToString(line[1]); tempvm.PNPJ = Convert.ToString(line[2]); tempvm.DefaultResult = Convert.ToString(line[3]); tempvm.PnRuleList = PnRulesVM.RetrieveRule(tempvm.PNKey); ret.Add(tempvm); } return(ret); }
private static bool MatchRuleWithParam(ScrapTableItem data, PnRulesVM rule, Controller ctrl) { var traceviewfilelist = TraceViewVM.LoadTraceView2Local(data.TestData.TestStation, data.TestData.ModuleSerialNum , data.WhichTest, data.TestData.TestTime.ToString("yyyy-MM-dd HH:mm:ss"), ctrl); if (traceviewfilelist.Count == 0) { return(false); } var traceviewdata = new List <TraceViewData>(); bool wildmatch = true; if (IsDigitsOnly(rule.LowLimit)) { wildmatch = false; } foreach (var filename in traceviewfilelist) { var testcase = rule.TestCase; if (string.IsNullOrEmpty(rule.TestCase)) { testcase = "ALL"; } var tempret = TraceViewVM.RetrieveTestDataFromTraceView(wildmatch, filename, testcase, rule.Param); if (tempret.Count > 0) { traceviewdata.AddRange(tempret); } } if (traceviewdata.Count == 0) { return(false); } if (wildmatch) { if (rule.LowLimit.Contains("##")) { try { var lowhigh = rule.LowLimit.Split(new string[] { "##" }, StringSplitOptions.RemoveEmptyEntries); var low = 0.0; var high = 0.0; if (lowhigh[0].ToUpper().Contains("0X")) { var parsed = long.Parse(lowhigh[0].ToUpper().Replace("0X", ""), NumberStyles.AllowHexSpecifier); low = Convert.ToDouble(parsed); } else { low = Convert.ToDouble(lowhigh[0]); } if (lowhigh[1].ToUpper().Contains("0X")) { var parsed = long.Parse(lowhigh[1].ToUpper().Replace("0X", ""), NumberStyles.AllowHexSpecifier); high = Convert.ToDouble(parsed); } else { high = Convert.ToDouble(lowhigh[1]); } foreach (var tdata in traceviewdata) { if (tdata.dValue >= low && tdata.dValue <= high) { return(true); } } } catch (Exception E) { } } else { foreach (var tdata in traceviewdata) { if (string.Compare(tdata.Value.ToUpper().Trim(), rule.LowLimit.ToUpper().Trim()) != 0) { return(true); } } } } else { foreach (var tdata in traceviewdata) { var low = Convert.ToDouble(rule.LowLimit); var high = Convert.ToDouble(rule.HighLimit); if (tdata.dValue >= low && tdata.dValue <= high) { return(true); } } } return(false); }