📄 tm0305.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 = "floorcard"
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 mvarromid As String '局部复制
Private mvarbuilding As Byte '局部复制
Private mvarfloor As Byte '局部复制
Private mvarondutytime As Date '局部复制
Private mvaroffdutytime As Date '局部复制
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 <> 2 Then
Err.Raise 60091, , GetError(91)
twrite = False
Exit Function
End If
End With
cardtype = TFloorcard
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"
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
ptemp = ptemp + "0000000000"
temp = ShortDateToBCD(ondutytime)
ptemp = ptemp + temp
ptemp = ptemp + "000000"
temp = ShortDateToBCD(offdutytime)
ptemp = ptemp + temp
ptemp = ptemp + "0000"
ptemp = ptemp + "0000000000000000"
ptemp = ptemp + "000000000000"
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 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 <> 2 Then
Err.Raise 60091, , GetError(91)
tread = False
Exit Function
End If
If .cardtype <> TFloorcard Then
Err.Raise 60005, , GetError(5)
tread = False
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 = readsub1(temp)
If (ptemp = "") Or (Len(ptemp) <> 128) Then
tread = False
Err.Raise 60012, "floorcard.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, 33, 2)
building = CLng("&H" + temp)
temp = Mid(ptemp, 35, 2)
floor = CLng("&H" + temp)
temp = Mid(ptemp, 47, 4)
ondutytime = BCDToShortDate(temp)
temp = Mid(ptemp, 57, 4)
offdutytime = BCDToShortDate(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)
End If
End Function
Public Property Let offdutytime(ByVal vData As Date)
mvaroffdutytime = vData
End Property
Public Property Get offdutytime() As Date
offdutytime = mvaroffdutytime
End Property
Public Property Let ondutytime(ByVal vData As Date)
mvarondutytime = vData
End Property
Public Property Get ondutytime() As Date
ondutytime = mvarondutytime
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 Property Let romid(ByVal vData As String)
If Len(vData) <> 16 Then
Err.Raise 60012, "floorcard.romid", GetError(12)
Exit Property
End If
mvarromid = vData
End Property
Public Property Get romid() As String
romid = mvarromid
End Property
Public Property Let userid(ByVal vData As Long)
If vData > 65535 Or vData < 0 Then
Err.Raise 60012, "floorcard.userid", GetError(12)
Exit Property
End If
mvaruserid = vData
End Property
Public Property Get userid() As Long
userid = mvaruserid
End Property
Public Property Let operatorid(ByVal vData As Long)
If vData > 65535 Or vData < 0 Then
Err.Raise 60012, "floorcard.operator", GetError(12)
Exit Property
End If
mvaroperatorid = vData
End Property
Public Property Get operatorid() As Long
operatorid = mvaroperatorid
End Property
Public Property Let hotelpwd(ByVal vData As Long)
If vData > 65535 Or vData < 0 Then
Err.Raise 60012, "floorcard.hotelpwd", GetError(12)
Exit Property
End If
mvarhotelpwd = vData
End Property
Public Property Get hotelpwd() As Long
hotelpwd = mvarhotelpwd
End Property
Public Property Let hotelcode(ByVal vData As Long)
If vData > 65535 Or vData < 0 Then
Err.Raise 60012, "floorcard.hotelcode", GetError(12)
Exit Property
End If
mvarhotelcode = vData
End Property
Public Property Get hotelcode() As Long
hotelcode = mvarhotelcode
End Property
Public Property Let cardtype(ByVal vData As JalTMCardType)
mvarcardtype = vData
End Property
Public Property Get cardtype() As JalTMCardType
cardtype = mvarcardtype
End Property
Public Property Let cardpwd(ByVal vData As Long)
If vData > 65534 Or vData < 1 Then
Err.Raise 60012, "floorcard.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, "floorcard.cardno", GetError(12)
Exit Property
End If
mvarcardno = vData
End Property
Public Property Get cardno() As Long
cardno = mvarcardno
End Property
Public Function CardInfo() As String
Dim Info As String
Info = "幢号=" & building
Info = Info & ",层号=" & floor
Info = Info & ",上班时间=" & ondutytime
Info = Info & ",下班时间=" & offdutytime
CardInfo = Info
End Function
Private Sub Class_Initialize()
ReDim state_buffer(15360)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -