add error cache

This commit is contained in:
simple321vip
2026-04-20 21:15:59 +08:00
parent 1b851b2224
commit 14682d3504
5 changed files with 46 additions and 16 deletions

View File

@@ -320,6 +320,11 @@ Public Function FormatDateInput(ByVal inputStr As String) As String
End If
End Function
Function ColNumToLetter(colNum As Long) As String
ColNumToLetter = Split(Cells(1, colNum).Address, "$")(1)
Function GetErrorMsg(ByVal errorCode As String, Optional ByVal param As String = "") As String
Dim errorList As Object: Set errorList = GetErrorList()
Dim errorMessage As String
If errorList.Exists(errorCode) Then
errorMessage = Replace(errorList(errorCode)(0), "{0}", param)
End If
GetErrorMsg = errorMessage
End Function

View File

@@ -30,6 +30,7 @@ Private oufukuList As Object
Private koutaiList As Object
Private higaitouList As Object
Private kenshuList As Object
Private errorList As Object
Private sheetConfDict As Object
@@ -396,6 +397,24 @@ RefreshError:
Err.Raise 1001, "RefreshKenshuList", "Failed to load Enum lookup cache: " & Err.Description
End Sub
' ============================================================
' higaitouList
' ============================================================
Private Sub RefreshErrorList()
On Error GoTo RefreshError
Set errorList = LoadLookup("Enum", keyCol:=18, valueCols:=Array(19), startRow:=3)
On Error GoTo 0
If errorList Is Nothing Or errorList.Count = 0 Then
Err.Raise 1003, "RefreshErrorList", "Enum reference data is empty"
End If
Exit Sub
RefreshError:
Err.Raise 1001, "RefreshErrorList", "Failed to load Enum lookup cache: " & Err.Description
End Sub
Private Sub RefreshSheetDict()
Set sheetConfDict = CreateObject("Scripting.Dictionary")
Dim sheetConf As Object
@@ -638,6 +657,11 @@ Public Function GetKenshuList() As Object
Set GetKenshuList = kenshuList
End Function
Public Function GetErrorList() As Object
If errorList Is Nothing Then Call RefreshErrorList
Set GetErrorList = errorList
End Function
Public Function RefreshCache() As Boolean
Call RefreshM1Cache
Call RefreshM1KukanDCache
@@ -653,5 +677,6 @@ Public Function RefreshCache() As Boolean
Call RefreshKoutaiList
Call RefreshHigaitouList
Call RefreshKenshuList
Call RefreshErrorList
RefreshCache = True
End Function