一、酒店系统连接身份证阅读器好处
在开房界面,点击读取身份证,可以自动读取姓名,性别,地址,身份证号码
1. 提高办理入住效率
- 传统的手动输入身份证信息繁琐且容易出错,一键读取能够快速准确地获取客人身份信息,减少客人等待时间。例如,在旅游旺季,大量客人涌入酒店,快速的办理入住可以避免大堂拥堵,提升客人的第一印象。
- 让前台工作人员能够更专注于提供优质的服务,而不是花费大量时间在信息录入上。
2. 确保信息准确性
- 避免因手动输入导致的错误,如姓名拼写错误、身份证号码错误等。曾经就有酒店因为手动输入错误的身份证信息,导致与公安系统的信息对接出现问题,给酒店带来了不必要的麻烦。
- 保证客人信息的完整性和一致性,为后续的服务和管理提供可靠的数据基础。
二、查看二代证读卡器信息
三、玄武星辰查到对应名称
知道自己家身份证读卡器,使用未来之窗【玄武芯辰】查询
通过上面我看出叫做CVR-100UC
在【玄武芯辰】输入CVR-100UC,人工智能会提示app信息
四、设置身份证控制app
在上一步找到app,直接在酒店系统重选择控制app
五:CVR100A身份证代码
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;using System.Windows.Forms;using System.Data.SQLite; 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时候要引入的包//故障排查系统查询
namespace CyberPHP_Dynamic
{class APP{private string cyber_db_shopgoods = Application.StartupPath + "/CyberWinPHP/CyberPHP_DataBase/cwpd_local_shopnew.cyberphp";private string 身份证照片保存路径="";public string start(NameValueCollection obj){string 车牌号码="";NameValueCollection d=obj;车牌号码 = d["carNO"];string s="随机预安装插件"+cyber_db_shopgoods;return s;}public string getCardInfo(NameValueCollection obj){NameValueCollection d=obj;string param = d["param"];身份证照片保存路径=param;try{int iPort, iRetUSB = 0;for (iPort = 1001; iPort <= 1016; iPort++){iRetUSB = CVR_InitComm(iPort);if (iRetUSB == 1){break;}}if (iRetUSB == 1){//this.labelOpResult.Text = "初始化成功!";}else{//this.labelOpResult.Text = "初始化失败!";}int authenticate = CVR_Authenticate();if (authenticate == 1){int readContent = CVR_Read_FPContent();if (readContent == 1){//this.labelOpResult.Text = "读卡操作成功!";string ret=FillData();CVR_CloseComm();return ret;}else{//this.labelOpResult.Text = "读卡操作失败!";CVR_CloseComm();return "9";}}else{//MessageBox.Show("");CVR_CloseComm();return "9";}return "操作完成!";}catch (Exception ex){//MessageBox.Show(ex.ToString());//return ex.ToString();return "4";}}public string FillData(){try{string json="";byte[] imgData = new byte[40960];int length = 40960;GetBMPData(ref imgData[0], ref length);MemoryStream myStream = new MemoryStream();for (int i = 0; i < length;i++ ){myStream.WriteByte(imgData[i]);}Image myImage = Image.FromStream(myStream);//照片不要 pictureBoxPhoto.Image = myImage;byte[] name = new byte[128];length = 128;GetPeopleName(ref name[0], ref length);byte[] cnName = new byte[128];length = 128;GetPeopleChineseName(ref cnName[0], ref length);byte[] number = new byte[128];length = 128;GetPeopleIDCode(ref number[0], ref length);byte[] peopleNation = new byte[128];length = 128;GetPeopleNation(ref peopleNation[0], ref length);byte[] peopleNationCode = new byte[128];length = 128;GetNationCode(ref peopleNationCode[0], ref length);byte[] validtermOfStart = new byte[128];length = 128;GetStartDate(ref validtermOfStart[0], ref length);byte[] birthday = new byte[128];length = 128;GetPeopleBirthday(ref birthday[0], ref length);byte[] address = new byte[128];length = 128;GetPeopleAddress(ref address[0], ref length);byte[] validtermOfEnd = new byte[128];length = 128;GetEndDate(ref validtermOfEnd[0], ref length);byte[] signdate = new byte[128];length = 128;GetDepartment(ref signdate[0], ref length);byte[] sex = new byte[128];length = 128;GetPeopleSex(ref sex[0], ref length);byte[] samid = new byte[128];CVR_GetSAMID(ref samid[0]);bool bCivic = true;byte[] certType = new byte[32];length = 32;GetCertType(ref certType[0], ref length);string strType = System.Text.Encoding.ASCII.GetString(certType);int nStart = strType.IndexOf("I");if (nStart != -1) bCivic = false;NameValueCollection data_idobj = new NameValueCollection();if (bCivic){string labelName =System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();;string labelSex =System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();string labelNation = System.Text.Encoding.GetEncoding("GB2312").GetString(peopleNation).Replace("\0", "").Trim();string labelNationCode = System.Text.Encoding.GetEncoding("GB2312").GetString(peopleNationCode).Replace("\0", "").Trim();string labelBirthday = System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();string labelIdCardNo = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();string labelAddress =System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();string labelDepartment = System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();string labelValidDate =System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();string labelSamID = System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();// Bitmap bmp = new Bitmap(myImage);// string 身份证照片保存路径_wj=身份证照片保存路径+"/"+labelIdCardNo+".jpg";//保存到磁盘文件// bmp.Save(身份证照片保存路径_wj, System.Drawing.Imaging.ImageFormat.Jpeg);// bmp.Dispose();byte[] arr = new byte[myStream.Length]; myStream.Position = 0;myStream.Read(arr, 0, (int)myStream.Length); myStream.Close();string photo=Convert.ToBase64String(arr);// return Convert.ToBase64String(arr);json=json+"{";json=json+"\"name\":"+"\""+labelName+"\",";json=json+"\"sex\":"+"\""+labelSex+"\",";json=json+"\"nation\":"+"\""+labelNation+"\",";json=json+"\"birthday\":"+"\""+labelBirthday+"\",";json=json+"\"idcardno\":"+"\""+labelIdCardNo+"\",";json=json+"\"address\":"+"\""+labelAddress+"\",";json=json+"\"department\":"+"\""+labelDepartment+"\",";json=json+"\"validdate\":"+"\""+labelValidDate+"\",";json=json+"\"samiD\":"+"\""+labelSamID+"\",";json=json+"\"photo\":"+"\""+photo+"\"";json=json+"}";data_idobj.Add("name", labelName);data_idobj.Add("sex", labelSex);data_idobj.Add("nation", labelNation);data_idobj.Add("idcardno", labelIdCardNo);data_idobj.Add("address", labelAddress);data_idobj.Add("department", labelDepartment);data_idobj.Add("validdate", labelValidDate);data_idobj.Add("samiD", labelSamID);}else{string labelCnName = "中文姓名:" + System.Text.Encoding.GetEncoding("GB2312").GetString(cnName).Replace("\0", "").Trim();string labelSex = "性别:" + System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();string labelNation = "国籍:" + System.Text.Encoding.GetEncoding("GB2312").GetString(peopleNation).Replace("\0", "").Trim();string labelNationCode = "国籍代码:" + System.Text.Encoding.GetEncoding("GB2312").GetString(peopleNationCode).Replace("\0", "").Trim();string labelBirthday = "出生日期:" + System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();string labelIdCardNo = "证件号码:" + System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();string labelDepartment = "签发机关:" + System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();string labelValidDate = "有效期限:" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();string labelSamID = "安全模块号:" + System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();json=json+"{";/*json=json+"\"name\":"+"\""labelCnName"\",";json=json+"\"sex\":"+"\""labelSex"\",";json=json+"\"nation\":"+"\""labelNationCode"\",";json=json+"\"birthday\":"+"\""labelBirthday"\",";json=json+"\"idcardno\":"+"\""labelIdCardNo"\",";json=json+"\"address\":"+"\""labelDepartment"\",";json=json+"\"validdate\":"+"\""labelValidDate"\",";json=json+"\"samiD\":"+"\""labelSamID"\"";*/json=json+"}";}// json=json+"]";// addFaceCheckPeople(data_idobj);return json;}catch (Exception ex){// MessageBox.Show(ex.ToString());return ex.ToString();}}//人脸进库public string addFaceCheckPeople(NameValueCollection idobj){string dbType = "MSSQL";string[] conn = new string[4];conn[0] =".";conn[1] ="sa";conn[2] ="cybersnow";conn[3] ="FaceCheck";string 未来之窗itime=CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinPC.PHPutility.function.DateTimeToUnixTimeStamp(System.DateTime.Now).ToString();Cyber_DataBase cdb = new Cyber_DataBase(dbType, conn);Cyber_M db_PersonInfo = new Cyber_M("ersonInfo", "P");NameValueCollection data_PersonInfo = new NameValueCollection();//基础信息NameValueCollection data_PersonInfo_D = new NameValueCollection();NameValueCollection data_PowerPerson_Settings = new NameValueCollection();string labelIdCardNo=idobj.Get("idcardno");data_PersonInfo.Add("PersonID",未来之窗itime);data_PersonInfo.Add("PersonName",idobj.Get("name"));data_PersonInfo.Add("Sex","0");//idobj.Get("sex")data_PersonInfo.Add("IdentityNo",idobj.Get("idcardno"));data_PersonInfo.Add("Address",idobj.Get("address"));data_PersonInfo.Add("SubSystem","01000000");data_PersonInfo.Add("BirthDate","2021-01-27 21:14:19.137");//idobj.Get("sex")data_PersonInfo.Add("Telephone","");//idobj.Get("sex")db_PersonInfo.where(" IdentityNo = '"+idobj.Get("idcardno")+"' ");if(db_PersonInfo.Count()>0){// return "已经存在";return "已经存在,全部取消";}else{db_PersonInfo.Add(data_PersonInfo);// return "添加成功";}//门禁信息属性db_PersonInfo.where(" IdentityNo = '"+idobj.Get("idcardno")+"' ");string PersonInfo_ID = db_PersonInfo.GetField("ID");data_PersonInfo_D.Add("PersonInfo_ID",PersonInfo_ID);data_PersonInfo_D.Add("people_identitytype","0");//data_PersonInfo_D.Add("People_IdentityStartDate","2021-01-27 21:14:19.137");//idobj.Get("sex")data_PersonInfo_D.Add("People_IdentityEndDate","2099-01-27 21:14:19.137");//idobj.Get("sex")data_PersonInfo_D.Add("People_IdentityIssue"," ");//data_PersonInfo_D.Add("People_CurrentAddress"," ");//data_PersonInfo_D.Add("People_Nation","0");//data_PersonInfo_D.Add("People_StartDate","2021-01-27 21:14:19.137");//idobj.Get("sex")data_PersonInfo_D.Add("People_EndDate","2099-01-27 21:14:19.137");//idobj.Get("sex")data_PersonInfo_D.Add("People_IdentityImg"," ");//data_PersonInfo_D.Add("People_ShootImg","");//data_PersonInfo_D.Add("People_Type","0");//data_PersonInfo_D.Add("Device_NoArray"," ");//data_PersonInfo_D.Add("People_Delete","0");//data_PersonInfo_D.Add("People_Sync"," ");//data_PersonInfo_D.Add("People_Creater","1");//data_PersonInfo_D.Add("People_CreateTime","2021-01-27 21:14:19.137");//data_PersonInfo_D.Add("People_LastModifier","1");//data_PersonInfo_D.Add("People_LastTime","2021-01-27 21:14:19.137");//data_PersonInfo_D.Add("WhiteGroup","");//data_PersonInfo_D.Add("CompanyName","wenti");//data_PersonInfo_D.Add("DepartMentName","bumenq");//data_PersonInfo_D.Add("People_IdNo","");//data_PersonInfo_D.Add("People_CarNo","");//data_PersonInfo_D.Add("People_QR_Code","");//string 身份证照片保存路径_wj=身份证照片保存路径+"/"+labelIdCardNo+".jpg";data_PersonInfo_D.Add("people_ShootImgPath1",身份证照片保存路径_wj);//data_PersonInfo_D.Add("people_ShootImgPath2","");//data_PersonInfo_D.Add("people_ShootImgPath3","");//data_PersonInfo_D.Add("people_ShootImgPath4","");//data_PersonInfo_D.Add("DownLoadSignal","00000000000000000000000000000000000000000000000000");//data_PersonInfo_D.Add("people_Device","");//data_PersonInfo_D.Add("isVisitorPeople","0");//data_PersonInfo_D.Add("personPhone","");//data_PersonInfo_D.Add("TimeGroupId","0");//data_PersonInfo_D.Add("CompanyID","1");//data_PersonInfo_D.Add("DepartMentID","2");//data_PersonInfo_D.Add("KQGroupID","1");//data_PersonInfo_D.Add("specialTime_Type","0");//data_PersonInfo_D.Add("PersonPwd","");//Cyber_M db_PersonInfo_D = new Cyber_M("ersonInfo_D", "P");string where_pd=" PersonInfo_ID = '"+PersonInfo_ID+"' ";db_PersonInfo_D.where(where_pd);//MessageBox.Show(where_pd+db_PersonInfo_D.getCurrentSQL());int count_pd = db_PersonInfo_D.Count();if(count_pd>0){// return "已经存在";// MessageBox.Show(where_pd+db_PersonInfo_D.getCurrentSQL());}else{// MessageBox.Show(where_pd+db_PersonInfo_D.getCurrentSQL());db_PersonInfo_D.Add(data_PersonInfo_D);// MessageBox.Show("添加后"+db_PersonInfo_D.getCurrentSQL());// return "添加成功";}//门禁权限Cyber_M db_PowerPerson_Settings = new Cyber_M("PowerPerson_Settings", "MJ_");data_PowerPerson_Settings.Add("MJ_Permission_Group_ID","1");data_PowerPerson_Settings.Add("Person_Name",idobj.Get("name"));data_PowerPerson_Settings.Add("Person_No",未来之窗itime);data_PowerPerson_Settings.Add("Person_IdentityNo",labelIdCardNo);db_PowerPerson_Settings.where(" Person_IdentityNo = '"+labelIdCardNo+"' ");if(db_PowerPerson_Settings.Count()>0){// return "已经存在";}else{db_PowerPerson_Settings.Add(data_PersonInfo_D);// return "添加成功";}return "登记成功";}//通用数据库操作public string getCommonData(NameValueCollection obj){NameValueCollection d=obj;string param = d["param"];string dbType = "MSSQL";string[] conn = new string[4];conn[0] =".";conn[1] ="sa";conn[2] ="cybersnow";conn[3] ="FaceCheck";string 未来之窗itime=CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinPC.PHPutility.function.DateTimeToUnixTimeStamp(System.DateTime.Now).ToString();Cyber_DataBase cdb = new Cyber_DataBase(dbType, conn);//门禁权限Cyber_M db_default = new Cyber_M("PowerPerson_Settings", "MJ_");DataTable dt1 = db_default.QueryDataTable(param);string ret = DataTableToJson(dt1);return ret;}public string DataTableToJson(DataTable table){var JsonString = new StringBuilder();if (table.Rows.Count > 0){JsonString.Append("[");for (int i = 0; i < table.Rows.Count; i++){JsonString.Append("{");for (int j = 0; j < table.Columns.Count; j++){if (j < table.Columns.Count - 1){JsonString.Append("\"" + table.Columns[j].ColumnName.ToString() + "\":" + "\"" + table.Rows[i][j].ToString() + "\",");}else if (j == table.Columns.Count - 1){JsonString.Append("\"" + table.Columns[j].ColumnName.ToString() + "\":" + "\"" + table.Rows[i][j].ToString() + "\"");}}if (i == table.Rows.Count - 1){JsonString.Append("}");}else{JsonString.Append("},");}}JsonString.Append("]");}return JsonString.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("Termb.dll", EntryPoint = "CVR_InitComm", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int CVR_InitComm(int Port);//声明外部的标准动态库, 跟Win32API是一样的[DllImport("Termb.dll", EntryPoint = "CVR_Authenticate", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int CVR_Authenticate();[DllImport("Termb.dll", EntryPoint = "CVR_Read_Content", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int CVR_Read_Content(int Active);[DllImport("Termb.dll", EntryPoint = "CVR_Read_FPContent", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int CVR_Read_FPContent();[DllImport("Termb.dll", EntryPoint = "CVR_FindCard", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int CVR_FindCard();[DllImport("Termb.dll", EntryPoint = "CVR_SelectCard", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int CVR_SelectCard();[DllImport("Termb.dll", EntryPoint = "CVR_CloseComm", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int CVR_CloseComm();[DllImport("Termb.dll", EntryPoint = "GetCertType", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int GetCertType(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetPeopleName", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int GetPeopleName(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetPeopleChineseName", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int GetPeopleChineseName(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetPeopleNation", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int GetPeopleNation(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetNationCode", CharSet = CharSet.Ansi, SetLastError = false)]public static extern int GetNationCode(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetPeopleBirthday", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetPeopleBirthday(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetPeopleAddress", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetPeopleAddress(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetPeopleIDCode", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetPeopleIDCode(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetDepartment", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetDepartment(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetStartDate", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetStartDate(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetEndDate", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetEndDate(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "GetPeopleSex", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetPeopleSex(ref byte strTmp, ref int strLen);[DllImport("Termb.dll", EntryPoint = "CVR_GetSAMID", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int CVR_GetSAMID(ref byte strTmp);[DllImport("Termb.dll", EntryPoint = "GetBMPData", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetBMPData(ref byte btBmp, ref int nLen);[DllImport("Termb.dll", EntryPoint = "GetJpgData", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]public static extern int GetJpgData(ref byte btBmp, ref int nLen);}
}
六、扩咱资源配置
<?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><cyber_lib author="cybersnow" path="System.Drawing.dll"></cyber_lib></include>
</cyberwin>
七、身份证读卡器厂家dll模块,拖到指定位置
将厂家文件放入程序位置
八、如何开通酒店押金原路系统和收银系统
自己可以注册,不需要他人自己就就能搞定