Browse Source

高拍仪已改成每次用的开启拍照然后关闭方式,已更新到234,该方式存在的问题,高拍仪拍照的时候会出现拍照返回的空的,没有拍到图片资源的情况

master
胡超1 1 year ago
parent
commit
846acaf57a
  1. 32
      CPF_Cef/FrmMain.cs
  2. 101
      CPF_Cef/MainModel.cs
  3. 2
      CPF_Cef/Parame.cs

32
CPF_Cef/FrmMain.cs

@ -81,8 +81,8 @@ namespace AksWebBrowser
//浏览器大小 //浏览器大小
Parame.webBrowser.Width = w; Parame.webBrowser.Width = w;
Parame.webBrowser.Height = h; Parame.webBrowser.Height = h;
Parame.webBrowser.Url = "http://143.169.62.3:8096/#/main-out";//天府新区 //Parame.webBrowser.Url = "http://143.169.62.3:8096/#/main-out";//天府新区
//Parame.webBrowser.Url = "http://192.168.0.232:8848/html/index.html"; Parame.webBrowser.Url = "http://192.168.0.234:8096/#/main-out";
//Parame.webBrowser.Url = "http://192.168.0.34:8078/#/main-out"; //Parame.webBrowser.Url = "http://192.168.0.34:8078/#/main-out";
//Parame.webBrowser.Url = Application.StartupPath + @"\html\index.html"; //Parame.webBrowser.Url = Application.StartupPath + @"\html\index.html";
//开发者工具暂时只能支持Windows //开发者工具暂时只能支持Windows
@ -109,21 +109,21 @@ namespace AksWebBrowser
} }
//获取授权 //获取授权
GetSQObject(); GetSQObject();
//获取设备 ////获取设备
MainModel.GetSnIndex(); //MainModel.GetSnIndex();
//打开高拍仪 ////打开高拍仪
if (MainModel.OpenSn(Parame.gpydevIndex) == "200") //if (MainModel.OpenSn(Parame.gpydevIndex) == "200")
{ //{
Parame.isGPY = true; // Parame.isGPY = true;
} //}
//开启/关闭纠偏显示 ////开启/关闭纠偏显示
MainModel.EnableDeskImage(1); //MainModel.EnableDeskImage(1);
//开启定时 ////开启定时
System.Timers.Timer timer = new System.Timers.Timer(1000);//3秒钟的时间间隔 //System.Timers.Timer timer = new System.Timers.Timer(1000);//3秒钟的时间间隔
timer.Elapsed += OnTimedEvent; //timer.Elapsed += OnTimedEvent;
timer.AutoReset = true;//重复执行 //timer.AutoReset = true;//重复执行
timer.Enabled = true;//启动定时器 //timer.Enabled = true;//启动定时器
} }
//矫正授权 //矫正授权

101
CPF_Cef/MainModel.cs

@ -519,33 +519,73 @@ namespace AksWebBrowser
{ {
try try
{ {
if (Parame.isGPY) //if (Parame.isGPY)
{ //{
//拍照 // //拍照
string param = getFrame(); // string param = getFrame();
//Log.Info("img2" + (param)); // //Log.Info("img2" + (param));
if (string.IsNullOrEmpty(param)) // if (string.IsNullOrEmpty(param))
{ // {
//关闭 // //关闭
//StopSn("0"); // //StopSn("0");
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; // string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}";
SubmitLogs(result, "openCamera"); // SubmitLogs(result, "openCamera");
return result; // return result;
} // }
else // else
{ // {
param = Utils.ImagesByRotate(param, 90); // param = Utils.ImagesByRotate(param, 90);
//关闭 // //关闭
//StopSn("0"); // //StopSn("0");
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; // string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}";
SubmitLogs(result, "openCamera"); // SubmitLogs(result, "openCamera");
return result; // return result;
} // }
//}
//else
//{
// //打开高拍仪
// string param = OpenSn(Parame.gpydevIndex);
// 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();
// //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
// {
// string base64 = 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;
// }
// }
//}
string devindex = GetSnIndex();
if (string.IsNullOrEmpty(devindex)) {
devindex = Parame.gpydevIndex;
} }
else
{
//打开高拍仪 //打开高拍仪
string param = OpenSn(Parame.gpydevIndex); string param = OpenSn(devindex);
if (string.IsNullOrEmpty(param)) if (string.IsNullOrEmpty(param))
{ {
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}";
@ -554,14 +594,15 @@ namespace AksWebBrowser
} }
else else
{ {
Task.Delay(1000).Wait(); //开启纠偏
EnableDeskImage(1);
//拍照 //拍照
param = getFrame(); param = getFrame();
//Log.Info("img2" + (param)); //Log.Info("img2" + (param));
if (string.IsNullOrEmpty(param)) if (string.IsNullOrEmpty(param))
{ {
//关闭 //关闭
//StopSn("0"); StopSn(devindex);
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}";
SubmitLogs(result, "openCamera"); SubmitLogs(result, "openCamera");
return result; return result;
@ -570,16 +611,12 @@ namespace AksWebBrowser
{ {
string base64 = Utils.ImagesByRotate(param, 90); string base64 = Utils.ImagesByRotate(param, 90);
//关闭 //关闭
//StopSn("0"); StopSn(devindex);
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}";
SubmitLogs(result, "openCamera"); SubmitLogs(result, "openCamera");
return result; return result;
} }
} }
}
} }
catch (Exception ex) catch (Exception ex)
{ {

2
CPF_Cef/Parame.cs

@ -19,7 +19,7 @@ namespace AksWebBrowser
public static Window frm { get; set; } public static Window frm { get; set; }
public static List<Func> FuncObject { get; set; } public static List<Func> FuncObject { get; set; }
//接口地址 //接口地址
public static string apiUrl = "http://143.169.62.3:8098";//"http://192.168.0.34:92";// public static string apiUrl = "http://192.168.0.234:8098";//"http://143.169.62.3:8098";//
//授权key //授权key
public static string key = "1"; public static string key = "1";
//硬件Ip //硬件Ip

Loading…
Cancel
Save