refactor: rename RunBOMExtraction to BOMExtraction for consistency
All checks were successful
NTFY Notification / notify (push) Successful in 4s
All checks were successful
NTFY Notification / notify (push) Successful in 4s
Rename the main BOM extraction function from RunBOMExtraction to BOMExtraction to follow consistent naming conventions across the codebase. Changes: - M09_BOMExtractor.bas: Rename function RunBOMExtraction → BOMExtraction - M01_Main.bas: Update function call to use new name - Update all internal return statements and logger references Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -143,7 +143,7 @@ End Sub
|
|||||||
' ------------------------------------------------------------------------------
|
' ------------------------------------------------------------------------------
|
||||||
Public Sub RunBOMExtraction()
|
Public Sub RunBOMExtraction()
|
||||||
Dim result As String
|
Dim result As String
|
||||||
result = M09_BOMExtractor.RunBOMExtraction()
|
result = BOMExtraction()
|
||||||
MsgBox result, vbInformation, "BOM提取"
|
MsgBox result, vbInformation, "BOM提取"
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ Private g_BOMWorkbook As Workbook
|
|||||||
'
|
'
|
||||||
' 示例调用:
|
' 示例调用:
|
||||||
' Dim result As String
|
' Dim result As String
|
||||||
' result = M09_BOMExtractor.RunBOMExtraction()
|
' result = M09_BOMExtractor.BOMExtraction()
|
||||||
' MsgBox result
|
' MsgBox result
|
||||||
' ------------------------------------------------------------------------------
|
' ------------------------------------------------------------------------------
|
||||||
Public Function RunBOMExtraction() As String
|
Public Function BOMExtraction() As String
|
||||||
On Error GoTo MainErrorHandler
|
On Error GoTo MainErrorHandler
|
||||||
|
|
||||||
' 初始化
|
' 初始化
|
||||||
@@ -65,7 +65,7 @@ Public Function RunBOMExtraction() As String
|
|||||||
Set wsInput = ThisWorkbook.Worksheets("产品型号")
|
Set wsInput = ThisWorkbook.Worksheets("产品型号")
|
||||||
|
|
||||||
If wsInput Is Nothing Then
|
If wsInput Is Nothing Then
|
||||||
RunBOMExtraction = "错误:未找到输入工作表。工作表名称应包含'" & INPUT_COL_MODEL & "'或'" & INPUT_COL_PRODUCT_MODEL & "'。"
|
BOMExtraction = "错误:未找到输入工作表。工作表名称应包含'" & INPUT_COL_MODEL & "'或'" & INPUT_COL_PRODUCT_MODEL & "'。"
|
||||||
GoTo ExitHandler
|
GoTo ExitHandler
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ Public Function RunBOMExtraction() As String
|
|||||||
inputModels = ReadInputModels(wsInput)
|
inputModels = ReadInputModels(wsInput)
|
||||||
|
|
||||||
If IsEmpty(inputModels) Then
|
If IsEmpty(inputModels) Then
|
||||||
RunBOMExtraction = "错误:未找到产品型号数据。请检查工作表中是否有数据。"
|
BOMExtraction = "错误:未找到产品型号数据。请检查工作表中是否有数据。"
|
||||||
GoTo ExitHandler
|
GoTo ExitHandler
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ Public Function RunBOMExtraction() As String
|
|||||||
Set g_BOMWorkbook = OpenBOMLibrary()
|
Set g_BOMWorkbook = OpenBOMLibrary()
|
||||||
|
|
||||||
If g_BOMWorkbook Is Nothing Then
|
If g_BOMWorkbook Is Nothing Then
|
||||||
RunBOMExtraction = "错误:无法打开BOM库文件。请确保[" & BOMLIB_FILENAME & "]与当前工作簿在同一目录下。"
|
BOMExtraction = "错误:无法打开BOM库文件。请确保[" & BOMLIB_FILENAME & "]与当前工作簿在同一目录下。"
|
||||||
GoTo ExitHandler
|
GoTo ExitHandler
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ Public Function RunBOMExtraction() As String
|
|||||||
M06A_Mapper.InitMapper g_Logger, wsMapping
|
M06A_Mapper.InitMapper g_Logger, wsMapping
|
||||||
Else
|
Else
|
||||||
If Not g_Logger Is Nothing Then
|
If Not g_Logger Is Nothing Then
|
||||||
g_Logger.RecordWarning "", "M09.RunBOMExtraction", "MappingTableMissing", _
|
g_Logger.RecordWarning "", "M09.BOMExtraction", "MappingTableMissing", _
|
||||||
"未找到对照表工作表,azxs和lcfw将仅使用原始值匹配", ""
|
"未找到对照表工作表,azxs和lcfw将仅使用原始值匹配", ""
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -173,7 +173,7 @@ Public Function RunBOMExtraction() As String
|
|||||||
Set wsBIPUpload = WriteBIPUploadResults(allResults, inputModels, productCodeMap)
|
Set wsBIPUpload = WriteBIPUploadResults(allResults, inputModels, productCodeMap)
|
||||||
|
|
||||||
If wsBIPUpload Is Nothing Then
|
If wsBIPUpload Is Nothing Then
|
||||||
RunBOMExtraction = "错误:无法生成BIP上传工作表。"
|
BOMExtraction = "错误:无法生成BIP上传工作表。"
|
||||||
GoTo ExitHandler
|
GoTo ExitHandler
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ Public Function RunBOMExtraction() As String
|
|||||||
Set wsInventoryCompare = WriteInventoryComparisonResults(allResults, inputModels)
|
Set wsInventoryCompare = WriteInventoryComparisonResults(allResults, inputModels)
|
||||||
|
|
||||||
If wsInventoryCompare Is Nothing Then
|
If wsInventoryCompare Is Nothing Then
|
||||||
RunBOMExtraction = "错误:无法生成库存比对工作表。"
|
BOMExtraction = "错误:无法生成库存比对工作表。"
|
||||||
GoTo ExitHandler
|
GoTo ExitHandler
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -227,11 +227,11 @@ Public Function RunBOMExtraction() As String
|
|||||||
msg = msg & vbCrLf & vbCrLf & "发现警告,已生成错误报告工作表。"
|
msg = msg & vbCrLf & vbCrLf & "发现警告,已生成错误报告工作表。"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
RunBOMExtraction = msg
|
BOMExtraction = msg
|
||||||
GoTo ExitHandler
|
GoTo ExitHandler
|
||||||
|
|
||||||
MainErrorHandler:
|
MainErrorHandler:
|
||||||
RunBOMExtraction = "发生运行时错误: " & err.Description & " (错误号: " & err.Number & ")"
|
BOMExtraction = "发生运行时错误: " & err.Description & " (错误号: " & err.Number & ")"
|
||||||
|
|
||||||
ExitHandler:
|
ExitHandler:
|
||||||
' 清理
|
' 清理
|
||||||
|
|||||||
Reference in New Issue
Block a user