private void ExAdd() { if (CurrentSelectItem != null && !CurrentSelectItem.IsGroup && !CurrentSelectItem.IsNoAlarm) { NoAlarmCollection.Add(new NoAlarmViewModel() { PhyId = CurrentSelectItem.PhyId, RtuId = CurrentSelectItem.NodeId, RtuName = CurrentSelectItem.NodeName }); CurrentSelectItem.IsNoAlarm = true; } }
private void ExDelete() { if (NoAlarmCollection != null) { foreach (var t in ChildTreeItems) { foreach (var tt in t.ChildTreeItems) { if (tt.NodeId == CurrentSelectNoAlarm.RtuId) { tt.IsNoAlarm = false; } } } NoAlarmCollection.Remove(CurrentSelectNoAlarm); } }
private void UpdateFaultsWhenUpdate() { ApplyFault.Clear(); NoAlarmCollection.Clear(); var lstfaultshow = (from t in FaultCollection select t.FaultCode).ToList(); foreach (var t in Wlst.Sr.EquipemntLightFault.Services.FaultBandtoTmlInfoSerices.InfoDictionary) { ApplyFault.Add(t.Key, new List <int>()); var lstssss = (from g in t.Value where lstfaultshow.Contains(g) select g).ToList(); if (t.Value.Contains(0)) { lstssss.Add(0); } ApplyFault[t.Key].AddRange(lstssss); } if (!ApplyFault.ContainsKey(0)) { ApplyFault.Add(0, new List <int>()); foreach (var t in this.FaultCollection) { ApplyFault[0].Add(t.FaultCode); } } else { if (ApplyFault[0].Count == 0) { foreach (var t in this.FaultCollection) { ApplyFault[0].Add(t.FaultCode); } } } FaultChecks(); UpdateRtuSelected(); OnCurrentSelectItemChange(); }
/// <summary> /// 根据缓存的故障信息 对终端列表Select进行设置 /// </summary> private void UpdateRtuSelected() { var lst = ApplyFault.Keys.ToList(); var ntsg = (from t in Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems where t.Value.EquipmentType == WjParaBase.EquType.Rtu orderby t.Key ascending select t).ToList(); foreach (var t in ListTreeTmlNode.Info) { if (lst.Contains(t.Key)) { if (ApplyFault[t.Key].Contains(0)) { var phyid = 0; var rtuname = ""; if (Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t.Key)) { phyid = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t.Key].RtuPhyId; rtuname = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t.Key].RtuName; } else { continue; } NoAlarmCollection.Add(new NoAlarmViewModel() { PhyId = phyid, RtuId = t.Key, RtuName = rtuname }); t.Value.IsNoAlarm = true; if (ApplyFault[t.Key].Count == 1) { t.Value.IsSelected = false; } else { t.Value.IsSelected = true; } } else { t.Value.IsSelected = true; t.Value.IsNoAlarm = false; } } else { t.Value.IsSelected = false; t.Value.IsNoAlarm = false; } } foreach (var t in ChildTreeItems) { if (t.IsGroup) { t.UpdateNodeSelected(); t.UpdateNoAlarmSelected(); } } }
//加载终端节点 private void LoadNode() { ChildTreeItems.Clear(); NoAlarmCollection.Clear(); if (CurrentSlecteArea == null) { return; } var groups = (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups where t.Key.Item1 == CurrentSlecteArea.Value orderby t.Value.Index ascending select t.Value).ToList(); if (groups.Count == 0) { Msg = CurrentSlecteArea.Name + " 未查询到分组信息..."; //return; } else { Msg = ""; } //正常分组 foreach (var t in groups) { var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(CurrentSlecteArea.Value, t.GroupId); if (grp == null) { return; } var ordtml = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml); if (ordtml.Count > 0) { foreach (var g in ordtml) { if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(g)) { continue; } if (Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[g].EquipmentType == WjParaBase.EquType.Rtu) { this.ChildTreeItems.Add(new ListTreeGroupNode(CurrentSlecteArea.Value, t.GroupId)); } break; } } } foreach (var child in ChildTreeItems) { foreach (var rtu in child.ChildTreeItems) { rtu.NodeName = rtu.PhyId.ToString().PadLeft(3, '0') + "-" + rtu.NodeName; } } var spe = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup( CurrentSlecteArea.Value); if (spe.Count > 0) { foreach (var g in spe) { if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(g)) { continue; } if (Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[g].EquipmentType == WjParaBase.EquType.Rtu) { this.ChildTreeItems.Add(new ListTreeGroupNode(CurrentSlecteArea.Value, 0)); break; } } } FaultChecks(); //更新选项 UpdateRtuSelected(); }