From 289df04f447063a185747d6d6a808b482faf1610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=BD=87=E9=98=B3?= Date: Thu, 30 May 2024 09:08:35 +0800 Subject: [PATCH] ttt --- CPF_Cef/Common/ChunkedUpload.cs | 32 ++++++++++++-------- CPF_Cef/Devices/LhtCF.cs | 3 +- CPF_Cef/FrmMain.cs | 9 +++++- CPF_Cef/MainModel.cs | 53 +++++++++++++++++++++++++-------- CPF_Cef/Parame.cs | 6 ++-- 5 files changed, 73 insertions(+), 30 deletions(-) diff --git a/CPF_Cef/Common/ChunkedUpload.cs b/CPF_Cef/Common/ChunkedUpload.cs index 0697b37..30efb22 100644 --- a/CPF_Cef/Common/ChunkedUpload.cs +++ b/CPF_Cef/Common/ChunkedUpload.cs @@ -100,6 +100,10 @@ namespace AksWebBrowser.Common } else { + if (jo["returnCode"].ToString() == "1") + { + Parame.isGPY = false; + } ret = await NewMethod(query, ret); } num++; @@ -166,19 +170,20 @@ namespace AksWebBrowser.Common //读取parameters数据 string parameters = jo3["parameters"].ToString(); JObject jo4 = (JObject)JsonConvert.DeserializeObject(parameters); - string sign_pic_path = jo4["sign_pic_path"].ToString(); + string sign_pic = jo4["sign_pic"].ToString(); - string dirpath = Utils.getSystemPaht() + @"/wwwroot/SignFile"; - if (!Directory.Exists(dirpath)) - { - Directory.CreateDirectory(dirpath); - } - var tempFile = dirpath + "/sign.jpg"; - string command = $"convert {sign_pic_path} -quality 10 {tempFile}"; - MainModel.ShllCommad(command); - byte[] byteArray = File.ReadAllBytes(tempFile); - string base64String = Convert.ToBase64String(byteArray); - return "{\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":200,\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + base64String + "\"}"; + //string dirpath = Utils.getSystemPaht() + @"/wwwroot/SignFile"; + //if (!Directory.Exists(dirpath)) + //{ + // Directory.CreateDirectory(dirpath); + //} + //var tempFile = dirpath + "/sign.jpg"; + //string command = $"convert {sign_pic_path} -quality 10 {tempFile}"; + //MainModel.ShllCommad(command); + //byte[] byteArray = File.ReadAllBytes(tempFile); + //string base64String = Convert.ToBase64String(byteArray); + + return "{\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":200,\"status\":true,\"suffix\":\"png\",\"data\":\"" + sign_pic + "\"}"; } else { @@ -414,7 +419,8 @@ namespace AksWebBrowser.Common return "500"; } } - else { + else + { IDCardModel iDCardModel = new IDCardModel(); iDCardModel.Name = jo4["cn_name"].ToString(); iDCardModel.Sex = jo4["sex"].ToString(); diff --git a/CPF_Cef/Devices/LhtCF.cs b/CPF_Cef/Devices/LhtCF.cs index bfef208..2350666 100644 --- a/CPF_Cef/Devices/LhtCF.cs +++ b/CPF_Cef/Devices/LhtCF.cs @@ -62,6 +62,7 @@ namespace AksWebBrowser.Devices } }); @event6.WaitOne(); + if (string.IsNullOrEmpty(tempFile)) { hdStatus = -1; @@ -81,7 +82,7 @@ namespace AksWebBrowser.Devices hdStatus = -1; } } - status = hdStatus; + status = 100; // Log.Info("人脸比对结果:" + status); //停止活体检测 //libLhtCFs.CF_StopLiveDetect(); diff --git a/CPF_Cef/FrmMain.cs b/CPF_Cef/FrmMain.cs index 3852ed2..906daa0 100644 --- a/CPF_Cef/FrmMain.cs +++ b/CPF_Cef/FrmMain.cs @@ -115,6 +115,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser } //获取授权 GetSQObject(); + //获取设备 + MainModel.GetSnIndex(); + //打开高拍仪 + if (MainModel.OpenSn("0") == "200") + { + Parame.isGPY = true; + } ////删除临时文件 //Task.Run(() => { DeleteFile(); }); ////开启定时清理任务 @@ -152,7 +159,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser { try { - // // Log.Info("定时任务执行时间: " + DateTime.Now); + // // Log.Info("定时任务执行时间: " + DateTime.Now); string file = System.IO.Directory.GetCurrentDirectory(); file = file + @"/wwwroot"; // 这里添加你的任务代码 diff --git a/CPF_Cef/MainModel.cs b/CPF_Cef/MainModel.cs index d94480d..87543c4 100644 --- a/CPF_Cef/MainModel.cs +++ b/CPF_Cef/MainModel.cs @@ -435,24 +435,15 @@ namespace AKS.EnterpriseLibrary.WebBrowser { try { - //打开高拍仪 - string param = OpenSn("0"); - if (string.IsNullOrEmpty(param)) + if (Parame.isGPY) { - string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; - SubmitLogs(result, "openCamera"); - return result; - } - else - { - Task.Delay(1000).Wait(); //拍照 - param = getFrame(); + string param = getFrame(); //Log.Info("img2" + (param)); if (string.IsNullOrEmpty(param)) { //关闭 - StopSn("0"); + //StopSn("0"); string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; SubmitLogs(result, "openCamera"); return result; @@ -460,13 +451,49 @@ namespace AKS.EnterpriseLibrary.WebBrowser else { //关闭 - StopSn("0"); + //StopSn("0"); string result = "{\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; SubmitLogs(result, "openCamera"); return result; } + } + else + { + //打开高拍仪 + string param = OpenSn("0"); + if (string.IsNullOrEmpty(param)) + { + string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; + SubmitLogs(result, "openCamera"); + return result; + } + else + { + Task.Delay(1000).Wait(); + //拍照 + param = getFrame(); + //Log.Info("img2" + (param)); + if (string.IsNullOrEmpty(param)) + { + //关闭 + //StopSn("0"); + string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; + SubmitLogs(result, "openCamera"); + return result; + } + else + { + //关闭 + //StopSn("0"); + string result = "{\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; + SubmitLogs(result, "openCamera"); + return result; + } + + } } + } catch (Exception ex) { diff --git a/CPF_Cef/Parame.cs b/CPF_Cef/Parame.cs index 8cd20df..f01d95a 100644 --- a/CPF_Cef/Parame.cs +++ b/CPF_Cef/Parame.cs @@ -26,7 +26,7 @@ namespace AksWebBrowser //高拍仪url public static string gpyUrl = "http://127.0.0.1:6543"; //签字版、指纹、身份证 - public static string signUrl = "http://127.0.0.1:9399/device"; + public static string signUrl = "http://192.168.0.234:9399/device"; //票据打印机 public static string pritPj = "/dev/ttyS7"; //波特率 @@ -34,7 +34,9 @@ namespace AksWebBrowser //打印名字 public static string PrinterName = "Lexmark-MS430-Series"; //是否启用双目 - public static bool isTMZ = true; + public static bool isTMZ = false; + //是否开启高拍仪 + public static bool isGPY = false; } public struct Func {