+ -
当前位置:首页 → 问答吧 → 那位做过中控的指纹打卡机接口

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

时间:2011-12-21

来源:互联网

如题!本人现在有个别人做好的程序,发现程序有时候无法读到记录,返回的提示是-2 
在此问问各位,看谁做过类似的程序,给点经验!
先谢谢!

作者: jlingang   发布时间: 2011-12-21

中控的东西没有API吗?

作者: LOVESONGFOREVER   发布时间: 2011-12-21

你把部分代码贴出来。。。

作者: sdl2005lyx   发布时间: 2011-12-21

该回复于2011-12-21 14:59:21被管理员删除

  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
#4楼 得分:0回复于:2011-12-21 16:08:40
C# code


        #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的错误信息

作者: xiaopshidai   发布时间: 2011-12-21

顶贴,希望有人可以回答一下!
谢谢!

作者: jlingang   发布时间: 2011-12-21

该回复于2011-12-23 09:15:50被管理员删除

  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
#7楼 得分:0回复于:2011-12-23 09:00:43
引用 4 楼 jlingang 的回复:
C# code


#region 读取数据
private void getLogData(string modeStr)
{
if (bIsConnected == false)
{
ErrorLog(DateTime.Now.ToString() +……
看到这种代码就头大了 这么多变量 还没有说明

作者: jlingang   发布时间: 2011-12-22

这是别人写的代码.所以我也很头大呀!问题是再头大也得看这代码
在读取不到数据时会有log日志

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

主要的错误信息是这两条 
中控考勤机出来

作者: jlingang   发布时间: 2011-12-23

以前用过中控的设备,你先看下开发包,看错误代码对应错误详细信息。指纹按压不标准会读取不到指纹特征码,指纹设备连接有时也会接触不好

作者: yanbuodiao   发布时间: 2011-12-23