Example #1
0
        /// <summary>
        /// 加载节点,第一次使用
        /// </summary>
        public void AddChild()
        {
            ChildTreeItems.Clear();

            ////添加分组到子节点中
            var tu = new Tuple <int, int>(AreaId, NodeId);
            //if (!Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(tu))//EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(NodeId))
            //    return;

            //foreach (var t in Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.Keys)
            //{
            //    if (t.Item1 != AreaId) continue;
            //        ChildTreeItems.Add(new TreeNodeGroup(t.Item2,t.Item1));
            //}

            //var atttmp = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups[tu].LstGrp);
            //foreach (
            //    var t in
            //       atttmp)
            //{
            //    var tu1 = new Tuple<int, int>(AreaId, NodeId);
            //    if (!Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(tu1))
            //        continue;
            //    ChildTreeItems.Add(new TreeNodeGroup(t));
            //}

            //加载终端节点

            //var ordtml =
            //  (from t in
            //       Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary[NodeId].LstTml
            //   orderby t ascending
            //   select t).ToList();
            var ordtml = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups[tu].LstTml);

            foreach (
                var t in ordtml)
            {
                if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t))
                {
                    continue;
                }
                var f =
                    Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t] as Sr.EquipmentInfoHolding.Model.Wj3005Rtu;
                if (f == null)
                {
                    continue;
                }

                ChildTreeItems.Add(new TreeNodeRtu(f.RtuId));
            }
        }
Example #2
0
        /// <summary>
        /// 加载节点,第一次使用
        /// </summary>
        public override void AddChild()
        {
            ChildTreeItems.Clear();
            if (!IsListTreeNodeGroup)
            {
                return;
            }
            //group

            //添加分组到子节点中
            if (!Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary.ContainsKey(NodeId))
            {
                return;
            }
            var atttmp = Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary[NodeId].LstGrp);

            foreach (
                var t in atttmp)
            {
                if (!Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary.ContainsKey(t))
                {
                    continue;
                }
                ChildTreeItems.Add(new ListTreeGroupNode(this, t));
            }
            //加载终端节点
            //var ordtml =
            //    (from t in
            //         Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary[NodeId].LstTml
            //     orderby t ascending
            //     select t).ToList();
            var ordtml = Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary[NodeId].LstTml);


            foreach (var t in ordtml)
            {
                if (!Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary.ContainsKey(t))
                {
                    continue;
                }
                var f =
                    Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary[t] as
                    IIRtuParaWork;
                if (f == null)
                {
                    continue;
                }
                ChildTreeItems.Add(new ListTreeTmlNode(this, f.RtuId));
            }
        }
Example #3
0
        public override void AddChild()  //将nodes中属于该分组下的节点增加上
        {
            ChildTreeItems.Clear();

            var rtuLst = new List <int>();

            if (NodeId == 0)
            {
                rtuLst   = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                NodeName = AreaId + "-特殊终端";
            }
            else
            {
                var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId,
                                                                                                             NodeId);
                if (grp == null)
                {
                    return;
                }
                NodeName = AreaId + "-" + grp.GroupName;
                rtuLst   = grp.LstTml;
            }
            if (rtuLst.Count == 0)
            {
                return;
            }

            //加载终端节点
            var ntssss = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(rtuLst);

            foreach (
                var t in ntssss)
            {
                if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t))
                {
                    continue;
                }
                var f = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t];
                if (f == null || f.EquipmentType != WjParaBase.EquType.Rtu)
                {
                    continue;
                }

                //if (TreeTmlNode.RegisterTmlNode.ContainsKey(f.RtuId))
                //    ChildTreeItems.Add(TreeTmlNode.RegisterTmlNode[f.RtuId]);
                //else
                ChildTreeItems.Add(new TreeTmlNode(this, f.RtuId));
            }
        }
 public void UpdateNoUsedShow()
 {
     //foreach (var t in lst)
     //{
     //    if(NodeId==t.Item1)
     //    {
     if (ChildTreeItems.Count > 0)
     {
         ChildTreeItems.Clear();
     }
     ThisNodeAddPartsNode();
     GetUsedCount();
     //    }
     //}
 }
        /// <summary>
        /// 加载节点,第一次使用
        /// </summary>
        public void AddChild()
        {
            ChildTreeItems.Clear();
            var ordtml = new List <int>();

            if (NodeId == 0)
            {
                var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                if (grp.Count == 0)
                {
                    return;
                }
                this.NodeName = "特殊终端";
                ordtml        = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp);
            }
            else
            {
                var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId, NodeId);
                if (grp == null)
                {
                    return;
                }
                this.NodeName = grp.GroupName;
                ordtml        = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml);
            }


            //加载终端节点



            foreach (var t in ordtml)
            {
                if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t))
                {
                    continue;
                }
                if (Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t].EquipmentType !=
                    WjParaBase.EquType.Rtu)
                {
                    continue;
                }
                ChildTreeItems.Add(new ListTreeTmlNode(t));
            }
        }
        public override void OnNodeSelectActive()
        {
            if (ChildTreeItems.Count > 0)
            {
                ChildTreeItems.Clear();
            }
            ThisNodeAddPartsNode();
            IsExpanded        = true;
            CurrentSelectNode = this;

            var args = new PublishEventArgs
            {
                EventType = PublishEventType.Core,
                EventId   = Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected,
            };

            args.AddParams(NodeId);

            EventPublish.PublishEvent(args);
        }
        public void LoadChildren(ObservableCollection <IIMenuItem> lst, int _menuId)
        {
            ChildTreeItems.Clear();

            if (_menuId <= MenuIdControlAssign.MenuFileGroupIdMin) //File)
            {
                return;
            }

            foreach (var t in lst)
            {
                if (t.Id >= MenuIdControlAssign.MenuFileGroupIdMin)  //File)
                //menu id
                {
                    if (t.Visibility != Visibility.Visible)
                    {
                        continue;
                    }
                    var tmp = new ShortCutTreeItemViewModel(this, t.Id, 0)
                    {
                        Name = t.Text
                    };
                    tmp.LoadChildren(t.CmItems, t.Id);
                    if (tmp.ChildTreeItems.Count > 0)
                    {
                        ChildTreeItems.Add(tmp);
                    }
                }
                else
                {
                    if (t.Visibility != Visibility.Visible)
                    {
                        continue;
                    }
                    ChildTreeItems.Add(new ShortCutTreeItemViewModel(this, this.InstanceId, t.Id)
                    {
                        Name = t.Text
                    });
                }
            }
        }
        //加载终端节点
        private void LoadNode()
        {
            ChildTreeItems.Clear();
            if (Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary.ContainsKey(0))
            {
                var tmp    = Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary[0].LstGrp;
                var atttmp = Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(tmp);

                // var atttmp = (from t in tmp orderby t ascending select t).ToList();
                foreach (var t in atttmp)
                {
                    if (
                        !Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary.ContainsKey(t))
                    {
                        continue;
                    }
                    this.ChildTreeItems.Add(new ListTreeGroupNode(null, t));
                }
            }

            AddSepcialTmltoTree();
        }
Example #9
0
        /// <summary>
        /// 加载节点,第一次使用
        /// </summary>
        public override void AddChild()
        {
            ChildTreeItems.Clear();

            //添加分组到子节点中
            if (!Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary.ContainsKey(NodeId))
            {
                return;
            }
            foreach (
                var t in
                Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary[NodeId].LstGrp)
            {
                if (!Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary.ContainsKey(t))
                {
                    continue;
                }
                ChildTreeItems.Add(new LeftTreeGroupNode(this, t));
            }
            //加载终端节点
            foreach (
                var t in
                Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary[NodeId].LstTml)
            {
                if (!Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary.ContainsKey(t))
                {
                    continue;
                }
                var f =
                    Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary[t] as
                    IIRtuParaWork;
                if (f == null)
                {
                    continue;
                }

                ChildTreeItems.Add(new LeftTreeTmlNode(this, f.RtuId));
            }
        }
Example #10
0
        public override void AddChild()  //将nodes中属于该分组下的节点增加上
        {
            ChildTreeItems.Clear();

            //添加分组到子节点中
            if (!Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary.ContainsKey(NodeId))
            {
                return;
            }
            foreach (
                var t in
                Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary[NodeId].LstGrp)
            {
                if (!Sr.EquipmentGroupInfoHolding.Services.ServicesGrpSingleInfoHold.GrpInfoDictionary.ContainsKey(t))
                {
                    continue;
                }
                if (ControlCenterViewModel.GetChickGroupInfo().ContainsKey(t))
                {
                    ChildTreeItems.Add(new RightTreeGroupNode(this, t));
                }
            }
            //加载终端节点
            foreach (var t in ControlCenterViewModel.GetChickGroupInfo()[NodeId].LstTml)
            {
                if (!Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary.ContainsKey(t))
                {
                    continue;
                }
                var f = Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary[t] as IIRtuParaWork;
                if (f == null)
                {
                    continue;
                }

                ChildTreeItems.Add(new RightTreeTmlNode(this, f.RtuId));
            }
        }
Example #11
0
        //加载终端节点
        private void LoadNode()
        {
            ChildTreeItems.Clear();
            var lssst = (from t in Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.MainEquipmentInfoDictionary
                         orderby t.Key ascending
                         select t).ToList();

            foreach (var t in lssst)
            {
                var lst = Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.GetMainEquipmentAttachedLst(t.Key);
                foreach (var g in lst)
                {
                    if (g > 1100000 && g < 1199999)
                    {
                        var info = new TreeNodeTmlViewModel(null, t.Value);
                        ChildTreeItems.Add(info);
                        info.UpdateTmlStateInfomation();
                        break;
                    }
                }
            }
            foreach (var t in ChildTreeItems)
            {
                if (!UpdateChildTreeItems.ContainsKey(t.NodeId))
                {
                    UpdateChildTreeItems.Add(t.NodeId, t);
                }
                foreach (var g in t.ChildTreeItems)
                {
                    if (!UpdateChildTreeItems.ContainsKey(g.NodeId))
                    {
                        UpdateChildTreeItems.Add(g.NodeId, g);
                    }
                }
            }
        }
        public void LoadChildren()
        {
            ChildTreeItems.Clear();

            if (_menuId <= MenuIdControlAssign.MenuIdMax && _menuId >= MenuIdControlAssign.MenuIdMin)
            {
                return;
            }
            else if (MenuId == 0 || (_menuId <= MenuIdControlAssign.MenuFileGroupIdMax &&
                                     _menuId >= MenuIdControlAssign.MenuFileGroupIdMin)) //file
            {
                var f = ServerInstanceRelation.GetInstanceRelationsByfatherId(this.InstanceId, MenuId);
                foreach (var t in f)
                {
                    if (t.Id <= MenuIdControlAssign.MenuIdMax && t.Id >= MenuIdControlAssign.MenuIdMin)
                    //menu id
                    {
                        var fff = MenuComponentHolding.GetMenuItemById(t.Id);
                        if (fff != null)
                        {
                            ChildTreeItems.Add(new ShortCutTreeItemViewModel(this, this.InstanceId, t.Id)
                            {
                                Name = t.Name
                            });
                        }
                    }
                    else
                    {
                        ChildTreeItems.Add(new ShortCutTreeItemViewModel(this, this.InstanceId, t.Id)
                        {
                            Name = t.Name
                        });
                    }
                }
            }
        }
Example #13
0
        //public TreeGroupNode()
        //{


        //    AreaId = 0;
        //    AreaName = "查询结果";


        //    Visi = Visibility.Visible;
        //    //_father = mvvmfather;
        //    IsGroup = true;
        //    IsShowSelectedCheckBox = false;
        //    NodeId = 0;
        //    PhysicalId = 0;

        //    foreach (var g in OperatorType)
        //    {
        //        g.SelfNode = this;
        //    }

        //}



        public override void AddChild()  //将nodes中属于该分组下的节点增加上
        {
            ChildTreeItems.Clear();

            var rtuLst = new List <int>();

            if (NodeId == 0)
            {
                rtuLst = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                if (areas.Count > 1)
                {
                    // NodeName =AreaId + "-特殊终端";
                    NodeName = "特殊终端";
                }
                else
                {
                    NodeName = "特殊终端";
                }
            }
            else if (NodeId == -1)
            {
                foreach (var tt in areas)
                {
                    rtuLst.AddRange(Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(tt));
                }
                if (areas.Count > 1)
                {
                    // NodeName =AreaId + "-特殊终端";
                    NodeName = "全部终端";
                }
                else
                {
                    NodeName = "全部终端";
                }
            }
            else
            {
                var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId,
                                                                                                             NodeId);
                if (grp == null)
                {
                    return;
                }
                if (areas.Count > 1)
                {
                    // NodeName = AreaId + "-" + grp.GroupName;
                    NodeName = grp.GroupName;
                }
                else
                {
                    NodeName = grp.GroupName;
                }
                rtuLst = grp.LstTml;
            }
            if (rtuLst.Count == 0)
            {
                return;
            }

            rtuLst = (from t in rtuLst orderby t select t).ToList();

            //加载终端节点
            var ntssss = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(rtuLst);

            foreach (
                var t in ntssss)
            {
                if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t))
                {
                    continue;
                }
                var f = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t];
                if (f == null || f.EquipmentType != WjParaBase.EquType.Slu)
                {
                    continue;
                }

                ChildTreeItems.Add(new SluInfo(this, f.RtuId));//this, f.RtuId
            }
        }
 public void OnUserHideOrClosing()
 {
     ChildTreeItems.Clear();
     Names.Clear();
 }
Example #15
0
        /// <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);
            }
        }
        //private void UpdateTerminalStateInfo(TerminalRunningInfomation basicTmlInfomation)
        //{
        //    //base.NodeModel = basicTmlInfomation.Model;
        //    if (!basicTmlInfomation.IsConnected)
        //    {
        //        ForeGround = "#FFA9A9A9";
        //        BackGround = "#FFFF1493";
        //        ImagesIcon = ImageResources.GetTmlTreeIcon(1);
        //    }
        //    else
        //    {
        //        ForeGround = "#FF000";
        //        //终端图标代码 1 连接断开 0关灯正常 2关灯故障  3 开灯正常 4开灯故障
        //        ImagesIcon = ImageResources.GetTmlTreeIcon(basicTmlInfomation.ImageCode);
        //    }
        //}

        #endregion

        /// <summary>
        /// 加载节点,第一次使用
        /// </summary>
        public override void AddChild()
        {
            ChildTreeItems.Clear();
        }
Example #17
0
        //加载终端节点
        private void LoadNode()
        {
            if (ServicesGrpMultiInfoHoldNew.ItemsMultiGrp.Count == 0 &&
                Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.Count == 0)
            {
                return;
            }
            ChildTreeItems.Clear();

            var userProperty = UserInfo.UserLoginInfo;

            if (userProperty.D == true)
            {
                if (Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.Count == 0)
                {
                    return;
                }
                IsLoadOnlyOneArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.Count < 2;
                if (IsLoadOnlyOneArea)
                {
                    int AreaId = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.Keys.ToList()[0];
                    var grp    =
                        (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpMultiInfoHoldNew.ItemsMultiGrp
                         where t.Key.Item1 == AreaId
                         orderby t.Value.Index
                         select t.Value).ToList();

                    foreach (var f in grp)
                    {
                        this.ChildTreeItems.Add(new TreeNodeItemMultiGroupViewModelNew(null, f.AreaId, f.GroupId,
                                                                                       TypeOfTabTreeNode.IsGrp));
                    }
                }
                else
                {
                    this.ChildTreeItems.Add(new TreeNodeItemMultiGroupViewModelNew(null, -1, 0,
                                                                                   TypeOfTabTreeNode.IsArea));
                    foreach (var f in Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.Keys)
                    {
                        var tmlLstOfArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(f);
                        var rtuLst       = new List <int>();
                        foreach (var fff in tmlLstOfArea)
                        {
                            if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(fff))
                            {
                                continue;
                            }
                            rtuLst.Add(fff);
                        }
                        if (rtuLst.Count == 0)
                        {
                            continue;
                        }

                        this.ChildTreeItems.Add(new TreeNodeItemMultiGroupViewModelNew(null, f, 0,
                                                                                       TypeOfTabTreeNode.IsArea));
                    }
                }
            }
            else
            {
                List <int> areaLst = new List <int>();
                areaLst.AddRange(userProperty.AreaR);
                foreach (var t in userProperty.AreaW)
                {
                    if (!areaLst.Contains(t))
                    {
                        areaLst.Add(t);
                    }
                }
                foreach (var t in userProperty.AreaX)
                {
                    if (!areaLst.Contains(t))
                    {
                        areaLst.Add(t);
                    }
                }
                IsLoadOnlyOneArea = areaLst.Count < 2;
                if (IsLoadOnlyOneArea)
                {
                    int AreaId = areaLst[0];
                    var grp    =
                        (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpMultiInfoHoldNew.ItemsMultiGrp
                         where t.Key.Item1 == AreaId
                         orderby t.Value.Index
                         select t.Value).ToList();
                    foreach (var f in grp)
                    {
                        this.ChildTreeItems.Add(new TreeNodeItemMultiGroupViewModelNew(null, f.AreaId, f.GroupId,
                                                                                       TypeOfTabTreeNode.IsGrp));
                    }
                }
                else
                {
                    this.ChildTreeItems.Add(new TreeNodeItemMultiGroupViewModelNew(null, -1, 0,
                                                                                   TypeOfTabTreeNode.IsArea));
                    foreach (var f in areaLst)
                    {
                        var tmlLstOfArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(f);
                        var rtuLst       = new List <int>();
                        foreach (var fff in tmlLstOfArea)
                        {
                            if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(fff))
                            {
                                continue;
                            }
                            rtuLst.Add(fff);
                        }
                        if (rtuLst.Count == 0)
                        {
                            continue;
                        }
                        //if (tmlLstOfArea.Count == 0) continue;

                        this.ChildTreeItems.Add(new TreeNodeItemMultiGroupViewModelNew(null, f, 0,
                                                                                       TypeOfTabTreeNode.IsArea));
                    }
                }
            }

            foreach (var f in ChildTreeItems)
            {
                f.GetChildRtuCount();
            }

            for (int i = this.ChildTreeItems.Count - 1; i >= 0; i--)
            {
                if (this.ChildTreeItems[i].RtuCount == 0 || this.ChildTreeItems[i].ChildTreeItems.Count == 0)
                {
                    this.ChildTreeItems.RemoveAt(i);
                }
            }
        }
Example #18
0
        public TreeGrpNodes(int areaid, int grpOrRtuId, bool isgrp)
        {
            IsGroup    = isgrp;
            AreaId     = areaid;
            RtuOrGrpId = grpOrRtuId;
            if (isgrp == false) //rtu
            {
                Msg = "终端";
                var tmp =
                    Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[grpOrRtuId];
                var areaInfo = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetAreaThatRtuIn(grpOrRtuId);
                //var tmp = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetShowFidPhyAndNameByRtuId(grpOrRtuId);
                AreaId = areaInfo;
                if (tmp == null)
                {
                    PhyId        = RtuOrGrpId + "";
                    RtuOrGrpName = RtuOrGrpId + "";
                    PhyIdMsg     = PhyId + "(" + Msg + ")";
                }
                else
                {
                    PhyId        = tmp.RtuPhyId.ToString("d4");
                    RtuOrGrpName = tmp.RtuName;
                    PhyIdMsg     = PhyId + "(" + Msg + ")";
                }

                if (tmp.RtuModel == EnumRtuModel.Wj3005 || tmp.RtuModel == EnumRtuModel.Wj3090)
                {
                    Has3005 = true;
                    Has3006 = false;
                }
                else
                {
                    Has3005 = false;
                    Has3006 = true;
                }
            }
            else  //分组
            {
                Msg = "分组";
                var tu = new Tuple <int, int>(areaid, grpOrRtuId);
                if (Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(tu))
                {
                    var tmp =
                        Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups[tu];
                    RtuOrGrpName = tmp.GroupName;
                    PhyId        = tmp.GroupId.ToString("d2");
                    PhyIdMsg     = PhyId + "(" + Msg + ")";


                    Has3005 = false;
                    Has3006 = false;
                    //清空子节点
                    ChildTreeItems.Clear();

                    var rtuLstTmp = (from t in tmp.LstTml orderby t select t).ToList();
                    //排序
                    var rtuLst = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(rtuLstTmp);

                    foreach (var t in rtuLst)
                    {
                        if (Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t))
                        {
                            var info = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t];
                            if (info.EquipmentType != WjParaBase.EquType.Rtu)
                            {
                                continue;
                            }
                            if (info != null)
                            {
                                //添加节点
                                ChildTreeItems.Add(new TreeGrpNodes(AreaId, t, false));


                                //添加终端节点  lvf 2019年6月18日08:55:06
                                if (info.RtuModel == EnumRtuModel.Wj3005 || info.RtuModel == EnumRtuModel.Wj3090)
                                {
                                    Has3005 = true;
                                }
                                else
                                {
                                    Has3006 = true;
                                }
                            }
                            //if (Has3005 && Has3006) continue;
                        }
                    }
                }
                else if (grpOrRtuId == -1)//特殊终端分组 lvf
                {
                    RtuOrGrpName = "特殊分组";
                    PhyId        = "00";
                    PhyIdMsg     = PhyId + "(" + Msg + ")";


                    //清空子节点
                    ChildTreeItems.Clear();

                    //添加特殊终端 lvf 2019年6月18日08:58:41
                    var tmp       = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                    var rtuLstTmp = new List <int>();
                    //获取特殊设备
                    foreach (var f in tmp)
                    {
                        if (Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(f))
                        {
                            var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[f];
                            if (para.EquipmentType == WjParaBase.EquType.Rtu)
                            {
                                rtuLstTmp.Add(f);
                            }
                        }
                    }
                    //排序
                    var rtuLst = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(rtuLstTmp);
                    //添加节点
                    foreach (var g in rtuLst)
                    {
                        ChildTreeItems.Add(new TreeGrpNodes(AreaId, g, false));
                    }
                }
            }
            FristLoadTimeTableInfo(isgrp, Has3005);
        }
        /// <summary>
        /// 加载节点,第一次使用
        /// </summary>
        public override void AddChild()
        {
            ChildTreeItems.Clear();

            if (NodeType == TypeOfTabTreeNode.IsGrp)
            {
                var regionGrps = ServiceGrpRegionInfoHold.GetGrpByType(AreaId, 1);
                //先加载全局分组  再加载地区分组
                if (regionGrps == null || regionGrps.Count == 0)
                {
                    return;
                }
                foreach (var f in regionGrps)
                {
                    this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, f.Key, f.Value,
                                                                                 TypeOfTabTreeNode.IsRegion));
                }

                //添加特殊分组  有grpid 未分区域
                var spLst = Wlst.Sr.EquipmentInfoHolding.Services.ServiceGrpRegionInfoHold.GetRtulstByGrpRegionId(AreaId, NodeId, 0);
                if (spLst == null)
                {
                    return;
                }
                if (spLst.Count == 0)
                {
                    return;
                }


                this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, NodeId, "特殊终端",
                                                                             TypeOfTabTreeNode.IsRegionSpecial));
            }
            if (NodeType == TypeOfTabTreeNode.IsRegion)
            {
                var rtulst = Wlst.Sr.EquipmentInfoHolding.Services.ServiceGrpRegionInfoHold.GetRtulstByGrpRegionId(AreaId, _father.NodeId, NodeId);
                if (rtulst == null || rtulst.Count == 0)
                {
                    return;
                }
                var rtlst   = (from t in rtulst orderby t.Item1 select t.Item1).ToList();
                var sortLst =
                    Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(rtlst);
                foreach (var f in sortLst)
                {
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }
                    var imageInfo = Wlst.Sr.EquipmentInfoHolding.Services.ServiceGrpRegionInfoHold.GetImageIdByRtuid(f);


                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                }
            }
            //有grpid  没有地区的设备
            if (NodeType == TypeOfTabTreeNode.IsRegionSpecial)
            {
                var rtulst = Wlst.Sr.EquipmentInfoHolding.Services.ServiceGrpRegionInfoHold.GetRtulstByGrpRegionId(AreaId, _father.NodeId, 0);
                if (rtulst == null || rtulst.Count == 0)
                {
                    return;
                }

                var rtlst   = (from t in rtulst orderby t.Item1 select t.Item1).ToList();
                var sortLst =
                    Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(rtlst);
                foreach (var f in sortLst)
                {
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }

                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                }
            }

            if (NodeType == TypeOfTabTreeNode.IsAll)
            {
                var grp          = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetAreaInfo(AreaId);
                var tmlLstOfArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(AreaId);
                if (grp == null)
                {
                    return;
                }
                var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml, AreaId, true);

                foreach (var f in gprs.Item1)
                {
                    if (tmlLstOfArea.Contains(f) == false)
                    {
                        continue;
                    }
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }

                    var vol = para as Wj3005Rtu;

                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para, true));
                }
                var sortLst =
                    Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(gprs.Item2);
                foreach (var f in sortLst)
                {
                    if (tmlLstOfArea.Contains(f) == false)
                    {
                        continue;
                    }
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }
                    var vol = para as Wj3005Rtu;


                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                }
            }
            if (NodeType == TypeOfTabTreeNode.IsGrpSpecial)
            {
                var tmlLstOfArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(AreaId);
                var grp          = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                if (grp.Count == 0)
                {
                    return;
                }
                var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp);
                foreach (var f in gprs)
                {
                    if (tmlLstOfArea.Contains(f) == false)
                    {
                        continue;
                    }
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }

                    var vol = para as Wj3005Rtu;

                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                }
            }

            if (NodeType == TypeOfTabTreeNode.IsArea)
            {
                var grp =
                    (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups
                     where t.Key.Item1 == AreaId
                     orderby t.Value.Index
                     select t.Value).ToList();



                this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0, "全部终端",
                                                                             TypeOfTabTreeNode.IsAll));



                foreach (var f in grp)
                {
                    var rtuList = new List <int>();
                    foreach (var fff in f.LstTml)
                    {
                        if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(fff))
                        {
                            continue;
                        }
                        if (fff < 1099999)
                        {
                            rtuList.Add(fff);
                        }
                    }
                    if (rtuList.Count < 1)
                    {
                        continue;
                    }
                    //if (f.LstTml.Count < 1) continue;
                    this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, f.AreaId, f.GroupId, f.GroupName,
                                                                                 TypeOfTabTreeNode.IsGrp));
                }


                var sp     = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                var rtuLst = new List <int>();
                foreach (var f in sp)
                {
                    if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(f))
                    {
                        continue;
                    }
                    if (f < 1099999)
                    {
                        rtuLst.Add(f);
                    }
                }


                if (rtuLst.Count > 0)
                {
                    this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0, "特殊终端",
                                                                                 TypeOfTabTreeNode.IsGrpSpecial));
                }
            }
        }
        //加载终端节点
        private void LoadNode()
        {
            ChildTreeItems.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;
            }


            //正常分组

            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;
                    }
                }
            }
            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();
        }
        /// <summary>
        /// 加载节点,第一次使用
        /// </summary>
        public override void AddChild()
        {
            ChildTreeItems.Clear();

            if (NodeType == TypeOfTabTreeNode.IsGrp)
            {
                if (AreaId != -1)
                {
                    var tmlLstOfArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(AreaId);
                    var grp          = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpMultiInfoHoldNew.GetGroupInfomation(AreaId,
                                                                                                                            NodeId);
                    if (grp == null)
                    {
                        return;
                    }
                    foreach (var f in grp.LstTml)
                    {
                        if (tmlLstOfArea.Contains(f) == false)
                        {
                            continue;
                        }
                        var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                        if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                        {
                            continue;
                        }
                        this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                    }
                }
                else
                {
                    var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpMultiInfoHoldNew.GetGroupInfomation(AreaId,
                                                                                                                   NodeId);
                    if (grp == null)
                    {
                        return;
                    }
                    foreach (var f in grp.LstTml)
                    {
                        var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                        if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                        {
                            continue;
                        }
                        this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                    }
                }
            }

            if (NodeType == TypeOfTabTreeNode.IsArea)
            {
                var grp =
                    (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpMultiInfoHoldNew.ItemsMultiGrp
                     where t.Key.Item1 == AreaId
                     orderby t.Value.Index
                     select t.Value).ToList();

                foreach (var f in grp)
                {
                    var rtuList = new List <int>();
                    foreach (var fff in f.LstTml)
                    {
                        if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(fff))
                        {
                            continue;
                        }
                        rtuList.Add(fff);
                    }
                    if (rtuList.Count < 1)
                    {
                        continue;
                    }
                    //if (f.LstTml.Count < 1) continue;
                    this.ChildTreeItems.Add(new TreeNodeItemMultiGroupViewModelNew(this, f.AreaId, f.GroupId,
                                                                                   TypeOfTabTreeNode.IsGrp));
                }
            }
        }
Example #22
0
        /// <summary>
        /// 加载节点,第一次使用
        /// </summary>
        public override void AddChild()
        {
            ChildTreeItems.Clear();

            if (NodeType == TypeOfTabTreeNode.IsGrp)
            {
                var tmlLstOfArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(AreaId);
                var grp          = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId,
                                                                                                                      NodeId);
                if (grp == null)
                {
                    return;
                }
                var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml);
                foreach (var f in gprs)
                {
                    if (tmlLstOfArea.Contains(f) == false)
                    {
                        continue;
                    }
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }
                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                }
            }
            if (NodeType == TypeOfTabTreeNode.IsAll)
            {
                var grp          = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetAreaInfo(AreaId);
                var tmlLstOfArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(AreaId);
                if (grp == null)
                {
                    return;
                }
                var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml,
                                                                                                            AreaId, true);

                foreach (var f in gprs.Item1)
                {
                    if (tmlLstOfArea.Contains(f) == false)
                    {
                        continue;
                    }
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }
                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para, true));
                }
                var sortLst =
                    Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(gprs.Item2);
                foreach (var f in sortLst)
                {
                    if (tmlLstOfArea.Contains(f) == false)
                    {
                        continue;
                    }
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }
                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                }
            }
            if (NodeType == TypeOfTabTreeNode.IsGrpSpecial)
            {
                var tmlLstOfArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(AreaId);
                var grp          = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                if (grp.Count == 0)
                {
                    return;
                }
                var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp);
                foreach (var f in gprs)
                {
                    if (tmlLstOfArea.Contains(f) == false)
                    {
                        continue;
                    }
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null || para.EquipmentType != WjParaBase.EquType.Rtu)
                    {
                        continue;
                    }
                    this.ChildTreeItems.Add(new TreeNodeItemTmlViewModel(this, para));
                }
            }
            if (NodeType == TypeOfTabTreeNode.IsArea)
            {
                var grp =
                    (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups
                     where t.Key.Item1 == AreaId
                     orderby t.Value.GroupId
                     select t.Value).ToList();



                this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0,
                                                                             TypeOfTabTreeNode.IsAll));
                foreach (var f in grp)
                {
                    var rtuList = new List <int>();
                    foreach (var fff in f.LstTml)
                    {
                        if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(fff))
                        {
                            continue;
                        }
                        if (fff < 1099999)
                        {
                            rtuList.Add(fff);
                        }
                    }
                    if (rtuList.Count < 1)
                    {
                        continue;
                    }
                    //if (f.LstTml.Count < 1) continue;
                    this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, f.AreaId, f.GroupId,
                                                                                 TypeOfTabTreeNode.IsGrp));
                }
                var sp     = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                var rtuLst = new List <int>();
                foreach (var f in sp)
                {
                    if (!Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(f))
                    {
                        continue;
                    }
                    if (f < 1099999)
                    {
                        rtuLst.Add(f);
                    }
                }
                if (rtuLst.Count > 0)
                {
                    this.ChildTreeItems.Add(new TreeNodeItemSingleGroupViewModel(this, AreaId, 0,
                                                                                 TypeOfTabTreeNode.IsGrpSpecial));
                }
            }
        }
        //加载终端节点
        private void LoadNode()
        {
            ChildTreeItems.Clear();
            TreeNodeRtu.Info.Clear();
            //正常分组

            foreach (var t in Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.Keys)
            {
                if (t.Item1 == AreaId && t.Item2 > 0)
                {
                    ChildTreeItems.Add(new TreeNodeGroup(t.Item2, t.Item1));
                }
            }

            //if (Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(0))
            //{
            //    var tmp = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups[0].LstGrp;
            //  //  var atttmp = (from t in tmp orderby t ascending select t).ToList();
            //    var atttmp = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(tmp);

            //    foreach (var t in atttmp)
            //    {
            //        if (
            //            !Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(t))
            //            continue;
            //        this.ChildTreeItems.Add(new TreeNodeGroup(t));
            //    }
            //}


            //无分组终端 特殊终端
            var tmp = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);

            //var lstNormal = (from t in TreeNodeRtu.Info select t.Key).ToList();
            //var lstSpecial = new List<int>();
            //foreach (
            //    var t in
            //        Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary)
            //{
            //    var equipmentInfo = t.Value as IIRtuParaWork;
            //    if (equipmentInfo == null) continue;
            //    if (!lstNormal.Contains(equipmentInfo.RtuId)) lstSpecial.Add(equipmentInfo.RtuId);
            //} //通过与所有终端比对 查阅为分组终端
            if (tmp.Count > 0)
            {
                var f = new TreeNodeGroup()
                {
                    NodeId = -1, NodeType = TreeNodeType.Special, NodeName = "未分组终端"
                };
                var atttmp = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(tmp);


                foreach (var t in atttmp)
                {
                    if (Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(t))
                    {
                        var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t];
                        if (para.EquipmentType == WjParaBase.EquType.Rtu)
                        {
                            f.ChildTreeItems.Add(new TreeNodeRtu(t));
                        }
                    }
                }
                this.ChildTreeItems.Add(f);

                if (TreeNodeGroup.Info.ContainsKey(-1))
                {
                    TreeNodeGroup.Info.Remove(-1);
                }
                TreeNodeGroup.Info.Add(-1, f);
            }

            var lst = (from g in this.ChildTreeItems orderby g.NodeId select g).ToList();

            this.ChildTreeItems.Clear();
            foreach (var t in lst)
            {
                this.ChildTreeItems.Add(t);
            }
        }
Example #24
0
        public void LoadNode()
        {
            if (ServicesGrpSingleInfoHold.InfoGroups.Count == 0 &&
                Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.Count == 0)
            {
                return;
            }
            ChildTreeItems.Clear();
            var        userProperty = UserInfo.UserLoginInfo;
            List <int> areaLst      = new List <int>();

            areaLst.AddRange(userProperty.AreaX);
            foreach (var t in userProperty.AreaW)
            {
                if (!areaLst.Contains(t))
                {
                    areaLst.Add(t);
                }
            }
            foreach (var f in userProperty.AreaR)
            {
                if (!areaLst.Contains(f))
                {
                    areaLst.Add(f);
                }
            }
            IsLoadOnlyOneArea = areaLst.Count < 2;

            if (userProperty.D == true)
            {
                if (Wj9001ManageSetting.ViewModel.Wj9001LoadSet.Myself.IsShowArea)
                {
                    foreach (var f in Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.Keys)
                    {
                        var lstInArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(f);
                        var rtuLst    = new List <int>();
                        foreach (var a in lstInArea)
                        {
                            var pb = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(a);
                            if (pb == null)
                            {
                                continue;
                            }
                            if (pb.EquipmentType == WjParaBase.EquType.Leak && pb.RtuFid == 0)  //线路为主设备
                            {
                                rtuLst.Add(pb.RtuId);
                                //if (IsLoadOnlyOneArea)
                                //{
                                //    int AreaId = areaLst[0];
                                //    ShowGrpInArea(AreaId);
                                //}
                                //else
                                //{
                                //    this.ChildTreeItems.Add(new TreeNodeAreaViewModel(null, f, 0, TypeOfTabTreeNode.IsArea));
                                //}

                                //break;
                            }
                            else if (pb.EquipmentType == WjParaBase.EquType.Rtu &&
                                     pb.EquipmentsThatAttachToThisRtu.Count > 0) //haha 特殊终端下有线路
                            {
                                foreach (var g in pb.EquipmentsThatAttachToThisRtu)
                                {
                                    var pa = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(g);
                                    if (pa == null)
                                    {
                                        continue;
                                    }
                                    if (pa.EquipmentType == WjParaBase.EquType.Leak && pa.RtuFid > 0)
                                    {
                                        rtuLst.Add(g);
                                        //if (IsLoadOnlyOneArea)
                                        //{
                                        //    int AreaId = areaLst[0];
                                        //    ShowGrpInArea(AreaId);
                                        //}
                                        //else
                                        //{
                                        //     this.ChildTreeItems.Add(new TreeNodeAreaViewModel(null, f, 0, TypeOfTabTreeNode.IsArea));
                                        //}

                                        //break;
                                    }
                                }
                            }
                        }
                        if (rtuLst.Count > 0)
                        {
                            if (IsLoadOnlyOneArea)
                            {
                                int AreaId = areaLst[0];
                                ShowGrpInArea(AreaId);
                            }
                            else
                            {
                                this.ChildTreeItems.Add(new TreeNodeAreaViewModel(null, f, 0,
                                                                                  TypeOfTabTreeNode.IsArea));
                            }
                        }
                    }
                }
                else
                {
                    foreach (var f in Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.Keys)
                    {
                        ShowGrpInArea(f);
                    }
                }
            }
            else
            {
                if (IsLoadOnlyOneArea)
                {
                    int AreaId = areaLst[0];
                    ShowGrpInArea(AreaId);
                }
                else
                {
                    foreach (var f in areaLst)
                    {
                        var lstInArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(f);
                        var rtuLst    = new List <int>();
                        foreach (var a in lstInArea)
                        {
                            var pb = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(a);
                            if (pb == null)
                            {
                                continue;
                            }
                            if (pb.EquipmentType == WjParaBase.EquType.Leak && pb.RtuFid == 0)  //线路为主设备
                            {
                                rtuLst.Add(pb.RtuId);
                                //this.ChildTreeItems.Add(new TreeNodeAreaViewModel(null, f, 0, TypeOfTabTreeNode.IsArea));
                                //break; ;
                            }
                            else if (pb.EquipmentType == WjParaBase.EquType.Rtu &&
                                     pb.EquipmentsThatAttachToThisRtu.Count > 0) //haha 特殊终端下有线路
                            {
                                foreach (var g in pb.EquipmentsThatAttachToThisRtu)
                                {
                                    var pa = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(g);
                                    if (pa == null)
                                    {
                                        continue;
                                    }
                                    if (pa.EquipmentType == WjParaBase.EquType.Leak && pa.RtuFid > 0)
                                    {
                                        rtuLst.Add(g);
                                        //this.ChildTreeItems.Add(new TreeNodeAreaViewModel(null, f, 0, TypeOfTabTreeNode.IsArea));
                                        //break;
                                    }
                                }
                            }
                        }
                        if (rtuLst.Count > 0)
                        {
                            if (IsLoadOnlyOneArea)
                            {
                                int AreaId = areaLst[0];
                                ShowGrpInArea(AreaId);
                            }
                            else
                            {
                                this.ChildTreeItems.Add(new TreeNodeAreaViewModel(null, f, 0,
                                                                                  TypeOfTabTreeNode.IsArea));
                            }
                        }
                    }
                }
            }
            for (int i = this.ChildTreeItems.Count - 1; i > 0; i--)
            {
                var t = this.ChildTreeItems[i];
                if (t.NodeType == TypeOfTabTreeNode.IsTml)
                {
                    continue;
                }
                t.GetChildRtuCount();
                if (t.RtuCount == 0)
                {
                    ChildTreeItems.Remove(t);
                }
            }
            foreach (var t in this.ChildTreeItems)
            {
                t.GetChildRtuCount();
            }
        }
Example #25
0
        public override void AddChild()
        {
            ChildTreeItems.Clear();
            if (NodeType == TypeOfTabTreeNode.IsGrp)
            {
                var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId,
                                                                                                             NodeId);
                if (grp == null)
                {
                    return;
                }
                var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml);//排序
                foreach (var f in gprs)
                {
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null)
                    {
                        continue;                                                         //|| para.EquipmentType != WjParaBase.EquType.Mru
                    }
                    if (para.EquipmentType == WjParaBase.EquType.Ldu && para.RtuFid == 0) //是电表,而且是主设备
                    {
                        this.ChildTreeItems.Add(new TreeNodeWj1090ViewModel(para.RtuId, para.RtuName, para.RtuFid));
                    }
                    else if (para.EquipmentType == WjParaBase.EquType.Rtu && para.EquipmentsThatAttachToThisRtu.Count > 0)
                    {
                        foreach (var g in para.EquipmentsThatAttachToThisRtu)
                        {
                            var pa = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(g);
                            if (pa == null)
                            {
                                continue;
                            }
                            if (pa.EquipmentType == WjParaBase.EquType.Ldu && pa.RtuFid > 0)
                            {
                                this.ChildTreeItems.Add(new TreeNodeWj1090ViewModel(pa.RtuId, pa.RtuName, pa.RtuFid));
                            }
                        }
                    }
                }
            }
            if (NodeType == TypeOfTabTreeNode.IsAll)
            {
                //var grp = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetAreaInfo(AreaId);
                //if (grp == null) return;
                //var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml);
                //foreach (var f in gprs)
                //{
                //    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                //    if (para == null || para.EquipmentType != WjParaBase.EquType.Mru) continue;

                //    this.ChildTreeItems.Add(new TreeNodeWj1050ViewModel(para.RtuId, para.RtuName, para.RtuFid));
                //}
            }
            if (NodeType == TypeOfTabTreeNode.IsGrpSpecial)
            {
                var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                if (grp.Count == 0)
                {
                    return;
                }
                var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp);
                foreach (var f in gprs)
                {
                    var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                    if (para == null)
                    {
                        continue;                                                         //|| para.EquipmentType != WjParaBase.EquType.Mru
                    }
                    if (para.EquipmentType == WjParaBase.EquType.Ldu && para.RtuFid == 0) //电表为主设备
                    {
                        this.ChildTreeItems.Add(new TreeNodeWj1090ViewModel(para.RtuId, para.RtuName, para.RtuFid));
                    }
                    else if (para.EquipmentType == WjParaBase.EquType.Rtu && para.EquipmentsThatAttachToThisRtu.Count > 0) //haha 特殊终端下有电表
                    {
                        foreach (var g in para.EquipmentsThatAttachToThisRtu)
                        {
                            var pa = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(g);
                            if (pa == null)
                            {
                                continue;
                            }
                            if (pa.EquipmentType == WjParaBase.EquType.Ldu && pa.RtuFid > 0)
                            {
                                this.ChildTreeItems.Add(new TreeNodeWj1090ViewModel(pa.RtuId, pa.RtuName, pa.RtuFid));
                            }
                        }
                    }
                }
            }
            if (NodeType == TypeOfTabTreeNode.IsArea)
            {
                if (Wj1090TreeSetLoad.Myself.IsShowGrp)
                {
                    var grp =
                        (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups
                         where t.Key.Item1 == AreaId
                         orderby t.Value.Index
                         select t.Value).ToList();

                    //this.ChildTreeItems.Add(new TreeNodeAreaViewModel(this, AreaId, 0, TypeOfTabTreeNode.IsAll));
                    foreach (var f in grp)
                    {
                        var rtuList = new List <int>();
                        foreach (var fff in f.LstTml)
                        {
                            var rtu = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(fff);
                            if (rtu == null)
                            {
                                continue;
                            }
                            if (rtu.EquipmentType == WjParaBase.EquType.Rtu &&
                                rtu.EquipmentsThatAttachToThisRtu.Count > 0)
                            {
                                foreach (var g in rtu.EquipmentsThatAttachToThisRtu)
                                {
                                    var pa = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(g);
                                    if (pa == null)
                                    {
                                        continue;
                                    }
                                    if (pa.EquipmentType == WjParaBase.EquType.Ldu && pa.RtuFid > 0)
                                    {
                                        rtuList.Add(g);
                                    }
                                }
                            }
                            else if (rtu.EquipmentType == WjParaBase.EquType.Ldu && rtu.RtuFid == 0)
                            {
                                rtuList.Add(rtu.RtuId);
                            }
                        }
                        if (rtuList.Count < 1)
                        {
                            continue;
                        }
                        this.ChildTreeItems.Add(new TreeNodeAreaViewModel(this, f.AreaId, f.GroupId,
                                                                          TypeOfTabTreeNode.IsGrp));
                    }
                    var sp     = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId);
                    var rtuLst = new List <int>();
                    foreach (var v in sp)
                    {
                        var rtu = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(v);
                        if (rtu == null)
                        {
                            continue;
                        }
                        if (rtu.EquipmentType == WjParaBase.EquType.Rtu &&
                            rtu.EquipmentsThatAttachToThisRtu.Count > 0)
                        {
                            foreach (var g in rtu.EquipmentsThatAttachToThisRtu)
                            {
                                var pa = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(g);
                                if (pa == null)
                                {
                                    continue;
                                }
                                if (pa.EquipmentType == WjParaBase.EquType.Ldu && pa.RtuFid > 0)
                                {
                                    rtuLst.Add(g);
                                }
                            }
                        }
                        else if (rtu.EquipmentType == WjParaBase.EquType.Ldu && rtu.RtuFid == 0)
                        {
                            rtuLst.Add(rtu.RtuId);
                        }
                    }
                    if (rtuLst.Count > 0)
                    {
                        this.ChildTreeItems.Add(new TreeNodeAreaViewModel(this, AreaId, 0,
                                                                          TypeOfTabTreeNode.IsGrpSpecial));
                    }
                }
                else
                {
                    var lstInArea = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuInArea(AreaId);
                    foreach (var f in lstInArea)
                    {
                        var pb = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f);
                        if (pb == null)
                        {
                            continue;
                        }
                        if (pb.EquipmentType == WjParaBase.EquType.Ldu && pb.RtuFid == 0) //线路为主设备
                        {
                            this.ChildTreeItems.Add(new TreeNodeWj1090ViewModel(pb.RtuId, pb.RtuName, pb.RtuFid));
                        }
                        else if (pb.EquipmentType == WjParaBase.EquType.Rtu && pb.EquipmentsThatAttachToThisRtu.Count > 0) //haha 特殊终端下有线路
                        {
                            foreach (var g in pb.EquipmentsThatAttachToThisRtu)
                            {
                                var pa = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(g);
                                if (pa == null)
                                {
                                    continue;
                                }
                                if (pa.EquipmentType == WjParaBase.EquType.Ldu && pa.RtuFid > 0)
                                {
                                    this.ChildTreeItems.Add(new TreeNodeWj1090ViewModel(pa.RtuId, pa.RtuName, pa.RtuFid));
                                }
                            }
                        }
                    }
                }
            }
        }