熵基人脸考勤机SDK对接思路

dzkaiwen 7天前 99

import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=936;bottom=640;)
winform.add(
button={cls="button";text="连接";left=186;top=12;right=267;bottom=40;z=2;};
button2={cls="button";text="断开连接";left=288;top=12;right=369;bottom=40;z=6;};
button3={cls="button";text="注册人员";left=30;top=58;right=111;bottom=86;z=7;};
button4={cls="button";text="读取记录";left=33;top=114;right=114;bottom=142;z=8;};
button5={cls="button";text="删除记录PULL";left=362;top=113;right=443;bottom=142;z=9;};
button6={cls="button";text="读取记录PULL";left=250;top=113;right=331;bottom=142;z=10;};
button7={cls="button";text="读取记录2";left=144;top=114;right=225;bottom=142;z=12;};
custom={cls="custom";text="自定义控件";left=26;top=251;right=782;bottom=387;z=11;};
edit={cls="edit";text="192.168.1.201";left=70;top=17;right=160;bottom=42;edge=1;z=3;};
editlog={cls="edit";left=21;top=394;right=772;bottom=568;edge=1;multiline=1;z=5;};
static={cls="static";text="控件";left=631;top=29;right=684;bottom=70;db=1;dl=1;dr=1;dt=1;transparent=1;z=1;};
static2={cls="static";text="IP地址";left=25;top=22;right=80;bottom=44;transparent=1;z=4;};

)
/*}}*/

import com.activeX;
import com.lite;
//var dll = com.lite.appData("/com/zkemkeeper.dll",$"\res\zkemkeeper.dll")
//var axEmbed = dll.createEmbedEx(winform.static,"{00853A19-BD51-419B-9269-2DABE57EB61F}");  
import godking.egrid;

grid = godking.egrid(winform.custom)
grid.RowCount = 1
grid.ColCount = 4
grid.setText(0, 0, "机号")
grid.setText(0, 1, "IP地址")
grid.setText(0, 2, "端口")
grid.setText(0, 3, "状态")
grid.addRow();
grid.setText(1, 0, "1")
grid.setText(1, 1, "192.168.1.201")
grid.setText(1, 2, "4370")
grid.addRow();
grid.setText(2, 0, "2")
grid.setText(2, 1, "192.168.1.202")
grid.setText(2, 2, "4370")

import console
var dll = com.CreateObject("{00853A19-BD51-419B-9269-2DABE57EB61F}");
//dll=com.activeX.createObject("{00853A19-BD51-419B-9269-2DABE57EB61F}","\res\zkemkeeper.dll",)
winform.button2.disabled = true
var CNETFLAG = false;

//console.log(grid.RowCount)

winform.button.oncommand = function(id, event) {
    winform.button.disabledText = {
        "✶";
        "✸";
        "✹";
        "✺";
        "✹";
        "✷"
    }
    var ret = dll.Connect_Net(winform.edit.text, 4370);
    winform.button.disabledText = null;
    if (ret) {
        winform.button.disabled = true;
        winform.button2.disabled = false;
        CNETFLAG = ret;
        dll.RegEvent(1, 65535)
        winform.button.disabledText = "连接成功";
    }
    else {
        winform.button.disabledText = "连接失败";
    }
}

winform.button2.oncommand = function(id, event) {
    var ret = dll.Disconnect()
    winform.button2.disabled = true;
    winform.button.disabled = false;
    winform.editlog.print(tostring(ret));
}

winform.button3.oncommand = function(id, event) {
    var dwMachineNumber = 1;
    var dwEnrollNumber = "801";
    var Name = "张小明";
    var Password = "123";
    var Privilege = "0";
    var Enabled = true;
    var ret = dll.SSR_SetUserInfo(dwMachineNumber, dwEnrollNumber, Name, Password, Privilege, Enabled);
    
    winform.editlog.print(tostring(ret))
}

winform.button4.oncommand = function(id, event) {
    
    if (!CNETFLAG) {
        winform.msgbox("未链接")
    }
    
    var dwMachineNumber = 1
    dll.ReadNewGLogData(1);
    console.log("我来了")
    //dll.SSR_GetGeneralLogDataEx(dwMachineNumber,dwEnrollNumber,dwVerifyMode,dwInOutMode,dwYear,dwMonth,dwDay,dwHour,dwMinute,dwSecond,dwWorkCode)
    var i = 0;
    while (true) {
        i++;
        
        var ret, dwEnrollNumber, dwVerifyMode, dwInOutMode, dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond, dwWorkCode = dll.SSR_GetGeneralLogDataEx(dwMachineNumber);
        if (ret) {
            winform.editlog.print(dwEnrollNumber, dwVerifyMode, dwYear);
            //console.log(i,dwEnrollNumber,"获取记录")
        }
        else {
            break;
        }
    }
    
}

winform.button5.oncommand = function(id, event) {
    
    var tablename = "transaction";
    
    var ret = dll.SSR_DeleteDeviceData(1, tablename, "*")
    
    console.log(ret)
    
}

winform.button6.oncommand = function(id, event) {
    import raw;
    var tabname = "transaction";
    //var  buff=raw.buffer(1024); 
    var a = {};
    var ret = dll.SSR_GetDeviceData(1, a, #a, tabname, "", "", "");
    console.varDump(a);
    
}
//实时获取记录
ocxEvents1 = {
    
    OnAttTransactionEx = function(EnrollNumber) {
        import console
        console.log(EnrollNumber, 'gonghao')
        
    }
    
}
ocxEvents2 = {
    
    OnAttTransactionEx = function(EnrollNumber) {
        import console
        console.log(EnrollNumber)
        
    }
}

dlls = {};
for (i = 1; grid.RowCount - 1) {
    dlls[i] = com.CreateObject("{00853A19-BD51-419B-9269-2DABE57EB61F}");
    var ip = grid.getText(i, 1);
    var ret = dlls[i].Connect_Net(ip, 4370);
    if (ret) {
        dlls[i].RegEvent(1, 65535)
        
        grid.setText(i, 3, "已连接")
    }
    else {
        grid.setText(i, 3, "连接失败")
    }
    
}

com.Connect(dlls[1], ocxEvents1); //获取实时事件  
//com.Connect(dlls[2],ocxEvents2); //获取实时事件  

com.Connect(dll, {
    @ {
        _get = function(eventName) {
            winform.edit.print("此对象支持事件:", eventName)
        }
    }
});

//读取记录
getlogdata = function() {
    
    while (var ret, dwEnrollNumber, dwVerifyMode, dwInOutMode, dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond, dwWorkCode, dwReserved = object.GetGeneralExtLogData(Makno);; ret) {
        a++
        console.open()
        console.log(ret, a, dwYear, dwEnrollNumber)
    }
    
}

winform.show();
win.loopMessage();


最新回复 (0)
返回