📄 tm0608.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 = "tm0608"
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 mvarbuilding As Byte '局部复制
Private mvarfloor As Byte '局部复制
Private mvarroom As Byte '局部复制
Private mvarcardtype As Byte '局部复制
Private mvarhotelcode As Long '局部复制
Private mvarhotelpwd As Long '局部复制
Private mvarmastercardpwd As Long '局部复制
Private mvaroperatorid As Long '局部复制
Private mvaruserid As Long '局部复制
Private mvarsecuritycardpwd As Long '局部复制
Private mvarfloorcardpwd As Long '局部复制
Private mvarguestcardpwd As Long '局部复制
Private mvarterminatecardpwd As Long '局部复制
Private mvarregioncardpwd As Long '局部复制
Private mvartimecardpwd As Long '局部复制
Private mvardatacardpwd As Long '局部复制
Private mvarcleanmoneyflag As Boolean '局部复制
Private mvarmodifycardpwd As Long '局部复制
Private mvarinitealizecardpwd As Long '局部复制
Private mvarlinkport As Byte '局部复制
Private mvarlinktype As Byte '局部复制
Public Enum cardtypeselects
MasterCard = 1
SecurityCard = 2
floorCard = 3
GuestCard = 4
TerminateCard = 5
RegionCard = 7
timeCard = 9
datacard = 10
End Enum
'保持属性值的局部变量
Private mvarcardtypeselected As cardtypeselects '局部复制
Public Property Let cardtypeselected(ByVal vData As cardtypeselects)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.cardtypeselected = 5
mvarcardtypeselected = vData
End Property
Public Property Get cardtypeselected() As cardtypeselects
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.cardtypeselected
Set cardtypeselected = mvarcardtypeselected
End Property
Public Function treadtype() As Boolean
Dim temp As String
Dim i As Byte
Dim rec As Boolean
PortNum = linkprot
PortType = linktype
temp = ""
temp = readtype()
If temp <> "" Then
i = Val("&H" + Mid(temp, 15, 2))
Select Case i
Case 2
cardtype = Val("&H" + Mid(temp, 17, 2))
'If cardtype = 8 Then
' hotelcode = Val("&H" + Mid(temp, 23, 4))
'End If
cardno = Val("&H" + Mid(temp, 19, 4))
romid = Trim(Mid(temp, 1, 16))
rec = True
Case 4
romid = Trim(Mid(temp, 1, 16))
rec = True
Case 10
romid = Trim(Mid(temp, 1, 16))
rec = True
Case Else
rec = False
End Select
Else
rec = False
End If
treadtype = rec
End Function
Public Function twrite() As Boolean
Dim ptemp As String
Dim temp As String
Dim ntemp As String
Dim i As Integer
PortNum = linkport
PortType = linktype
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
If cardtype = 8 Then
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
ptemp = ptemp + "010101"
Else
ptemp = ptemp + "0101010101"
End If
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
If cardtype = 8 Then
temp = Hex(cardtype)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp + temp
Else
temp = Hex(hotelpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
End If
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"
temp = Hex(building)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(floor)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(room)
While Len(temp) < 2
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = ""
If cardtype = 8 Then
If cleanmoneyflag Then
ptemp = ptemp + "00"
Else
ptemp = ptemp + "FF"
End If
End If
If cardtype = 6 Then
Select Case cardtypeselected
Case MasterCard
temp = "71"
Case SecurityCard
temp = "72"
Case floorCard
temp = "73"
Case GuestCard
temp = "74"
Case TerminateCard
temp = "75"
Case RegionCard
temp = "77"
Case timeCard
temp = "79"
Case datacard
temp = "7A"
Case Else
Err.Raise 60012, "tm0608.cardtypeselected", GetError(12)
Exit Function
End Select
Else
Err.Raise 60012, "tm0608.cardtype", GetError(12)
Exit Function
End If
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
ptemp = ptemp + "0000"
temp = Hex(mastercardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(securitycardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(floorcardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(guestcardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(terminatecardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(modifycardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(regioncardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(initealizecardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(timecardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(datacardpwd)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
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
ptemp = ptemp + "00000000"
ptemp = ptemp + "0000000000000000"
twrite = writesub1(ptemp)
End Function
Public Function tread() As Boolean
Dim ptemp As String
Dim temp As String
Dim tmcardmark As String
PortNum = linkport
PortType = linktype
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 = readsub1(temp)
If (ptemp = "") Or (Len(ptemp) <> 128) Then
tread = False
Else
tread = True
temp = Mid(ptemp, 1, 2)
cardtype = Val("&H" + temp)
temp = Mid(ptemp, 3, 4)
cardcode = Val("&H" + temp)
temp = Mid(ptemp, 17, 4)
hotelcode = Val("&H" + temp)
tmcardmark = Mid(ptemp, 39, 2)
If cardtype = 8 Then
temp = Mid(ptemp, 45, 4)
hotelpwd = Val("&H" + temp)
temp = Mid(ptemp, 33, 2)
building = Val("&H" + temp)
temp = Mid(ptemp, 35, 2)
floor = Val("&H" + temp)
temp = Mid(ptemp, 37, 2)
room = Val("&H" + temp)
If tmcardmark = "FF" Then
cleanmoneyflag = False
ElseIf tmcardmark = "00" Then
cleanmoneyflag = True
Else
Err.Raise 60012, "tm0608.read cleanmoneyflag", GetError(12)
Exit Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -