我使用axCZKEM1_OnAttTransactionEx(string EnrollNumber,int IsInValid,int AttState,int VerifyMethod,int Year,int could,int Day,int Hour,int Minute,int Second,int WorkCode)将数据插入到数据库中,但是找不到设备ID,我需要知道是哪台机器触发了这个事件。
我已经通过一组axCZKEM完成了,事件工作正常,但无法获得被触发机器的ip
For i = 0 To LsvMachines.Items.Count - 1
If LsvMachines.Items(i).SubItems(2).Text = "Connected" Then
axCZKEMiu(Val(LsvMachines.Items(i).SubItems(3).Text)).Disconnect()
RemoveHandler axCZKEMiu(Val(LsvMachines.Items(i).SubItems(3).Text)).OnAttTransactionEx, AddressOf AxCZKEM1_OnAttTransactionEx
bIsConnected = False
LsvMachines.Items(i).SubItems(2).Text = "Connect"
Else
ReDim Preserve axCZKEMiu(mIndex)
axCZKEMiu(mIndex) = New zkemkeeper.CZKEM
bIsConnected = axCZKEMiu(mIndex).Connect_Net(LsvMachines.Items(i).Text, 4370) 'IP , Port
If bIsConnected = True Then
LsvMachines.Items(i).SubItems(2).Text = "Connected"
LsvMachines.Items(i).SubItems(3).Text = mIndex
If axCZKEMiu(mIndex).RegEvent(1, 65535) = True Then
'Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
AddHandler axCZKEMiu(mIndex).OnAttTransactionEx, AddressOf AxCZKEM1_OnAttTransactionEx
End If
mIndex = mIndex + 1
bIsConnected = False
End If
End If
Next#Region "RealTime Events"
Private Sub AxCZKEM1_OnAttTransactionEx(ByVal sEnrollNumber As String, ByVal iIsInValid As Integer, ByVal iAttState As Integer, ByVal iVerifyMethod As Integer, _
ByVal iYear As Integer, ByVal iMonth As Integer, ByVal iDay As Integer, ByVal iHour As Integer, ByVal iMinute As Integer, ByVal iSecond As Integer, ByVal iWorkCode As Integer)
'I want to get ip address of triggered machine before saving
End Sub
#End Region发布于 2020-04-13 15:39:20
你不能通过IP连接解决方案来定义机器ID,只能给它分配数字1。但你可以使用IP地址来识别机器。
namespace XXXXX
{
internal class DeviceInfo
{
public string IPAddress { get; set; }
public string Port { get; set; }
public string MachineNumber { get; set; }
}
} https://stackoverflow.com/questions/56680425
复制相似问题