|
|
|
@ -1,86 +1,212 @@
|
|
|
|
|
using AksWebBrowser; |
|
|
|
|
using AksWebBrowser.Common; |
|
|
|
|
using AksWebBrowser.Devices; |
|
|
|
|
using AKSWebBrowser.Commen; |
|
|
|
|
using AKSWebBrowser.Common; |
|
|
|
|
using CPF.Cef; |
|
|
|
|
using CPF.Mac.AppKit; |
|
|
|
|
using DevicesService.Devices; |
|
|
|
|
using NAudio.Wave; |
|
|
|
|
using NAudio.Wave.SampleProviders; |
|
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using SkiaSharp; |
|
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
|
using System; |
|
|
|
|
using System.Buffers.Text; |
|
|
|
|
using System.Diagnostics; |
|
|
|
|
using System.Globalization; |
|
|
|
|
using System.IO; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Net; |
|
|
|
|
using System.Net.Http; |
|
|
|
|
using System.Net.Http.Headers; |
|
|
|
|
using System.Net.Sockets; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Text.RegularExpressions; |
|
|
|
|
using System.Threading; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
using System.Web; |
|
|
|
|
using System.Xml.Linq; |
|
|
|
|
using static System.Net.Mime.MediaTypeNames; |
|
|
|
|
using AksWebBrowser.Devices; |
|
|
|
|
using System.Reflection; |
|
|
|
|
|
|
|
|
|
namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
|
{ |
|
|
|
|
public class MainModel : CPF.CpfObject |
|
|
|
|
{ |
|
|
|
|
public string callback = string.Empty; |
|
|
|
|
public string PrinterName = "Lexmark-MS430-Series"; |
|
|
|
|
|
|
|
|
|
//初始化网络连接 |
|
|
|
|
public static void DeviceControllerInit() |
|
|
|
|
{ |
|
|
|
|
SAEA.WebSocket.WSServer ws = new SAEA.WebSocket.WSServer(19983); |
|
|
|
|
ws.OnConnected += (s) => |
|
|
|
|
{ |
|
|
|
|
byte[] bytes = SerializeContent("连接成功"); |
|
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
|
}; |
|
|
|
|
ws.OnMessage += (s, e) => |
|
|
|
|
{ |
|
|
|
|
string content = Encoding.UTF8.GetString(e.Content); |
|
|
|
|
var json = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string) |
|
|
|
|
}); |
|
|
|
|
//接收指令和参数 |
|
|
|
|
string keycode = json.code; |
|
|
|
|
//返回内容 |
|
|
|
|
string result = string.Empty; |
|
|
|
|
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); |
|
|
|
|
break; |
|
|
|
|
//aks100110 播放音频文件 {"code":"aks100110"} |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
//答复请求者(处理完请求后在些答复) |
|
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
|
}; |
|
|
|
|
ws.Start(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//解包 |
|
|
|
|
private static string DeserializeContent(byte[] param) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
return Encoding.UTF8.GetString(param); |
|
|
|
|
} |
|
|
|
|
catch |
|
|
|
|
{ |
|
|
|
|
return "参数无效"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//封包 |
|
|
|
|
private static byte[] SerializeContent(string param) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
return Encoding.UTF8.GetBytes(param); |
|
|
|
|
} |
|
|
|
|
catch |
|
|
|
|
{ |
|
|
|
|
return null; |
|
|
|
|
//return "参数无效"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static string callback = string.Empty; |
|
|
|
|
public static string PrinterName = "Lexmark-MS430-Series"; |
|
|
|
|
public static Process recordingProcess; |
|
|
|
|
public static Process Typrocess; |
|
|
|
|
private string srpath = string.Empty; |
|
|
|
|
private static string srpath = string.Empty; |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 读取身份证卡号(已国产化) |
|
|
|
|
/// aks100101 读取身份证卡号(已国产化) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="paramsString"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string IDCardRead(string paramsString) |
|
|
|
|
public static string IDCardRead(string code) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
//Finger("",""); |
|
|
|
|
IDCard iDCard = new IDCard(); |
|
|
|
|
string result = iDCard.getIdCard(); |
|
|
|
|
string result = iDCard.getIdCard(code); |
|
|
|
|
SubmitLogs(result, "IDCardRead"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("读取身份证卡号异常: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "IDCardRead"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 打印排队票据(已国产化) |
|
|
|
|
/// aks100102 打印排队票据(已国产化) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="ph">排号</param> |
|
|
|
|
/// <param name="ddrs">等待人数</param> |
|
|
|
|
/// <param name="qrcode">二维码</param> |
|
|
|
|
/// <param name="ywmc">办理业务名称</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string SendByPrint(string ph, string ddrs, string qrcode, string ywmc) |
|
|
|
|
public static string SendByPrint(string content) |
|
|
|
|
{ |
|
|
|
|
var param = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string), |
|
|
|
|
ph = default(string), |
|
|
|
|
ddrs = default(string), |
|
|
|
|
qrcode = default(string), |
|
|
|
|
ywmc = default(string) |
|
|
|
|
}); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
string ph = param.ph; |
|
|
|
|
string ddrs = param.ddrs; |
|
|
|
|
string qrcode = param.qrcode; |
|
|
|
|
string ywmc = param.ywmc; |
|
|
|
|
|
|
|
|
|
if (!isFuncisFuncObject("SendByPrint")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("打印排队票据设备未授权使用"); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印排队票据设备未授权使用" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印排队票据设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -88,13 +214,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
var data = print.SendPrint(ph, ddrs, qrcode, ywmc); |
|
|
|
|
if (data == 0) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; |
|
|
|
|
SubmitLogs(result, "SendByPrint"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + (data == 1 ? "打印失败" : (data == 2 ? "打印机未连接" : "打印机初始化失败")) + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + (data == 1 ? "打印失败" : (data == 2 ? "打印机未连接" : "打印机初始化失败")) + "\"}"; |
|
|
|
|
SubmitLogs(result, "SendByPrint"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -103,7 +229,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("打印排队票据异常: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "SendByPrint"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -117,17 +243,29 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// <param name="text"></param> |
|
|
|
|
/// <param name="ispaye"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public WaveOutEvent playerTxt = null; |
|
|
|
|
public static string tempWav = string.Empty; |
|
|
|
|
[JSFunction] |
|
|
|
|
public string payleText(string text, bool ispaye) |
|
|
|
|
/// <summary> |
|
|
|
|
/// aks100103文字语音播报 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="content"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public static string payleText(string content) |
|
|
|
|
{ |
|
|
|
|
var param = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string), |
|
|
|
|
text = default(string), |
|
|
|
|
ispaye = default(bool), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
string text = param.text; |
|
|
|
|
bool ispaye = param.ispaye; |
|
|
|
|
if (!isFuncisFuncObject("payleText")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("文字语音播报设备未授权使用"); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "文字语音播报设备未授权使用" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "文字语音播报设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -147,7 +285,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "停止播放成功" + "}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "停止播放成功" + "}"; |
|
|
|
|
SubmitLogs(result, "payleText"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -161,7 +299,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
string command = $"sox {tempWav} -d"; |
|
|
|
|
ShllCommad(command); |
|
|
|
|
}); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "开始播放" + "}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "开始播放" + "}"; |
|
|
|
|
SubmitLogs(result, "payleText"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -170,26 +308,25 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("文字语音播报异常2: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "payleText"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 打开高拍仪并且进行快速扫描文件 (已国产化) |
|
|
|
|
/// aks100104打开高拍仪并且进行快速扫描文件 (已国产化) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="url"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string openCamera(string url) |
|
|
|
|
public static string openCamera(string code) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
string devIndex = GetSnIndex(); |
|
|
|
|
if (string.IsNullOrEmpty(devIndex)) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -199,7 +336,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
string param = OpenSn(devIndex); |
|
|
|
|
if (string.IsNullOrEmpty(param)) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -209,7 +346,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
param = getFrame(); |
|
|
|
|
if (string.IsNullOrEmpty(param)) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -220,7 +357,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
//关闭 |
|
|
|
|
StopSn(devIndex); |
|
|
|
|
}); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"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"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -231,39 +368,42 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("打开高拍仪并且进行快速扫描文件异常: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 打开签字版 sudo apt-get install libgdiplus (已国产化) |
|
|
|
|
/// aks100105打开签字版 sudo apt-get install libgdiplus (已国产化) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="paramsString"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string OpenSign(string paramsString, string callback) |
|
|
|
|
public static string OpenSign(string content) |
|
|
|
|
{ |
|
|
|
|
var param = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string) |
|
|
|
|
}); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
if (!isFuncisFuncObject("OpenSign")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Task.Run(() => HttpPostResponseBySign("open", 1, callback)); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "签字版已打开" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
Task.Run(() => { HttpPostResponseBySign("open", 1, param.code); event2.WaitOne(); }); |
|
|
|
|
string result = sginStr; |
|
|
|
|
SubmitLogs(result, "OpenSign"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("打开签字版异常: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "OpenSign"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -274,20 +414,19 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="paramsString"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string CloseSign(string paramsString) |
|
|
|
|
private static string CloseSign(string code) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
if (!isFuncisFuncObject("OpenSign")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Task.Run(() => HttpPostResponseBySign("close", 2, "")); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "签字版已关闭" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "签字版已关闭" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -295,31 +434,30 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("关闭签字版异常: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "OpenSign"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 指纹 (已国产化,未完成测试) |
|
|
|
|
/// aks100106指纹 (已国产化,未完成测试) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="paramsString"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string ReadFingerData(string callback) |
|
|
|
|
public static string ReadFingerData(string code) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
if (false)//!isFuncisFuncObject("Finger") |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("指纹设备未授权使用"); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "指纹设备未授权使用" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "指纹设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
string result = Fingerprint.LIVESCANFinger(callback); |
|
|
|
|
string result = Fingerprint.LIVESCANFinger(code); |
|
|
|
|
SubmitLogs(result, "Finger"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -327,29 +465,38 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("指纹异常: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "Finger"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 开始录音、取消录音、结束录音 (已国产化) |
|
|
|
|
/// aks100107开始录音、取消录音、结束录音 (已国产化) |
|
|
|
|
/// sudo apt-get update |
|
|
|
|
/// sudo apt-get install alsa-utils |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="isopen"></param> |
|
|
|
|
/// <param name="url"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string SoundRecording(bool isopen, string url) |
|
|
|
|
public static string SoundRecording(string content) |
|
|
|
|
{ |
|
|
|
|
var param = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string), |
|
|
|
|
isopen = default(bool), |
|
|
|
|
url = default(string) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
bool isopen = param.isopen; |
|
|
|
|
string url = param.url; |
|
|
|
|
if (!isFuncisFuncObject("SoundRecording")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("录音设备未授权使用"); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "录音设备未授权使用" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "录音设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -366,13 +513,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
Regex re = new Regex(@"(((?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(:[0-9]+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)"); |
|
|
|
|
MatchCollection mc = re.Matches(url);//获取的是一个数组 |
|
|
|
|
string reurl = mc[0].ToString() + "://" + mc[1].ToString() + urlpath; |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + reurl + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + reurl + "\"}"; |
|
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "结束录音失败" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "结束录音失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -381,13 +528,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
{ |
|
|
|
|
if (StartRecording()) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "开始录音" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "开始录音" + "\"}"; |
|
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "录音失败" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "录音失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -397,14 +544,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
if (StopRecording()) |
|
|
|
|
{ |
|
|
|
|
srpath = string.Empty; |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "取消录音" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "取消录音" + "\"}"; |
|
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
srpath = string.Empty; |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "取消录音失败" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "取消录音失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -415,26 +562,34 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("开始录音、取消录音、结束录音异常: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 根据文件地址在线打印 (已国产化) |
|
|
|
|
/// aks100108根据文件地址在线打印 (已国产化) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="filename"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string PrintFile(string url, string ext) |
|
|
|
|
public static string PrintFile(string content) |
|
|
|
|
{ |
|
|
|
|
var param = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string), |
|
|
|
|
url = default(string), |
|
|
|
|
ext = default(string) |
|
|
|
|
}); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
string url = param.url; |
|
|
|
|
string ext = param.ext; |
|
|
|
|
if (!isFuncisFuncObject("PrintFile")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -465,7 +620,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
string command = $"lp -d {PrinterName} {path}"; |
|
|
|
|
ShllCommad(command); |
|
|
|
|
}); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; |
|
|
|
|
SubmitLogs(result, "PrintFile"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -473,7 +628,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("根据文件地址在线打印异常: " + ex.Message + ""); |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "PrintFile"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -481,20 +636,28 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 根据文件base64打印 (已国产化) |
|
|
|
|
/// aks100109根据文件base64打印 (已国产化)PrintBase64 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="base64"></param> |
|
|
|
|
/// <param name="ext"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string PrintBase64(string url, string base64, string ext) |
|
|
|
|
public static string PrintBase64(string content) |
|
|
|
|
{ |
|
|
|
|
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 "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -520,40 +683,41 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
string command = $"lp -d {PrinterName} {path}"; |
|
|
|
|
ShllCommad(command); |
|
|
|
|
}); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; |
|
|
|
|
SubmitLogs(result, "PrintBase64"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "PrintBase64"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 播放音频文件 (已国产化) |
|
|
|
|
/// aks100110播放音频文件 (已国产化) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="filename"></param> |
|
|
|
|
/// <param name="url"></param> |
|
|
|
|
/// <param name="ispaly"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public static WaveOutEvent player = null; |
|
|
|
|
public static AudioFileReader audioFileReader = null; |
|
|
|
|
public static string WaveOutPath = string.Empty; |
|
|
|
|
[JSFunction] |
|
|
|
|
public string PalyFile(string url, bool ispaly) |
|
|
|
|
public static string PalyFile(string content) |
|
|
|
|
{ |
|
|
|
|
var param = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string), |
|
|
|
|
url = default(string), |
|
|
|
|
ispaly = default(bool) |
|
|
|
|
}); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
string url = param.url; |
|
|
|
|
bool ispaly = param.ispaly; |
|
|
|
|
if (!isFuncisFuncObject("PalyFile")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("音频设备未授权使用"); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "音频设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else if (Parame.tcpClient == null) |
|
|
|
|
{ |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "硬件服务未启动" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "音频设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -591,7 +755,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
string command = $"sox {path} -d"; |
|
|
|
|
ShllCommad(command); |
|
|
|
|
}); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "开始播放" + "}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "开始播放" + "}"; |
|
|
|
|
SubmitLogs(result, "PalyFile"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -611,7 +775,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
string result = "{\"callback\":\"" + callback + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "停止播放成功" + "}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "停止播放成功" + "}"; |
|
|
|
|
SubmitLogs(result, "PalyFile"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -619,42 +783,18 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "PalyFile"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 播放完成 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="sender"></param> |
|
|
|
|
/// <param name="e"></param> |
|
|
|
|
private void waveOut_PlaybackStopped(object sender, StoppedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
player.Stop(); |
|
|
|
|
// 释放资源 |
|
|
|
|
player.Dispose(); |
|
|
|
|
audioFileReader.Dispose(); |
|
|
|
|
player = null; |
|
|
|
|
File.Delete(WaveOutPath); |
|
|
|
|
//Log.Info("播放完成"); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
//Log.Info("播放完成,清除本地文件异常" + ex.Message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 唤醒键盘 (已国产化) |
|
|
|
|
/// aks100111唤醒键盘 (已国产化) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="filename"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public string openKey(string paramsString) |
|
|
|
|
public static string openKey(string code) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
@ -662,12 +802,12 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
{ |
|
|
|
|
Bash("/usr/bin/python3 /usr/bin/onboard"); |
|
|
|
|
}); |
|
|
|
|
return "{\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "唤醒键盘成功" + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "唤醒键盘成功" + "\"}"; |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Log.Error("唤醒键盘异常: " + ex.Message + ""); |
|
|
|
|
return "{\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -701,7 +841,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// 获取设备index |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public string GetSnIndex() |
|
|
|
|
public static string GetSnIndex() |
|
|
|
|
{ |
|
|
|
|
//获取设备信息 |
|
|
|
|
string param = "/GetAllDisplayInfo"; |
|
|
|
@ -742,7 +882,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// 打开高拍仪 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public string OpenSn(string dev_idx) |
|
|
|
|
public static string OpenSn(string dev_idx) |
|
|
|
|
{ |
|
|
|
|
//获取设备信息 |
|
|
|
|
string param = "/StartPreview?dev_idx=" + dev_idx + "&res_id=0"; |
|
|
|
@ -775,7 +915,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// 关闭高拍仪 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public string StopSn(string dev_idx) |
|
|
|
|
public static string StopSn(string dev_idx) |
|
|
|
|
{ |
|
|
|
|
//获取设备信息 |
|
|
|
|
string param = "/StopPreview?dev_idx=" + dev_idx; |
|
|
|
@ -804,7 +944,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// 拍照 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public string getFrame() |
|
|
|
|
public static string getFrame() |
|
|
|
|
{ |
|
|
|
|
//获取设备信息 |
|
|
|
|
string param = "/getFrame"; |
|
|
|
@ -835,7 +975,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// 右转 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public string RotateRight() |
|
|
|
|
public static string RotateRight() |
|
|
|
|
{ |
|
|
|
|
//获取设备信息 |
|
|
|
|
string param = "/rotate/right"; |
|
|
|
@ -864,7 +1004,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// 左转 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public string RotateLeft() |
|
|
|
|
public static string RotateLeft() |
|
|
|
|
{ |
|
|
|
|
//获取设备信息 |
|
|
|
|
string param = "/rotate/left"; |
|
|
|
@ -892,9 +1032,9 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 高拍仪 |
|
|
|
|
/// </summary> |
|
|
|
|
private string gpyStr = string.Empty; |
|
|
|
|
private AutoResetEvent @event6 = new AutoResetEvent(false); |
|
|
|
|
private async void HttpResponse(string param) |
|
|
|
|
private static string gpyStr = string.Empty; |
|
|
|
|
private static AutoResetEvent @event6 = new AutoResetEvent(false); |
|
|
|
|
private static async void HttpResponse(string param) |
|
|
|
|
{ |
|
|
|
|
var httpClient = new HttpClient(); |
|
|
|
|
var uploader = new ChunkedUpload(httpClient); |
|
|
|
@ -902,22 +1042,24 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
@event6.Set(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static string sginStr = string.Empty; |
|
|
|
|
/// <summary> |
|
|
|
|
/// 签字版 |
|
|
|
|
/// </summary> |
|
|
|
|
private async void HttpPostResponseBySign(string type, int typeCode, string callback) |
|
|
|
|
private static async void HttpPostResponseBySign(string type, int typeCode, string code) |
|
|
|
|
{ |
|
|
|
|
var httpClient = new HttpClient(); |
|
|
|
|
var uploader = new ChunkedUpload(httpClient); |
|
|
|
|
await uploader.PostSign(type, typeCode, callback); |
|
|
|
|
sginStr = await uploader.PostSign(type, typeCode, code); |
|
|
|
|
@event2.Set(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 初始文件上传 |
|
|
|
|
/// </summary> |
|
|
|
|
private string urlpath = string.Empty; |
|
|
|
|
private AutoResetEvent @event2 = new AutoResetEvent(false); |
|
|
|
|
private async void UploadInfo(string url, string srpath) |
|
|
|
|
private static string urlpath = string.Empty; |
|
|
|
|
private static AutoResetEvent @event2 = new AutoResetEvent(false); |
|
|
|
|
private static async void UploadInfo(string url, string srpath) |
|
|
|
|
{ |
|
|
|
|
var httpClient = new HttpClient(); |
|
|
|
|
var uploader = new ChunkedUpload(httpClient); |
|
|
|
@ -926,9 +1068,9 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//上传本地文件中转 |
|
|
|
|
private string urlP = string.Empty; |
|
|
|
|
private AutoResetEvent @event5 = new AutoResetEvent(false); |
|
|
|
|
private async void UploadInfoByFile(string url, string strpath) |
|
|
|
|
private static string urlP = string.Empty; |
|
|
|
|
private static AutoResetEvent @event5 = new AutoResetEvent(false); |
|
|
|
|
private static async void UploadInfoByFile(string url, string strpath) |
|
|
|
|
{ |
|
|
|
|
var httpClient = new HttpClient(); |
|
|
|
|
var uploader = new ChunkedUpload(httpClient); |
|
|
|
@ -980,7 +1122,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// 开始录音 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public bool StartRecording() |
|
|
|
|
public static bool StartRecording() |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
@ -1032,7 +1174,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 结束录音 |
|
|
|
|
/// </summary> |
|
|
|
|
public bool StopRecording() |
|
|
|
|
public static bool StopRecording() |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
@ -1115,7 +1257,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="funcName"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public bool isFuncisFuncObject(string funcName) |
|
|
|
|
public static bool isFuncisFuncObject(string funcName) |
|
|
|
|
{ |
|
|
|
|
bool isFunc = false; |
|
|
|
|
if (Parame.FuncObject.Count > 0) |
|
|
|
|