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

101
CPF_Cef/MainModel.cs

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

2
CPF_Cef/Parame.cs

@ -19,7 +19,7 @@ namespace AksWebBrowser
public static Window frm { 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
public static string key = "1";
//硬件Ip

Loading…
Cancel
Save