Browse Source

注释掉log日志

master
胡超1 1 year ago
parent
commit
95342eea03
  1. 2
      CPF_Cef/Common/COMUtils.cs
  2. 6
      CPF_Cef/Common/ChunkedUpload.cs
  3. 16
      CPF_Cef/Common/Log.cs
  4. 2
      CPF_Cef/Common/Utils.cs
  5. 34
      CPF_Cef/Devices/Fingerprint.cs
  6. 2
      CPF_Cef/Devices/IDCard.cs
  7. 14
      CPF_Cef/Devices/LhtCF.cs
  8. 8
      CPF_Cef/Devices/PrintPJ.cs
  9. 10
      CPF_Cef/FrmMain.cs
  10. 147
      CPF_Cef/MainModel.cs

2
CPF_Cef/Common/COMUtils.cs

@ -210,7 +210,7 @@ namespace AKSWebBrowser.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("关闭异常: " + ex.Message + ""); //Log.Error("关闭异常: " + ex.Message + "");
} }
} }

6
CPF_Cef/Common/ChunkedUpload.cs

@ -85,7 +85,7 @@ namespace AksWebBrowser.Common
} }
catch (HttpRequestException e) catch (HttpRequestException e)
{ {
Log.Error(" get请求: " + e.Message); //Log.Error(" get请求: " + e.Message);
} }
} }
return ret; return ret;
@ -130,7 +130,7 @@ namespace AksWebBrowser.Common
} }
else else
{ {
Log.Error("请求签字失败" + jo["message"].ToString()); //Log.Error("请求签字失败" + jo["message"].ToString());
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}"; return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}";
} }
} }
@ -153,7 +153,7 @@ namespace AksWebBrowser.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("签字异常:" + ex.Message); //Log.Error("签字异常:" + ex.Message);
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字异常" + "\"}"; return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字异常" + "\"}";
} }
} }

16
CPF_Cef/Common/Log.cs

@ -26,16 +26,18 @@ namespace AKSWebBrowser.Commen
{ {
streamWriter = !File.Exists(directPath) ? File.CreateText(directPath) : File.AppendText(directPath); streamWriter = !File.Exists(directPath) ? File.CreateText(directPath) : File.AppendText(directPath);
} }
else
{
streamWriter.WriteLine("***********************************************************************"); streamWriter.WriteLine("***********************************************************************");
streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss")); streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss"));
streamWriter.WriteLine("输出信息:错误信息"); streamWriter.WriteLine("输出信息:错误信息");
if (message != null)
{
streamWriter.WriteLine("异常信息:\r\n" + message); streamWriter.WriteLine("异常信息:\r\n" + message);
} }
} }
catch { } catch { }
finally finally
{
try
{ {
if (streamWriter != null) if (streamWriter != null)
{ {
@ -47,6 +49,8 @@ namespace AKSWebBrowser.Commen
} }
} }
} }
catch (Exception) { }
}
} }
public static void Info(string message) public static void Info(string message)
@ -64,16 +68,18 @@ namespace AKSWebBrowser.Commen
{ {
try { streamWriter = !File.Exists(directPath) ? File.CreateText(directPath) : File.AppendText(directPath); } catch { } finally { } try { streamWriter = !File.Exists(directPath) ? File.CreateText(directPath) : File.AppendText(directPath); } catch { } finally { }
} }
else
{
streamWriter.WriteLine("***********************************************************************"); streamWriter.WriteLine("***********************************************************************");
streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss")); streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss"));
streamWriter.WriteLine("输出信息:信息"); streamWriter.WriteLine("输出信息:信息");
if (message != null)
{
streamWriter.WriteLine("信息:\r\n" + message); streamWriter.WriteLine("信息:\r\n" + message);
} }
} }
catch { } catch { }
finally finally
{
try
{ {
if (streamWriter != null) if (streamWriter != null)
{ {
@ -85,6 +91,8 @@ namespace AKSWebBrowser.Commen
} }
} }
} }
catch (Exception) { }
}
} }
} }
} }

2
CPF_Cef/Common/Utils.cs

@ -41,7 +41,7 @@ namespace AksWebBrowser.Common
// 确保文件夹路径是完整的,并且文件夹存在 // 确保文件夹路径是完整的,并且文件夹存在
if (!Directory.Exists(folderPath)) if (!Directory.Exists(folderPath))
{ {
Log.Error("未找到删除临时目录"); //Log.Error("未找到删除临时目录");
} }
// 获取文件夹内所有文件,包括子文件夹内的文件 // 获取文件夹内所有文件,包括子文件夹内的文件

34
CPF_Cef/Devices/Fingerprint.cs

@ -32,28 +32,28 @@ namespace AksWebBrowser.Devices
init = LibFingerprint.LIVESCAN_Init(); init = LibFingerprint.LIVESCAN_Init();
if (init == 1) if (init == 1)
{ {
Log.Info("初始化指纹成功"); // Log.Info("初始化指纹成功");
td = LibFingerprint.LIVESCAN_GetChannelCount(); td = LibFingerprint.LIVESCAN_GetChannelCount();
if (td > 0) if (td > 0)
{ {
Log.Info("获得采集器通道数量成功"); // Log.Info("获得采集器通道数量成功");
int pnBright = 254; int pnBright = 254;
int status = LibFingerprint.LIVESCAN_GetBright(td, ref pnBright); int status = LibFingerprint.LIVESCAN_GetBright(td, ref pnBright);
Log.Info(" 获得采集器当前的亮度:" + status); // Log.Info(" 获得采集器当前的亮度:" + status);
Log.Info(" 获得采集器当前的亮度:" + pnBright); // Log.Info(" 获得采集器当前的亮度:" + pnBright);
int pnContrast = 254; int pnContrast = 254;
status = LibFingerprint.LIVESCAN_GetContrast(td, ref pnContrast); status = LibFingerprint.LIVESCAN_GetContrast(td, ref pnContrast);
Log.Info(" 获得采集器当前对比度:" + status); // Log.Info(" 获得采集器当前对比度:" + status);
Log.Info(" 获得采集器当前对比度:" + pnBright); // Log.Info(" 获得采集器当前对比度:" + pnBright);
int pnWidth = 0, pnHeight = 0; int pnWidth = 0, pnHeight = 0;
status = LibFingerprint.LIVESCAN_GetMaxImageSize(td, ref pnWidth, ref pnHeight); status = LibFingerprint.LIVESCAN_GetMaxImageSize(td, ref pnWidth, ref pnHeight);
Log.Info(" 获得采集器采集图像的宽度、高度的最大值:" + status); // Log.Info(" 获得采集器采集图像的宽度、高度的最大值:" + status);
Log.Info(" 获得采集器采集图像的宽度、高度的最大值:" + pnWidth + "*" + pnHeight); // Log.Info(" 获得采集器采集图像的宽度、高度的最大值:" + pnWidth + "*" + pnHeight);
byte[] pszDesc = new byte[1024]; byte[] pszDesc = new byte[1024];
status = LibFingerprint.LIVESCAN_GetDesc(pszDesc); status = LibFingerprint.LIVESCAN_GetDesc(pszDesc);
Log.Info("获得接口规范的说明:" + status); // Log.Info("获得接口规范的说明:" + status);
Log.Info("获得接口规范的说明返回数据:" + Encoding.UTF8.GetString(pszDesc)); // Log.Info("获得接口规范的说明返回数据:" + Encoding.UTF8.GetString(pszDesc));
MessageBox.Show("转变采集"); MessageBox.Show("转变采集");
@ -66,7 +66,7 @@ namespace AksWebBrowser.Devices
} }
else else
{ {
Log.Info("获得采集器通道数量失败"); // Log.Info("获得采集器通道数量失败");
} }
Task.Run(() => Task.Run(() =>
{ {
@ -75,7 +75,7 @@ namespace AksWebBrowser.Devices
} }
else else
{ {
Log.Info("初始化指纹失败,错误代码:" + init); // Log.Info("初始化指纹失败,错误代码:" + init);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -87,7 +87,7 @@ namespace AksWebBrowser.Devices
LibFingerprint.LIVESCAN_Close(); LibFingerprint.LIVESCAN_Close();
}); });
} }
Log.Error("读取指纹异常:" + ex.Message); //Log.Error("读取指纹异常:" + ex.Message);
} }
return ""; return "";
@ -104,16 +104,16 @@ namespace AksWebBrowser.Devices
//status = LibFingerprint.LIVESCAN_GetFPBmpData(td, Encoding.UTF8.GetBytes(FileName)); //status = LibFingerprint.LIVESCAN_GetFPBmpData(td, Encoding.UTF8.GetBytes(FileName));
if (status == 1) if (status == 1)
{ {
Log.Info("采集一帧图像:" + Encoding.UTF8.GetString(pRawData)); // Log.Info("采集一帧图像:" + Encoding.UTF8.GetString(pRawData));
Log.Info("获取指纹成功"); // Log.Info("获取指纹成功");
timer.Stop(); timer.Stop();
Log.Info("停止采集"); // Log.Info("停止采集");
} }
LibFingerprint.LIVESCAN_EndCapture(td); LibFingerprint.LIVESCAN_EndCapture(td);
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("定时读取指纹异常:" + ex.Message); //Log.Error("定时读取指纹异常:" + ex.Message);
timer.Stop(); timer.Stop();
} }
} }

2
CPF_Cef/Devices/IDCard.cs

@ -100,7 +100,7 @@ namespace AksWebBrowser.Devices
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Info("获取身份证异常:" + ex.Message); // Log.Info("获取身份证异常:" + ex.Message);
if (icdev != -1) if (icdev != -1)
{ {
LibClass.ICReaderClose(icdev); LibClass.ICReaderClose(icdev);

14
CPF_Cef/Devices/LhtCF.cs

@ -25,23 +25,23 @@ namespace AksWebBrowser.Devices
try try
{ {
int status = libLhtCFs.CF_Init(); int status = libLhtCFs.CF_Init();
Log.Info("初始化函数" + status); // Log.Info("初始化函数" + status);
if (status == 0) if (status == 0)
{ {
status = libLhtCFs.CF_GetCameraStatus(0); status = libLhtCFs.CF_GetCameraStatus(0);
Log.Info("获取摄像头状态" + status); // Log.Info("获取摄像头状态" + status);
if (status == 0) if (status == 0)
{ {
status = libLhtCFs.CF_OpenCamera(); status = libLhtCFs.CF_OpenCamera();
Log.Info("打开摄像头" + status); // Log.Info("打开摄像头" + status);
if (status == 0) if (status == 0)
{ {
status = libLhtCFs.CF_CreatWindow(0, 0, 300, 800, 600, 500); status = libLhtCFs.CF_CreatWindow(0, 0, 300, 800, 600, 500);
Log.Info("创建视频预览窗口" + status); // Log.Info("创建视频预览窗口" + status);
if (status == 0) if (status == 0)
{ {
status = libLhtCFs.CF_StartLiveDetectEx(10000); status = libLhtCFs.CF_StartLiveDetectEx(10000);
Log.Info("活体检测超时时间:" + status); // Log.Info("活体检测超时时间:" + status);
if (status == 0) if (status == 0)
{ {
string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
@ -49,7 +49,7 @@ namespace AksWebBrowser.Devices
byte[] faceA = Convert.FromBase64String(face); byte[] faceA = Convert.FromBase64String(face);
byte[] faceB = Encoding.UTF8.GetBytes(tmpFile); byte[] faceB = Encoding.UTF8.GetBytes(tmpFile);
status = libLhtCFs.CF_FaceCompare(faceA, faceB, 60); status = libLhtCFs.CF_FaceCompare(faceA, faceB, 60);
Log.Info("人脸比对:" + status); // Log.Info("人脸比对:" + status);
//停止活体检测 //停止活体检测
Task.Run(() => { libLhtCFs.CF_StopLiveDetect(); }); Task.Run(() => { libLhtCFs.CF_StopLiveDetect(); });
@ -66,7 +66,7 @@ namespace AksWebBrowser.Devices
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("双目摄像头采集人脸异常:" + ex.Message); //Log.Error("双目摄像头采集人脸异常:" + ex.Message);
} }
return ""; return "";
} }

8
CPF_Cef/Devices/PrintPJ.cs

@ -115,7 +115,7 @@ namespace AksWebBrowser.Devices
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("票据打印失败:" + ex.Message); //Log.Error("票据打印失败:" + ex.Message);
return 1; return 1;
} }
return 0; return 0;
@ -134,17 +134,17 @@ namespace AksWebBrowser.Devices
m_iInit = LibPrint.SetDevname(3,"", 0); m_iInit = LibPrint.SetDevname(3,"", 0);
if (m_iInit == 0) if (m_iInit == 0)
{ {
Log.Info("热敏打印机已连接"); // Log.Info("热敏打印机已连接");
//初始化打印机 //初始化打印机
m_iInit = LibPrint.SetInit(); m_iInit = LibPrint.SetInit();
if (m_iInit == 0) if (m_iInit == 0)
{ {
Log.Info("初始化成功"); // Log.Info("初始化成功");
LibPrint.SetCommandmode(3); LibPrint.SetCommandmode(3);
} }
else else
{ {
Log.Info("初始化失败"); // Log.Info("初始化失败");
} }
} }
} }

10
CPF_Cef/FrmMain.cs

@ -31,7 +31,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser
Title = "控申业务专用浏览器"; Title = "控申业务专用浏览器";
CanResize = false; CanResize = false;
ShowInTaskbar = true; ShowInTaskbar = true;
WindowState = WindowState.FullScreen; //WindowState = WindowState.FullScreen;
WindowState = WindowState.Maximized;
Parame.videoV = new VideoView Parame.videoV = new VideoView
{ {
Name = "player", Name = "player",
@ -82,7 +83,6 @@ namespace AKS.EnterpriseLibrary.WebBrowser
this.Height = h; this.Height = h;
//SetTaskStatus.Hidetask(); //SetTaskStatus.Hidetask();
base.OnInitialized(); base.OnInitialized();
//初始化网络连接(硬件服务响应) //初始化网络连接(硬件服务响应)
MainModel.DeviceControllerInit(); MainModel.DeviceControllerInit();
Parame.webBrowser = FindPresenterByName<CusWebBrowser>(nameof(Parame.webBrowser)); Parame.webBrowser = FindPresenterByName<CusWebBrowser>(nameof(Parame.webBrowser));
@ -137,7 +137,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("定时任务开启异常: " + ex.Message); //Log.Error("定时任务开启异常: " + ex.Message);
} }
} }
@ -152,7 +152,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
{ {
try try
{ {
Log.Info("定时任务执行时间: " + DateTime.Now); // Log.Info("定时任务执行时间: " + DateTime.Now);
string file = System.IO.Directory.GetCurrentDirectory(); string file = System.IO.Directory.GetCurrentDirectory();
file = file + @"/wwwroot"; file = file + @"/wwwroot";
// 这里添加你的任务代码 // 这里添加你的任务代码
@ -160,7 +160,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("定时任务执行异常: " + ex.Message); //Log.Error("定时任务执行异常: " + ex.Message);
} }
} }

147
CPF_Cef/MainModel.cs

@ -2,17 +2,21 @@
using AksWebBrowser.Common; using AksWebBrowser.Common;
using AksWebBrowser.Devices; using AksWebBrowser.Devices;
using AKSWebBrowser.Commen; using AKSWebBrowser.Commen;
using CPF.Cef;
using CPF.Shapes; using CPF.Shapes;
using CPF.Windows; using CPF.Windows;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Security.Authentication;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
@ -27,17 +31,24 @@ namespace AKS.EnterpriseLibrary.WebBrowser
//初始化网络连接 //初始化网络连接
public static void DeviceControllerInit() public static void DeviceControllerInit()
{ {
List<string> lit = new List<string>();
SAEA.WebSocket.WSServer ws = new SAEA.WebSocket.WSServer(19983); SAEA.WebSocket.WSServer ws = new SAEA.WebSocket.WSServer(19983);
ws.OnConnected += (s) => ws.OnConnected += (s) =>
{ {
lit.Add(s.ToString());
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}"; string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}";
byte[] bytes = SerializeContent(result); byte[] bytes = SerializeContent(result);
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes));
}; };
ws.OnMessage += (s, e) => ws.OnMessage += (s, e) =>
{ {
string content = Encoding.GetEncoding("GB2312").GetString(e.Content); string content = Encoding.UTF8.GetString(e.Content);
if (content != "ping") if (content != "ping")
{
//返回内容
string result = string.Empty;
content = Base64str2(content);
if (!string.IsNullOrEmpty(content))
{ {
var json = content.ConvertToAnonymousType(new var json = content.ConvertToAnonymousType(new
{ {
@ -45,8 +56,6 @@ namespace AKS.EnterpriseLibrary.WebBrowser
}); });
//接收指令和参数 //接收指令和参数
string keycode = json.code; string keycode = json.code;
//返回内容
string result = string.Empty;
switch (keycode) switch (keycode)
{ {
//aks100101 //aks100101
@ -101,7 +110,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser
//aks100109 //aks100109
//根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"} //根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"}
case "aks100109": case "aks100109":
result = PrintBase64(content); //result = PrintBase64(content);
result = "{\"keycode\":\"" + "aks100109" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"Base64打印保留原方式\"}";
break; break;
//aks100110 //aks100110
//播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false} //播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false}
@ -118,14 +128,27 @@ namespace AKS.EnterpriseLibrary.WebBrowser
result = ReadFingerData(keycode); result = ReadFingerData(keycode);
break; break;
default: default:
result = "{\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}";
break; break;
} }
}
else
{
result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}";
}
//答复请求者(处理完请求后在些答复) //答复请求者(处理完请求后在些答复)
byte[] bytes = SerializeContent(result); byte[] bytes = SerializeContent(result);
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); 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(); ws.Start();
} }
@ -179,7 +202,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("读取身份证卡号异常: " + ex.Message + ""); //Log.Error("读取身份证卡号异常: " + ex.Message + "");
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "IDCardRead"); SubmitLogs(result, "IDCardRead");
return result; return result;
@ -237,7 +260,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) 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 + "\"}"; string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "SendByPrint"); SubmitLogs(result, "SendByPrint");
return result; return result;
@ -281,6 +304,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser
if (ispaye) if (ispaye)
{ {
Task.Run(() => Task.Run(() =>
{
try
{ {
if (Typrocess != null) if (Typrocess != null)
{ {
@ -293,9 +318,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
Typrocess.WaitForExit(); Typrocess.WaitForExit();
} }
} }
}
catch (Exception ex)
{
//Log.Error("停止失败: " + ex.Message + "");
}
//AutoAudio(false, ""); //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"); SubmitLogs(result, "payleText");
return result; return result;
} }
@ -310,7 +340,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
ShllCommad(command); ShllCommad(command);
//AutoAudio(true, tempWav); //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"); SubmitLogs(result, "payleText");
return result; return result;
} }
@ -318,7 +348,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) 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 + "\"}"; string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "payleText"); SubmitLogs(result, "payleText");
return result; return result;
@ -357,17 +387,16 @@ namespace AKS.EnterpriseLibrary.WebBrowser
param = getFrame(); param = getFrame();
if (string.IsNullOrEmpty(param)) if (string.IsNullOrEmpty(param))
{ {
//关闭
StopSn(devIndex);
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}";
SubmitLogs(result, "openCamera"); SubmitLogs(result, "openCamera");
return result; return result;
} }
else else
{
Task.Run(() =>
{ {
//关闭 //关闭
StopSn(devIndex); StopSn(devIndex);
});
string result = "{\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; string result = "{\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}";
SubmitLogs(result, "openCamera"); SubmitLogs(result, "openCamera");
return result; return result;
@ -378,7 +407,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("打开高拍仪并且进行快速扫描文件异常: " + ex.Message + ""); //Log.Error("打开高拍仪并且进行快速扫描文件异常: " + ex.Message + "");
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "openCamera"); SubmitLogs(result, "openCamera");
return result; return result;
@ -413,7 +442,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) 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 + "\"}"; string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "OpenSign"); SubmitLogs(result, "OpenSign");
return result; return result;
@ -444,7 +473,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("关闭签字版异常: " + ex.Message + ""); //Log.Error("关闭签字版异常: " + ex.Message + "");
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "OpenSign"); SubmitLogs(result, "OpenSign");
return result; return result;
@ -475,7 +504,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("指纹异常: " + ex.Message + ""); //Log.Error("指纹异常: " + ex.Message + "");
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "Finger"); SubmitLogs(result, "Finger");
return result; return result;
@ -572,7 +601,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) 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 + "\"}"; string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "SoundRecording"); SubmitLogs(result, "SoundRecording");
return result; return result;
@ -638,7 +667,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) 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 + "\"}"; string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "PrintFile"); SubmitLogs(result, "PrintFile");
return result; return result;
@ -652,23 +681,15 @@ namespace AKS.EnterpriseLibrary.WebBrowser
/// <param name="base64"></param> /// <param name="base64"></param>
/// <param name="ext"></param> /// <param name="ext"></param>
/// <returns></returns> /// <returns></returns>
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 try
{ {
string base64 = param.base64;
string ext = param.ext;
if (!isFuncisFuncObject("PrintBase64")) if (!isFuncisFuncObject("PrintBase64"))
{ {
Utils.MessagesBox("打印机设备未授权使用"); Utils.MessagesBox("打印机设备未授权使用");
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; return "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}";
} }
else else
{ {
@ -694,14 +715,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
string command = $"lp -d {PrinterName} {path}"; string command = $"lp -d {PrinterName} {path}";
ShllCommad(command); 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"); SubmitLogs(result, "PrintBase64");
return result; return result;
} }
} }
catch (Exception ex) 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"); SubmitLogs(result, "PrintBase64");
return result; return result;
} }
@ -819,7 +840,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("唤醒键盘异常: " + ex.Message + ""); //Log.Error("唤醒键盘异常: " + ex.Message + "");
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + 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) catch (Exception ex)
{ {
Log.Error("执行文件异常:" + ex.Message); //Log.Error("执行文件异常:" + ex.Message);
} }
return ""; return "";
} }
@ -880,7 +901,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
if (jo["returnCode"].ToString() == "0") if (jo["returnCode"].ToString() == "0")
{ {
string result = jo["data"].ToString(); string result = jo["data"].ToString();
Log.Info(result); // Log.Info(result);
JArray jo1 = (JArray)JsonConvert.DeserializeObject(result); JArray jo1 = (JArray)JsonConvert.DeserializeObject(result);
string devidx = string.Empty; string devidx = string.Empty;
string name = string.Empty; string name = string.Empty;
@ -888,21 +909,21 @@ namespace AKS.EnterpriseLibrary.WebBrowser
{ {
devidx = jo2["dev_idx"].ToString(); devidx = jo2["dev_idx"].ToString();
name = jo2["name"].ToString(); name = jo2["name"].ToString();
Log.Info(name); // Log.Info(name);
break; break;
} }
return devidx; return devidx;
} }
else else
{ {
Log.Info(jo["returnMsg"].ToString()); // Log.Info(jo["returnMsg"].ToString());
return ""; return "";
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("获取设备index异常:" + ex.Message); //Log.Error("获取设备index异常:" + ex.Message);
} }
return ""; return "";
} }
@ -936,14 +957,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
else else
{ {
Log.Info(jo["returnMsg"].ToString()); // Log.Info(jo["returnMsg"].ToString());
return ""; return "";
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("打开高拍仪异常:" + ex.Message); //Log.Error("打开高拍仪异常:" + ex.Message);
} }
return ""; return "";
} }
@ -971,7 +992,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
else else
{ {
Log.Info(jo["returnMsg"].ToString()); // Log.Info(jo["returnMsg"].ToString());
return ""; return "";
} }
} }
@ -1004,14 +1025,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
else else
{ {
Log.Info(jo["returnMsg"].ToString()); // Log.Info(jo["returnMsg"].ToString());
return ""; return "";
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("拍照异常:" + ex.Message); //Log.Error("拍照异常:" + ex.Message);
} }
return ""; return "";
} }
@ -1041,14 +1062,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
else else
{ {
Log.Info(jo["returnMsg"].ToString()); // Log.Info(jo["returnMsg"].ToString());
return ""; return "";
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("右转异常:" + ex.Message); //Log.Error("右转异常:" + ex.Message);
} }
return ""; return "";
} }
@ -1078,14 +1099,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
else else
{ {
Log.Info(jo["returnMsg"].ToString()); // Log.Info(jo["returnMsg"].ToString());
return ""; return "";
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("左转异常:" + ex.Message); //Log.Error("左转异常:" + ex.Message);
} }
return ""; return "";
} }
@ -1106,7 +1127,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("高拍仪异常:" + ex.Message); //Log.Error("高拍仪异常:" + ex.Message);
} }
} }
@ -1125,7 +1146,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("签字版异常:" + ex.Message); //Log.Error("签字版异常:" + ex.Message);
} }
} }
@ -1145,7 +1166,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("初始文件上传异常:" + ex.Message); //Log.Error("初始文件上传异常:" + ex.Message);
} }
} }
@ -1164,7 +1185,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("上传本地文件中转异常:" + ex.Message); //Log.Error("上传本地文件中转异常:" + ex.Message);
} }
} }
@ -1187,7 +1208,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("根据程序名称杀死进程异常:" + ex.Message); //Log.Error("根据程序名称杀死进程异常:" + ex.Message);
} }
} }
@ -1239,7 +1260,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("开始录音异常:" + ex.Message); //Log.Error("开始录音异常:" + ex.Message);
return false; return false;
} }
} }
@ -1262,7 +1283,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("结束录音异常:" + ex.Message); //Log.Error("结束录音异常:" + ex.Message);
return false; return false;
} }
} }
@ -1293,7 +1314,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("执行命令异常:" + ex.Message); //Log.Error("执行命令异常:" + ex.Message);
} }
} }
@ -1309,7 +1330,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
"yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); "yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
string dirpath = System.IO.Directory.GetCurrentDirectory(); string dirpath = System.IO.Directory.GetCurrentDirectory();
dirpath = dirpath + @"/wwwroot/WavFile"; dirpath = dirpath + @"/wwwroot/WavFile";
Log.Info(dirpath); // Log.Info(dirpath);
if (!Directory.Exists(dirpath)) if (!Directory.Exists(dirpath))
{ {
Directory.CreateDirectory(dirpath); Directory.CreateDirectory(dirpath);
@ -1335,7 +1356,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("文字转语音失败:" + ex.Message); //Log.Error("文字转语音失败:" + ex.Message);
} }
return tempFile; return tempFile;
} }
@ -1367,7 +1388,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("是否已获取收取异常:" + ex.Message); //Log.Error("是否已获取收取异常:" + ex.Message);
} }
return isFunc; return isFunc;
} }
@ -1422,7 +1443,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("提交设备操作日志异常:" + ex.Message); //Log.Error("提交设备操作日志异常:" + ex.Message);
} }
} }
@ -1445,7 +1466,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("播放语音文件异常:" + ex.Message); //Log.Error("播放语音文件异常:" + ex.Message);
} }
} }
@ -1463,7 +1484,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("string 转换为 base64异常:" + ex.Message); //Log.Error("string 转换为 base64异常:" + ex.Message);
} }
return ""; return "";
} }
@ -1483,7 +1504,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("base64 转换为 string异常:" + ex.Message); //Log.Error("base64 转换为 string异常:" + ex.Message);
} }
return ""; return "";
} }

Loading…
Cancel
Save