private void frmPowerManage_Load(object sender, EventArgs e)
        {
            usingWg = frmMain.UsingDoor;
            if (wgControl == null)
            {
                wgControl = new clsWgInfo();
            }
            LoadWgInfo();


            xtraTabControl1.SelectedTabPage = xtraTabPage1;
            AddTreeView("0", (TreeNode)null);
            treeView1.ExpandAll();

            TableInit(dtQueryPower);
            TableInit(dtAddPower);
            TableInit(dtDeletePower);

            ShowDtQuery();
        }
        public void LoadBox()
        {
            try
            {
                #region  工具柜门禁

                string strSql = "select tvChildId,AreaName,PlaceName,DoorIp,DoorSn,BoxHasRfid,BoxRfidMain,wgPort from tb_Tools where  " +
                                "IsArea='" + ToolAreaType.工具柜.ToString() + "' and HasDoor='" + DeviceUsing.启用.ToString() + "'  ";
                DataTable dt = datalogic.GetDataTable(strSql);

                foreach (DataRow datarow in dt.Rows)
                {
                    string strChildId  = datarow["tvChildId"].ToString();
                    string strArea     = datarow["AreaName"].ToString();
                    string strName     = datarow["PlaceName"].ToString();
                    string strIp       = datarow["DoorIp"].ToString();
                    string strPort     = datarow["wgPort"].ToString();
                    string strSn       = datarow["DoorSn"].ToString();
                    string strHasRfid  = datarow["BoxHasRfid"].ToString();
                    string strRfidMain = datarow["BoxRfidMain"].ToString();
                    int    iSn         = 0;
                    int    iPort       = 60000;
                    if (!string.IsNullOrEmpty(strSn))
                    {
                        iSn = Convert.ToInt32(strSn);
                    }
                    else
                    {
                        MessageUtil.ShowTips(strName + " 工具柜门禁SN为空");
                    }
                    if (!string.IsNullOrEmpty(strPort))
                    {
                        iPort = Convert.ToInt32(strPort);
                    }
                    else
                    {
                        MessageUtil.ShowTips(strName + " 工具柜门禁 端口号 为空");
                    }

                    clsWgInfo wgInfo = new clsWgInfo(strIp, iPort, iSn);
                    //wgInfo.StrNameOfWg = strName;
                    //wgInfo.DoorOrBoxDoor = WgDoorType.工具柜;
                    wgInfo.StrChildId = strChildId;
                    clsDoorInfo door = new clsDoorInfo(strName, 1);
                    wgInfo.listDoor.Add(door);
                    listWg.Add(wgInfo);

                    //boxDoor.StrChildId = strChildId;
                    //boxDoor.StrHasRfid = strHasRfid;
                    //boxDoor.StrRfidMain = strRfidMain;
                }
                #endregion
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
        }