/// <summary> /// 第一次加载时 使用; /// 此函数是为节点加载子节点,从dataholding中读取数; /// 仅第一次加载节点时使用 /// </summary> public void AddChild() { _areaTreeItem.Clear(); if (NodeType != TreeNodeType.IsPartition) { return; } var grp = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetAreaInfo(NodeId); if (grp == null) { return; } //if(grp.LstTml.Count==0) return; //加载终端节点 var tmpLst = new List <AreaTmlModel>(); foreach (var t in grp.LstTml) { if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t)) { continue; } var f = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t]; var ttt = new AreaTmlModel(); ttt.TmlId = f.RtuId; ttt.PhysicalId = f.RtuPhyId; if (f.RtuModel == EnumRtuModel.Wj3006 || f.RtuModel == EnumRtuModel.Wj3005) { ttt.TmlType = "aTml"; } else if (f.RtuModel == EnumRtuModel.Wj1080) { ttt.TmlType = "zLux"; } else { ttt.TmlType = f.RtuModel.ToString(); } tmpLst.Add(ttt); } var tmpLstTml = (from t in tmpLst orderby t.TmlType, t.PhysicalId ascending select t.TmlId).ToList(); foreach (var t in tmpLstTml) //grp.LstTml { var f = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t]; if (f.RtuFid == 0) { _areaTreeItem.Add(new AreaTreeItemModel(this, f, false)); } } }
/// <summary> /// 从终端数据区域加载终端信息到ItemTmls中 /// </summary> private void LoadTmlsData() { dictionaryC = new Dictionary <int, int>(); TmlData.Clear(); string type = " "; int i = 0; var tmpLst = new List <AreaTmlModel>(); foreach (var t in Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems) { if (t.Value.RtuFid != 0) { continue; } int id = t.Value.RtuId; string name = t.Value.RtuName; if (t.Value.RtuModel == EnumRtuModel.Wj3005) { type = "3005终端"; } else if (t.Value.RtuModel == EnumRtuModel.Wj3090) { type = "3090终端"; } else if (t.Value.RtuModel == EnumRtuModel.Wj3006) { type = "3006终端"; } else if (t.Value.RtuModel == EnumRtuModel.Wj2090) { type = "单灯设备"; } else if (t.Value.RtuModel == EnumRtuModel.Wj1080) { type = "光控设备"; } else if (t.Value.RtuModel == EnumRtuModel.Wj1050) { type = "电表设备"; } else if (t.Value.RtuModel == EnumRtuModel.Jd601) { type = "节电设备"; } else if (t.Value.RtuModel == EnumRtuModel.Wj1090) { type = "线路检测"; } else if (t.Value.RtuModel == EnumRtuModel.Wj4005) { type = "4005终端"; } var ttt = new AreaTmlModel(); ttt.PhysicalId = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(id).RtuPhyId; ttt.TmlId = id; ttt.AreaName = AreaTreeItem[0].NodeName; ttt.IsChecked = false; ttt.TmlName = name; ttt.TmlType = type; tmpLst.Add(ttt); //TmlData.Add(ttt); //dictionaryC.Add(ttt.TmlId, i); //i++; } var tmpLst2 = (from t in tmpLst orderby t.TmlType, t.PhysicalId ascending select t).ToList(); foreach (var t in tmpLst2) { TmlData.Add(t); dictionaryC.Add(t.TmlId, i); i++; } }
private void ExFastSearch() { if (string.IsNullOrEmpty(SearchText)) { LoadTmlsData(); ReLoadTmlsAreasBelong(); } else { TmlData.Clear(); dictionaryC = new Dictionary <int, int>(); int i = 0; string type = ""; foreach (var t in Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems) { if (t.Value.RtuName.Contains(this.SearchText) || StringContainKeyword(t.Value.RtuName, SearchText) || t.Value.RtuPhyId.ToString().PadLeft(4, '0').Contains(SearchText)) { if (t.Value.RtuModel == EnumRtuModel.Wj3005) { type = "3005终端"; } else if (t.Value.RtuModel == EnumRtuModel.Wj3090) { type = "3090终端"; } else if (t.Value.RtuModel == EnumRtuModel.Wj3006) { type = "3006终端"; } else if (t.Value.RtuModel == EnumRtuModel.Wj2090) { type = "单灯设备"; } else if (t.Value.RtuModel == EnumRtuModel.Wj4005) { type = "4005终端"; } else if (t.Value.RtuModel == EnumRtuModel.Wj1080) { type = "光控设备"; if (t.Value.RtuFid != 0) { continue; } } else if (t.Value.RtuModel == EnumRtuModel.Wj1050) { type = "电表设备"; if (t.Value.RtuFid != 0) { continue; } } else if (t.Value.RtuModel == EnumRtuModel.Jd601) { if (t.Value.RtuFid != 0) { continue; } type = "节电设备"; } else if (t.Value.RtuModel == EnumRtuModel.Wj1090) { if (t.Value.RtuFid != 0) { continue; } type = "线路检测"; } var SearchResult = new AreaTmlModel(); var areaId = Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuBelongArea(t.Value.RtuId); SearchResult.AreaId = areaId; SearchResult.PhysicalId = t.Value.RtuPhyId; SearchResult.TmlId = t.Value.RtuId; SearchResult.TmlName = t.Value.RtuName; SearchResult.TmlType = type; this.TmlData.Add(SearchResult); dictionaryC.Add(SearchResult.TmlId, i); i++; } } ReLoadTmlsAreasBelong(); } }