【gofar远为门锁】酒店智能门锁源码 对接收银CyberWinApp-SAAS本地化-未来之窗行业应用跨平台架构

通过写房卡按钮写房卡

一、查看门锁读卡器信息

二、玄武星辰查到对应名称

如何知道自己家门锁的app,使用未来之窗【玄武芯辰】查询

通过上面我看出叫做gofar

在【玄武芯辰】输入gofar,人工智能会提示app信息

三、设置门锁控制app

在上一步找到app,直接在酒店系统重选择控制app

四:门锁代码

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;

using System.Windows.Forms;


using System.IO;
using System.Drawing;

//
using System.Data;
using System.Data.Common;

//引用数据库


//using CyberSnow.VB.NET.Data.Helper;

//
using System.Text.RegularExpressions;

using CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinWeb.WebData;

using System.Runtime.InteropServices;//这是用到DllImport时候要引入的包

//线程
using System.Threading;
 



//酒店门锁
//qujing
namespace CyberPHP_Dynamic
{
    class APP
    {
        byte[] carddata = new byte[128];

      

	 


	 public string start(NameValueCollection obj){
	      string 参数1="";
	       NameValueCollection d=obj;
	       参数1 = d["param1"];

	     string s="随机预安装插件";
	     return s;
	 }

	  public string status(NameValueCollection obj){
	   

	     string s="当你听到设备蜂鸣器,说明设备已经连接";
	     return s;
	 }


	 //退房checking out
	 //入住checking in
	 //检测技术
	 //
	  public string checkingout(NameValueCollection obj){
	     string s="注销卡片";

	       NameValueCollection d=obj;
	      string param = d["param"];
              //解析未来之窗协议
	      CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinProtocol.Cl_CyberWinAPPProtocolPackage clApp = new CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinProtocol.Cl_CyberWinAPPProtocolPackage();
	      clApp.formatString(param);
	       
	     
	      string 酒店标识 = clApp.get("hotelsign");
	      string 通讯端口 = clApp.get("devaddress");
	      Int32  端口= Int32.Parse(通讯端口);
	      //devaddress
	      int ret_hard_打开 = opencomm(端口);
	      if(ret_hard_打开==0){
	      }else{
	          s=s+":失败"+ "设备不存在";
	          return s;
	       }

	         int ret_hard_退房 = deletecard(酒店标识);
		 if(ret_hard_退房==0){
		     s=s+"成功";
		 }else{
		     s=s+":失败"+ ""+ret_hard_退房.ToString();
		 }
		 closecomm();//关闭

	         
		     return s;
	 }


	 // 酒店入住
	 public string checkingin(NameValueCollection obj){
	 string s="酒店入住发卡";

	      NameValueCollection d=obj;
	      string param = d["param"];
              //解析未来之窗协议
	      CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinProtocol.Cl_CyberWinAPPProtocolPackage clApp = new CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinProtocol.Cl_CyberWinAPPProtocolPackage();
	      clApp.formatString(param);
	      // string url=clApp.get("address")+clApp.get("action");
	      string 锁号 = clApp.get("lockno");
	      string 酒店标识 = clApp.get("hotelsign");
	      string 通讯端口 = clApp.get("devaddress");
	      Int32  端口= Int32.Parse(通讯端口);

	      string 卡号 = "0";
	      string 屏蔽前卡标志 = "0";
	      string 退房时间 = clApp.get("checkingouttime");//格式yyMMddHHmm y-m-dHi
	      string 开房时间 = DateTime.Now.ToString("yyyyMMddHHmm");

	        int ret_hard_打开 = opencomm(端口);
	      if(ret_hard_打开==0){
	      }else{
	          s=s+":失败"+ "设备不存在";
	          return s;
	       }

	    string 系列号 = 酒店标识;
            string 门锁状态 = "3";
            string 卡系列号 = 未来之窗随机(5);
            string 房间锁号 = 锁号;

            string 开始时间 =开房时间;
            string 结束时间 = 退房时间;
            string a6 = "00";

	     
            if (房间锁号.Length!=10) {
                MessageBox.Show("锁号必须是10位数字组成"+房间锁号);
		 closecomm();//关闭
                return "锁号必须是10位数字组成"+房间锁号;
            }


            int ret_hard = makecard(门锁状态, 卡系列号, 房间锁号, 开始时间, 结束时间, a6, 系列号);
	   if (ret_hard == 0)
            {
	       s=s+"发宾客卡成功";
	       MessageBox.Show("发宾客卡成功!");
	    }else{
	          s=s+"发宾客卡失败,返回值:"+ret_hard.ToString();
                  MessageBox.Show("发宾客卡失败,返回值:"+ret_hard.ToString());
	    }

	     closecomm();//关闭

 
             

          
 
     

	     
	     return s;
	 }

	 public static string 未来之窗随机(int Length)
        {
            char[] constant =
      {
        '0','1','2','3','4','5','6','7','8','9',
        'A','B','C','D','E','F'};

            System.Text.StringBuilder newRandom = new System.Text.StringBuilder(16);
            Random rd = new Random();
            for (int i = 0; i < Length; i++)
            {
                newRandom.Append(constant[rd.Next(16)]);
            }
            return newRandom.ToString();
        }











	 
	 

 

	 

 

	//日志
	 public static void write_log(string capturetype, string type, string s)
         {
            string logPath = Application.StartupPath + "/log/" + capturetype + "/" + DateTime.Now.ToLongDateString() + "/";
            if (System.IO.Directory.Exists(logPath) == false)
            {
                System.IO.Directory.CreateDirectory(logPath);
            }
            string 文件路径 = logPath + type + "_log.log";

            FileStream fs = new FileStream(文件路径, FileMode.Append);
            StreamWriter sw = new StreamWriter(fs);
            //开始写入
            sw.WriteLine("==============================\r\n" + DateTime.Now.ToLongDateString() + "<<<<<<<<<<<<<<<<<<<<<<<<<<");
            sw.WriteLine(s);
            sw.WriteLine("");
            //清空缓冲区
            sw.Flush();
            //关闭流
            sw.Close();
            fs.Close();
        }



	

       //--------------------
   
        

        [DllImport("门锁厂家模块路径gofar.dll/larkdll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall, EntryPoint = "opencomm")]
        public static extern int opencomm(int iPort);

        [DllImport("门锁厂家模块路径gofar.dll/larkdll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall, EntryPoint = "closecomm")]
        public static extern int closecomm();

        [DllImport("门锁厂家模块路径gofar.dll/larkdll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall, EntryPoint = "deletecard")]
        public static extern int deletecard(string a7);

        [DllImport("门锁厂家模块路径gofar.dll/larkdll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall, EntryPoint = "makecard")]
        public static extern int makecard(string a1, string a2, string a3, string a4, string a5, string a6, string a7);


        [DllImport("门锁厂家模块路径gofar.dll/larkdll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall, EntryPoint = "readcard")]
        public static extern int readcard(ref string a1, string a7);


        [DllImport("门锁厂家模块路径gofar.dll/larkdll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall, EntryPoint = "makec")]
        public static extern int makec(string a1, string a7);

        [DllImport("门锁厂家模块路径gofar.dll/larkdll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall, EntryPoint = "readc")]
        public static extern int readc(string a1, string a7);
      

 
       

	 

    
	 
     }
}

五、扩咱资源配置

<?xml version="1.0" encoding="GBK"?>
<!--  Copyright www.ynwlzc.cn -->
<cyberwin>
	<include>
		<cyber_lib author="cybersnow" path="System.Xml.dll"> </cyber_lib>
		<cyber_lib author="cybersnow" path="{cyberphp_core}/System.Data.dll"></cyber_lib>
		<cyber_lib author="cybersnow" path="{cyberphp_core}/CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.exe"></cyber_lib>
		<cyber_lib author="cybersnow" path="{cyberphp_core}/System.Data.SQLite.DLL"></cyber_lib>
		<cyber_lib author="cybersnow" path="System.Windows.Forms.dll"></cyber_lib>
    </include>
</cyberwin>

五、门锁厂家dll模块,拖到指定位置

将厂家文件放入程序位置

六、如何开通酒店押金原路系统

自己可以注册,不需要他人自己就就能搞定

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值