/// <summary> /// 具体实现更新本分组 /// </summary> /// <param name="node"></param> /// <param name="loop"></param> /// <param name="newTimeTableId"></param> /// <param name="applyRtuCls"></param> private void UpdateGroupTimeTable(ListTreeNodeBase node, int loop, int newTimeTableId, int applyRtuCls) { UpdateNodeTimeTable(node, loop, newTimeTableId); foreach (var t in node.ChildTreeItems) { if (t.IsListTreeNodeGroup) { if (applyRtuCls == 2 || applyRtuCls == 4) { UpdateGroupTimeTable(t, loop, newTimeTableId, applyRtuCls); } } else { if (applyRtuCls == 1 || applyRtuCls == 2) { if (!t.IsThisTmlSpecialTerminal) { UpdateNodeTimeTable(t, loop, newTimeTableId); } } else if (applyRtuCls == 3 || applyRtuCls == 4) { UpdateNodeTimeTable(t, loop, newTimeTableId); } } } CalcateGroupSame(node); }
/// <summary> /// 具体实现跟新本终端 /// </summary> /// <param name="node"></param> /// <param name="loop"></param> /// <param name="newTimeTableId"></param> private void UpdateNodeTimeTable(ListTreeNodeBase node, int loop, int newTimeTableId) { switch (loop) { case 1: node.K1TimeTalbe = newTimeTableId; break; case 2: node.K2TimeTalbe = newTimeTableId; break; case 3: node.K3TimeTalbe = newTimeTableId; break; case 4: node.K4TimeTalbe = newTimeTableId; break; case 5: node.K5TimeTalbe = newTimeTableId; break; case 6: node.K6TimeTalbe = newTimeTableId; break; } }
private void GetTmlbandingTimeTable(ListTreeNodeBase tmlNode) //tml loop timetable { if (tmlNode.K1TimeTalbe > 0) { _lstTmlbandingTimeTable.Add(new Tuple <int, int, int>(tmlNode.NodeId, 1, tmlNode.K1TimeTalbe)); } if (tmlNode.K2TimeTalbe > 0) { _lstTmlbandingTimeTable.Add(new Tuple <int, int, int>(tmlNode.NodeId, 2, tmlNode.K2TimeTalbe)); } if (tmlNode.K3TimeTalbe > 0) { _lstTmlbandingTimeTable.Add(new Tuple <int, int, int>(tmlNode.NodeId, 3, tmlNode.K3TimeTalbe)); } if (tmlNode.K4TimeTalbe > 0) { _lstTmlbandingTimeTable.Add(new Tuple <int, int, int>(tmlNode.NodeId, 4, tmlNode.K4TimeTalbe)); } if (tmlNode.K5TimeTalbe > 0) { _lstTmlbandingTimeTable.Add(new Tuple <int, int, int>(tmlNode.NodeId, 5, tmlNode.K5TimeTalbe)); } if (tmlNode.K6TimeTalbe > 0) { _lstTmlbandingTimeTable.Add(new Tuple <int, int, int>(tmlNode.NodeId, 6, tmlNode.K6TimeTalbe)); } }
//tml loop timetable private void GetGrpbandingTimeTable(ListTreeNodeBase tmlNode) { foreach (var t in tmlNode.ChildTreeItems) { GetTmlbandingTimeTable(t); if (t.IsListTreeNodeGroup) { GetGrpbandingTimeTable(t); } } }
public ListTreeTmlNode(ListTreeNodeBase mvvmFather, int tmlId) { Visi = Visibility.Visible; this._father = mvvmFather; this.IsListTreeNodeGroup = false; this.IsThisTmlSpecialVisual = Visibility.Visible; this.IsThisGroupHasSpecialVisual = Visibility.Collapsed; this.IsThisTmlSpecialTerminalEnable = true; this.NodeId = tmlId; this.PhyId = tmlId; GetNodeInfomation(); GetNodeTimeTableInformation(); }
//计算分组节点中的终端 终端信息 private void GetChildTmlNode(ListTreeNodeBase node) { foreach (var t in node.ChildTreeItems) { if (t.IsListTreeNodeGroup) { GetChildTmlNode(t); } else { _lstContentTml.Add(t.NodeId); } } }
private void CalcateGroupSame(ListTreeNodeBase node) { if (!node.IsListTreeNodeGroup && node.Father != null) { if (node.K1TimeTalbe == node.Father.K1TimeTalbe && node.K2TimeTalbe == node.Father.K2TimeTalbe && node.K3TimeTalbe == node.Father.K3TimeTalbe && node.K4TimeTalbe == node.Father.K4TimeTalbe && node.K5TimeTalbe == node.Father.K5TimeTalbe && node.K6TimeTalbe == node.Father.K6TimeTalbe ) { node.IsThisTmlSpecialTerminal = false; } else { node.IsThisTmlSpecialTerminal = true; } return; } foreach (var t in node.ChildTreeItems) { CalcateGroupSame(t); } bool bolHasSpecial = false; foreach (var t in node.ChildTreeItems) { if (t.IsListTreeNodeGroup) { if (t.IsThisGroupHasSpecialTermial) { bolHasSpecial = true; } } else { if (t.IsThisTmlSpecialTerminal) { bolHasSpecial = true; } } } node.IsThisGroupHasSpecialTermial = bolHasSpecial; }
public ListTreeTmlNode(ListTreeNodeBase mvvmFather, int tmlId) { Visi = Visibility.Visible; _father = mvvmFather; IsGroup = false; NodeId = tmlId; GetNodeInfomation(); if (!RegisterNodes.ContainsKey(NodeId)) { RegisterNodes.Add(NodeId, this); } else { RegisterNodes.Remove(NodeId); RegisterNodes.Add(NodeId, this); } }
public ListTreeGroupNode(ListTreeNodeBase mvvmFather, int groupId) { Visi = Visibility.Visible; this._father = mvvmFather; this.IsListTreeNodeGroup = true; this.IsThisGroupHasSpecialVisual = Visibility.Visible; this.IsThisTmlSpecialVisual = Visibility.Collapsed; this.NodeId = groupId; this.PhyId = groupId; GetNodeInfomation(); this.GetNodeTimeTableInformation(); this.AddChild(); // GetNodeTimeTableIdInformation(); UpdateTmlTimeTableInfo(); }
/// <summary> /// 递归查询跟新分组或终端 /// </summary> /// <param name="node"></param> /// <param name="isGroup"></param> /// <param name="rtuIdOrGroupId"></param> /// <param name="newTimeTabelId"></param> /// <param name="kLoops"></param> /// <param name="applyRtuCls"></param> public void UpdatRtuTimeTable(ListTreeNodeBase node, bool isGroup, int rtuIdOrGroupId, int newTimeTabelId, int kLoops, int applyRtuCls) { foreach (var t in node.ChildTreeItems) { if (t.NodeId == rtuIdOrGroupId) { if (t.IsListTreeNodeGroup) { UpdateGroupTimeTable(t, kLoops, newTimeTabelId, applyRtuCls); } else { UpdateNodeTimeTable(t, kLoops, newTimeTabelId); } } else if (t.IsListTreeNodeGroup) { UpdatRtuTimeTable(t, isGroup, rtuIdOrGroupId, newTimeTabelId, kLoops, applyRtuCls); } } }