public void RemoveLMAnInfo(LMAnInfo lmAnInfo) { if (lmAnInfoList.Contains(lmAnInfo)) { lmAnInfoList.Remove(lmAnInfo); } }
public void AddLMAnInfo(LMAnInfo lmAnInfo) { if (lmAnInfo == null) { return; } if (!lmAnInfoList.Contains(lmAnInfo)) { lmAnInfoList.Add(lmAnInfo); } }
public void Resolve(string ip) { if (LMCommands.Select(o => o.IP).Contains(ip)) { throw new Exception(string.Format("IP:{0}已存在", ip)); } var lmCommadnContract = database.LMCommands.Where(o => o.IP == ip).SingleOrDefault(); if (lmCommadnContract == null) { throw new Exception(string.Format("数据库不存在IP:{0}的数采器", ip)); } LMCommandPara lmCommandPara = new LMCommandPara(lmCommadnContract); lmCommandList.Add(lmCommandPara); var availableRSlotNums = database.LMAnInfos.Where(o => o.IP == ip && o.SignalType == (int)SignalType.Digital).Select(o => o.SlotNum + 1).Distinct().ToArray(); var availableRChaNs = database.LMAnInfos.Where(o => o.IP == ip && o.SignalType == (int)SignalType.Digital).Select(o => o.ChaN + 1).Distinct().ToArray(); foreach (var item in database.LMHDParas.Where(o => o.IP == ip)) { LMHDPara lmHDPara = new LMHDPara(item); lmHDPara.AvailableRSlotNums = availableRSlotNums; lmHDPara.AvailableRChaNs = availableRChaNs; lmHDParaList.Add(lmHDPara); } foreach (var item in database.LMVInfos.Where(o => o.IP == ip)) { LMVInfo lmVInfo = new LMVInfo(item); lmVInfo.AvailableRSlotNums = availableRSlotNums; lmVInfo.AvailableRChaNs = availableRChaNs; var lmDivFres = database.LMDivFres.Where(o => o.ChannelID == item.ChannelID).ToArray(); foreach (var div in lmDivFres) { LMDivFre divFre = new LMDivFre(div); lmVInfo.DivFres.Add(divFre); } lmVInfoList.Add(lmVInfo); } foreach (var item in database.LMAnInfos.Where(o => o.IP == ip)) { LMAnInfo lmAnInfo = new LMAnInfo(item); lmAnInfoList.Add(lmAnInfo); } }