Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public static string GetDataComputerValueString(Service.SystemStatus.Model_DataComputer myDataComputer)
        {
            StringBuilder m_ValueString = new StringBuilder();

            if (myDataComputer != null && myDataComputer.Switch != null)
            {
                m_ValueString.Append("{\"Id\":\"" + myDataComputer.Id +
                                     "\",\"Name\":\"" + myDataComputer.Name +
                                     "\",\"IpAddress\":\"" + myDataComputer.IpAddress +
                                     "\",\"PropertyName\":\"" + myDataComputer.PropertyName +
                                     "\",\"Switch\":");

                string m_SwitchValueTemp = "{\"Id\":\"" + myDataComputer.Switch.Id +
                                           "\",\"Name\":\"" + myDataComputer.Switch.Name +
                                           "\",\"DepthIndex\":" + myDataComputer.Switch.DepthIndex +
                                           ",\"MaxDepth\":" + myDataComputer.Switch.MaxDepth +
                                           ",\"CollectorCount\":" + myDataComputer.Switch.CollectorCount +
                                           ",\"PropertyName\":\"" + myDataComputer.PropertyName +
                                           "\",\"Switch\":";
                /////////////////////////////////获得子交换机//////////////////////////
                string m_SubSwitchValueTemp = "";
                for (int i = 0; i < myDataComputer.Switch.Switch.Count; i++)
                {
                    if (i == 0)
                    {
                        m_SubSwitchValueTemp = GetSwitchValueString(myDataComputer.Switch.Switch[i]);
                    }
                    else
                    {
                        m_SubSwitchValueTemp = m_SubSwitchValueTemp + "," + GetSwitchValueString(myDataComputer.Switch.Switch[i]);
                    }
                }
                if (m_SubSwitchValueTemp != "")
                {
                    m_SwitchValueTemp = m_SwitchValueTemp + "[" + m_SubSwitchValueTemp + "]";
                }
                else
                {
                    m_SwitchValueTemp = m_SwitchValueTemp + "[]";
                }
                ////////////////////////////////获得设备////////////////////////////////
                string m_CollectorValueTemp = GetCollectorValueString(myDataComputer.Switch);
                if (m_CollectorValueTemp != "")
                {
                    m_SwitchValueTemp = m_SwitchValueTemp + ",\"Collector\":" + "[" + m_CollectorValueTemp + "]";
                }
                else
                {
                    m_SwitchValueTemp = m_SwitchValueTemp + ",\"Collector\":[]";
                }

                ///////////////////////////////////////////////////////////////////////
                m_SwitchValueTemp = m_SwitchValueTemp + "}";
                m_ValueString.Append(m_SwitchValueTemp);
                m_ValueString.Append("}");
            }
            else
            {
                m_ValueString.Append("[]");
            }
            return(m_ValueString.ToString());
        }
Exemplo n.º 3
0
        public static void GetUpperSwitchInfo(DataTable myDataCollectionNetInfoTable, ref Service.SystemStatus.Model_DataComputer myDataComputer, string myParentNodeId, string myOrganizationId)
        {
            ////////////////////查找下层交换机/////////////////////
            DataRow[] m_DataRow = myDataCollectionNetInfoTable.Select(string.Format("OrganizationID = '{0}' and NodeId = '{1}' and NodeType = '{2}'", myOrganizationId, myParentNodeId, "Switch"));
            if (m_DataRow.Length > 0)
            {
                myDataComputer.Switch.Id         = myOrganizationId + "_" + m_DataRow[0]["NodeId"].ToString();
                myDataComputer.Switch.Name       = m_DataRow[0]["NodeName"].ToString();
                myDataComputer.Switch.DepthIndex = 1;
                myDataComputer.Switch.Switch     = GetSwitchInfo(myDataCollectionNetInfoTable, myDataComputer.Switch.DepthIndex, myParentNodeId, myOrganizationId);       //查找下级交换机
                myDataComputer.Switch.Collector  = GetDeviceInfo(myDataCollectionNetInfoTable, myDataComputer.Switch.DepthIndex, myParentNodeId, myOrganizationId);

                if (myDataComputer.Switch.Switch != null)
                {
                    int m_MaxDepthIndex  = 0;     //找出子节点最深的深度数
                    int m_CollectorCount = 0;     //汇总所有的采集器的数量
                    for (int j = 0; j < myDataComputer.Switch.Switch.Count; j++)
                    {
                        if (myDataComputer.Switch.Switch[j].MaxDepth > m_MaxDepthIndex)
                        {
                            m_MaxDepthIndex = myDataComputer.Switch.Switch[j].MaxDepth;
                        }
                        m_CollectorCount = myDataComputer.Switch.Switch[j].CollectorCount + m_CollectorCount;
                    }
                    myDataComputer.Switch.MaxDepth       = m_MaxDepthIndex + 1;
                    myDataComputer.Switch.CollectorCount = myDataComputer.Switch.Collector.Count + m_CollectorCount;
                }
                else
                {
                    myDataComputer.Switch.MaxDepth       = 1;
                    myDataComputer.Switch.CollectorCount = myDataComputer.Switch.Collector.Count;
                }
            }
        }