通过房态写房卡
通过写房卡按钮写房卡
一、查看门锁读卡器信息
二、玄武星辰查到对应名称
如何知道自己家门锁的app,使用未来之窗【玄武芯辰】查询
通过上面我看出叫做D801
在【玄武芯辰】输入D801,人工智能会提示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];
private string 身份证照片保存路径="";
public string start(NameValueCollection obj){
string 参数1="";
NameValueCollection d=obj;
参数1 = d["param1"];
string s="随机预安装插件";
return s;
}
public string status(NameValueCollection obj){
Buzzer(1, 50);//蜂鸣器
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");
int st;
byte[] sa1 = new byte[256 + 1];
if (!rdCard())
{
return "读卡失败";
}
// 先读卡
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
st = CardErase(1, Convert.ToInt32(酒店标识), sa1);
string 未来之窗 = Encoding.ASCII.GetString(sa1);
// edt_CardData.Text = 未来之窗;
Cursor.Current = System.Windows.Forms.Cursors.Default;
if (st != 0)
{
System.Windows.Forms.MessageBox.Show(("注销失败" + '\n' + (st).ToString() as string), "提示", System.Windows.Forms.MessageBoxButtons.OK);
s=s+":注销失败"+ st.ToString();
}
else
{
// System.Windows.Forms.MessageBox.Show("注销成功", "提示", System.Windows.Forms.MessageBoxButtons.OK );
s=s+":成功";
}
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 屏蔽前卡标志 = "0";
string 退房时间服务器 = clApp.get("checkingouttime");//格式yyMMddHHmm y-m-dHi
int st;
byte llock;
byte[] sa1 = new byte[256 + 1];
if (!rdCard())
{
return "读卡失败";
}
// 先读卡
// 退房时间
// DateTimePicker1.Value = DateTimePicker2.Value;
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
// 酒店标识
// DAI
//@ Unsupported function or procedure: 'FormatDateTime'
// 发卡时间
//@ Unsupported function or procedure: 'FormatDateTime'
// 退房时间
// 锁号
string edt_Dai = "1";
char[] 锁号 = new char[6];
char[] 开房时间 = new char[10];
char[] 退房时间 = new char[10];
if (锁号服务器.Length < 6){
System.Windows.Forms.MessageBox.Show("锁号长度错误="+锁号服务器, "提示", System.Windows.Forms.MessageBoxButtons.OK );
return "";
}
for (int i = 0; i < 6; i++)
{
锁号[i] = Convert.ToChar(锁号服务器.Substring(i, 1));
}
string 开房时间s =System.DateTime.Now.ToString("yyMMddHHmm");// "2205220101";// FormatDateTime("YYMMDDHHMM", DateTime.Now);
//2024-7-28 门锁格式
// System.Windows.Forms.MessageBox.Show("退房时间服务器="+退房时间服务器, "提示", System.Windows.Forms.MessageBoxButtons.OK );
// DateTime 退房时间服务器time = DateTime.Parse(退房时间服务器);
// 退房时间服务器 = 退房时间服务器time.ToString("yyMMddHHmm");
// System.Windows.Forms.MessageBox.Show("退房时间服务器2="+退房时间服务器, "提示", System.Windows.Forms.MessageBoxButtons.OK );
string 退房时间S = 退房时间服务器;//txt_退房时间.Text;// FormatDateTime("YYMMDDHHMM", DateTime.Now);
for (int i = 0; i < 10; i++)
开房时间[i] = Convert.ToChar(开房时间s.Substring(i, 1));
for (int i = 0; i < 10; i++)
退房时间[i] = Convert.ToChar(退房时间S.Substring(i, 1));
// byte dai;
byte dai;
dai = Convert.ToByte("1");
st = GuestCard(1, Convert.ToInt32(酒店标识), 0, dai, 0, 0, 开房时间, 退房时间, 锁号, sa1);
// 返回 卡数据
string 未来之窗 = Encoding.ASCII.GetString(sa1);
// edt_CardData.Text = 未来之窗;
Cursor.Current = System.Windows.Forms.Cursors.Default;
if (st != 0)
{
System.Windows.Forms.MessageBox.Show(("调用发卡函数失败" + '\n' + (st).ToString() as string), "提示", System.Windows.Forms.MessageBoxButtons.OK );
s=s+"调用发卡函数失败";
}
else
{
// System.Windows.Forms.MessageBox.Show("制卡后,请调用读卡函数,数据一致才是真正的制卡成功!", "调用发卡函数成功", System.Windows.Forms.MessageBoxButtons.OK );
s=s+"发卡成功";
}
return s;
}
//读取标识
public string getsign(NameValueCollection obj){
int i;
string 酒店标识 , s,s2;
if (!rdCard())
{
return "读卡失败";
}
// 先读卡
string 未来之窗 = Encoding.ASCII.GetString(bufCard);
// edt_CardData.Text = 未来之窗;// bufCard as string;
//@ Unsupported function or procedure: 'copy'
if (Copy(bufCard, 25, 8) == "FFFFFFFF")
{
System.Windows.Forms.MessageBox.Show("此卡是空白卡,请换一张能开门的卡", "提示", System.Windows.Forms.MessageBoxButtons.OK );
return "此卡是空白卡,请换一张能开门的卡";
}
//@ Unsupported function or procedure: 'copy'
s = Copy(bufCard, 11, 4);
i = Convert.ToInt32( s,16) % 16384;
//@ Unsupported function or procedure: 'copy'
s2 = Copy(bufCard, 9, 2);
i = i + (Convert.ToInt32( s, 16) * 65536);
// i = Convert.ToInt32(coid.Substring(0, 2), 16) * 65536 + Convert.ToInt32(coid.Substring(2, 4), 16) % 16383;
int i2 = Convert.ToInt32(Copy(bufCard, 9, 2), 16) * 65536 + Convert.ToInt32(Copy(bufCard, 11, 4), 16) % 16383;
酒店标识 = (i2).ToString();
return 酒店标识;
}
//日志
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();
}
//--------------------
//门锁专用参数
// Private declarations
private bool rdCard()
{
bool result;
int st;
result = false;
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
st = ReadCard(1, bufCard);
if (st != 0)
{
if (st == 1)
{
System.Windows.Forms.MessageBox.Show(("请放一张卡在发卡器上面," + '\n' + "确保 门锁软件 可以正常发卡,然后调试接口" + '\n' + bufCard as string), "读卡失败(返回值=1)", System.Windows.Forms.MessageBoxButtons.OK );
}
else
{
System.Windows.Forms.MessageBox.Show(("读卡失败" + '\n' + (st).ToString() as string), "提示");
//System.Windows.Forms.MessageBoxButtons.OK + System.Windows.Forms.MessageBoxIcon.Error);
}
goto Exit_rdCard; //@ Unsupport goto
}
//@ Unsupported function or procedure: 'copy'
if (Copy(bufCard, 5, 2) != "01")
{
System.Windows.Forms.MessageBox.Show(("发卡器的感应区无卡" + '\n' + bufCard as string), "提示");
//System.Windows.Forms.MessageBoxButtons.OK + System.Windows.Forms.MessageBoxIcon.Warning);
goto Exit_rdCard; //@ Unsupport goto
}
result = true;
Exit_rdCard:
Cursor.Current = System.Windows.Forms.Cursors.Default;
return result;
}
public string Copy(byte[] 字符串, int 开始, int 长度)
{
string 完整 = "";
for (int i = 0; i < 字符串.Length; i++)
{
完整 = 完整 + ((char)字符串[i]).ToString();
}
// textBox1.Text = 完整;
if (开始 < 1)
{
开始 = 1;
}
string 返回= 完整.Substring(开始-1, 长度);
return 返回;
}
public static byte[] bufCard = new byte[128 + 1];
public static int st = 0;
[DllImport("门锁厂家模块路径.dll")]
public static extern int GetDLLVersion(byte[] sDllVer);
[DllImport("门锁厂家模块路径.dll")]
public static extern int initializeUSB(byte fUSB);
[DllImport("门锁厂家模块路径.dll")]
public static extern void CloseUSB(byte fUSB);
[DllImport("门锁厂家模块路径.dll")]
public static extern int Buzzer(byte fUSB, int t);
[DllImport("门锁厂家模块路径.dll")]
public static extern int ReadCard(byte fUSB, byte[] Buffer);
[DllImport("门锁厂家模块路径.dll")]
public static extern int ReadCardID_T5557(byte fUSB, byte[] Buffer);
[DllImport("门锁厂家模块路径.dll")]
public static extern int GuestCard(byte fUSB, int dlsCoID, byte CardNo, byte dai, byte llock, byte pdoors, char[] BDate, char[] EDate, char[] RoomNo, byte[] CardHexStr);
[DllImport("门锁厂家模块路径.dll")]
public static extern int LimitCard(byte fUSB, int dlsCoID, byte CardNo, byte dai, string BDate, string LCardNo, string CardHexStr);
[DllImport("门锁厂家模块路径.dll")]
public static extern int CardErase(byte fUSB, int dlsCoID, byte[] cardHexStr);
[DllImport("门锁厂家模块路径.dll")]
public static extern int hex_a(string hex, string asc, int hLen);
[DllImport("门锁厂家模块路径.dll")]
public static extern int a_hex(string asc, string hex, int aLen);
[DllImport("门锁厂家模块路径.dll")]
public static extern int GetCardTypeByCardDataStr(string cardHexStr, string CardType);
[DllImport("门锁厂家模块路径.dll")]
public static extern int GetGuestLockNoByCardDataStr(int dlsCoID, string cardHexStr, string LockNo);
[DllImport("门锁厂家模块路径.dll")]
public static extern int GetGuestETimeByCardDataStr(int dlsCoID, byte[] cardHexStr, byte[] eTime);
[DllImport("门锁厂家模块路径.dll")]
public static extern int ReadRecord(byte fUSB, string bufData);
[DllImport("门锁厂家模块路径.dll")]
public static extern int GetOpenRecordByDataStr(string DataStr, string sOpen);
}
}
五、扩咱资源配置
<?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模块,拖到指定位置
将厂家文件放入程序位置
到此就可以通过按钮调用门锁
六、如何开通酒店押金原路系统
自己可以注册,不需要他人自己就就能搞定