那位做过中控的指纹打卡机接口

林g 2011-12-21 01:49:03
如题!本人现在有个别人做好的程序,发现程序有时候无法读到记录,返回的提示是-2
在此问问各位,看谁做过类似的程序,给点经验!
先谢谢!
...全文
322 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
林g 2011-12-28
  • 打赏
  • 举报
回复
已经弄明白了.谢谢大家,现在已经把代码改到有注释的状态下了.

再次谢谢!
qq598235031 2011-12-27
  • 打赏
  • 举报
回复
写的代码看起来很恼火啊
为什么不把这个打卡机的接口包装下吗,
比如 使用个适配器包装下,打开设备,准备就绪,开始读数据。。。暂时打卡,关闭设备等功能
使用者一看就明白了,怎么使用
林g 2011-12-27
  • 打赏
  • 举报
回复
那位好心人做过,给个例子也可以呀!
姣游天下 2011-12-23
  • 打赏
  • 举报
回复
以前用过中控的设备,你先看下开发包,看错误代码对应错误详细信息。指纹按压不标准会读取不到指纹特征码,指纹设备连接有时也会接触不好
林g 2011-12-23
  • 打赏
  • 举报
回复
这是别人写的代码.所以我也很头大呀!问题是再头大也得看这代码
在读取不到数据时会有log日志

2011-12-8 9:49:36无法连接到设备,错误代码:-7
2011-12-8 12:04:58读取数据失败,错误代码:-2

主要的错误信息是这两条
中控考勤机出来
烟波钓 2011-12-23
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 jlingang 的回复:]
C# code


#region 读取数据
private void getLogData(string modeStr)
{
if (bIsConnected == false)
{
ErrorLog(DateTime.Now.ToString() +……
[/Quote]看到这种代码就头大了 这么多变量 还没有说明
林g 2011-12-22
  • 打赏
  • 举报
回复
顶贴,希望有人可以回答一下!
谢谢!
林g 2011-12-21
  • 打赏
  • 举报
回复


#region 读取数据
private void getLogData(string modeStr)
{
if (bIsConnected == false)
{
ErrorLog(DateTime.Now.ToString() + "请先连接设备!");
return;
}

int idwErrorCode = 0;

int idwEnrollNumber = 0;
int idwVerifyMode = 0;
int idwInOutMode = 0;

int idwYear = 0;
int idwMonth = 0;
int idwDay = 0;
int idwHour = 0;
int idwMinute = 0;
int idwSecond = 0;
int idwWorkCode = 0;
int idwReserved = 0;

int iGLCount = 0;
int iIndex = 0;

string fileStr = string.Empty;
string lastStr = string.Empty;
bool rf = false;
string lr = lastRecordRead();

Cursor = Cursors.WaitCursor;
lvLogs.Items.Clear();
axCZKEM1.EnableDevice(iMachineNumber, false);//disable the device

if (axCZKEM1.ReadGeneralLogData(iMachineNumber))//read all the attendance records to the memory
{
while (axCZKEM1.GetGeneralExtLogData(iMachineNumber, ref idwEnrollNumber, ref idwVerifyMode, ref idwInOutMode,
ref idwYear, ref idwMonth, ref idwDay, ref idwHour, ref idwMinute, ref idwSecond, ref idwWorkCode, ref idwReserved))//get records from the memory
{

string m = idwMonth.ToString();
if (m.Length == 1)
{
m = "0" + m;
}

string d = idwDay.ToString();
if (d.Length == 1)
{
d = "0" + d;
}

string h = idwHour.ToString();
if (h.Length == 1)
{
h = "0" + h;
}

string mnt = idwMinute.ToString();
if (mnt.Length == 1)
{
mnt = "0" + mnt;
}

string scd = idwSecond.ToString();
if (scd.Length == 1)
{
scd = "0" + scd;
}

iGLCount++;
iIndex++;
/*
lvLogs.Items.Add(iGLCount.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwEnrollNumber.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwVerifyMode.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwInOutMode.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwYear.ToString() + "-" + idwMonth.ToString() + "-" + idwDay.ToString() + " " + idwHour.ToString() + ":" + idwMinute.ToString() + ":" + idwSecond.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwWorkCode.ToString());
lvLogs.Items[iIndex].SubItems.Add(idwReserved.ToString());
*/

lastStr = idwEnrollNumber.ToString() + ";" + idwYear.ToString() + "-" + m + "-" + d +
";" + h + ":" + mnt + ";" + h + ":" + mnt + ":" + scd +
";" + idwVerifyMode.ToString() + ";" + idwInOutMode.ToString() + ";" + idwWorkCode.ToString() + ";" + idwReserved.ToString();

if (rf)
{
fileStr += lastStr + "\n";
}
else
{
if (lr.Trim() == lastStr.Trim())
{
rf = true;
}
}
}

if (rf)
{
lastRecord(lastStr);
}
}
else
{
Cursor = Cursors.Default;
axCZKEM1.GetLastError(ref idwErrorCode);

if (idwErrorCode != 0)
{
ErrorLog(DateTime.Now.ToString() + "读取数据失败,错误代码:" + idwErrorCode.ToString());
}
else
{
ErrorLog(DateTime.Now.ToString() + "设备无返回数据!");
}
}

writeFile(fileStr, modeStr);

axCZKEM1.EnableDevice(iMachineNumber, true);//enable the device
Cursor = Cursors.Default;

// MessageBox.Show("共有记录" + iGLCount + "条。");
}
#endregion


上面的是代码,用的是直接写到txt文件的形式, 然后是别人每次打卡成功了,一天总共六次,最后读到的有时候一次,二次,三次,四次,五次,六次,零次
我都郁闷的要命了,我没有接触过这个东西,中控的API也有,不知道是什么原因,没有读到数据返回-2的错误信息
sdl2005lyx 2011-12-21
  • 打赏
  • 举报
回复
你把部分代码贴出来。。。
garfieldzf 2011-12-21
  • 打赏
  • 举报
回复
中控的东西没有API吗?

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧