|
|
|
@ -3,6 +3,7 @@ using AksWebBrowser.Devices;
|
|
|
|
|
using AKSWebBrowser.Commen; |
|
|
|
|
using CPF.Cef; |
|
|
|
|
using Fleck; |
|
|
|
|
using LibVLCSharp.Shared; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
|
using System; |
|
|
|
@ -98,6 +99,11 @@ namespace AksWebBrowser
|
|
|
|
|
result = StopSn(keycode); |
|
|
|
|
//Log.Info("打开高拍仪并且进行快速扫描文件关闭:" + result); |
|
|
|
|
break; |
|
|
|
|
//打开高拍仪并且进行快速扫描文件打开{"code":"aks100122"} |
|
|
|
|
case "aks100122": |
|
|
|
|
result = OpenSn(keycode); |
|
|
|
|
//Log.Info("打开高拍仪并且进行快速扫描文件打开:" + result); |
|
|
|
|
break; |
|
|
|
|
//aks100105 |
|
|
|
|
//打开签字版 {"code":"aks100105"} |
|
|
|
|
case "aks100105": |
|
|
|
@ -509,29 +515,29 @@ namespace AksWebBrowser
|
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
//if (Parame.isGPY) |
|
|
|
|
//{ |
|
|
|
|
// //拍照 |
|
|
|
|
// string param = getFrame(); |
|
|
|
|
// //Log.Info("img2" + (param)); |
|
|
|
|
// if (string.IsNullOrEmpty(param)) |
|
|
|
|
// { |
|
|
|
|
// //关闭 |
|
|
|
|
// //StopSn("0"); |
|
|
|
|
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; |
|
|
|
|
// SubmitLogs(result, "openCamera"); |
|
|
|
|
// return result; |
|
|
|
|
// } |
|
|
|
|
// else |
|
|
|
|
// { |
|
|
|
|
// param = Utils.ImagesByRotate(param, 90); |
|
|
|
|
// //关闭 |
|
|
|
|
// //StopSn("0"); |
|
|
|
|
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; |
|
|
|
|
// SubmitLogs(result, "openCamera"); |
|
|
|
|
// return result; |
|
|
|
|
// } |
|
|
|
|
//} |
|
|
|
|
if (true) |
|
|
|
|
{ |
|
|
|
|
//拍照 |
|
|
|
|
string param = getFrame(); |
|
|
|
|
//Log.Info("img2" + (param)); |
|
|
|
|
if (string.IsNullOrEmpty(param)) |
|
|
|
|
{ |
|
|
|
|
//关闭 |
|
|
|
|
//StopSn("0"); |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
param = Utils.ImagesByRotate(param, 90); |
|
|
|
|
//关闭 |
|
|
|
|
//StopSn("0"); |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//else |
|
|
|
|
//{ |
|
|
|
|
// //打开高拍仪 |
|
|
|
@ -570,42 +576,42 @@ namespace AksWebBrowser
|
|
|
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
string devindex = GetSnIndex(); |
|
|
|
|
if (string.IsNullOrEmpty(devindex)) |
|
|
|
|
{ |
|
|
|
|
devindex = Parame.gpydevIndex; |
|
|
|
|
} |
|
|
|
|
//打开高拍仪 |
|
|
|
|
string param = OpenSn(devindex); |
|
|
|
|
if (string.IsNullOrEmpty(param)) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Task.Delay(1000).Wait(); |
|
|
|
|
//拍照 |
|
|
|
|
param = getFrame(); |
|
|
|
|
Task.Delay(1000).Wait(); |
|
|
|
|
//Log.Info("拍照结果img2:" + (param)); |
|
|
|
|
if (string.IsNullOrEmpty(param)) |
|
|
|
|
{ |
|
|
|
|
//关闭 |
|
|
|
|
StopSn(devindex); |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描失败,请重新扫描" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
string base64 = Utils.ImagesByRotate(param, 90); |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//string devindex = GetSnIndex(); |
|
|
|
|
//if (string.IsNullOrEmpty(devindex)) |
|
|
|
|
//{ |
|
|
|
|
// devindex = Parame.gpydevIndex; |
|
|
|
|
//} |
|
|
|
|
////打开高拍仪 |
|
|
|
|
//string param = OpenSn(devindex); |
|
|
|
|
//if (string.IsNullOrEmpty(param)) |
|
|
|
|
//{ |
|
|
|
|
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; |
|
|
|
|
// SubmitLogs(result, "openCamera"); |
|
|
|
|
// return result; |
|
|
|
|
//} |
|
|
|
|
//else |
|
|
|
|
//{ |
|
|
|
|
// Task.Delay(1000).Wait(); |
|
|
|
|
// //拍照 |
|
|
|
|
// param = getFrame(); |
|
|
|
|
// Task.Delay(1000).Wait(); |
|
|
|
|
// //Log.Info("拍照结果img2:" + (param)); |
|
|
|
|
// if (string.IsNullOrEmpty(param)) |
|
|
|
|
// { |
|
|
|
|
// //关闭 |
|
|
|
|
// StopSn(devindex); |
|
|
|
|
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描失败,请重新扫描" + "\"}"; |
|
|
|
|
// SubmitLogs(result, "openCamera"); |
|
|
|
|
// return result; |
|
|
|
|
// } |
|
|
|
|
// else |
|
|
|
|
// { |
|
|
|
|
// string base64 = Utils.ImagesByRotate(param, 90); |
|
|
|
|
// string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; |
|
|
|
|
// SubmitLogs(result, "openCamera"); |
|
|
|
|
// return result; |
|
|
|
|
// } |
|
|
|
|
//} |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
@ -1413,36 +1419,48 @@ namespace AksWebBrowser
|
|
|
|
|
/// 打开高拍仪 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public static string OpenSn(string dev_idx) |
|
|
|
|
public static string OpenSn(string code) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
string devindex = GetSnIndex(); |
|
|
|
|
if (string.IsNullOrEmpty(devindex)) |
|
|
|
|
{ |
|
|
|
|
devindex = Parame.gpydevIndex; |
|
|
|
|
} |
|
|
|
|
//获取设备信息 |
|
|
|
|
string param = "/StartPreview?dev_idx=" + dev_idx + "&res_id=0"; |
|
|
|
|
string param = "/StartPreview?dev_idx=" + devindex + "&res_id=0"; |
|
|
|
|
Task.Run(() => HttpResponse(param)); |
|
|
|
|
@event6.WaitOne(); |
|
|
|
|
if (string.IsNullOrEmpty(gpyStr)) |
|
|
|
|
{ |
|
|
|
|
return ""; |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "打开高拍仪失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr); |
|
|
|
|
if (jo["returnCode"].ToString() == "0" || jo["returnCode"].ToString() == "2") |
|
|
|
|
{ |
|
|
|
|
return "200"; |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "打开高拍仪成功" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
return ""; |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "打开高拍仪失败" + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
//Log.Error("打开高拍仪异常:" + ex.Message); |
|
|
|
|
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
|
SubmitLogs(result, "openCamera"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|