📄 tm07.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 = "regioncard"
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 mvarcardtype As JalTMCardType
Private mvarhotelcode As Long '局部复制
Private mvarhotelpwd As Long '局部复制
Private mvaroperatorid As Long '局部复制
Private mvaruserid As Long '局部复制
Private mvarbegindatetime As Date '局部复制
Private mvarenddatetime As Date '局部复制
Private mvarnormalorhourcard As RegionCardType '局部复制
Private mvarRoomList() As Byte
Private mvarBuildingList() As Byte
Private mvarregionorgroup As RegionCardType1 '局部复制
Public Enum RegionCardType1
trRegionCard = 1
TrGroupCard = 2
End Enum
Public Enum RegionCardType
NormalRegionCard = 1
HourRegionCard = 2
End Enum
Public Property Let regionorgroup(ByVal vData As RegionCardType1)
mvarregionorgroup = vData
End Property
Public Property Get regionorgroup() As RegionCardType1
regionorgroup = mvarregionorgroup
End Property
Public Property Let normalorhourcard(ByVal vData As RegionCardType)
mvarnormalorhourcard = vData
End Property
Public Property Get normalorhourcard() As RegionCardType
normalorhourcard = mvarnormalorhourcard
End Property
Public Function twrite() As Boolean
Dim ptemp As String
Dim temp As String
Dim ntemp As String
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim thisdatetime As Data
Dim prepaydatetime As Data
Dim card1 As New tmreadtype
Set card1 = New tmreadtype
With card1
.treadtype
temp = .romid
i = CLng("&H" + Mid(temp, 15, 2))
If i <> 2 Then
Err.Raise 60091, , GetError(91)
Exit Function
End If
End With
cardtype = tRegionCard
ptemp = ""
temp = Hex(cardtype)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(cardno)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
ptemp = ptemp + "0101010101"
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(hotelpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(255 - cardtype)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(65535 - cardno)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
ptemp = ptemp + "01"
ptemp = ptemp + "000000"
temp = ""
If normalorhourcard = NormalRegionCard Then
If regionorgroup = trRegionCard Then
temp = "AA"
Else
temp = "00"
End If
Else
If regionorgroup = trRegionCard Then
temp = "BB"
Else
temp = "CC"
End If
End If
ptemp = ptemp + temp
temp = DateToBCD(begindatetime)
ptemp = ptemp + temp
temp = DateToBCD(enddatetime)
ptemp = ptemp + temp
ptemp = ptemp + "0000000000000000"
ptemp = ptemp + "0000000000000000"
temp = Hex(cardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(operatorid)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(userid)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(mvarBuildingList(0))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
For j = 0 To 4
For k = 0 To 1
temp = Hex(mvarRoomList(0, j, k))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
Next k
Next j
temp = Hex(mvarRoomList(0, 5, 0))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
twrite = tm91.writesub1(ptemp)
ptemp = ""
ptemp = ptemp + "0202020202020202"
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(hotelpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(255 - cardtype)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(65535 - cardno)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
ptemp = ptemp + "02"
temp = Hex(mvarRoomList(0, 5, 1))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
For j = 6 To 16
For k = 0 To 1
temp = Hex(mvarRoomList(0, j, k))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
Next k
Next j
ptemp = ptemp + "00"
temp = Hex(mvarBuildingList(1))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
For j = 0 To 10
For k = 0 To 1
temp = Hex(mvarRoomList(1, j, k))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
Next k
Next j
temp = Hex(mvarRoomList(1, 11, 0))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
twrite = tm91.writesub2(ptemp)
ptemp = ""
ptemp = ptemp + "0303030303030303"
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(hotelpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(255 - cardtype)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(65535 - cardno)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
ptemp = ptemp + "03"
temp = Hex(mvarRoomList(1, 11, 1))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
For j = 12 To 16
For k = 0 To 1
temp = Hex(mvarRoomList(1, j, k))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
Next k
Next j
ptemp = ptemp + "00"
temp = Hex(mvarBuildingList(2))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
For j = 0 To 16
For k = 0 To 1
temp = Hex(mvarRoomList(2, j, k))
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
Next k
Next j
ptemp = ptemp + "00"
twrite = tm91.writesub3(ptemp)
End Function
Public Function tread() As Boolean
Dim ptemp As String
Dim temp As String
Dim i As Integer
Dim j As Integer
Dim k 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 <> 2 Then
Err.Raise 60091, , GetError(91)
tread = False
Exit Function
End If
If .cardtype <> tRegionCard Then
tread = False
Err.Raise 60005, , GetError(5)
Exit Function
End If
End With
temp = ""
ptemp = ""
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = ""
temp = Hex(hotelpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = ""
temp = ptemp
ptemp = ""
ptemp = tm91.readsub1(temp)
If (ptemp = "") Or (Len(ptemp) <> 128) Then
tread = False
Err.Raise 60012, "regioncard.readsub", GetError(12)
Else
tread = True
temp = Mid(ptemp, 1, 2)
cardtype = CLng("&H" + temp)
temp = Mid(ptemp, 3, 4)
cardno = CLng("&H" + temp)
temp = Mid(ptemp, 17, 4)
hotelcode = CLng("&H" + temp)
temp = Mid(ptemp, 21, 4)
hotelpwd = CLng("&H" + temp)
temp = Mid(ptemp, 39, 2)
Select Case temp
Case "AA"
normalorhourcard = NormalRegionCard '= False
regionorgroup = trRegionCard
Case "BB"
normalorhourcard = HourRegionCard '= True
regionorgroup = trRegionCard
Case "00"
normalorhourcard = NormalRegionCard '= False
regionorgroup = TrGroupCard
Case "CC"
normalorhourcard = HourRegionCard '= True
regionorgroup = TrGroupCard
Case Else
tread = False
End Select
temp = Mid(ptemp, 41, 10)
begindatetime = BCDToDate(temp)
temp = Mid(ptemp, 51, 10)
enddatetime = BCDToDate(temp)
temp = Mid(ptemp, 93, 4)
cardpwd = CLng("&H" + temp)
temp = Mid(ptemp, 97, 4)
operatorid = CLng("&H" + temp)
temp = Mid(ptemp, 101, 4)
userid = CLng("&H" + temp)
temp = Mid(ptemp, 105, 2)
mvarBuildingList(0) = CLng("&H" + temp)
For j = 0 To 4
For k = 0 To 1
temp = Mid(ptemp, 107 + 4 * j + 2 * k, 2)
mvarRoomList(0, j, k) = CLng("&H" + temp)
Next k
Next j
temp = Mid(ptemp, 127, 2)
mvarRoomList(0, 5, 0) = CLng("&H" + temp)
End If
temp = ""
ptemp = ""
temp = Hex(cardtype)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(cardno)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = ""
temp = Hex(hotelpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = ""
temp = ptemp
ptemp = ""
ptemp = tm91.readsub2(temp)
If (ptemp = "") Or (Len(ptemp) <> 128) Then
tread = False
Err.Raise 60012, "regioncard.readsub", GetError(12)
Else
tread = True
temp = Mid(ptemp, 33, 2)
mvarRoomList(0, 5, 1) = CLng("&H" + temp)
For j = 6 To 16
For k = 0 To 1
temp = Mid(ptemp, 35 + 4 * (j - 6) + 2 * k, 2)
mvarRoomList(0, j, k) = CLng("&H" + temp)
Next k
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -