add T1 T2 T3
This commit is contained in:
@@ -389,6 +389,18 @@ Function CheckVarcharOver(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal col
|
||||
CheckVarcharOver = True
|
||||
End Function
|
||||
|
||||
Function CheckNumberOver(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal colNum As Long, ByVal numberLength As Long, ByVal errorCol As String)
|
||||
Dim checkValue As String: checkValue = Trim(ws.Cells(rowNum, colNum).Value)
|
||||
If Len(checkValue) > numberLength Then
|
||||
Dim letter As String: letter = ColLetter(colNum)
|
||||
ws.Cells(rowNum, errorCol).Value = GetErrorMsg("E014", letter & rowNum, numberLength)
|
||||
ws.Cells(rowNum, colNum).Interior.Color = RGB(255, 0, 0)
|
||||
CheckNumberOver = False
|
||||
Exit Function
|
||||
End If
|
||||
CheckNumberOver = True
|
||||
End Function
|
||||
|
||||
Function Check01(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal colNum As Long, ByVal errorCol As String)
|
||||
Dim checkValue As String: checkValue = Trim(ws.Cells(rowNum, colNum).Value)
|
||||
Dim letter As String: letter = ColLetter(colNum)
|
||||
@@ -446,14 +458,21 @@ Function CheckDuplicate(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal colNu
|
||||
CheckDuplicate = True
|
||||
End Function
|
||||
|
||||
Function CheckNumber(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal colNum As Long, ByVal varcharLength As Long, ByVal errorCol As String)
|
||||
Function CheckNumber(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal colNum As Long, ByVal errorCol As String) As Boolean
|
||||
Dim checkValue As String: checkValue = Trim(ws.Cells(rowNum, colNum).Value)
|
||||
If Len(checkValue) > varcharLength Then
|
||||
Dim letter As String: letter = ColLetter(colNum)
|
||||
ws.Cells(rowNum, errorCol).Value = GetErrorMsg("E011", letter & rowNum)
|
||||
ws.Cells(rowNum, colNum).Interior.Color = RGB(255, 0, 0)
|
||||
CheckVarcharOver = False
|
||||
Dim letter As String: letter = ColLetter(colNum)
|
||||
|
||||
If checkValue = "" Then
|
||||
CheckNumber = True
|
||||
Exit Function
|
||||
End If
|
||||
CheckVarcharOver = True
|
||||
|
||||
If Not IsNumeric(checkValue) Then
|
||||
ws.Cells(rowNum, errorCol).Value = GetErrorMsg("E011", letter & rowNum)
|
||||
ws.Cells(rowNum, colNum).Interior.Color = RGB(255, 0, 0)
|
||||
CheckNumber = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
CheckNumber = True
|
||||
End Function
|
||||
|
||||
@@ -22,6 +22,9 @@ Private z1Cache As Object
|
||||
Private z2Cache As Object
|
||||
Private z3Cache As Object
|
||||
Private z4Cache As Object
|
||||
Private t1Cache As Object
|
||||
Private t2Cache As Object
|
||||
Private t3Cache As Object
|
||||
Private o1Cache As Object
|
||||
Private o2Cache As Object
|
||||
Private m2Cache As Object
|
||||
@@ -235,6 +238,66 @@ RefreshError:
|
||||
Err.Raise 1001, "RefreshZ4Cache", "Failed to load Enum lookup cache: " & Err.Description
|
||||
End Sub
|
||||
|
||||
' ============================================================
|
||||
' T1 Cache
|
||||
' ============================================================
|
||||
Private Sub RefreshT1Cache()
|
||||
Set t1Cache = Nothing
|
||||
|
||||
On Error GoTo RefreshError
|
||||
Set t1Cache = LoadLookup("T1", keyCol:=3, valueCols:=Array(4), startRow:=7)
|
||||
On Error GoTo 0
|
||||
|
||||
If t1Cache Is Nothing Or t1Cache.Count = 0 Then
|
||||
Err.Raise 1001, "RefreshT1Cache", "T1 reference data is empty"
|
||||
End If
|
||||
|
||||
Exit Sub
|
||||
|
||||
RefreshError:
|
||||
Err.Raise 1002, "RefreshT1Cache", "Failed to load T1 lookup cache: " & Err.Description
|
||||
End Sub
|
||||
|
||||
' ============================================================
|
||||
' T2 Cache
|
||||
' ============================================================
|
||||
Private Sub RefreshT2Cache()
|
||||
Set t2Cache = Nothing
|
||||
|
||||
On Error GoTo RefreshError
|
||||
Set t2Cache = LoadLookup("T2", keyCol:=3, valueCols:=Array(4), startRow:=7)
|
||||
On Error GoTo 0
|
||||
|
||||
If t2Cache Is Nothing Or t2Cache.Count = 0 Then
|
||||
Err.Raise 1001, "RefreshT2Cache", "T2 reference data is empty"
|
||||
End If
|
||||
|
||||
Exit Sub
|
||||
|
||||
RefreshError:
|
||||
Err.Raise 1002, "RefreshT2Cache", "Failed to load T2 lookup cache: " & Err.Description
|
||||
End Sub
|
||||
|
||||
' ============================================================
|
||||
' T3 Cache
|
||||
' ============================================================
|
||||
Private Sub RefreshT3Cache()
|
||||
Set t3Cache = Nothing
|
||||
|
||||
On Error GoTo RefreshError
|
||||
Set t3Cache = LoadLookup("T3", keyCol:=3, valueCols:=Array(4), startRow:=7)
|
||||
On Error GoTo 0
|
||||
|
||||
If t3Cache Is Nothing Or t3Cache.Count = 0 Then
|
||||
Err.Raise 1001, "RefreshT3Cache", "T3 reference data is empty"
|
||||
End If
|
||||
|
||||
Exit Sub
|
||||
|
||||
RefreshError:
|
||||
Err.Raise 1002, "RefreshT3Cache", "Failed to load T3 lookup cache: " & Err.Description
|
||||
End Sub
|
||||
|
||||
' ============================================================
|
||||
' O1 Cache
|
||||
' ============================================================
|
||||
@@ -546,6 +609,60 @@ Private Sub RefreshSheetDict()
|
||||
|
||||
Set sheetConfDict("Z4") = sheetConf
|
||||
|
||||
' T1
|
||||
Set sheetConf = CreateObject("Scripting.Dictionary")
|
||||
|
||||
sheetConf("StartCol") = "C"
|
||||
sheetConf("EndCol") = "G"
|
||||
sheetConf("ErrorCol") = "B"
|
||||
sheetConf("StartRow") = 7
|
||||
sheetConf("HeaderRow") = 5
|
||||
sheetConf("RefreshCacheName") = "RefreshT1Cache"
|
||||
sheetConf("CSV_Encoding") = "utf-8"
|
||||
sheetConf("HasHeader") = False
|
||||
sheetConf("ExpectedColumnCount") = 5
|
||||
sheetConf("HeaderColumns") = Array("C", "D", "E", "F", "G")
|
||||
sheetConf("AlwaysQuote") = True
|
||||
sheetConf("FilterRow") = 6
|
||||
|
||||
Set sheetConfDict("T1") = sheetConf
|
||||
|
||||
' T2
|
||||
Set sheetConf = CreateObject("Scripting.Dictionary")
|
||||
|
||||
sheetConf("StartCol") = "C"
|
||||
sheetConf("EndCol") = "M"
|
||||
sheetConf("ErrorCol") = "B"
|
||||
sheetConf("StartRow") = 7
|
||||
sheetConf("HeaderRow") = 5
|
||||
sheetConf("RefreshCacheName") = "RefreshT2Cache"
|
||||
sheetConf("CSV_Encoding") = "utf-8"
|
||||
sheetConf("HasHeader") = False
|
||||
sheetConf("ExpectedColumnCount") = 11
|
||||
sheetConf("HeaderColumns") = Array("C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M")
|
||||
sheetConf("AlwaysQuote") = True
|
||||
sheetConf("FilterRow") = 6
|
||||
|
||||
Set sheetConfDict("T2") = sheetConf
|
||||
|
||||
' T3
|
||||
Set sheetConf = CreateObject("Scripting.Dictionary")
|
||||
|
||||
sheetConf("StartCol") = "C"
|
||||
sheetConf("EndCol") = "I"
|
||||
sheetConf("ErrorCol") = "B"
|
||||
sheetConf("StartRow") = 7
|
||||
sheetConf("HeaderRow") = 5
|
||||
sheetConf("RefreshCacheName") = "RefreshT3Cache"
|
||||
sheetConf("CSV_Encoding") = "utf-8"
|
||||
sheetConf("HasHeader") = False
|
||||
sheetConf("ExpectedColumnCount") = 7
|
||||
sheetConf("HeaderColumns") = Array("C", "D", "E", "F", "G", "H", "I")
|
||||
sheetConf("AlwaysQuote") = True
|
||||
sheetConf("FilterRow") = 6
|
||||
|
||||
Set sheetConfDict("T3") = sheetConf
|
||||
|
||||
' O1
|
||||
Set sheetConf = CreateObject("Scripting.Dictionary")
|
||||
|
||||
@@ -623,6 +740,21 @@ Public Function GetZ4Cache() As Object
|
||||
Set GetZ4Cache = z4Cache
|
||||
End Function
|
||||
|
||||
Public Function GetT1Cache() As Object
|
||||
If t1Cache Is Nothing Then Call RefreshT1Cache
|
||||
Set GetT1Cache = t1Cache
|
||||
End Function
|
||||
|
||||
Public Function GetT2Cache() As Object
|
||||
If t2Cache Is Nothing Then Call RefreshT2Cache
|
||||
Set GetT2Cache = t2Cache
|
||||
End Function
|
||||
|
||||
Public Function GetT3Cache() As Object
|
||||
If t3Cache Is Nothing Then Call RefreshT3Cache
|
||||
Set GetT3Cache = t3Cache
|
||||
End Function
|
||||
|
||||
Public Function GetO1Cache() As Object
|
||||
If o1Cache Is Nothing Then Call RefreshO1Cache
|
||||
Set GetO1Cache = o1Cache
|
||||
@@ -671,6 +803,9 @@ Public Function RefreshCache() As Boolean
|
||||
Call RefreshZ2Cache
|
||||
Call RefreshZ3Cache
|
||||
Call RefreshZ4Cache
|
||||
Call RefreshT1Cache
|
||||
Call RefreshT2Cache
|
||||
Call RefreshT3Cache
|
||||
Call RefreshO1Cache
|
||||
Call RefreshO2Cache
|
||||
Call RefreshTokubetu
|
||||
|
||||
Reference in New Issue
Block a user