示例#1
0
 /// <summary>
 /// 清除 控制器类 及所控制的门
 /// </summary>
 public void Clear()
 {
     if (axCZKEM1 != null)
     {
         if (blConnoct)
         {
             DisConnect();
         }
         axCZKEM1 = null;
     }
     if (doorInfo != null)
     {
         doorInfo = null;
     }
 }
示例#2
0
        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);
                }
            }
        }
示例#3
0
        /// <summary>
        /// 加载大门 门禁控制器信息
        /// </summary>
        private void LoadWgInfo()
        {
            string    strSql = "select DoorSN,DoorIP,wgPort,DoorName1,DoorName2,WgDoorName3,WgDoorName4 from tb_SysDevice ";
            DataTable dt     = datalogic.GetDataTable(strSql);//wgPort,WgDoorName3,WgDoorName4,UsingFinger,FingerDoorName

            if (dt.Rows.Count > 0)
            {
                int    iSn   = 0;
                string strIp = "";
                int    iPort = 0;
                strIp = dt.Rows[0]["DoorIP"].ToString();
                if (string.IsNullOrEmpty(strIp))
                {
                    if (frmMain.blDebug)
                    {
                        MessageUtil.ShowTips("IC门禁 IP为空");
                    }
                }
                string str = dt.Rows[0]["wgPort"].ToString();
                if (string.IsNullOrEmpty(str))
                {
                    if (frmMain.blDebug)
                    {
                        MessageUtil.ShowTips("IC门禁 端口号为空");
                    }
                }
                else
                {
                    iPort = Convert.ToInt32(str);
                }
                str = dt.Rows[0]["DoorSN"].ToString();
                if (string.IsNullOrEmpty(str))
                {
                    if (frmMain.blDebug)
                    {
                        MessageUtil.ShowTips("IC门禁 SN为空");
                    }
                }
                else
                {
                    iSn = Convert.ToInt32(str);
                }
                wgControl.SetWgIpSnPort(strIp, iPort, iSn);

                if (wgControl.listDoor.Count > 0)
                {
                    wgControl.listDoor.Clear();
                }

                str = dt.Rows[0]["DoorName1"].ToString();//DoorName1,DoorName2,WgDoorName3,WgDoorName4
                if (!string.IsNullOrEmpty(str))
                {
                    clsDoorInfo door = new clsDoorInfo(str, 1);
                    wgControl.listDoor.Add(door);
                }
                str = dt.Rows[0]["DoorName2"].ToString();
                if (!string.IsNullOrEmpty(str))
                {
                    clsDoorInfo door = new clsDoorInfo(str, 2);
                    wgControl.listDoor.Add(door);
                }
                str = dt.Rows[0]["WgDoorName3"].ToString();
                if (!string.IsNullOrEmpty(str))
                {
                    clsDoorInfo door = new clsDoorInfo(str, 3);
                    wgControl.listDoor.Add(door);
                }
                str = dt.Rows[0]["WgDoorName4"].ToString();
                if (!string.IsNullOrEmpty(str))
                {
                    clsDoorInfo door = new clsDoorInfo(str, 4);
                    wgControl.listDoor.Add(door);
                }
            }
            else
            {
                MessageUtil.ShowError("IC门禁控制器未配置,请检查系统设置");
            }
        }