From c08a2f34e14ce7b7ec68dd8b269af0392458a74a Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Fri, 27 Feb 2026 12:24:12 +0800 Subject: [PATCH] refactor: rename RunBOMExtraction to BOMExtraction for consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- VBA_BOMConverter/Modules/M01_Main.bas | 2 +- VBA_BOMConverter/Modules/M09_BOMExtractor.bas | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/VBA_BOMConverter/Modules/M01_Main.bas b/VBA_BOMConverter/Modules/M01_Main.bas index 81db88c..e7b4033 100644 --- a/VBA_BOMConverter/Modules/M01_Main.bas +++ b/VBA_BOMConverter/Modules/M01_Main.bas @@ -143,7 +143,7 @@ End Sub ' ------------------------------------------------------------------------------ Public Sub RunBOMExtraction() Dim result As String - result = M09_BOMExtractor.RunBOMExtraction() + result = BOMExtraction() MsgBox result, vbInformation, "BOM提取" End Sub diff --git a/VBA_BOMConverter/Modules/M09_BOMExtractor.bas b/VBA_BOMConverter/Modules/M09_BOMExtractor.bas index 193067a..582e5a8 100644 --- a/VBA_BOMConverter/Modules/M09_BOMExtractor.bas +++ b/VBA_BOMConverter/Modules/M09_BOMExtractor.bas @@ -46,10 +46,10 @@ Private g_BOMWorkbook As Workbook ' ' 示例调用: ' Dim result As String -' result = M09_BOMExtractor.RunBOMExtraction() +' result = M09_BOMExtractor.BOMExtraction() ' MsgBox result ' ------------------------------------------------------------------------------ -Public Function RunBOMExtraction() As String +Public Function BOMExtraction() As String On Error GoTo MainErrorHandler ' 初始化 @@ -65,7 +65,7 @@ Public Function RunBOMExtraction() As String Set wsInput = ThisWorkbook.Worksheets("产品型号") If wsInput Is Nothing Then - RunBOMExtraction = "错误:未找到输入工作表。工作表名称应包含'" & INPUT_COL_MODEL & "'或'" & INPUT_COL_PRODUCT_MODEL & "'。" + BOMExtraction = "错误:未找到输入工作表。工作表名称应包含'" & INPUT_COL_MODEL & "'或'" & INPUT_COL_PRODUCT_MODEL & "'。" GoTo ExitHandler End If @@ -76,7 +76,7 @@ Public Function RunBOMExtraction() As String inputModels = ReadInputModels(wsInput) If IsEmpty(inputModels) Then - RunBOMExtraction = "错误:未找到产品型号数据。请检查工作表中是否有数据。" + BOMExtraction = "错误:未找到产品型号数据。请检查工作表中是否有数据。" GoTo ExitHandler End If @@ -86,7 +86,7 @@ Public Function RunBOMExtraction() As String Set g_BOMWorkbook = OpenBOMLibrary() If g_BOMWorkbook Is Nothing Then - RunBOMExtraction = "错误:无法打开BOM库文件。请确保[" & BOMLIB_FILENAME & "]与当前工作簿在同一目录下。" + BOMExtraction = "错误:无法打开BOM库文件。请确保[" & BOMLIB_FILENAME & "]与当前工作簿在同一目录下。" GoTo ExitHandler End If @@ -106,7 +106,7 @@ Public Function RunBOMExtraction() As String M06A_Mapper.InitMapper g_Logger, wsMapping Else If Not g_Logger Is Nothing Then - g_Logger.RecordWarning "", "M09.RunBOMExtraction", "MappingTableMissing", _ + g_Logger.RecordWarning "", "M09.BOMExtraction", "MappingTableMissing", _ "未找到对照表工作表,azxs和lcfw将仅使用原始值匹配", "" End If End If @@ -173,7 +173,7 @@ Public Function RunBOMExtraction() As String Set wsBIPUpload = WriteBIPUploadResults(allResults, inputModels, productCodeMap) If wsBIPUpload Is Nothing Then - RunBOMExtraction = "错误:无法生成BIP上传工作表。" + BOMExtraction = "错误:无法生成BIP上传工作表。" GoTo ExitHandler End If @@ -184,7 +184,7 @@ Public Function RunBOMExtraction() As String Set wsInventoryCompare = WriteInventoryComparisonResults(allResults, inputModels) If wsInventoryCompare Is Nothing Then - RunBOMExtraction = "错误:无法生成库存比对工作表。" + BOMExtraction = "错误:无法生成库存比对工作表。" GoTo ExitHandler End If @@ -227,11 +227,11 @@ Public Function RunBOMExtraction() As String msg = msg & vbCrLf & vbCrLf & "发现警告,已生成错误报告工作表。" End If - RunBOMExtraction = msg + BOMExtraction = msg GoTo ExitHandler MainErrorHandler: - RunBOMExtraction = "发生运行时错误: " & err.Description & " (错误号: " & err.Number & ")" + BOMExtraction = "发生运行时错误: " & err.Description & " (错误号: " & err.Number & ")" ExitHandler: ' 清理