Browse Source

签字版与扫描

master
胡超1 1 year ago
parent
commit
1f382a66ff
  1. 2
      DevicesService/App.config
  2. 4
      DevicesService/Commen/Util.cs
  3. 11
      DevicesService/Devices/EloamDll.cs
  4. 30
      DevicesService/Devices/HScamera.cs
  5. 12
      DevicesService/Devices/SignDll.cs
  6. 2
      DevicesService/DevicesService.csproj

2
DevicesService/App.config

@ -5,7 +5,7 @@
<add key="COMName" value="COM4"/>
<!--高拍仪图片旋转方向逆时针为例-->
<add key="xzds" value="90"/>
<add key="ysb" value="10"/>
<add key="ysb" value="5"/>
<add key="ipAddress" value="192.168.1.166"/>
<add key="port" value="1234"/>
<add key="rootPath" value="http://192.168.1.166:5000/wwwroot/"/>

4
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

11
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);
}
}

30
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.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);
//旋转图片
//filename = ImgToBase64String(filename);
//为获取图片重新破获
if (!File.Exists(filename))
{
openCamera2();
}
}
}
return filename;
}

12
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";

2
DevicesService/DevicesService.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>

Loading…
Cancel
Save