Zkteco如何按记录周期阅读出勤情况?

时间:2019-12-18 07:36:04

标签: c# biometrics zkteco

如何使用sta_readLogByPeriod代码?这是Zkteco的源代码,但无法正常工作。

string fromTime = stime_log.Text.Trim().ToString();
string toTime = etime_log.Text.Trim().ToString();

DataTable dt_periodLog = new DataTable("dt_periodLog");
gv_Attlog.AutoGenerateColumns = true;
gv_Attlog.Columns.Clear();
dt_periodLog.Columns.Add("User ID", System.Type.GetType("System.String"));
dt_periodLog.Columns.Add("Verify Date", System.Type.GetType("System.String"));
dt_periodLog.Columns.Add("Verify Type", System.Type.GetType("System.Int32"));
dt_periodLog.Columns.Add("Verify State", System.Type.GetType("System.Int32"));
dt_periodLog.Columns.Add("WorkCode", System.Type.GetType("System.Int32"));
gv_Attlog.DataSource = dt_periodLog;

DataMng.SDK.sta_readLogByPeriod(DataMng.lbSysOutputInfo, dt_periodLog, fromTime, toTime);

但是我在Github中看到我需要更新固件版本,但是如何更新固件版本? Github Link.

2 个答案:

答案 0 :(得分:0)

如菲律宾Zkteco所说。 enter image description here看起来我们对此无能为力。

如Zkteco所说:

Good Day!
    About this, only us can update firmware and there's a charge to it.

答案 1 :(得分:0)

首先将所有日志填充到数据表中,然后执行填充数据表的功能

public int sta_readLogByPeriod( DataTable dt_logPeriod, string fromTime, string toTime)
    {
        zkemkeeper.CZKEM axCZKEM1 = new zkemkeeper.CZKEM();
        if (axCZKEM1.Connect_Net("192.168.1.201",4370) == false)
        {
            MessageBox.Show("*Please connect first!");
            return -1024;
        }
    dt_logPeriod.Columns.Add("User ID", System.Type.GetType("System.String"));
    dt_logPeriod.Columns.Add("Verify Date", System.Type.GetType("System.String"));
    dt_logPeriod.Columns.Add("Verify Type", System.Type.GetType("System.Int32"));
    dt_logPeriod.Columns.Add("Verify State", System.Type.GetType("System.Int32"));
    dt_logPeriod.Columns.Add("WorkCode", System.Type.GetType("System.Int32"));

    int ret = 0;

    axCZKEM1.EnableDevice(1, false);//disable the device

    string sdwEnrollNumber = "";
    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;


    if (axCZKEM1.ReadTimeGLogData(1, fromTime, toTime))
    {
        while (axCZKEM1.SSR_GetGeneralLogData(1, out sdwEnrollNumber, out idwVerifyMode,
                    out idwInOutMode, out idwYear, out idwMonth, out idwDay, out idwHour, out idwMinute, out idwSecond, ref idwWorkcode))//get records from the memory
        {
            DataRow dr = dt_logPeriod.NewRow();
            dr["User ID"] = sdwEnrollNumber;
            dr["Verify Date"] = idwYear + "-" + idwMonth + "-" + idwDay + " " + idwHour + ":" + idwMinute + ":" + idwSecond;
            dr["Verify Type"] = idwVerifyMode;
            dr["Verify State"] = idwInOutMode;
            dr["WorkCode"] = idwWorkcode;
            dt_logPeriod.Rows.Add(dr);
        }
        ret = 1;
    }
    else
    {
        axCZKEM1.GetLastError(ref ret);
        

        if (ret != 0)
        {
            MessageBox.Show("*Read attlog by period failed,ErrorCode: " + ret.ToString());
        }
        else
        {
            MessageBox.Show("No data from terminal returns!");
        }
    }


    //lblOutputInfo.Items.Add("[func ReadTimeGLogData]Temporarily unsupported");
    axCZKEM1.EnableDevice(1, true);//enable the device

    return ret;
}

现在调用函数并传递数据表

DataTable dt_periodLog = new DataTable("dt_periodLog");
sta_readLogByPeriod(dt_periodLog, dt1.Text, dt2.Text);

现在你可以在for循环中使用这个数据表在gridview中显示

foreach (DataRow row in dt_periodLog .Rows)
            {
                datagridview1.Rows.Add(row[0]);
            }