Beispiel #1
0
        public string unusualNode(String clickProcess, String DBName)
        {
            IDao     dao        = new Dao(DBName);
            int      Project_ID = new INI_IO().ReadID();
            MainPage mainPage   = new MainPage();

            m_NotNormalNodeList = mainPage.RefrashNodeList(dao);  //获取正常的工艺监测
            string allNodeString = "";

            if (m_NotNormalNodeList.Count > 0)
            {
                foreach (NormalNodeList temp in m_NotNormalNodeList)
                {
                    if (null != temp.Group && temp.Group.Trim() == clickProcess.Trim())
                    {
                        string FatherID = Father_id;

                        FatherID = FatherID + "_" + temp.ID;
                        int projectid = Project_ID;
                        allNodeString += FatherID + "," + projectid + "," + temp.Describe + ",";
                    }
                }
                if (allNodeString != "")
                {
                    allNodeString = allNodeString.Substring(0, allNodeString.Length - 1);
                }
            }
            return(allNodeString);
        }
Beispiel #2
0
        /// <summary>
        /// 生成json串供前台展示
        /// </summary>
        /// <returns></returns>
        public string produceJson(Plant plant)
        {
            IDao     dao        = new Dao(plant, false);
            int      Project_ID = new INI_IO().ReadID();
            MainPage mainPage   = new MainPage();

            DynamicProcess      = mainPage.DynamicLoadFuntion(dao);      //添加默认装置
            m_NormalNodeList    = mainPage.RefrashNodeList(dao);         //获取正常的工艺监测
            m_NotNormalNodeList = mainPage.notNormalNodeList(dao, "工艺"); //mainPage.initNotNormalNodeList(dao);

            string           jsonData = "";
            List <JasonSeri> js       = new List <JasonSeri>();

            for (int pn = DynamicProcess.Count; pn > 0; pn--)
            {
                string    processName = DynamicProcess[pn - 1];
                JasonSeri tempjs      = new JasonSeri();

                List <excNode> listexc    = new List <excNode>();
                string         nodestatus = "";
                foreach (NormalNodeList temp in m_NotNormalNodeList)
                {
                    if (temp.Group == processName)
                    {
                        excNode tempNode = new excNode();
                        string  FatherID = Father_id;

                        FatherID = FatherID + "_" + temp.ID;
                        int projectid = Project_ID;
                        tempNode.twoID = FatherID + "," + projectid;
                        tempNode.Text  = temp.Describe;
                        if ("" == nodestatus || "预警" == nodestatus)
                        {
                            nodestatus = temp.nodeState;
                        }
                        listexc.Add(tempNode);
                    }
                }
                tempjs.name = processName;
                if (listexc.Count > 0)
                {
                    tempjs.state = nodestatus;
                    tempjs.exc   = listexc;

                    js.Add(tempjs);
                }
                else
                {
                    tempjs.state = "正常";
                    js.Add(tempjs);
                }
            }

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();

            jsonData = jsonSerializer.Serialize(js);
            return(jsonData);
        }
Beispiel #3
0
        /// <summary>
        /// 生成json串供前台展示
        /// </summary>
        /// <returns></returns>
        public string produceJson(Plant plant)
        {
            IDao                  dao                 = new Dao(plant, false);
            int                   Project_ID          = new INI_IO().ReadID();
            MainPage              mainPage            = new MainPage();
            List <Equipment>      DynamicProcess      = loadEquipmentFuntion(plant); //节点
            List <NormalNodeList> m_NotNormalNodeList = mainPage.initNotNormalNodeList(dao);

            string           jsonData = "";
            List <JasonSeri> js       = new List <JasonSeri>();

            for (int pn = DynamicProcess.Count - 1; pn >= 0; pn--)
            {
                string    processName = DynamicProcess[pn].monitorObject_Name;
                JasonSeri tempjs      = new JasonSeri();

                List <excNode> listexc = new List <excNode>();
                foreach (NormalNodeList temp in m_NotNormalNodeList)
                {
                    if (temp.Group == processName)
                    {
                        excNode tempNode = new excNode();
                        string  FatherID = "-1";

                        FatherID = FatherID + "_" + temp.ID;
                        int projectid = Project_ID;
                        tempNode.twoID = FatherID + "," + projectid;
                        tempNode.Text  = temp.Describe;
                        listexc.Add(tempNode);
                    }
                }
                tempjs.name = processName;
                if (listexc.Count > 0)
                {
                    tempjs.state = "异常";
                    tempjs.exc   = listexc;

                    js.Add(tempjs);
                }
                else
                {
                    tempjs.state = "正常";
                    js.Add(tempjs);
                }
            }

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();

            jsonData = jsonSerializer.Serialize(js);
            return(jsonData);
        }