private List <Monitor_OverView.Service.SystemStatus.Model_FactoryServer> LoadNetworkStructure() { List <Monitor_OverView.Service.SystemStatus.Model_FactoryServer> m_FactoryServerList = new List <Service.SystemStatus.Model_FactoryServer>(); string m_StationId = Monitor_OverView.Service.OverView.OverView_Nxjc.GetStationId(); string m_StationIpAddress = ""; //m_StationId = "zc_nxjc"; DataTable m_FactoryServerInfoTable = Monitor_OverView.Service.SystemStatus.NetworkStatus.GetFactoryServerInfo(m_StationId); if (m_FactoryServerInfoTable != null) { string[] m_FactoryDataBaseName = new string[m_FactoryServerInfoTable.Rows.Count]; string[] m_OrganzationId = new string[m_FactoryServerInfoTable.Rows.Count]; for (int i = 0; i < m_FactoryServerInfoTable.Rows.Count; i++) { m_FactoryDataBaseName[i] = m_FactoryServerInfoTable.Rows[i]["MeterDatabase"].ToString(); m_OrganzationId[i] = m_FactoryServerInfoTable.Rows[i]["OrganizationId"].ToString(); m_StationIpAddress = Monitor_OverView.Service.SystemStatus.NetworkStatus.GetStationIpAddress(m_OrganzationId[i], m_FactoryServerInfoTable); //获取站点IP地址 Monitor_OverView.Service.SystemStatus.Model_FactoryServer m_FactoryServerTemp = new Service.SystemStatus.Model_FactoryServer(); m_FactoryServerTemp.Id = m_OrganzationId[i] + "_" + m_FactoryServerInfoTable.Rows[i]["NodeId"].ToString(); m_FactoryServerTemp.OrganizationId = m_OrganzationId[i]; m_FactoryServerTemp.Name = m_FactoryServerInfoTable.Rows[i]["Name"].ToString(); m_FactoryServerTemp.IpAddress = m_StationIpAddress; m_FactoryServerList.Add(m_FactoryServerTemp); } DataTable m_DataCollectionNetInfoTable = Monitor_OverView.Service.SystemStatus.NetworkStatus.GetDataCollectionNetInfo(m_OrganzationId); if (m_DataCollectionNetInfoTable != null) { for (int i = 0; i < m_FactoryServerList.Count; i++) { //////////////获得每一个分厂的所有数采计算机 DataRow[] m_DataComputer = m_DataCollectionNetInfoTable.Select(string.Format("OrganizationID = '{0}' and NodeType = '{1}'", m_FactoryServerList[i].OrganizationId, "DataComputer")); for (int j = 0; j < m_DataComputer.Length; j++) { Monitor_OverView.Service.SystemStatus.Model_DataComputer m_DataComputerTemp = new Service.SystemStatus.Model_DataComputer(); m_DataComputerTemp.IpAddress = m_DataComputer[j]["IpAddress"].ToString(); m_DataComputerTemp.Id = m_FactoryServerList[i].OrganizationId + "_" + m_DataComputer[j]["NodeId"].ToString(); m_DataComputerTemp.Name = m_DataComputer[j]["NodeName"].ToString(); string m_ParentNodeId = m_DataComputer[j]["ParentNodeId"].ToString(); //获得每一个数采计算机下面的交换机 Monitor_OverView.Service.SystemStatus.NetworkStatus.GetUpperSwitchInfo(m_DataCollectionNetInfoTable, ref m_DataComputerTemp, m_ParentNodeId, m_FactoryServerList[i].OrganizationId); m_FactoryServerList[i].DataComputer.Add(m_DataComputerTemp); } } } } return(m_FactoryServerList); }
//获取每个服务器下面的数据采集电脑 public static string GetFactoryServerValueString(Service.SystemStatus.Model_FactoryServer myFactoryServer) { StringBuilder m_ValueString = new StringBuilder(); if (myFactoryServer != null && myFactoryServer.DataComputer != null) { m_ValueString.Append("{\"Id\":\"" + myFactoryServer.Id + "\",\"Name\":\"" + myFactoryServer.Name + "\",\"IpAddress\":\"" + myFactoryServer.IpAddress + "\",\"OrganizationId\":\"" + myFactoryServer.OrganizationId + "\",\"PropertyName\":\"" + myFactoryServer.PropertyName + "\",\"DataComputer\":"); string m_ComputerValueTemp = ""; for (int i = 0; i < myFactoryServer.DataComputer.Count; i++) { if (i == 0) { m_ComputerValueTemp = GetDataComputerValueString(myFactoryServer.DataComputer[i]); } else { m_ComputerValueTemp = m_ComputerValueTemp + "," + GetDataComputerValueString(myFactoryServer.DataComputer[i]); } } if (m_ComputerValueTemp != "") { m_ValueString.Append("[" + m_ComputerValueTemp + "]"); } else { m_ValueString.Append("[]"); } m_ValueString.Append("}"); } else { m_ValueString.Append("[]"); } return(m_ValueString.ToString()); }