protected override void InSession() { try { if (_qrInfo != null) { //写入本地记录并且通知 var info = new SessionsInfo { SessionId = MyMatch.SessionId, CreateDate = DateTime.Now, Name = MyMatch.SessionName, IdNo = BarIdNo, IdCardPhoto = null, TakePhoto = PhotoOk, FaceData = FaceFun.StructToBytes(CameraRft), IdAddress = null, TicketType = 0, TicketNo = _qrInfo.Value.TicketNo, Area = _qrInfo.Value.Area, Row = _qrInfo.Value.Row, Seat = _qrInfo.Value.Seat, TelNo = IrAdvanced.ReadString("TelNo"), TelArea = IrAdvanced.ReadString("TelArea"), BuyName = "", BuyPhoto = null, BuyDate = null, ValidateType = 5, SyncTime = null, Status = 0, Remark = "", UserName = AftUserName, }; if (FaceFun.AddSessions(info) > 0) { Dispatcher.Invoke(() => { MyArea.Text = string.Format("区域:{0}{1}排{2}座", info.Area, info.Row, info.Seat); MyNum.Text = "票号:" + info.TicketNo; MyType.Text = "类型:散票"; MyTime.Text = "时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); ShowEventMsg("检票成功", MsgType.FaceOk); }); } else { ShowEventMsg("检票失败,数据库连接失败", MsgType.TipErr); } } } catch (Exception ex) { ex.ToSaveLog("InSession"); } }
public override void Init() { base.Init(); CameraPic1.Visibility = Visibility.Visible; Title.Text = MyMatch.SessionName; "身份证+人脸识别+散票验证模式".ToSaveLog("【调用模式】:"); _irSeialPort = new IrSerialPort(IrAdvanced.ReadString("BarCodePort")); _irSeialPort.DataReceived += irSeialPort_DataReceived; _irSeialPort.ErrorEvent += (sender, e) => ShowEventMsg(e, MsgType.TipErr); }
/// <summary> 写入数据库 </summary> protected override void InSession() { try { //写入本地记录并且通知 var info = new SessionsInfo { SessionId = MyMatch.SessionId, CreateDate = DateTime.Now, Name = MyMatch.SessionName, IdNo = Cvr.Info.Number, IdCardPhoto = IrAdvanced.ReadBytesFromFile(FaceFun.BaseDir + "\\pic.bmp"), TakePhoto = PhotoOk, FaceData = FaceFun.StructToBytes(CameraRft), IdAddress = Cvr.Info.Address, TicketType = 2, TicketNo = null, Area = null, Row = null, Seat = null, TelNo = IrAdvanced.ReadString("TelNo"), TelArea = IrAdvanced.ReadString("TelArea"), BuyName = Cvr.Info.Name, BuyPhoto = null, BuyDate = null, ValidateType = 1, SyncTime = null, Status = 0, Remark = "", UserName = AftUserName, }; if (FaceFun.AddSessions(info) > 0) { Dispatcher.InvokeAsync(() => { MiniImg.Source = FaceFun.ByteToBitmapImage(PhotoOk); }); base.InSession(); } else { "写入数据库失败".ToSaveLog("入场记录时:"); } } catch (Exception ex) { ex.ToSaveLog("InSession"); } }
public BaseView() { Width = 1280; Height = 800; IdCardFunc.Port = IrAdvanced.ReadString("Port", "", "", "Communication1").ToLower(); IdCardFunc.BeepPort = IrAdvanced.ReadString("BeepPort", "", "", "Communication1").ToLower(); UseWriteList = IrAdvanced.ReadBoolean("Whitelist"); //是否启用白名单验证 UseInSession = IrAdvanced.ReadBoolean("InSession"); //是否启用入场验证避免重复入场 IsIdSame = IrAdvanced.ReadBoolean("IsIdSame"); //散票的身份证号码是否验证必须与所识别身份证号码一致 IsCheckIdNo = IrAdvanced.ReadBoolean("IsCheckIdNo"); IsCheckBlack = IrAdvanced.ReadBoolean("IsCheckBlack"); IsAudio = IrAdvanced.ReadBoolean("IsAudio"); CamSleep = IrAdvanced.ReadInt("CamSleep", 100); //摄像头刷新速率 FaceTimeOut = IrAdvanced.ReadInt("FaceTimeOut", 3000); //人脸识别超时时间 FaceOutCount = FaceTimeOut / CamSleep; }
public override void Init() { try { #region 2019年3月屏蔽检查模块 //base.Init(); #endregion Title.Text = MyMatch.SessionName; "散票验证模式".ToSaveLog("【调用模式】:"); _irSeialPort = new IrSerialPort(IrAdvanced.ReadString("BarCodePort")); _irSeialPort.DataReceived += irSeialPort_DataReceived; _irSeialPort.ErrorEvent += (sender, e) => ShowEventMsg(e, MsgType.TipErr); } catch (Exception ex) { ex.ToSaveLog("OnlyQrView.init:"); } }
public override void Init() { base.Init(); Title.Text = MyMatch.SessionName; "散票兼容IC年卡验证模式".ToSaveLog("【调用模式】:"); //创建线程循环请求IC卡 if (!IdCardFunc.Port.IsNullOrEmpty()) { _icThread = new Thread(OpenIc) { IsBackground = true }; _icThread.Start(); } _irSeialPort = new IrSerialPort(IrAdvanced.ReadString("BarCodePort")); _irSeialPort.DataReceived += irSeialPort_DataReceived; _irSeialPort.ErrorEvent += (sender, e) => ShowEventMsg(e, MsgType.TipErr); }
/// <summary> /// 告警数据上传 /// </summary> public static void InspectTicket(int sessionId, string gameName) { LogManager.WriteLog("告警数据开始上传"); try { string sql = "SELECT id,session_id,buy_name,id_no,id_card_photo,year_ticket_photo,address,status,remark from black_names where session_id = '" + sessionId + "' and isupload = 0"; DataTable dataTable = MySqlDBHelper.ExecuteDataTable(entranceCon, sql); InspectTicket inspectTicket = new InspectTicket() { verification = verification, dataVoList = new List <InspectTicketInfo>() }; foreach (DataRow item in dataTable.Rows) { inspectTicket.dataVoList.Add(new InspectTicketInfo() { taskId = serverGameName, warningTime = DateTime.Now, warningPosition = IrAdvanced.ReadString("TelArea"), ticketWarningType = 1, ticketNo = item["id"].ToString(), ticketHolderIdCardNo = item["id_no"].ToString(), ticketHolderName = item["buy_name"].ToString(), entranceFacePic = item["remark"].ToString() }); } string url = URL + "/api/inspectTicket"; string data = JsonConvert.SerializeObject(inspectTicket); LogManager.WriteLog("告警上传数据:" + data); string msg = PoliceDataFactory.HttpPost(url, data, null); LogManager.WriteLog("告警数据上传完成"); LogManager.WriteLog("告警数据上传返回结果:" + msg); LogManager.WriteLog("更新上传数据状态"); string updatesql = "update black_names set isupload=1 where session_id = '" + sessionId + "'"; MySqlDBHelper.ExecuteNonQuery(PoliceDataFactory.entranceCon, CommandType.Text, updatesql); } catch (Exception ex) { LogManager.WriteLog("检票数据上传异常" + ex.Message); } }
/// <summary> 写入本地记录并且通知 </summary> protected override void InSession() { //写入本地记录并且通知 var info = new SessionsInfo { SessionId = MyMatch.SessionId, CreateDate = DateTime.Now, Name = MyMatch.SessionName, IdNo = Cvr.Info.Number, IdCardPhoto = IrAdvanced.ReadBytesFromFile(FaceFun.BaseDir + "\\pic.bmp"), TakePhoto = PhotoOk, FaceData = FaceFun.StructToBytes(CameraRft), IdAddress = Cvr.Info.Address, TicketType = 0, TicketNo = _qrInfo.Value.TicketNo, Area = _qrInfo.Value.Area, Row = _qrInfo.Value.Row, Seat = _qrInfo.Value.Seat, TelNo = IrAdvanced.ReadString("TelNo"), TelArea = IrAdvanced.ReadString("TelArea"), BuyName = Cvr.Info.Name, BuyPhoto = null, BuyDate = null, ValidateType = 3, SyncTime = null, Status = 0, Remark = "", UserName = AftUserName, }; if (FaceFun.AddSessions(info) > 0) { ShowEventMsg("检票成功", MsgType.FaceOk); } else { "写入数据库失败".ToSaveLog("入场记录时:"); ShowEventMsg("检票失败", MsgType.FaceErr); } }
/// <summary> 条码扫描枪 </summary> protected bool TestQr() { try { var spProjector = new SerialPort(IrAdvanced.ReadString("BarCodePort")) { BaudRate = 115200, //波特率 DataBits = 8, //数据位 StopBits = StopBits.One, //停止位 Parity = Parity.None //校检位 }; spProjector.Open(); var r = spProjector.IsOpen; spProjector.Close(); spProjector.Dispose(); return(r); } catch (Exception ex) { return(false); } }
/// <summary> 写入数据库 </summary> protected override void InSession() { try { //写入本地记录并且通知 var info = new SessionsInfo { SessionId = MyMatch.SessionId, CreateDate = DateTime.Now, Name = MyMatch.SessionName, IdNo = Cvr.Info.Number, IdCardPhoto = IrAdvanced.ReadBytesFromFile(FaceFun.BaseDir + "\\pic.bmp"), TakePhoto = PhotoOk, FaceData = FaceFun.StructToBytes(CameraRft), IdAddress = Cvr.Info.Address, TicketType = 2, TicketNo = null, Area = null, Row = null, Seat = null, TelNo = IrAdvanced.ReadString("TelNo"), TelArea = IrAdvanced.ReadString("TelArea"), BuyName = Cvr.Info.Name, BuyPhoto = null, BuyDate = null, ValidateType = 1, SyncTime = null, Status = 0, Remark = "", UserName = AftUserName, }; AFT_System.Face.FaceFun.AddSessions(info); } catch (Exception ex) { ex.ToSaveLog("InSession"); } }
/// <summary> 读写IC卡 </summary> private int CheckICard() { FaceFun.TimeStart(); var icInfo = new IdCardFunc.TicketCardInfo(); int i = IdCardFunc.GetTicketData_New(ref icInfo); if (i == 0) { if (IsIdSame && (Cvr.Info.Number != icInfo.IDCard)) { ShowEventMsg("身份证号码与票面不符合!", MsgType.Info); } else { tempTime = DateTime.Now; //检查白名单验证 if (!CheckWhite(icInfo.IDCard)) { return(1); } //写入本地记录并且通知 var info = new SessionsInfo { SessionId = MyMatch.SessionId, CreateDate = DateTime.Now, Name = MyMatch.SessionName, IdNo = icInfo.IDCard, IdCardPhoto = IrAdvanced.ReadBytesFromFile(FaceFun.BaseDir + "\\pic.bmp"), TakePhoto = PhotoOk, FaceData = FaceFun.StructToBytes(CameraRft), IdAddress = "", TicketType = 1, TicketNo = icInfo.CardNo, Area = icInfo.StadiumArea, Row = icInfo.Row, Seat = icInfo.Position, TelNo = IrAdvanced.ReadString("TelNo"), TelArea = IrAdvanced.ReadString("TelArea"), BuyName = icInfo.Name, BuyPhoto = null, BuyDate = null, ValidateType = 2, SyncTime = null, Status = 0, Remark = "", UserName = AftUserName, }; if (FaceFun.AddSessions(info) > 0) { Dispatcher.InvokeAsync(() => { ShowEventMsg("检票成功", MsgType.FaceOk); MyArea.Text = string.Format("区域:{0}{1}排{2}座", info.Area, info.Row, info.Seat); MyNum.Text = "票号:" + info.TicketNo; MyType.Text = "类型:年票"; MyTime.Text = "时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); }); } } } else if (i == 16) { i.ToString().ToSaveLog("已刷卡:"); var str = (tempTime == null) ? "拒绝入场" : string.Format("{0}入场", tempTime); ShowEventMsg("一天只能入场一次!\n" + str, MsgType.InfoErr); ShowEventMsg("检票失败", MsgType.FaceErr); Thread.Sleep(500); } else if (i == 1) //未放卡 { tempTime = null; } else { i.ToString().ToSaveLog("IC卡读卡失败:"); Thread.Sleep(300); } FaceFun.TimeStop("IC读写耗时:"); return(i); }
/// <summary>窗体初始并初始数据</summary> public LoginWindow() { InitializeComponent(); //必要环境初始化 MysqlHelper.ConnStr = string.Format("Data Source={0};Database={1};User ID=root;Password=root;SslMode=None;", IrAdvanced.ReadString("ServerIp"), IrAdvanced.ReadString("DbName")); FaceFun.BaseDir = AppDomain.CurrentDomain.BaseDirectory; //初始化基础数据 IrAdvanced.InitBaseData("AFT_SYSTEM"); //是否调试状态 Cursor = IrAdvanced.IsDebug ? Cursors.Arrow : Cursors.None; //是否置顶 //Topmost = !IrAdvanced.IsDebug; if (IrAdvanced.ReadBoolean("UpData")) { IrAdvanced.RunApp(AppDomain.CurrentDomain.BaseDirectory + "updata.exe"); } }
/// <summary> 读写IC卡 </summary> private int CheckICard() { try { "准备请求读卡".ToSaveLog("CheckIcard:"); FaceFun.TimeStart(); var icInfo = new IdCardFunc.TicketCardInfo(); int i = IdCardFunc.GetTicketData_New(ref icInfo); if (i == 0) { tempTime = DateTime.Now; icInfo.IDCard.ToSaveLog("读取到IC卡:"); //判断是否超过时限 if (!icInfo.IDCard.IsNullOrEmpty()) { Dispatcher.Invoke(() => MyIdNo.Text = icInfo.IDCard); } var flag = true; Dispatcher.Invoke(() => { //黑名单检查 if (IsCheckBlack && FaceFun.IsInBlack(MyIdNo.Text)) { LeftImg.Visibility = Visibility.Visible; } if (IsCheckIdNo && MyIdNo.Text.IsNullOrEmpty()) { flag = false; } }); if (!flag) { ShowEventMsg("请录入身份证号码.", MsgType.TipErr); return(1); } //检查白名单验证 if (!CheckWhite(icInfo.IDCard)) { return(1); } PhotoOk = null; lock (Obj) { if (MyCapture != null) { "拍照获取Photo.".ToSaveLog(""); using (var myMap = MyCapture.QueryFrame()) { if (myMap != null) { PhotoOk = FaceFun.BitmapToByte(myMap.Bitmap); } else { "未取得摄像头Mat数据".ToSaveLog("OnlyQrView.BarCode_OnKeyUp:"); } } } } //写入本地记录并且通知 var info = new SessionsInfo { SessionId = MyMatch.SessionId, CreateDate = DateTime.Now, Name = MyMatch.SessionName, IdNo = icInfo.IDCard, IdCardPhoto = null, TakePhoto = PhotoOk, FaceData = null, IdAddress = "", TicketType = 1, TicketNo = icInfo.CardNo, Area = icInfo.StadiumArea, Row = icInfo.Row, Seat = icInfo.Position, TelNo = IrAdvanced.ReadString("TelNo"), TelArea = IrAdvanced.ReadString("TelArea"), BuyName = icInfo.Name, BuyPhoto = null, BuyDate = null, ValidateType = 4, SyncTime = null, Status = 0, Remark = "", UserName = AftUserName, }; if (FaceFun.AddSessions(info) > 0) { Dispatcher.Invoke(() => { MyArea.Text = string.Format("区域:{0}区{1}排{2}座", info.Area, info.Row, info.Seat); MyNum.Text = "票号:" + info.TicketNo; MyType.Text = "类型:年票"; MyTime.Text = "时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); }); ShowEventMsg("检票成功", MsgType.FaceOk); Thread.Sleep(500); } FaceFun.TimeStop("IC读写耗时:"); } else if (i == 16) { i.ToString().ToSaveLog("已刷卡:"); var str = (tempTime == null) ? "拒绝入场" : string.Format("{0}入场", tempTime); ShowEventMsg("一天只能入场一次!\n" + str, MsgType.FaceErr); Thread.Sleep(500); } else if (i == 1) //未放卡 { tempTime = null; } else { i.ToString().ToSaveLog("IC卡读卡失败:"); Thread.Sleep(300); } icPass = false; return(i); } catch (Exception ex) { ex.ToSaveLog("CheckICard失败:"); } icPass = false; return(0); }