diff --git a/CPF_Cef/Common/COMUtils.cs b/CPF_Cef/Common/COMUtils.cs index 60ed1a9..d60a9e7 100644 --- a/CPF_Cef/Common/COMUtils.cs +++ b/CPF_Cef/Common/COMUtils.cs @@ -210,7 +210,7 @@ namespace AKSWebBrowser.Common } catch (Exception ex) { - Log.Error("关闭异常: " + ex.Message + ""); + //Log.Error("关闭异常: " + ex.Message + ""); } } diff --git a/CPF_Cef/Common/ChunkedUpload.cs b/CPF_Cef/Common/ChunkedUpload.cs index 39db7d8..6ee5d5d 100644 --- a/CPF_Cef/Common/ChunkedUpload.cs +++ b/CPF_Cef/Common/ChunkedUpload.cs @@ -85,7 +85,7 @@ namespace AksWebBrowser.Common } catch (HttpRequestException e) { - Log.Error(" get请求: " + e.Message); + //Log.Error(" get请求: " + e.Message); } } return ret; @@ -130,7 +130,7 @@ namespace AksWebBrowser.Common } else { - Log.Error("请求签字失败" + jo["message"].ToString()); + //Log.Error("请求签字失败" + jo["message"].ToString()); return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}"; } } @@ -153,7 +153,7 @@ namespace AksWebBrowser.Common } catch (Exception ex) { - Log.Error("签字异常:" + ex.Message); + //Log.Error("签字异常:" + ex.Message); return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字异常" + "\"}"; } } diff --git a/CPF_Cef/Common/Log.cs b/CPF_Cef/Common/Log.cs index 4d6f69f..923591c 100644 --- a/CPF_Cef/Common/Log.cs +++ b/CPF_Cef/Common/Log.cs @@ -26,26 +26,30 @@ namespace AKSWebBrowser.Commen { streamWriter = !File.Exists(directPath) ? File.CreateText(directPath) : File.AppendText(directPath); } - streamWriter.WriteLine("***********************************************************************"); - streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss")); - streamWriter.WriteLine("输出信息:错误信息"); - if (message != null) + else { + streamWriter.WriteLine("***********************************************************************"); + streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss")); + streamWriter.WriteLine("输出信息:错误信息"); streamWriter.WriteLine("异常信息:\r\n" + message); } } catch { } finally { - if (streamWriter != null) + try { - streamWriter.Flush(); if (streamWriter != null) { - streamWriter.Dispose(); - streamWriter = null; + streamWriter.Flush(); + if (streamWriter != null) + { + streamWriter.Dispose(); + streamWriter = null; + } } } + catch (Exception) { } } } @@ -64,26 +68,30 @@ namespace AKSWebBrowser.Commen { try { streamWriter = !File.Exists(directPath) ? File.CreateText(directPath) : File.AppendText(directPath); } catch { } finally { } } - streamWriter.WriteLine("***********************************************************************"); - streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss")); - streamWriter.WriteLine("输出信息:信息"); - if (message != null) + else { + streamWriter.WriteLine("***********************************************************************"); + streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss")); + streamWriter.WriteLine("输出信息:信息"); streamWriter.WriteLine("信息:\r\n" + message); } } catch { } finally { - if (streamWriter != null) + try { - streamWriter.Flush(); if (streamWriter != null) { - streamWriter.Dispose(); - streamWriter = null; + streamWriter.Flush(); + if (streamWriter != null) + { + streamWriter.Dispose(); + streamWriter = null; + } } } + catch (Exception) { } } } } diff --git a/CPF_Cef/Common/Utils.cs b/CPF_Cef/Common/Utils.cs index 38845b7..2822969 100644 --- a/CPF_Cef/Common/Utils.cs +++ b/CPF_Cef/Common/Utils.cs @@ -41,7 +41,7 @@ namespace AksWebBrowser.Common // 确保文件夹路径是完整的,并且文件夹存在 if (!Directory.Exists(folderPath)) { - Log.Error("未找到删除临时目录"); + //Log.Error("未找到删除临时目录"); } // 获取文件夹内所有文件,包括子文件夹内的文件 diff --git a/CPF_Cef/Devices/Fingerprint.cs b/CPF_Cef/Devices/Fingerprint.cs index b36fd57..0489c96 100644 --- a/CPF_Cef/Devices/Fingerprint.cs +++ b/CPF_Cef/Devices/Fingerprint.cs @@ -32,28 +32,28 @@ namespace AksWebBrowser.Devices init = LibFingerprint.LIVESCAN_Init(); if (init == 1) { - Log.Info("初始化指纹成功"); + // Log.Info("初始化指纹成功"); td = LibFingerprint.LIVESCAN_GetChannelCount(); if (td > 0) { - Log.Info("获得采集器通道数量成功"); + // Log.Info("获得采集器通道数量成功"); int pnBright = 254; int status = LibFingerprint.LIVESCAN_GetBright(td, ref pnBright); - Log.Info(" 获得采集器当前的亮度:" + status); - Log.Info(" 获得采集器当前的亮度:" + pnBright); + // Log.Info(" 获得采集器当前的亮度:" + status); + // Log.Info(" 获得采集器当前的亮度:" + pnBright); int pnContrast = 254; status = LibFingerprint.LIVESCAN_GetContrast(td, ref pnContrast); - Log.Info(" 获得采集器当前对比度:" + status); - Log.Info(" 获得采集器当前对比度:" + pnBright); + // Log.Info(" 获得采集器当前对比度:" + status); + // Log.Info(" 获得采集器当前对比度:" + pnBright); int pnWidth = 0, pnHeight = 0; status = LibFingerprint.LIVESCAN_GetMaxImageSize(td, ref pnWidth, ref pnHeight); - Log.Info(" 获得采集器采集图像的宽度、高度的最大值:" + status); - Log.Info(" 获得采集器采集图像的宽度、高度的最大值:" + pnWidth + "*" + pnHeight); + // Log.Info(" 获得采集器采集图像的宽度、高度的最大值:" + status); + // Log.Info(" 获得采集器采集图像的宽度、高度的最大值:" + pnWidth + "*" + pnHeight); byte[] pszDesc = new byte[1024]; status = LibFingerprint.LIVESCAN_GetDesc(pszDesc); - Log.Info("获得接口规范的说明:" + status); - Log.Info("获得接口规范的说明返回数据:" + Encoding.UTF8.GetString(pszDesc)); + // Log.Info("获得接口规范的说明:" + status); + // Log.Info("获得接口规范的说明返回数据:" + Encoding.UTF8.GetString(pszDesc)); MessageBox.Show("转变采集"); @@ -66,7 +66,7 @@ namespace AksWebBrowser.Devices } else { - Log.Info("获得采集器通道数量失败"); + // Log.Info("获得采集器通道数量失败"); } Task.Run(() => { @@ -75,7 +75,7 @@ namespace AksWebBrowser.Devices } else { - Log.Info("初始化指纹失败,错误代码:" + init); + // Log.Info("初始化指纹失败,错误代码:" + init); } } catch (Exception ex) @@ -87,7 +87,7 @@ namespace AksWebBrowser.Devices LibFingerprint.LIVESCAN_Close(); }); } - Log.Error("读取指纹异常:" + ex.Message); + //Log.Error("读取指纹异常:" + ex.Message); } return ""; @@ -104,16 +104,16 @@ namespace AksWebBrowser.Devices //status = LibFingerprint.LIVESCAN_GetFPBmpData(td, Encoding.UTF8.GetBytes(FileName)); if (status == 1) { - Log.Info("采集一帧图像:" + Encoding.UTF8.GetString(pRawData)); - Log.Info("获取指纹成功"); + // Log.Info("采集一帧图像:" + Encoding.UTF8.GetString(pRawData)); + // Log.Info("获取指纹成功"); timer.Stop(); - Log.Info("停止采集"); + // Log.Info("停止采集"); } LibFingerprint.LIVESCAN_EndCapture(td); } catch (Exception ex) { - Log.Error("定时读取指纹异常:" + ex.Message); + //Log.Error("定时读取指纹异常:" + ex.Message); timer.Stop(); } } diff --git a/CPF_Cef/Devices/IDCard.cs b/CPF_Cef/Devices/IDCard.cs index a20948c..d4d4021 100644 --- a/CPF_Cef/Devices/IDCard.cs +++ b/CPF_Cef/Devices/IDCard.cs @@ -100,7 +100,7 @@ namespace AksWebBrowser.Devices } catch (Exception ex) { - Log.Info("获取身份证异常:" + ex.Message); + // Log.Info("获取身份证异常:" + ex.Message); if (icdev != -1) { LibClass.ICReaderClose(icdev); diff --git a/CPF_Cef/Devices/LhtCF.cs b/CPF_Cef/Devices/LhtCF.cs index f499d8a..a1ef7db 100644 --- a/CPF_Cef/Devices/LhtCF.cs +++ b/CPF_Cef/Devices/LhtCF.cs @@ -25,23 +25,23 @@ namespace AksWebBrowser.Devices try { int status = libLhtCFs.CF_Init(); - Log.Info("初始化函数" + status); + // Log.Info("初始化函数" + status); if (status == 0) { status = libLhtCFs.CF_GetCameraStatus(0); - Log.Info("获取摄像头状态" + status); + // Log.Info("获取摄像头状态" + status); if (status == 0) { status = libLhtCFs.CF_OpenCamera(); - Log.Info("打开摄像头" + status); + // Log.Info("打开摄像头" + status); if (status == 0) { status = libLhtCFs.CF_CreatWindow(0, 0, 300, 800, 600, 500); - Log.Info("创建视频预览窗口" + status); + // Log.Info("创建视频预览窗口" + status); if (status == 0) { status = libLhtCFs.CF_StartLiveDetectEx(10000); - Log.Info("活体检测超时时间:" + status); + // Log.Info("活体检测超时时间:" + status); if (status == 0) { string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); @@ -49,7 +49,7 @@ namespace AksWebBrowser.Devices byte[] faceA = Convert.FromBase64String(face); byte[] faceB = Encoding.UTF8.GetBytes(tmpFile); status = libLhtCFs.CF_FaceCompare(faceA, faceB, 60); - Log.Info("人脸比对:" + status); + // Log.Info("人脸比对:" + status); //停止活体检测 Task.Run(() => { libLhtCFs.CF_StopLiveDetect(); }); @@ -66,7 +66,7 @@ namespace AksWebBrowser.Devices } catch (Exception ex) { - Log.Error("双目摄像头采集人脸异常:" + ex.Message); + //Log.Error("双目摄像头采集人脸异常:" + ex.Message); } return ""; } diff --git a/CPF_Cef/Devices/PrintPJ.cs b/CPF_Cef/Devices/PrintPJ.cs index c661ec3..71b1035 100644 --- a/CPF_Cef/Devices/PrintPJ.cs +++ b/CPF_Cef/Devices/PrintPJ.cs @@ -115,7 +115,7 @@ namespace AksWebBrowser.Devices } catch (Exception ex) { - Log.Error("票据打印失败:" + ex.Message); + //Log.Error("票据打印失败:" + ex.Message); return 1; } return 0; @@ -134,17 +134,17 @@ namespace AksWebBrowser.Devices m_iInit = LibPrint.SetDevname(3,"", 0); if (m_iInit == 0) { - Log.Info("热敏打印机已连接"); + // Log.Info("热敏打印机已连接"); //初始化打印机 m_iInit = LibPrint.SetInit(); if (m_iInit == 0) { - Log.Info("初始化成功"); + // Log.Info("初始化成功"); LibPrint.SetCommandmode(3); } else { - Log.Info("初始化失败"); + // Log.Info("初始化失败"); } } } diff --git a/CPF_Cef/FrmMain.cs b/CPF_Cef/FrmMain.cs index 6b85ef4..4d6c5a7 100644 --- a/CPF_Cef/FrmMain.cs +++ b/CPF_Cef/FrmMain.cs @@ -31,7 +31,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser Title = "控申业务专用浏览器"; CanResize = false; ShowInTaskbar = true; - WindowState = WindowState.FullScreen; + //WindowState = WindowState.FullScreen; + WindowState = WindowState.Maximized; Parame.videoV = new VideoView { Name = "player", @@ -82,7 +83,6 @@ namespace AKS.EnterpriseLibrary.WebBrowser this.Height = h; //SetTaskStatus.Hidetask(); base.OnInitialized(); - //初始化网络连接(硬件服务响应) MainModel.DeviceControllerInit(); Parame.webBrowser = FindPresenterByName(nameof(Parame.webBrowser)); @@ -137,7 +137,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("定时任务开启异常: " + ex.Message); + //Log.Error("定时任务开启异常: " + ex.Message); } } @@ -152,7 +152,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser { try { - Log.Info("定时任务执行时间: " + DateTime.Now); + // Log.Info("定时任务执行时间: " + DateTime.Now); string file = System.IO.Directory.GetCurrentDirectory(); file = file + @"/wwwroot"; // 这里添加你的任务代码 @@ -160,7 +160,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("定时任务执行异常: " + ex.Message); + //Log.Error("定时任务执行异常: " + ex.Message); } } diff --git a/CPF_Cef/MainModel.cs b/CPF_Cef/MainModel.cs index 0ba8609..0ff5058 100644 --- a/CPF_Cef/MainModel.cs +++ b/CPF_Cef/MainModel.cs @@ -2,17 +2,21 @@ using AksWebBrowser.Common; using AksWebBrowser.Devices; using AKSWebBrowser.Commen; +using CPF.Cef; using CPF.Shapes; using CPF.Windows; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; +using System.Collections; +using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Net.Http; +using System.Security.Authentication; using System.Text; using System.Text.RegularExpressions; using System.Threading; @@ -27,105 +31,124 @@ namespace AKS.EnterpriseLibrary.WebBrowser //初始化网络连接 public static void DeviceControllerInit() { + List lit = new List(); SAEA.WebSocket.WSServer ws = new SAEA.WebSocket.WSServer(19983); ws.OnConnected += (s) => { + lit.Add(s.ToString()); string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}"; byte[] bytes = SerializeContent(result); ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); }; ws.OnMessage += (s, e) => { - string content = Encoding.GetEncoding("GB2312").GetString(e.Content); + string content = Encoding.UTF8.GetString(e.Content); if (content != "ping") { - var json = content.ConvertToAnonymousType(new - { - code = default(string) - }); - //接收指令和参数 - string keycode = json.code; //返回内容 string result = string.Empty; - switch (keycode) + content = Base64str2(content); + if (!string.IsNullOrEmpty(content)) { - //aks100101 - //读取身份证卡号 {"code":"aks100101"} - case "aks100101": - result = IDCardRead(keycode); - break; - //aks100102 - //打印排队票据 {"code":"aks100102","ph":"100101","ddrs":"中国检察","qrcode":"90087100100124433002","ywmc":"信访"} - case "aks100102": - result = SendByPrint(content); - break; - //aks100103 - //文字语音播报 - //播放:{ "code":"aks100103","text":"你好!","ispaye":false}, - //停止播放:{ "code":"aks100104","text":"","ispaye":true} - case "aks100103": - result = payleText(content); - break; - //aks100104 - //打开高拍仪并且进行快速扫描文件 {"code":"aks100104"} - case "aks100104": - result = openCamera(keycode); - break; - //aks100105 - //打开签字版 {"code":"aks100105"} - case "aks100105": - result = OpenSign(content); - break; - //aks100112 - //关闭签字版 {"code":"aks100112"} - case "aks100112": - result = CloseSign(keycode); - break; - //aks100106 - //指纹 {"code":"aks100106"} - case "aks100106": - result = ReadFingerData(keycode); - break; - //aks100107 开始录音、取消录音、结束录音 - // 开始录音:{ "code":"aks100107","url":"","isopen":true} - // 取消录音: { "code":"aks100107","url":"","isopen":false} - // 结束录音: { "code":"aks100107","url":"http://127.0.0.1/Upload","isopen":false} - case "aks100107": - result = SoundRecording(content); - break; - //aks100108 - //根据文件地址在线打印 { "code":"aks100108","url":"http://127.0.0.1/test.doc","ext":"doc"} - case "aks100108": - result = PrintFile(content); - break; - //aks100109 - //根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"} - case "aks100109": - result = PrintBase64(content); - break; - //aks100110 - //播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false} - //停止播放音频文件 { "code":"aks100110","url":"","ispaye":true} - case "aks100110": - result = PalyFile(content); - break; - //aks100111 唤醒键盘 {"code":"aks100111"} - case "aks100111": - result = openKey(keycode); - break; - //aks100113 指纹 {"code":"aks100113"} - case "aks100113": - result = ReadFingerData(keycode); - break; - default: - result = "{\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; - break; + var json = content.ConvertToAnonymousType(new + { + code = default(string) + }); + //接收指令和参数 + string keycode = json.code; + switch (keycode) + { + //aks100101 + //读取身份证卡号 {"code":"aks100101"} + case "aks100101": + result = IDCardRead(keycode); + break; + //aks100102 + //打印排队票据 {"code":"aks100102","ph":"100101","ddrs":"中国检察","qrcode":"90087100100124433002","ywmc":"信访"} + case "aks100102": + result = SendByPrint(content); + break; + //aks100103 + //文字语音播报 + //播放:{ "code":"aks100103","text":"你好!","ispaye":false}, + //停止播放:{ "code":"aks100104","text":"","ispaye":true} + case "aks100103": + result = payleText(content); + break; + //aks100104 + //打开高拍仪并且进行快速扫描文件 {"code":"aks100104"} + case "aks100104": + result = openCamera(keycode); + break; + //aks100105 + //打开签字版 {"code":"aks100105"} + case "aks100105": + result = OpenSign(content); + break; + //aks100112 + //关闭签字版 {"code":"aks100112"} + case "aks100112": + result = CloseSign(keycode); + break; + //aks100106 + //指纹 {"code":"aks100106"} + case "aks100106": + result = ReadFingerData(keycode); + break; + //aks100107 开始录音、取消录音、结束录音 + // 开始录音:{ "code":"aks100107","url":"","isopen":true} + // 取消录音: { "code":"aks100107","url":"","isopen":false} + // 结束录音: { "code":"aks100107","url":"http://127.0.0.1/Upload","isopen":false} + case "aks100107": + result = SoundRecording(content); + break; + //aks100108 + //根据文件地址在线打印 { "code":"aks100108","url":"http://127.0.0.1/test.doc","ext":"doc"} + case "aks100108": + result = PrintFile(content); + break; + //aks100109 + //根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"} + case "aks100109": + //result = PrintBase64(content); + result = "{\"keycode\":\"" + "aks100109" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"Base64打印保留原方式\"}"; + break; + //aks100110 + //播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false} + //停止播放音频文件 { "code":"aks100110","url":"","ispaye":true} + case "aks100110": + result = PalyFile(content); + break; + //aks100111 唤醒键盘 {"code":"aks100111"} + case "aks100111": + result = openKey(keycode); + break; + //aks100113 指纹 {"code":"aks100113"} + case "aks100113": + result = ReadFingerData(keycode); + break; + default: + result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; + break; + } + } + else + { + result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; } //答复请求者(处理完请求后在些答复) byte[] bytes = SerializeContent(result); ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); } - + }; + ws.OnDisconnected += (s) => + { + try + { + lit.RemoveAll(n => n == s); + } + catch { } + finally { } }; ws.Start(); } @@ -179,7 +202,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("读取身份证卡号异常: " + ex.Message + ""); + //Log.Error("读取身份证卡号异常: " + ex.Message + ""); string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "IDCardRead"); return result; @@ -237,7 +260,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("打印排队票据异常: " + ex.Message + ""); + //Log.Error("打印排队票据异常: " + ex.Message + ""); string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "SendByPrint"); return result; @@ -282,20 +305,27 @@ namespace AKS.EnterpriseLibrary.WebBrowser { Task.Run(() => { - if (Typrocess != null) + try { - // 如果进程还在运行 - if (!Typrocess.HasExited) + if (Typrocess != null) { - // 发送SIGTERM信号来停止进程 - Typrocess.Kill(); - // 等待进程真正停止 - Typrocess.WaitForExit(); + // 如果进程还在运行 + if (!Typrocess.HasExited) + { + // 发送SIGTERM信号来停止进程 + Typrocess.Kill(); + // 等待进程真正停止 + Typrocess.WaitForExit(); + } } } + catch (Exception ex) + { + //Log.Error("停止失败: " + ex.Message + ""); + } //AutoAudio(false, ""); }); - string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "停止播放成功" + "}"; + string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "停止播放成功" + "\"}"; SubmitLogs(result, "payleText"); return result; } @@ -310,7 +340,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser ShllCommad(command); //AutoAudio(true, tempWav); }); - string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "开始播放" + "}"; + string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "开始播放" + "\"}"; SubmitLogs(result, "payleText"); return result; } @@ -318,7 +348,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("文字语音播报异常2: " + ex.Message + ""); + //Log.Error("文字语音播报异常2: " + ex.Message + ""); string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "payleText"); return result; @@ -357,17 +387,16 @@ namespace AKS.EnterpriseLibrary.WebBrowser param = getFrame(); if (string.IsNullOrEmpty(param)) { + //关闭 + StopSn(devIndex); string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; SubmitLogs(result, "openCamera"); return result; } else { - Task.Run(() => - { - //关闭 - StopSn(devIndex); - }); + //关闭 + StopSn(devIndex); string result = "{\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; SubmitLogs(result, "openCamera"); return result; @@ -378,7 +407,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("打开高拍仪并且进行快速扫描文件异常: " + ex.Message + ""); + //Log.Error("打开高拍仪并且进行快速扫描文件异常: " + ex.Message + ""); string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "openCamera"); return result; @@ -413,7 +442,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("打开签字版异常: " + ex.Message + ""); + //Log.Error("打开签字版异常: " + ex.Message + ""); string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "OpenSign"); return result; @@ -444,7 +473,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("关闭签字版异常: " + ex.Message + ""); + //Log.Error("关闭签字版异常: " + ex.Message + ""); string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "OpenSign"); return result; @@ -475,7 +504,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("指纹异常: " + ex.Message + ""); + //Log.Error("指纹异常: " + ex.Message + ""); string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "Finger"); return result; @@ -572,7 +601,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("开始录音、取消录音、结束录音异常: " + ex.Message + ""); + //Log.Error("开始录音、取消录音、结束录音异常: " + ex.Message + ""); string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "SoundRecording"); return result; @@ -638,7 +667,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("根据文件地址在线打印异常: " + ex.Message + ""); + //Log.Error("根据文件地址在线打印异常: " + ex.Message + ""); string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "PrintFile"); return result; @@ -652,23 +681,15 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// /// /// - public static string PrintBase64(string content) + [JSFunction] + public static string PrintBase64(string url, string base64, string ext) { - var param = content.ConvertToAnonymousType(new - { - code = default(string), - ext = default(string), - base64 = default(string) - }); try { - string base64 = param.base64; - string ext = param.ext; - if (!isFuncisFuncObject("PrintBase64")) { Utils.MessagesBox("打印机设备未授权使用"); - return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; + return "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; } else { @@ -694,14 +715,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser string command = $"lp -d {PrinterName} {path}"; ShllCommad(command); }); - string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; + string result = "{\"keycode\":\"" + "" + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; SubmitLogs(result, "PrintBase64"); return result; } } catch (Exception ex) { - string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "PrintBase64"); return result; } @@ -819,7 +840,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("唤醒键盘异常: " + ex.Message + ""); + //Log.Error("唤醒键盘异常: " + ex.Message + ""); return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; } } @@ -853,7 +874,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("执行文件异常:" + ex.Message); + //Log.Error("执行文件异常:" + ex.Message); } return ""; } @@ -880,7 +901,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser if (jo["returnCode"].ToString() == "0") { string result = jo["data"].ToString(); - Log.Info(result); + // Log.Info(result); JArray jo1 = (JArray)JsonConvert.DeserializeObject(result); string devidx = string.Empty; string name = string.Empty; @@ -888,21 +909,21 @@ namespace AKS.EnterpriseLibrary.WebBrowser { devidx = jo2["dev_idx"].ToString(); name = jo2["name"].ToString(); - Log.Info(name); + // Log.Info(name); break; } return devidx; } else { - Log.Info(jo["returnMsg"].ToString()); + // Log.Info(jo["returnMsg"].ToString()); return ""; } } } catch (Exception ex) { - Log.Error("获取设备index异常:" + ex.Message); + //Log.Error("获取设备index异常:" + ex.Message); } return ""; } @@ -936,14 +957,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser } else { - Log.Info(jo["returnMsg"].ToString()); + // Log.Info(jo["returnMsg"].ToString()); return ""; } } } catch (Exception ex) { - Log.Error("打开高拍仪异常:" + ex.Message); + //Log.Error("打开高拍仪异常:" + ex.Message); } return ""; } @@ -971,7 +992,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } else { - Log.Info(jo["returnMsg"].ToString()); + // Log.Info(jo["returnMsg"].ToString()); return ""; } } @@ -1004,14 +1025,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser } else { - Log.Info(jo["returnMsg"].ToString()); + // Log.Info(jo["returnMsg"].ToString()); return ""; } } } catch (Exception ex) { - Log.Error("拍照异常:" + ex.Message); + //Log.Error("拍照异常:" + ex.Message); } return ""; } @@ -1041,14 +1062,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser } else { - Log.Info(jo["returnMsg"].ToString()); + // Log.Info(jo["returnMsg"].ToString()); return ""; } } } catch (Exception ex) { - Log.Error("右转异常:" + ex.Message); + //Log.Error("右转异常:" + ex.Message); } return ""; } @@ -1078,14 +1099,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser } else { - Log.Info(jo["returnMsg"].ToString()); + // Log.Info(jo["returnMsg"].ToString()); return ""; } } } catch (Exception ex) { - Log.Error("左转异常:" + ex.Message); + //Log.Error("左转异常:" + ex.Message); } return ""; } @@ -1106,7 +1127,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("高拍仪异常:" + ex.Message); + //Log.Error("高拍仪异常:" + ex.Message); } } @@ -1125,7 +1146,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("签字版异常:" + ex.Message); + //Log.Error("签字版异常:" + ex.Message); } } @@ -1145,7 +1166,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("初始文件上传异常:" + ex.Message); + //Log.Error("初始文件上传异常:" + ex.Message); } } @@ -1164,7 +1185,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("上传本地文件中转异常:" + ex.Message); + //Log.Error("上传本地文件中转异常:" + ex.Message); } } @@ -1187,7 +1208,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("根据程序名称杀死进程异常:" + ex.Message); + //Log.Error("根据程序名称杀死进程异常:" + ex.Message); } } @@ -1239,7 +1260,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("开始录音异常:" + ex.Message); + //Log.Error("开始录音异常:" + ex.Message); return false; } } @@ -1262,7 +1283,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("结束录音异常:" + ex.Message); + //Log.Error("结束录音异常:" + ex.Message); return false; } } @@ -1293,7 +1314,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("执行命令异常:" + ex.Message); + //Log.Error("执行命令异常:" + ex.Message); } } @@ -1309,7 +1330,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser "yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); string dirpath = System.IO.Directory.GetCurrentDirectory(); dirpath = dirpath + @"/wwwroot/WavFile"; - Log.Info(dirpath); + // Log.Info(dirpath); if (!Directory.Exists(dirpath)) { Directory.CreateDirectory(dirpath); @@ -1335,7 +1356,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("文字转语音失败:" + ex.Message); + //Log.Error("文字转语音失败:" + ex.Message); } return tempFile; } @@ -1367,7 +1388,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("是否已获取收取异常:" + ex.Message); + //Log.Error("是否已获取收取异常:" + ex.Message); } return isFunc; } @@ -1422,7 +1443,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("提交设备操作日志异常:" + ex.Message); + //Log.Error("提交设备操作日志异常:" + ex.Message); } } @@ -1445,7 +1466,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("播放语音文件异常:" + ex.Message); + //Log.Error("播放语音文件异常:" + ex.Message); } } @@ -1463,7 +1484,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("string 转换为 base64异常:" + ex.Message); + //Log.Error("string 转换为 base64异常:" + ex.Message); } return ""; } @@ -1483,7 +1504,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - Log.Error("base64 转换为 string异常:" + ex.Message); + //Log.Error("base64 转换为 string异常:" + ex.Message); } return ""; }