style: standardize VBA property and method name casing
All checks were successful
NTFY Notification / notify (push) Successful in 11s
All checks were successful
NTFY Notification / notify (push) Successful in 11s
Standardize all VBA property and method names to lowercase for consistent code style: - Err object: Err.Description → err.Description, Err.Number → err.Number - Collection properties: .Count → .count - Range properties: .Rows.Count → .Rows.count, .Row → .row - Dictionary methods: .Keys → .keys, .Exists → .exists - Worksheet properties: .Sheets.Count → .Sheets.count - Fix typo: Thisworkbook.Path → ThisWorkbook.Path VBA is case-insensitive, but consistent lowercase convention improves readability. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,7 @@ Private Sub LoadInventoryData(ByVal inventoryWb As Workbook)
|
||||
|
||||
' 查找最后一行
|
||||
Dim lastRow As Long
|
||||
lastRow = wsInventory.Cells(wsInventory.Rows.Count, 2).End(xlUp).Row ' B列
|
||||
lastRow = wsInventory.Cells(wsInventory.Rows.count, 2).End(xlUp).row ' B列
|
||||
|
||||
If lastRow < INVENTORY_HEADER_ROW + 1 Then
|
||||
Exit Sub ' 没有数据
|
||||
@@ -110,7 +110,7 @@ Private Sub LoadInventoryData(ByVal inventoryWb As Workbook)
|
||||
ErrorHandler:
|
||||
If Not g_Logger Is Nothing Then
|
||||
g_Logger.RecordWarning "", "M08.LoadInventoryData", "LoadError", _
|
||||
"加载库存数据失败: " & Err.Description, ""
|
||||
"加载库存数据失败: " & err.Description, ""
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -211,7 +211,7 @@ Public Function ProcessComponentRecord( _
|
||||
ErrorHandler:
|
||||
If Not logger Is Nothing Then
|
||||
logger.Record productionOrderNo, "M08.ProcessComponentRecord", "SystemError", _
|
||||
"处理部件记录失败: " & Err.Description, ""
|
||||
"处理部件记录失败: " & err.Description, ""
|
||||
End If
|
||||
|
||||
' 返回错误物料
|
||||
@@ -221,7 +221,7 @@ ErrorHandler:
|
||||
errorMat("materialName") = ""
|
||||
errorMat("materialCode") = ""
|
||||
errorMat("materialQty") = 0
|
||||
errorMat("remarks") = "系统错误: " & Err.Description
|
||||
errorMat("remarks") = "系统错误: " & err.Description
|
||||
|
||||
Dim errorCol As New Collection
|
||||
errorCol.Add errorMat
|
||||
@@ -249,9 +249,9 @@ End Function
|
||||
'
|
||||
' 示例:
|
||||
' 订单1、订单3、订单6都用部件A,每个订单数量=2,BOM需求量=1,现存量=5
|
||||
' - 订单1:累计需求 = 2×1 + 0 = 2,5 >= 2 ✓ true(使用部件)
|
||||
' - 订单3:累计需求 = 2×1 + 2 = 4,5 >= 4 ✓ true(使用部件)
|
||||
' - 订单6:累计需求 = 2×1 + 4 = 6,5 < 6 ✗ false(使用子件)
|
||||
' - 订单1:累计需求 = 2×1 + 0 = 2,5 >= 2 ?? true(使用部件)
|
||||
' - 订单3:累计需求 = 2×1 + 2 = 4,5 >= 4 ?? true(使用部件)
|
||||
' - 订单6:累计需求 = 2×1 + 4 = 6,5 < 6 ?? false(使用子件)
|
||||
' ------------------------------------------------------------------------------
|
||||
Private Function CheckComponentInventory( _
|
||||
ByVal wsComponent As Worksheet, _
|
||||
@@ -346,7 +346,7 @@ Private Function CheckComponentInventory( _
|
||||
ErrorHandler:
|
||||
If Not g_Logger Is Nothing Then
|
||||
g_Logger.Record productionOrderNo, "M08.CheckComponentInventory", "SystemError", _
|
||||
"库存检查失败: " & Err.Description, ""
|
||||
"库存检查失败: " & err.Description, ""
|
||||
End If
|
||||
' 出错时返回False(库存不足)
|
||||
CheckComponentInventory = False
|
||||
@@ -425,7 +425,7 @@ Private Function ExtractComponentInfo( _
|
||||
ErrorHandler:
|
||||
If Not g_Logger Is Nothing Then
|
||||
g_Logger.Record "", "M08.ExtractComponentInfo", "SystemError", _
|
||||
"提取部件信息失败: " & Err.Description, componentType
|
||||
"提取部件信息失败: " & err.Description, componentType
|
||||
End If
|
||||
Set ExtractComponentInfo = Nothing
|
||||
End Function
|
||||
@@ -479,7 +479,7 @@ Private Function ExtractSubComponents( _
|
||||
ErrorHandler:
|
||||
If Not g_Logger Is Nothing Then
|
||||
g_Logger.Record "", "M08.ExtractSubComponents", "SystemError", _
|
||||
"提取子件信息失败: " & Err.Description, ""
|
||||
"提取子件信息失败: " & err.Description, ""
|
||||
End If
|
||||
Set ExtractSubComponents = New Collection
|
||||
End Function
|
||||
@@ -575,7 +575,7 @@ Private Function ExtractSingleSubComponent( _
|
||||
ErrorHandler:
|
||||
If Not g_Logger Is Nothing Then
|
||||
g_Logger.Record "", "M08.ExtractSingleSubComponent", "SystemError", _
|
||||
"提取子件[" & subComponentType & "]失败: " & Err.Description, ""
|
||||
"提取子件[" & subComponentType & "]失败: " & err.Description, ""
|
||||
End If
|
||||
Set ExtractSingleSubComponent = Nothing
|
||||
End Function
|
||||
@@ -764,6 +764,6 @@ Public Function ValidateComponentCombination(ByVal materials As Collection) As O
|
||||
|
||||
ErrorHandler:
|
||||
result("valid") = False
|
||||
result("message") = "验证过程发生错误: " & Err.Description
|
||||
result("message") = "验证过程发生错误: " & err.Description
|
||||
Set ValidateComponentCombination = result
|
||||
End Function
|
||||
Reference in New Issue
Block a user