public static List <valRes> GetValById(int id) { List <valRes> listRes = new List <valRes>(); valRes curRes = new valRes(); curRes.id = id; List <L1tag> listtag = OpcHelp.GetTagList(); L1tag item = listtag.Find(o => o.id == id); string val = "0"; if (item == null) { val = "-9999"; } else { if (item.type == 0) { val = KepServer.GetInstance().getVal(id); } else if (item.type == 1) { val = WinccBof.GetInstance().getVal(id); } else if (item.type == 2) { val = WinccBof_B.GetInstance().getVal(id); } else if (item.type == 3) { val = WinccCcm.GetInstance().getVal(id); } else if (item.type == 4) { val = WinccCcm_B.GetInstance().getVal(id); } else if (item.type == 5) { val = KepServer.GetInstance().getVal(id); } } curRes.val = val; listRes.Add(curRes); return(listRes); }
public static List <valRes> GetOpcVal(List <valReq> listQes) { List <valRes> listRes = new List <valRes>(); if (listQes == null) { return(listRes); } foreach (var item in listQes) { valRes curRes = new valRes(); curRes.id = item.id; if (item.type == 0) { curRes.val = KepServer.GetInstance().getVal(item.id); } else if (item.type == 1) { curRes.val = WinccBof.GetInstance().getVal(item.id); } else if (item.type == 2) { curRes.val = WinccBof_B.GetInstance().getVal(item.id); } else if (item.type == 3) { curRes.val = WinccCcm.GetInstance().getVal(item.id); } else if (item.type == 4) { curRes.val = WinccCcm_B.GetInstance().getVal(item.id); } listRes.Add(curRes); } return(listRes); }