Esempio n. 1
0
 /// <summary>
 /// 开闸动作
 /// </summary>
 /// <param name="SN"></param>
 /// <returns></returns>
 public static int OpenDoor(string Ip, int Port, string SN)
 {
     using (wgMjController wgMjController1 = new wgMjController())
     {
         wgMjController1.IP           = Ip;
         wgMjController1.PORT         = Port;
         wgMjController1.ControllerSN = Int32.Parse(SN);
         return(wgMjController1.RemoteOpenDoorIP(1));
     }
 }
Esempio n. 2
0
 private void sbtnOpenBox_Click(object sender, EventArgs e)
 {
     sbtnOpenBox.Enabled = false;
     if (treeView1.SelectedNode != null)
     {
         string    strChildId = treeView1.SelectedNode.Name.ToString();
         string    strName    = treeView1.SelectedNode.Text.ToString();
         string    strSql     = "select IsArea,HasDoor,DoorIp,DoorSn from tb_Tools where tvChildId='" + strChildId + "'";
         DataTable dt         = datalogic.GetDataTable(strSql);
         if (dt.Rows.Count > 0)
         {
             string str = dt.Rows[0]["IsArea"].ToString();
             if (str != ToolAreaType.工具柜.ToString())
             {
                 MessageUtil.ShowError("请选择工具柜,开柜门");
                 sbtnOpenBox.Enabled = true;
                 return;
             }
             str = dt.Rows[0]["HasDoor"].ToString();
             if (str != DeviceUsing.启用.ToString())
             {
                 MessageUtil.ShowError(strName + " 工具柜未启用门禁功能");
                 sbtnOpenBox.Enabled = true;
                 return;
             }
             string strIp = dt.Rows[0]["DoorIp"].ToString();
             string strSn = dt.Rows[0]["DoorSn"].ToString();
             if (string.IsNullOrEmpty(strIp) || string.IsNullOrEmpty(strSn))
             {
                 MessageUtil.ShowError(strName + " 工具柜门禁控制器IP或SN为空,请重新设置");
                 sbtnOpenBox.Enabled = true;
                 return;
             }
             else
             {
                 int iSn = Convert.ToInt32(strSn);
                 wgMjController.ControllerSN = iSn;
                 wgMjController.IP           = strIp;
                 if (wgMjController.RemoteOpenDoorIP(1) > 0)
                 {
                     MessageUtil.ShowTips(strName + " 开柜门成功!");
                 }
                 else
                 {
                     MessageUtil.ShowError(strName + " 开柜门失败,请检查网络或控制器");
                 }
                 sbtnOpenBox.Enabled = true;
             }
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 开闸动作
 /// </summary>
 /// <param name="SN"></param>
 /// <returns></returns>
 public void OpenDoor(string Ip, int Port, string SN)
 {
     using (wgMjController wgMjController1 = new wgMjController())
     {
         wgMjController1.IP           = Ip;
         wgMjController1.PORT         = Port;
         wgMjController1.ControllerSN = Int32.Parse(SN);
         if (wgMjController1.RemoteOpenDoorIP(1) > 0)
         {
             _Log.logInfo.Info(string.Format("Open {0} Door Success", SN));
             SetMessageAction?.Invoke(string.Format("Open {0} Door Success", SN));
         }
         else
         {
             _Log.logInfo.Info(string.Format("Open {0} Door Failed", SN));
             SetMessageAction?.Invoke(string.Format("Open {0} Door Failed", SN));
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 开门 门号
        /// </summary>
        /// <param name="iDoorNo"></param>
        /// <returns></returns>
        public bool OpenDoor(int iDoorNo)
        {
            if (wgController == null)
            {
                wgController = new wgMjController();
                wgController.ControllerSN = (int)intSn;
                wgController.PORT         = 60000;
                wgController.IP           = strIp;
            }
            bool blRet = false;

            if (wgController.RemoteOpenDoorIP(1) > 0)
            {
                blRet = true;
            }
            else
            {
                blRet = false;
            }
            return(blRet);
        }