以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请教vb.net代码如何转换在狐表中使用? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141797) |
||||
-- 作者:z769036165 -- 发布时间:2019/10/11 8:50:00 -- 请教vb.net代码如何转换在狐表中使用? Private Const DeviceCodePage As Int32 = 936 Public Sub New() InitializeComponent() End Sub Private Sub buttonClear_Click(ByVal sender As Object, ByVal e As EventArgs) textBoxRecords.Clear() End Sub Private Sub buttonExport_Click(ByVal sender As Object, ByVal e As EventArgs) Try Using Client As FaceId = New FaceId(textBoxDeviceIP.Text, Convert.ToInt32(textBoxDevicePort.Text)) Dim Answer As String Dim ErrorCode As FaceId_ErrorCode = Client.Execute("GetRecord(end_time=""" & DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") & """)", Answer, DeviceCodePage) If ErrorCode = FaceId_ErrorCode.Success Then Dim Pattern As String = "\\b(time=.+" & vbCrLf & "(?:photo=""[^""]+"")*)" Dim matches As MatchCollection = Regex.Matches(Answer, Pattern) If matches IsNot Nothing Then For Each match As Match In matches textBoxRecords.AppendText(match.Groups(1).Value & vbCrLf) Next End If Else MessageBox.Show("错误代码:" & ErrorCode.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) End If End Using Catch ex As Exception MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) End Try [此贴子已经被作者于2019/10/11 9:03:36编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2019/10/11 9:35:00 -- 放到全局代码 Public Const DeviceCodePage As Int32 = 936 Public Function buttonExport() As String Dim res As new stringbuilder Try Using Client As 从源代码找到完整命名空间放到这里.FaceId = New 完整命名空间.FaceId(textBoxDeviceIP.Text, Convert.ToInt32(textBoxDevicePort.Text)) Dim Answer As String Dim ErrorCode As 完整命名空间.FaceId_ErrorCode = Client.Execute("GetRecord(end_time=""" & DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") & """)", Answer, DeviceCodePage) If ErrorCode = 完整命名空间.FaceId_ErrorCode.Success Then Dim Pattern As String = "\\b(time=.+" & vbCrLf & "(?:photo=""[^""]+"")*)" Dim matches As object = System.Text.RegularExpressions.Regex.Matches(Answer, Pattern) If matches IsNot Nothing Then For Each match As object In matches res.Appendline(match.Groups(1).Value) Next End If Else MessageBox.Show("错误代码:" & ErrorCode.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) End If End Using Catch ex As Exception MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) End Try Return res.tostring End Function 调用 msgbox(buttonExport())
|
||||
-- 作者:z769036165 -- 发布时间:2019/10/11 15:15:00 -- 谢谢,可以获取考勤数据了,但是能否可以监视考勤设备,如果新考勤数据发生了,可以自动发送到ft中来呢? |
||||
-- 作者:z769036165 -- 发布时间:2019/10/11 15:17:00 --
考勤的dll,后缀不能上传,改成txt上传的
|
||||
-- 作者:有点蓝 -- 发布时间:2019/10/11 15:41:00 -- 这个看设备的开发文档,有没有和监控数据有关的接口 |
||||
-- 作者:z769036165 -- 发布时间:2019/10/11 15:43:00 -- http://www.firstsolver.com/wordpress/?p=1118 这个应该可以,就是太多内容看不明白
[此贴子已经被作者于2019/10/11 15:43:47编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2019/10/11 15:57:00 -- 找厂家要开发文档和.net的开发实例 |
||||
-- 作者:z769036165 -- 发布时间:2019/10/11 23:40:00 -- http://www.firstsolver.com/download/FaceIdSDK/Help-CS-SC/index.html 开发文档连接 这个vb方式获取 Private Const DeviceCodePage As Int32 = 936 Private TcpServer As TcpListenerPlus = Nothing Private IsServerRunning As Boolean = False Public Sub New() InitializeComponent() End Sub Private Sub buttonSetServerHost_Click(ByVal sender As Object, ByVal e As EventArgs) Try Using Client As FaceId = New FaceId(textBoxDeviceIP.Text, Convert.ToInt32(textBoxDevicePort.Text)) Dim Command As String = "SetServerHost(ip=""" & comboBoxServerIP.Text & """ port=""" + textBoxServerPort.Text & """)" Dim Answer As String If Client.Execute(Command, Answer, DeviceCodePage) = FaceId_ErrorCode.Success Then MessageBox.Show("设置服务器参数成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information) Else MessageBox.Show("设置服务器参数失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) End If End Using Catch ex As Exception MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) End Try End Sub Private Sub buttonClear_Click(ByVal sender As Object, ByVal e As EventArgs) textBoxRecords.Clear() End Sub Private Sub buttonStartListener_Click(ByVal sender As Object, ByVal e As EventArgs) If IsServerRunning Then TcpServer.[Stop]() TcpServer = Nothing IsServerRunning = False buttonStartListener.Text = "开启侦听" Else Try TcpServer = New TcpListenerPlus(IPAddress.Parse(comboBoxServerIP.Text), Convert.ToInt32(textBoxServerPort.Text)) TcpServer.SecretKey = String.Empty TcpServer.OnServerTaskRequest += AddressOf OnServerTaskProcess TcpServer.StartListenThread(New String() {textBoxDeviceIP.Text}, 0, 10 * 60 * 1000) Catch ex As Exception MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) Return End Try IsServerRunning = True buttonStartListener.Text = "停止侦听" End If End Sub Private Sub OnServerTaskProcess(ByVal sender As Object, ByVal e As EventArgs) Dim Stream As NetworkStreamPlus = CType(sender, NetworkStreamPlus) While True Try Dim Answer As String Stream.Read(Answer, DeviceCodePage) textBoxRecords.Invoke(New Action(Sub() textBoxRecords.AppendText(Answer & vbCrLf) End Sub)) If Answer.StartsWith("PostRecord") Then Stream.Write("Return(result=""success"" postphoto=""false"")", DeviceCodePage) ElseIf Answer.StartsWith("Record") Then Stream.Write("Return(result=""success"")", DeviceCodePage) ElseIf Answer.StartsWith("PostEmployee") Then Stream.Write("Return(result=""success"")", DeviceCodePage) ElseIf Answer.StartsWith("Employee") Then Stream.Write("Return(result=""success"")", DeviceCodePage) ElseIf Answer.StartsWith("Quit") Then Exit While End If Catch __unusedSocketException1__ As System.Net.Sockets.SocketException Exit While Catch __unusedIOException2__ As System.IO.IOException Exit While Catch __unusedObjectDisposedException3__ As System.ObjectDisposedException Exit While Catch ex As Exception Dim ErrorMessage As String = "错误信息:" & ex.[GetType]().Name MessageBox.Show(ErrorMessage, "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) End Try End While End Sub |
||||
-- 作者:有点蓝 -- 发布时间:2019/10/12 8:38:00 -- 8楼的代码按照2楼那样改即可。 buttonSetServerHost_Click函数用于设置服务参数 buttonStartListener_Click函数用于启动监听 OnServerTaskProcess函数用于接收监听结果,由于是在子线程里异步接收的,所以不能操作界面和表格,需要把结果直接写入数据库,把下面这段代码 textBoxRecords.Invoke(New Action(Sub() textBoxRecords.AppendText(Answer & vbCrLf) End Sub)) 改为保存到数据库即可,监听结果就是变量Answer的内容 |
||||
-- 作者:z769036165 -- 发布时间:2019/10/12 9:50:00 -- Using Client As FaceId = New FaceId(textBoxDeviceIP.Text, Convert.ToInt32(textBoxDevicePort.Text)) Dim Command As String = "SetServerHost(ip=""" & comboBoxServerIP.Text & """ port=""" + textBoxServerPort.Text & """)" Dim Answer As String If Client.Execute(Command, Answer, DeviceCodePage) = FaceId_ErrorCode.Success Then MessageBox.Show("设置服务器参数成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information) Else MessageBox.Show("设置服务器参数失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.[Error]) End If End Using 就是这一截不知道是怎么回事,设置都是失败
|