通勤認定エクセルツール対応11

This commit is contained in:
guanxiangwei
2026-05-26 19:00:23 +09:00
parent 6af0ff404c
commit 85707853e6
9 changed files with 315 additions and 138 deletions

View File

@@ -152,11 +152,12 @@ Private Function LookupM2Cache() As Object
Dim r As Long
For r = startRow To lastRow
Dim kukanCode As String: kukanCode = Trim(ws.Cells(r, 3).Value) ' C column
Dim kanshu As String: kanshu = Trim(ws.Cells(r, 9).Value) ' I column
Dim kenshu As String: kenshu = Trim(ws.Cells(r, 9).Value) ' I column
Dim code As String: code = Trim(ws.Cells(r, 10).Value) ' J column
Dim name As String: name = Trim(ws.Cells(r, 11).Value) ' K column
Dim teikikikanNum As String: teikikikanNum = Trim(ws.Cells(r, 14).Value) ' N column
If kukanCode = "" Or kanshu = "" Or code = "" Then GoTo NextRow
If kukanCode = "" Or kenshu = "" Or code = "" Then GoTo NextRow
' Outer level: kukanCode
If Not resultCache.Exists(kukanCode) Then
@@ -164,17 +165,28 @@ Private Function LookupM2Cache() As Object
resultCache.Add kukanCode, innerDict
End If
' Middle level: kanshu
' Middle level: kenshu
Set innerDict = resultCache(kukanCode)
If Not innerDict.Exists(kanshu) Then
If Not innerDict.Exists(kenshu) Then
Dim innermostDict As Object: Set innermostDict = CreateObject("Scripting.Dictionary")
innerDict.Add kanshu, innermostDict
innerDict.Add kenshu, innermostDict
End If
' Inner level: code -> name
Set innermostDict = innerDict(kanshu)
' Inner level: code -> {name, teikikikanNumList}
Set innermostDict = innerDict(kenshu)
Dim infoDict As Object
If Not innermostDict.Exists(code) Then
innermostDict.Add code, name
Set infoDict = CreateObject("Scripting.Dictionary")
infoDict.Add "name", name
infoDict.Add "teikikikanNum", Array(teikikikanNum)
innermostDict.Add code, infoDict
Else
' Already exists, add teikikikanNum to the list
Set infoDict = innermostDict(code)
Dim oldList As Variant: oldList = infoDict("teikikikanNum")
ReDim Preserve oldList(UBound(oldList) + 1)
oldList(UBound(oldList)) = teikikikanNum
infoDict("teikikikanNum") = oldList
End If
NextRow:
@@ -274,7 +286,7 @@ Private Sub RefreshSheetDict()
sheetConf("CSV_Encoding") = "shift_jis"
sheetConf("HasHeader") = True
sheetConf("ExpectedColumnCount") = 41
sheetConf("HeaderColumns") = Array("C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "W", "X", "Y", "Z", "AD", "AE", "AF", "AG", "AK", "AL", "AM", "AN", "AR", "AS", "AT", "AU", "AV", "AW", "AX", "AY", "AZ", "BA", "BB", "BC")
sheetConf("HeaderColumns") = Array("C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "W", "X", "Y", "Z", "AA", "AE", "AF", "AG", "AH", "AI", "AM", "AN", "AO", "AP", "AQ", "AU", "AV", "AW", "AX", "AY", "AZ", "BA", "BB", "BC", "BD", "BE", "BF", "BG")
sheetConf("AlwaysQuote") = False
sheetConf("FilterRow") = 7
Set sheetConfDict("C1") = sheetConf