|
|
|
using DevicesService.Commen;
|
|
|
|
using DevicesService.Common;
|
|
|
|
using Functions.FileExt;
|
|
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
|
|
|
using System;
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.IO;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
public struct TOUCH_INFO
|
|
|
|
{
|
|
|
|
public int btnID;//5寸 确定 重签 取消按钮
|
|
|
|
}
|
|
|
|
namespace DevicesService.Devices
|
|
|
|
{
|
|
|
|
public class SignDll
|
|
|
|
{
|
|
|
|
public static int status = -1;
|
|
|
|
public SignDll()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
status = FiveInchDll.OpenComDevice(DevGetTouchNumber);
|
|
|
|
Console.WriteLine("OpenComDevice:" + status);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
Log.Error(ex.Message);
|
|
|
|
}
|
|
|
|
finally { }
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void DevGetTouchNumber(int number)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Console.WriteLine(number);
|
|
|
|
//1 签字确定按钮 2签字取消按钮 3 签字重签按钮(清空界面)
|
|
|
|
if (number == 1)
|
|
|
|
{
|
|
|
|
int ret = FiveInchDll.ComSignOK();
|
|
|
|
Console.WriteLine("ComSignOK:" + ret);
|
|
|
|
FiveInchDll.ComSetBackGroundAdv();
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
ScriptCallbackObject script = new ScriptCallbackObject();
|
|
|
|
string str = script.GetSignData("", "'");
|
|
|
|
str = "@" + str;
|
|
|
|
TcpServer.SendImages(str);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else if (number == 3)
|
|
|
|
{
|
|
|
|
string UIFile = System.IO.Directory.GetCurrentDirectory() + "\\sign_ui.jpg";
|
|
|
|
int ret = FiveInchDll.ComSetSignBackgroundImage(UIFile);
|
|
|
|
Console.WriteLine("ComSetSignBackgroundImage:" + ret);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FiveInchDll.ComSetBackGroundAdv();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch { }
|
|
|
|
finally { }
|
|
|
|
}
|
|
|
|
|
|
|
|
//0816加报点
|
|
|
|
public static void GetTouchPoint(TOUCH_INFO[] info1)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//打开签字版
|
|
|
|
public static int OpenComDevice()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (status == -1)
|
|
|
|
{
|
|
|
|
status = FiveInchDll.OpenComDevice(DevGetTouchNumber);
|
|
|
|
Console.WriteLine("OpenComDevice:" + status);
|
|
|
|
if (status == 0)
|
|
|
|
{
|
|
|
|
//关闭报点
|
|
|
|
int ret = FiveInchDll.ComSendPoint(0, GetTouchPoint);
|
|
|
|
if (true)
|
|
|
|
{
|
|
|
|
string UIFile = System.IO.Directory.GetCurrentDirectory() + "\\adv_ui.jpg";
|
|
|
|
int ret1 = FiveInchDll.ComSendAdvantageImage(UIFile);
|
|
|
|
Console.WriteLine("ComSendAdvantageImage:" + ret1);
|
|
|
|
FiveInchDll.ComSetBackGroundAdv();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (true)
|
|
|
|
{
|
|
|
|
string UIFile = System.IO.Directory.GetCurrentDirectory() + "\\sign_ui.jpg";
|
|
|
|
int ret1 = FiveInchDll.ComSetSignBackgroundImage(UIFile);
|
|
|
|
Console.WriteLine("ComSetSignBackgroundImage:" + ret1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (status == 0)
|
|
|
|
{
|
|
|
|
//关闭报点
|
|
|
|
int ret = FiveInchDll.ComSendPoint(0, GetTouchPoint);
|
|
|
|
if (true)
|
|
|
|
{
|
|
|
|
string UIFile = System.IO.Directory.GetCurrentDirectory() + "\\adv_ui.jpg";
|
|
|
|
int ret1 = FiveInchDll.ComSendAdvantageImage(UIFile);
|
|
|
|
Console.WriteLine("ComSendAdvantageImage:" + ret1);
|
|
|
|
FiveInchDll.ComSetBackGroundAdv();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (true)
|
|
|
|
{
|
|
|
|
string UIFile = System.IO.Directory.GetCurrentDirectory() + "\\sign_ui.jpg";
|
|
|
|
int ret1 = FiveInchDll.ComSetSignBackgroundImage(UIFile);
|
|
|
|
Console.WriteLine("ComSetSignBackgroundImage:" + ret1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
Log.Error(ex.Message);
|
|
|
|
}
|
|
|
|
finally { }
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
//关闭签字版
|
|
|
|
public static int CloseComDevice()
|
|
|
|
{
|
|
|
|
int ret = -1;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (status == 0)
|
|
|
|
{
|
|
|
|
ret = FiveInchDll.CloseComDevice();
|
|
|
|
if (ret == 0)
|
|
|
|
{
|
|
|
|
status = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch { }
|
|
|
|
finally { }
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class FiveInchDll
|
|
|
|
{
|
|
|
|
|
|
|
|
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
|
|
|
|
public delegate void GetTouchNumber(int number);
|
|
|
|
//0816加报点
|
|
|
|
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
|
|
|
|
public delegate void TOUCH_INFO_FUNC([MarshalAs(UnmanagedType.LPArray, SizeConst = 160)] TOUCH_INFO[] info);
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComSendPoint(int nState, [MarshalAs(UnmanagedType.FunctionPtr)] TOUCH_INFO_FUNC callback); //0816加报点
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int OpenComDevice([MarshalAs(UnmanagedType.FunctionPtr)] GetTouchNumber callback);
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int CloseComDevice();
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComSetSignBackgroundImage(string UIFile);
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComSetPictureSavePath(string PicturePath, int PicturePathLen);
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComSignOK();
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComSetPenStyle(int PenStyle);
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComGetDevSN(StringBuilder pDevSN, int iSync);
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComGetDevSN_Async(StringBuilder pDevSN);
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComWhiteScreen();
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComSendAdvantageImage(string UIFile);
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("XTJZFiveInch.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int ComSetBackGroundAdv();
|
|
|
|
}
|
|
|
|
}
|