예제 #1
0
        //移除服务端组
        public static void RemoveGroup(SHHOPCServer server, SHHOPCGroup group)
        {
            foreach (SHHOPCItem item in group.ItemList)
            {
                RemovePoint(group, item);
            }

            server.RemoveGroup(group);
            TB_TF_OPCGroups.DeleteOPCGroup(group.ID);
        }
예제 #2
0
        //加载参数
        public static void Load()
        {
            SqlDataReader opcserver = TB_TF_OPCServer.GetServer();

            while (opcserver.Read())
            {
                SHHOPCServer  server   = new SHHOPCServer(new Guid(opcserver["OPCServerID"].ToString()), IPAddress.Parse(opcserver["MachineIP"].ToString()), opcserver["OPCServerName"].ToString(), opcserver["Name"].ToString());
                SqlDataReader opcgroup = TB_TF_OPCGroups.GetGroups();
                while (opcgroup.Read())
                {
                    if (opcserver["OPCServerID"].ToString() == opcgroup["OPCServerID"].ToString())
                    {
                        SHHOPCGroup   group    = new SHHOPCGroup(new Guid(opcgroup["OPCGroupID"].ToString()), opcgroup["Name"].ToString(), Int32.Parse(opcgroup["UpdateRate"].ToString()), float.Parse(opcgroup["DeadBend"].ToString()), Int32.Parse(opcgroup["TimeBias"].ToString()), (bool)opcgroup["IsActive"], (bool)opcgroup["IsSubscribed"]);
                        SqlDataReader opcpoint = TB_TF_Points.GetPoints();
                        while (opcpoint.Read())
                        {
                            if (opcgroup["OPCGroupID"].ToString() == opcpoint["OPCGroupID"].ToString())
                            {
                                SHHOPCItem item = new SHHOPCItem(new Guid(opcpoint["PointID"].ToString()), new SHHEquipment((SHHEquipmentID)Int32.Parse(opcpoint["EquipID"].ToString()), SHHEquipmentType.Analog, opcpoint["PointName"].ToString(), "MPa"), opcpoint["PointName"].ToString(), opcpoint["EquipPlace"].ToString(), opcpoint["PointAddress"].ToString());


                                group.AddItem(item);

                                /**********删除测试数据*******/
                                //RemovePoint(group, item);
                                /***************************/
                            }
                        }

                        //**********添加测试数据 * *********/
                        //for (int i = 0; i < 5; ++i)
                        //{
                        //    string s = group.Name.Substring(group.Name.Length - 1, 1);
                        //    SHHOPCItem testPoint = new SHHOPCItem(Guid.NewGuid(), new SHHEquipment((SHHEquipmentID)i, SHHEquipmentType.Analog, "测点" + i, "kpa"), "测点" + i, "地点" + i, "Channel_" + s + ".Device_" + 0 + ".Tag_" + i);
                        //    AddPoint(group, testPoint);
                        //}
                        ///******************************

                        server.AddGroup(group);
                    }
                }
                ServerList.Add(server);
            }
        }
예제 #3
0
 //修改组
 public static void ModifyGroup(SHHOPCGroup group)
 {
     TB_TF_OPCGroups.UpdateOPCGroups(group);
 }
예제 #4
0
        //添加服务端组
        public static void AddGroup(SHHOPCServer server, SHHOPCGroup group)
        {
            server.AddGroup(group);

            TB_TF_OPCGroups.AddOPCGroups(group);
        }