考勤机接口调用(POs收费机)汇多
/此公用文件主要是对考勤机操作, 如果对收费机操作则可参考此文件定义结构即可. unit uPublic; interface Uses Windows , SysUtils , QForms , StdCtrls ,QComCtrls ,DBGrids, QExtCtrls ,Classes,QGraphics ; //-------------------------定义结构----------------------------------- Type TName = array[1..8] of Char; Type TKey = array[1..4] of Char; Type TPerson = array[1..7] of Char; //考勤门禁卡发卡信息结构 Type CARDINFO_ATTEND = Record nFileSort : Integer; //卡文件类型 nCardID : Integer; //卡号 strPersonID : TPerson; //个人信息号 nGradeID : Integer; //卡级别 nAttGroup : Integer; //考勤分组 strUserKey : TKey; //用户密码 strName : TName; //姓名 nKeyLimitYear : Integer; //卡有效期——年 nKeyLimitMonth : Integer; nKeyLimitDay : Integer; End; Type CARDKEY = Record //销卡结构式 nSector : Integer; strOldKeyA : array[1..16] of Char ; strOldKeyB : array[1..16] of Char ; end; Type BATCHADDBCCARD = Record //下载黑名单结构 bAddOrDel : BOOL; nCount : Integer; nCardID : Array[1..1000] of Integer; end; Type TStrKey = array[1..16] of char; //下载系统密码 Type PsysKey = Record nKeyHandle :Integer; strOldKeyA :TStrKey; strOldKeyB :TStrKey; strNewKeyA :TStrKey; strNewKeyB :TStrKey; nSectorNum :Integer; end; Type RECVATTGUARDREC = Record //取记录条数 nRecIndex : Integer ; nRecCount : Integer ; end; Type TstrPerson = Record PersonID :array[1..7] of char; end; Type ATTGUARDRECORD = Record //考勤门禁记录结构 strPersonID : TstrPerson; //工号 nYear : Integer; //年 nMonth : Integer; nDay : Integer; nHour : Integer; nMinute : Integer; nSecond : Integer; bOnDuty : BOOL; //上下班标志,0-上班, 1-下班 bBC : BOOL; //是否黑名单 nDMAdr : Integer; //机具地址 end; Type ATTGUARDRECORDID = Record //*4E的数据结构*/ strPersonID :Cardinal; nYear :Integer; nMonth :Integer; nDay :Integer; nHour :Integer; nMinute :Integer; nSecond :Integer; bOnDuty :BOOL; bBC :BOOL; nDMAdr :Integer; end; Type SEARCHDMONLINE = Record //联网寻机 nCount : Integer; nDMadr : Array [0..255] of Integer; end; const //---------------------------------命令字定义----------------------------------------- nSetTime :Integer = 1; // 广播校时 nSetDMAddress :Integer = 2; // 联网设置机具地址 nSearchDMOnline :Integer = 3; // 在线寻机 nRecvAttGuardRecord :Integer = 16; //按序号取下位机考勤记录 nRecvAttGuardRecordRlt :Integer = 17; //取记录序号 nSetDMProperty :Integer = 20; // 设置机具属性 nRecvDMProperty :Integer = 21; // 取机具属性 nRecvDMStatus :Integer = 22; // 取机具状态 nSetAllowTime :Integer = 25; // 下载允许打卡时间段 nClearChangeBuffer :Integer = 27; // 清空修改信息存储区 nRecvDelRecord :Integer = 28; //删除方式取考勤记录 nRecvDelRecordRlt :Integer = 29; //删除方式取记录确认帧 nRecvCurRecIndex :Integer = 30 ; //取当前记录序号 nDownloadTariff :Integer = 31; // 下载价目表 nSetRepastTime :Integer = 32; // 设置就餐时间段 nReadCardInfo :Integer = 96; //读卡 nWriteCardInfo :Integer = 97; //发卡 nInitCardkey :Integer = 101; //销卡 nUpdateCardInfo :Integer = 102; //改卡 nTest :Integer = 112; // 通讯测试 nClearBKCardRegion :Integer = 114; // 黑名单区清空 nShowLCDTitle :Integer = 118; // 下载LCD显示题头 nClearTariff :Integer = 123; // 清空价目表 nDownloadSysKey :Integer = 144; // 下载系统密码 nAddDelWhiteCard :Integer = 162; //下载/删除白名单 nAddDelInvaidCard :Integer = 163; // 下载/删除黑名单 nDownloadUserKey :Integer = 147; // 下载用户密码 nSearchAdminCard :Integer = 225; // 搜索系统管理员卡 ///////////////////////////////////////////////////////////////////////// //返回信息代码 nSendSuccess :Integer = 0; //发送成功(成功,广播命令) nCommError :Integer = 1; //通讯错误 nTagAdrError :Integer = 2; //目标地址错误 nSourAdrError :Integer = 3; //源地址错误 nCheckError :Integer = 4; //校验错误 nOverTime :Integer = 5; //超时错误 nNotRecvFrm :Integer = 6; //未收到返回帧 nRecvFrm :Integer = 7; //收到返回帧 nSuccess :Integer = 8; //命令执行成功(成功) nFail :Integer = 9; //命令执行失败 nNotSend :Integer = 10; //未发送错误 nCmdError :Integer = 11; //返回命令字错误 nDataError :Integer = 12; //返回数据错误 nRecvEmpty :Integer = 14; //下位机信息取完(成功,取信息) nRecvSuccess :Integer = 13; //成功取信息(成功,取信息) nFormatError :Integer = 15; //格式错误 nNoThisCmd :Integer = 16; //无此命令 //---------------------------------------------调用动态库的函数与过程定义----------------------------------------- function OpenDevice(nMyAddress: Integer; hWnd: HWND): Pointer; stdcall; external 'ICDM.dll' Name 'OpenDevice'; Procedure CloseDevice(pDevice: Pointer); stdcall; external 'ICDM.dll' Name 'CloseDevice'; function ConnectPort(pDevice: Pointer; lpCommDef: pChar): Bool stdcall; external 'ICDM.dll' Name 'ConnectPort'; Procedure SetAddLog(pDevice: Pointer; bAddLog: Bool); stdcall; external 'ICDM.dll' Name 'SetAddLog'; function DisConnectPort(pDevice: Pointer): Bool stdcall; external 'ICDM.dll' Name 'DisConnectPort'; function StartICDMCommand(pDevice: Pointer; nAddress: Integer; ICDMCmd: Integer; pPara: Pointer; nSize: Integer): Pointer; stdcall; external 'ICDM.dll' Name 'StartICDMCommand'; function GetSizeOfData(pCommand: Pointer): Integer; stdcall; external 'ICDM.dll' Name 'GetSizeOfData'; function GetData(pCommand: Pointer; pDataBuffer: Pointer; nSize: Integer): Bool; stdcall; external 'ICDM.dll' Name 'GetData'; function GetCmdResult(pCommand: Pointer): Integer; stdcall; external 'ICDM.dll' Name 'GetCmdResult'; Procedure EndICDMCommand(pCommand: Pointer); stdcall; external 'ICDM.dll' Name 'EndICDMCommand'; Procedure SetInnerCode(pDevice: Pointer; bBig5: Bool); stdcall; external 'ICDM.dll' Name 'SetInnerCode'; function SetMyAddress(pDevice:pointer;nMyAddress:integer):Pointer;stdcall;external 'ICDM.dll' Name 'SetMyAddress'; function IsConnect(pDevice:pointer):Bool;stdcall;external 'ICDM.dll' Name 'IsConnect'; Procedure SetWaitTime(pDevice: Pointer; dwWaitTime: DWORD); stdcall; external 'ICDM.dll' Name 'SetWaitTime'; //----------------------------------------对机具操作的公用函数-------------------------------------------------------- Var m_pDevice : Pointer ; m_pCommand : Pointer ; nInfoCode : Integer ; nSysKey : PsysKey ; //系统密码 BatchBCCard : BATCHADDBCCARD ; //下载黑名单 rCardKey : CARDKEY ; //销卡 rCardInfo : CARDINFO_ATTEND ; //发卡,改卡 pCardInfoBuffer : ^CARDINFO_ATTEND; //读卡 pDataBuffer : Pointer; pAttendCardBuffer :^ATTGUARDRECORD; //考勤记录 rRecvrecord : ATTGUARDRECORD; nFileHandle : Integer ; //文件句柄 ,采集数据先写临时文本,然后导数据库,再备份
- 飛揚哥哥2013-01-16太老了,我用不上,不过还是得感谢楼主。
- 粉丝: 2
- 资源: 2
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助