diff --git a/DevicesService/App.config b/DevicesService/App.config
index 53cfc32..120fc2b 100644
--- a/DevicesService/App.config
+++ b/DevicesService/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/DevicesService/Commen/Util.cs b/DevicesService/Commen/Util.cs
index 1b7fc42..5a1a4e5 100644
--- a/DevicesService/Commen/Util.cs
+++ b/DevicesService/Commen/Util.cs
@@ -56,7 +56,7 @@ namespace DevicesService.Common
ms.Read(arr, 0, (int)ms.Length);
ms.Close();
bmp.Dispose();
- File.Delete(fileLocation);
+ //File.Delete(fileLocation);
return Convert.ToBase64String(arr);
}
return "";
@@ -400,7 +400,7 @@ namespace DevicesService.Common
string newName = file.Name.Replace(file.Extension, "") + "_compress" + file.Extension;
fullpath = file.FullName.Replace(file.Name, newName);
image.Save(fullpath);
- file.Delete();
+ //file.Delete();
}
}
else
diff --git a/DevicesService/Devices/EloamDll.cs b/DevicesService/Devices/EloamDll.cs
index 208813e..e4ca9c6 100644
--- a/DevicesService/Devices/EloamDll.cs
+++ b/DevicesService/Devices/EloamDll.cs
@@ -243,5 +243,16 @@ namespace DevicesService.Devices
[DllImport("eloamDll.dll", EntryPoint = "EloamGlobal_StopOcrDiscern", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
public static extern BOOL EloamGlobal_StopOcrDiscern();
//OCR --end
+
+
+ //新增
+ [DllImport("eloamDll.dll", EntryPoint = "EloamImage_GetChannels")]
+ public static extern LONG EloamImage_GetChannels(HELOAMIMAGE img);
+
+ [DllImport("eloamDll.dll", EntryPoint = "EloamImage_Copy")]
+ public static extern LONG EloamImage_Copy(HELOAMIMAGE hSaveImg, HELOAMIMAGE img);
+
+
+
}
}
diff --git a/DevicesService/Devices/HScamera.cs b/DevicesService/Devices/HScamera.cs
index 0b52489..cfdee9b 100644
--- a/DevicesService/Devices/HScamera.cs
+++ b/DevicesService/Devices/HScamera.cs
@@ -88,6 +88,7 @@ namespace DevicesService.Devices
string filename = string.Empty;
if (m_vDevice.Count == 0)
{
+ Console.WriteLine("初始化扫描仪");
DevChangeCallBack = new ELOAM_DEVCHANGECALLBACK(DEVCHANGECALLBACK);
EloamDll.EloamGlobal_InitDevs(DevChangeCallBack, IntPtr.Zero);
EloamDll.EloamGlobal_VideoCapInit();
@@ -100,8 +101,7 @@ namespace DevicesService.Devices
hDev, resIdx, modeIdx, null, (IntPtr)0, null, (IntPtr)0, 0, 2);
//开始拍照
- HELOAMIMAGE hImg = EloamDll.EloamVideo_CreateImage(
- m_hVideo, 0, m_hView);
+ HELOAMIMAGE hImg = EloamDll.EloamVideo_CreateImage(m_hVideo, 0, m_hView);
if (IntPtr.Zero != hImg)
{
DateTime dateTime = DateTime.Now;
@@ -111,13 +111,33 @@ namespace DevicesService.Devices
FileExt.MakeSureDirExist(dirpath);
var filepath = Path.Combine(dirpath, time);
filename = dirpath + "\\" + time + ".jpg";
- if (1 == EloamDll.EloamImage_Save(hImg, filename, 0))
+ //新增
+ LONG width = EloamDll.EloamImage_GetWidth(hImg);
+ LONG height = EloamDll.EloamImage_GetHeight(hImg);
+ HELOAMIMAGE hSaveImg = EloamDll.EloamGlobal_CreateImage(width, height, EloamDll.EloamImage_GetChannels(hImg));
+ if (null == hSaveImg)
+ { //释放
+ EloamDll.EloamImage_Release(hSaveImg);
+ EloamDll.EloamImage_Release(hImg);
+ openCamera2();
+ }
+ else
{
- EloamDll.EloamView_PlayCaptureEffect(m_hView);
+ EloamDll.EloamImage_Copy(hSaveImg, hImg);
+ //保存图片
+ if (1 == EloamDll.EloamImage_Save(hSaveImg, filename, 0))
+ {
+ EloamDll.EloamView_PlayCaptureEffect(m_hView);
+ }
+ //释放
+ EloamDll.EloamImage_Release(hSaveImg);
+ EloamDll.EloamImage_Release(hImg);
+ //为获取图片重新破获
+ if (!File.Exists(filename))
+ {
+ openCamera2();
+ }
}
- EloamDll.EloamImage_Release(hImg);
- //旋转图片
- //filename = ImgToBase64String(filename);
}
return filename;
}
diff --git a/DevicesService/Devices/SignDll.cs b/DevicesService/Devices/SignDll.cs
index e0c5d3a..febba5e 100644
--- a/DevicesService/Devices/SignDll.cs
+++ b/DevicesService/Devices/SignDll.cs
@@ -56,6 +56,7 @@ namespace DevicesService.Devices
{
try
{
+ Console.WriteLine(number);
//1 签字确定按钮 2签字取消按钮 3 签字重签按钮(清空界面)
if (number == 1)
{
@@ -65,18 +66,10 @@ namespace DevicesService.Devices
}
else if (number == 3)
{
-
string UIFile = System.IO.Directory.GetCurrentDirectory() + "\\sign_ui.jpg";
int ret = FiveInchDll.ComSetSignBackgroundImage(UIFile);
Console.WriteLine("ComSetSignBackgroundImage:" + ret);
}
- //2023-02-27 通知返回获取SN
- else if (number == 17) //返回设备SN
- {
- StringBuilder sbDevSN = new StringBuilder();
- FiveInchDll.ComGetDevSN_Async(sbDevSN);
- Console.WriteLine("ComGetDevSN:" + sbDevSN);
- }
else
{
lastpointx[0] = -1;
@@ -96,6 +89,7 @@ namespace DevicesService.Devices
//0816加报点
public static void GetTouchPoint(TOUCH_INFO[] info1)
{
+ return;
int x = 0, y = 0;
int pressurevl;
int dx = 0, dy = 0;
@@ -235,7 +229,7 @@ namespace DevicesService.Devices
if (status == 0)
{
//关闭报点
- int ret = FiveInchDll.ComSendPoint(0, null);
+ int ret = FiveInchDll.ComSendPoint(0, GetTouchPoint);
if (true)
{
string UIFile = System.IO.Directory.GetCurrentDirectory() + "\\adv_ui.jpg";
diff --git a/DevicesService/DevicesService.csproj b/DevicesService/DevicesService.csproj
index ce6b1d4..a403bb9 100644
--- a/DevicesService/DevicesService.csproj
+++ b/DevicesService/DevicesService.csproj
@@ -1,4 +1,4 @@
-
+
Exe