コード例 #1
0
 //二代身份证识别触发
 protected virtual void Cvr_GetNewDataEvent(object sender, CvrInfo e)
 {
     if (e.Number.IsNullOrEmpty())
     {
         return;
     }
     //当识别到新身份证,清空之前认证结果
     e.Number.ToSaveLog("新的身份证信息被发现:");
     ClearValue();
     try
     {
         if (CheckRule(e.Number))
         {
             //当识别到新身份证,清空之前认证结果
             var item = IrAdvanced.GetBitmapFromFile(e.PeopleImg);
             if (item != null)
             {
                 FaceFun.TimeStart();
                 Rft2 = Face.FaceTz(item);
                 if (Face.TzIr.ToInt32() == 0)
                 {
                     CvrPass = true;
                 }
                 else
                 {
                     "身份证照片人脸检测失败".ToSaveLog("Cvr_GetNewDataEvent");
                 }
                 FaceFun.TimeStop("读取身份证人脸数据耗时:");
             }
         }
     }
     catch (Exception ex)
     {
         ex.ToSaveLog("BaseFaceView:");
     }
 }
コード例 #2
0
        /// <summary> 读写IC卡 </summary>
        private int CheckICard()
        {
            FaceFun.TimeStart();
            var icInfo = new IdCardFunc.TicketCardInfo();
            int i      = IdCardFunc.GetTicketData_New(ref icInfo);

            if (i == 0)
            {
                if (icInfo.IDCard.IsNullOrEmpty())
                {
                    "读卡成功,但身份证号码为空.".ToSaveLog(); return(1);
                }
                //黑名单检查
                if (IsCheckBlack && FaceFun.IsInBlack(icInfo.IDCard))
                {
                    LeftImg.Visibility = Visibility.Visible;
                }
                //判断是否超过时限
                var now  = DateTime.Now;
                var time = IrAdvanced.StringToDateTime(icInfo.Reserved2);
                if ((time.Year <= now.Year && time.Month <= now.Month && time.Day < now.Day))
                {
                    //读取数据库白名单记录
                    white = FaceFun.CheckWhiteName(icInfo.IDCard);
                    if (white != null)
                    {
                        Bitmap photobitmap = IrAdvanced.GetBitmapFormByte(white.Value.IdCardPhoto);
                        Dispatcher.Invoke(() =>
                        {
                            BitmapImage photoImg = IrAdvanced.GetBitmapImageFormByte(white.Value.IdCardPhoto);
                            CvrImgMain.Source    = CvrImg.Source = photoImg;
                        });
                        Rft2 = Face.FaceTz(photobitmap);
                        if (Face.TzIr.ToInt32() == 0)
                        {
                            icPass = true;
                            ShowEventMsg("正在进行人脸识别", MsgType.Info);
                        }
                        else
                        {
                            ShowEventMsg("无法识别该照片人脸特征码", MsgType.InfoErr);
                        }
                    }
                    else
                    {
                        ShowEventMsg("白名单不存在此年票记录.", MsgType.InfoErr);
                    }
                }
                else
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        ShowEventMsg(string.Format("一天只能入场一次!\n{0}已使用", icInfo.Reserved2), MsgType.InfoErr);
                        MyArea.Text = string.Format("区域:{0}区{1}排{2}座", icInfo.StadiumArea, icInfo.Row, icInfo.Position);
                        MyNum.Text  = "票号:" + icInfo.CardNo;
                        MyType.Text = "类型:年票";
                        MyTime.Text = "时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                        ShowEventMsg("检票失败", MsgType.FaceErr);
                    });
                }
            }
            FaceFun.TimeStop("IC读写耗时:");
            return(i);
        }