Exemplo n.º 1
0
        //修改组
        private void ModifyGroup(object sender, RoutedEventArgs e)
        {
            SHHOPCGroup node = tree.SelectedItem as SHHOPCGroup;
            FormGroup   form = new FormGroup();

            //载入参数
            form.tbx_Name.Text              = node.Name;
            form.tbx_UpdateRate.Text        = node.UpdateRate.ToString();
            form.tbx_DeadBend.Text          = node.DeadBend.ToString();
            form.tbx_TimeBias.Text          = node.TimeBias.ToString();
            form.cbx_IsActive.IsChecked     = node.IsActive;
            form.cbx_IsSubscribed.IsChecked = node.IsSubscribed;

            form.Owner = this;
            if ((bool)form.ShowDialog())
            {
                //确定修改
                node.Name         = form.Name;
                node.UpdateRate   = form.UpdateRate;
                node.DeadBend     = form.DeadBend;
                node.TimeBias     = form.TimeBias;
                node.IsActive     = form.IsActive;
                node.IsSubscribed = form.IsSubscribed;


                OPCManager.ModifyGroup(node);
            }
        }
Exemplo n.º 2
0
        //删除组
        private void DeleteGroup(object sender, RoutedEventArgs e)
        {
            SHHOPCGroup node = tree.SelectedItem as SHHOPCGroup;

            if (node != null)
            {
                //确定删除
                OPCManager.RemoveGroup(node.Server, node);
            }
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public static void UpdateOPCGroups(SHHOPCGroup group)
        {
            SqlParameter[] parameterList = new SqlParameter[8]
            {
                new SqlParameter("OPCServerID", group.Server.ID),
                new SqlParameter("OPCGroupID", group.ID),
                new SqlParameter("Name", group.Name),
                new SqlParameter("UpdateRate", group.UpdateRate),
                new SqlParameter("DeadBend", group.DeadBend),
                new SqlParameter("TimeBias", group.TimeBias),
                new SqlParameter("IsActive", group.IsActive),
                new SqlParameter("IsSubscribed", group.IsSubscribed)
            };

            SqlHelper.ExecuteReader(Database.sqlConStr, CommandType.StoredProcedure, "TF_UpdateOPCGroups", parameterList);
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
 //删除测点
 public static void RemovePoint(SHHOPCGroup group, SHHOPCItem point)
 {
     group.RemoveItem(point);
     TB_TF_Points.DeletePoints(point.ID);
 }
Exemplo n.º 7
0
 //添加测点
 public static void AddPoint(SHHOPCGroup group, SHHOPCItem point)
 {
     group.AddItem(point);
     TB_TF_Points.AddPoints(point);
 }
Exemplo n.º 8
0
 //修改组
 public static void ModifyGroup(SHHOPCGroup group)
 {
     TB_TF_OPCGroups.UpdateOPCGroups(group);
 }
Exemplo n.º 9
0
        //添加服务端组
        public static void AddGroup(SHHOPCServer server, SHHOPCGroup group)
        {
            server.AddGroup(group);

            TB_TF_OPCGroups.AddOPCGroups(group);
        }