📄 tm09.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "datacard"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Private mvarcardno As Long '局部复制
Private mvarcardpwd As Long '局部复制
Private mvarhotelcode As Long '局部复制
Private mvarbuilding As Byte '局部复制
Private mvarfloor As Byte '局部复制
Private mvarroom As Byte '局部复制
Private mvarcnt As Integer '局部复制
Private mvarRecordList() As String
Private mvarISVIP As Boolean
Public Property Let ISVIP(ByVal vData As Boolean)
mvarISVIP = vData
End Property
Public Property Get ISVIP() As Boolean
ISVIP = mvarISVIP
End Property
Public Property Let cnt(ByVal vData As Integer)
mvarcnt = vData
End Property
Public Property Get cnt() As Integer
cnt = mvarcnt
End Property
Public Property Let room(ByVal vData As Byte)
mvarroom = vData
End Property
Public Property Get room() As Byte
room = mvarroom
End Property
Public Property Let floor(ByVal vData As Byte)
mvarfloor = vData
End Property
Public Property Get floor() As Byte
floor = mvarfloor
End Property
Public Property Let building(ByVal vData As Byte)
mvarbuilding = vData
End Property
Public Property Get building() As Byte
building = mvarbuilding
End Property
Public Function tread() As Boolean
Dim ptemp As String
Dim temp As String
Dim i As Integer
Dim j As Integer
Dim yy As String
Dim lastyy As String
Dim card1 As New tmreadtype
Set card1 = New tmreadtype
With card1
.treadtype
temp = .romid
i = CLng("&H" + Mid(temp, 15, 2))
If i <> 10 Then
Err.Raise 60095, , GetError(95)
Exit Function
End If
End With
temp = ""
ptemp = ""
ptemp = tm95.readtm95()
If (ptemp = "") Or (Len(ptemp) <> 4096) Then
tread = False
Err.Raise 60012, "tm95.readtm95", GetError(12)
Else
tread = True
temp = Mid(ptemp, 1, 4)
hotelcode = CLng("&H" + temp)
' temp = Mid(ptemp, 5, 4)
' cardpwd = 65535 - CLng("&H" + temp)
' temp = Mid(ptemp, 9, 4)
' cardno = CLng("&H" + temp)
temp = Mid(ptemp, 15, 2) '00-07H开门记数器
cnt = CLng("&H" + temp)
' temp = Mid(ptemp, 17, 2)
' building = CLng("&H" + temp)
' temp = Mid(ptemp, 19, 2)
' floor = CLng("&H" + temp)
' temp = Mid(ptemp, 21, 2)
' room = CLng("&H" + temp)
For i = 0 To 319
If ISVIP Then
temp = LTrim(Str(CLng("&H" + Mid(ptemp, 513 + 16 * i, 6))))
While Len(temp) < 5
temp = "0" + temp
Wend
mvarRecordList(i, 0) = temp
temp = Mid(ptemp, 513 + 16 * i + 6, 10)
If temp = "FFFFFFFFFF" Then
Exit For
End If
If temp = "0000000000" Then
Exit For
End If
mvarRecordList(i, 1) = temp
Else
temp = LTrim(Str(CLng("&H" + Mid(ptemp, 513 + 16 * i, 4))))
While Len(temp) < 5
temp = "0" + temp
Wend
mvarRecordList(i, 0) = temp
temp = Mid(ptemp, 513 + 16 * i + 4, 12)
If temp = "FFFFFFFFFFFF" Then
Exit For
End If
If temp = "000000000000" Then
Exit For
End If
mvarRecordList(i, 1) = temp
End If
Next i
End If
End Function
Public Function twrite() As Boolean
Dim ptemp As String
Dim temp As String
Dim ntemp As String
Dim i As Integer
Dim card1 As New tmreadtype
Set card1 = New tmreadtype
With card1
.treadtype
temp = .romid
i = CLng("&H" + Mid(temp, 15, 2))
If i <> 10 Then
Err.Raise 60095, , GetError(95)
Exit Function
End If
End With
ptemp = ""
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(65535) '写入FFFF
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(65535) '写入FFFF
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
twrite = tm95.writetm95(ptemp)
End Function
Public Function sGetRecordList(ByRef RecordList() As String) As Boolean
If LBound(RecordList(), 1) < 0 Or LBound(RecordList(), 2) < 0 _
Or UBound(RecordList(), 1) > 320 Or UBound(RecordList(), 2) > 1 Then
sGetKeyRecords = False
Err.Raise 60011, "DataCard.sGetKeyRecords", GetError(11)
Exit Function
End If
Dim i As Integer
Dim j As Integer
sGetRecordList = True
For i = 0 To 320
For j = 0 To 1
RecordList(i, j) = mvarRecordList(i, j)
Next
Next
End Function
Public Property Let hotelcode(ByVal vData As Long)
If vData > 65535 Or vData < 0 Then
Err.Raise 60012, "datacard.hotelcode", GetError(12)
Exit Property
End If
mvarhotelcode = vData
End Property
Public Property Get hotelcode() As Long
hotelcode = mvarhotelcode
End Property
Public Property Let cardpwd(ByVal vData As Long)
If vData > 65534 Or vData < 1 Then
Err.Raise 60012, "datacard.cardpwd", GetError(12)
Exit Property
End If
mvarcardpwd = vData
End Property
Public Property Get cardpwd() As Long
cardpwd = mvarcardpwd
End Property
Public Property Let cardno(ByVal vData As Long)
If vData > 65535 Or vData < 0 Then
Err.Raise 60012, "datacard.cardno", GetError(12)
Exit Property
End If
mvarcardno = vData
End Property
Public Property Get cardno() As Long
cardno = mvarcardno
End Property
Private Sub Class_Initialize()
ReDim mvarRecordList(0 To 320, 0 To 1)
ReDim state_buffer(15360)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -