/// <summary> /// 加载节点,第一次使用 /// </summary> public override void AddChild() { ChildTreeItems.Clear(); if (NodeType != TypeOfTabTreeNode.IsGrp) { return; } if (!Sr.EquipmentInfoHolding.Services.ServicesGrpMulitInfoHold.ItemsMultGrp.ContainsKey(NodeId)) { return; } var ntsss = ServicesGrpSingleInfoHold.GetRtuOrGrpIndex( Sr.EquipmentInfoHolding.Services.ServicesGrpMulitInfoHold.ItemsMultGrp[NodeId].LstTml); foreach (var t in ntsss) { if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t)) { continue; } var ff = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t]; if (ff == null || ff.EquipmentType != WjParaBase.EquType.Rtu) { continue; } ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, ff)); } foreach (var f in ChildTreeItems) { f.GetChildRtuCount(); } }
private void ExQuery() { InvalidTmlList.Clear(); int index = 1; foreach (var t in EquipmentDataInfoHold.InfoItems) { bool add = false; string faultType = string.Empty; if (t.Value.EquipmentType == WjParaBase.EquType.Rtu) { if (MNLSelect == true) { var tt = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t.Value.RtuId] as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu; if (tt != null) { List <int> MoniliangID = new List <int>(); foreach (var ttt in tt.WjLoops.Values) { if (ttt.VectorMoniliang != 0) { foreach (var m in MoniliangID) { if (m == ttt.VectorMoniliang) { add = true; faultType += "模拟量缺省,"; break; } } if (add) { break; } else { MoniliangID.Add(ttt.VectorMoniliang); } } } foreach (var m in MoniliangID) { if ((m < 1) || (m > MoniliangID.Count)) { add = true; faultType += "模拟量缺省,"; break; } } } } if (KGLSelect == true) { var tt = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t.Value.RtuId] as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu; bool fault = false; if (tt != null) { foreach (var ttt in tt.WjSwitchOuts.Values) { if (ttt.SwitchVecotr != ttt.SwitchId) { add = true; faultType += "开关量缺省,"; fault = true; break; } } int[] loopNum = new int[6]; if (fault == false) { foreach (var ttt in tt.WjLoops.Values) { if (ttt.SwitchOutputId != 0) { loopNum[ttt.SwitchOutputId - 1]++; if (ttt.SwitchOutputId != ttt.VectorSwitchIn) { add = true; faultType += "开关量缺省,"; fault = true; break; } } } } if (fault == false) { for (int i = 1; i < 6; i++) { if ((loopNum[i] != 0) && (loopNum[i - 1] == 0)) { add = true; faultType += "开关量缺省,"; break; } } } } } if (TYSelect == true) { if (t.Value.RtuStateCode == 1) { add = true; faultType += "状态停运,"; } } if (BYSelect == true) { if (t.Value.RtuStateCode == 0) { add = true; faultType += "状态不用,"; } } if (ZBZQSelect == true) { var tt = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t.Value.RtuId] as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu; if (tt != null) { if (tt.WjGprs.RtuReportCycle < ZBZQThres) { add = true; faultType += "主报周期过小,"; } } } if (PBYDLSelect == true) { var tt = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t.Value.RtuId] as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu; if (tt != null) { foreach (var ttt in tt.WjLoops.Values) { if (ttt.IsShieldLoop != 0) { } } } } if (add == true) { var tmp = ServicesGrpSingleInfoHold.GetRtuBelongGrp(t.Value.RtuId); var grpName = "未分组"; if (tmp != null) { grpName = (ServicesGrpSingleInfoHold.InfoGroups[new Tuple <int, int>(tmp.Item1, tmp.Item2)]). GroupName; } InvalidTmlList.Add(new InvalidTmlModel { Index = index, RtuId = t.Value.RtuId, PhyId = t.Value.RtuPhyId, RtuName = t.Value.RtuName, GrpName = grpName, FaultType = faultType.Substring(0, faultType.Length - 1) }); index++; } else { } } } if (InvalidTmlList.Count != 0) { ShowMsg = "共查询到" + InvalidTmlList.Count + "个记录"; } else { ShowMsg = string.Empty; } }
/// <summary> /// 当分组信息发生变化的时候 增量式重新加载节点 /// </summary> public void UpdateSpecial() { var info = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId); if (info.Count == 0) { this.ChildTreeItems.Clear(); if (_father != null) { _father.ChildTreeItems.Remove(this); } return; } //node delete for (int i = this.ChildTreeItems.Count - 1; i >= 0; i--) { if (ChildTreeItems[i].NodeType != TypeOfTabTreeNode.IsTml) { this.ChildTreeItems.RemoveAt(i); continue; } if (info.Contains(ChildTreeItems[i].NodeId) == false || !Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey( ChildTreeItems[i].NodeId)) { this.ChildTreeItems.RemoveAt(i); } } //tml add and update var exist = (from t in ChildTreeItems select t.NodeId).ToList(); foreach (var t in info) { if (exist.Contains(t)) { continue; } var para = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(t); if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu) { continue; } if (para.RtuFid != 0) { continue; } var vol = para as Wj3005Rtu; if (vol != null && vol.WjVoltage.RtuUsedType == 2) { ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para)); } } //按给定顺序排序 var ntss = ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(info); var idc = new Dictionary <int, TreeNodeBaseNode>(); foreach (var f in this.ChildTreeItems) { if (!ntss.Contains(f.NodeId)) { continue; } int index = ntss.IndexOf(f.NodeId); if (idc.ContainsKey(index) == false) { idc.Add(index, f); } } for (int i = 0; i < ChildTreeItems.Count; i++) { if (idc.ContainsKey(i) == false) { continue; } if (ChildTreeItems.Count < i) { continue; } if (ChildTreeItems[i].NodeId != idc[i].NodeId) { if (ChildTreeItems.Contains(idc[i])) { ChildTreeItems.Remove(idc[i]); } ChildTreeItems.Insert(i, idc[i]); } } }
public void NavOnLoad(params object[] parsObjects) { SendOrderList.Clear(); int m = 0; CurrentOrderID = Convert.ToUInt64(GetOrderId()); foreach (var ttt in FaultRecord) { var tmp = ServicesGrpSingleInfoHold.GetRtuBelongGrp(ttt.RtuId); var grpName = "特殊分组"; if (tmp != null) { grpName = (ServicesGrpSingleInfoHold.InfoGroups[new Tuple <int, int>(tmp.Item1, tmp.Item2)]).GroupName; } var str = ttt.RtuName + " " + ttt.FaultName; if (ttt.LoopID > 0) { str = ttt.RtuName + " 回路" + ttt.LoopID + " " + ttt.FaultName; var hld = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(ttt.RtuId); if (hld != null) { var tmpsdfsd = hld as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu; if (tmpsdfsd != null) { if (tmpsdfsd.WjLoops.ContainsKey(ttt.LoopID)) { str = ttt.RtuName + " " + tmpsdfsd.WjLoops[ttt.LoopID].LoopName + " " + ttt.FaultName + "\r\n" + ttt.Remarks; } } } } var orderInfo = new SendOrderItems { Id = m++, RtuId = ttt.RtuId, AdminName = UserInfo.UserLoginInfo.UserName, MergencyLocation = string.Empty, MergencyLocationEnable = Return_PriorityLevel_Enable(ttt.PriorityLevel), OrderId = ttt.OrderID, FaultId = ttt.FaultID, FaultName = ttt.FaultName, OrderTime = string.Empty, PriorityLevel = Return_PriorityLevel_Desc(ttt.PriorityLevel), RepairContent = str, RtuGroup = grpName, RtuName = ttt.RtuName, LoopId = ttt.LoopID, Status = ReturnStatusDesc(ttt.OrderID) }; SendOrderList.Add(orderInfo); } if (SendOrderList.Count != 0) { CurrentSendOrderItem = SendOrderList[0]; MessageShow = string.Empty; } }
/// <summary> /// 加载节点,第一次使用 /// </summary> public override void AddChild() { ChildTreeItems.Clear(); if (NodeType != TypeOfTabTreeNode.IsGrp) { return; } //lvf 2018年4月17日14:37:13 默认区域id为0 var tu = new Tuple <int, int>(0, NodeId); //添加分组到子节点中 //if (!ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(tu)) // return; //var tmps = // (from gt in // ServicesGrpSingleInfoHold.InfoGroups[tu].LstGrp // orderby gt ascending // select gt).ToList(); //var ntss = ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(tmps); //foreach (var t in ntss) //{ // if (!ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(t)) // continue; //ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, // ServicesGrpSingleInfoHold.InfoGroups[ // tu])); ////} ////对分组子节点 进行数据加载 //foreach (var t1 in ChildTreeItems) //{ // t1.AddChild(); //} ///加载终端节点 var tmpssssss = (from gt in ServicesGrpSingleInfoHold.InfoGroups[tu].LstTml orderby gt ascending select gt).ToList(); var ntsss = ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(tmpssssss); var LST = new List <TreeNodeBaseNode>(); foreach (var t in ntsss) { if (!BaseNodes.Nodess.ContainsKey(t)) { if ( !Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey( t)) { continue; } var f = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems [t]; new TreeNodeItemTmlViewModel(this, f); } if (!BaseNodes.Nodess.ContainsKey(t)) { continue; } // ChildTreeItems.Add(GrpComSingleMuliViewModel.BaseNodes.Nodess[t]); LST.Add(BaseNodes.Nodess[t]); continue; } // var lstord = (from t in LST orderby t.PhyId ascending select t).ToList(); foreach (var t in LST) { ChildTreeItems.Add(t); } }