refactor: replace row index with production order number in error reports
All checks were successful
NTFY Notification / notify (push) Successful in 12s
All checks were successful
NTFY Notification / notify (push) Successful in 12s
Replace "原表行号" (original row number) field with "生产订单号" (production order number) in BOM Extraction System error reporting to improve traceability. Changes: - clsErrorLogger: Update Record/RecordWarning signatures to accept OrderNo (String) instead of RowIndex (Long) - M09_BOMExtractor: Propagate productionOrderNo through validation chain for context-aware error reporting - M06/M07/M08: Use empty string for system-level errors without production order context - Error report header: Change column B from "原表行号" to "生产订单号" Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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 0, "M09.RunBOMExtraction", "MappingTableMissing", _
|
||||
g_Logger.RecordWarning "", "M09.RunBOMExtraction", "MappingTableMissing", _
|
||||
"未找到对照表工作表,azxs和lcfw将仅使用原始值匹配", ""
|
||||
End If
|
||||
End If
|
||||
@@ -355,7 +355,7 @@ Private Function ProcessSingleModel( _
|
||||
' 步骤2: 匹配所有物料类型(两阶段)
|
||||
Dim allMaterials As Collection
|
||||
Dim validation As Object
|
||||
Set allMaterials = MatchAllMaterialTypesWithValidation(params, bomWb, logger, orderQty, validation)
|
||||
Set allMaterials = MatchAllMaterialTypesWithValidation(params, bomWb, logger, orderQty, productionOrderNo, validation)
|
||||
|
||||
' 步骤3: 生成输出行
|
||||
Dim remarks As String
|
||||
@@ -387,7 +387,7 @@ Private Function ProcessSingleModel( _
|
||||
|
||||
ErrorHandler:
|
||||
If Not logger Is Nothing Then
|
||||
logger.Record 0, "M09.ProcessSingleModel", "SystemError", _
|
||||
logger.Record productionOrderNo, "M09.ProcessSingleModel", "SystemError", _
|
||||
"处理型号[" & modelString & "]失败: " & Err.Description, ""
|
||||
End If
|
||||
|
||||
@@ -422,6 +422,7 @@ Private Function MatchAllMaterialTypesWithValidation( _
|
||||
ByVal bomWb As Workbook, _
|
||||
ByVal logger As clsErrorLogger, _
|
||||
ByVal orderQty As Long, _
|
||||
ByVal productionOrderNo As String, _
|
||||
ByRef outValidation As Object _
|
||||
) As Collection
|
||||
On Error GoTo ErrorHandler
|
||||
@@ -523,7 +524,7 @@ Private Function MatchAllMaterialTypesWithValidation( _
|
||||
' Phase 2: 统一验证所有匹配结果
|
||||
' ========================================
|
||||
Dim validationResult As Object
|
||||
Set validationResult = ValidateAllMatchResults(resultsDict, logger, params)
|
||||
Set validationResult = ValidateAllMatchResults(resultsDict, logger, params, productionOrderNo)
|
||||
|
||||
' ========================================
|
||||
' Phase 3: 根据验证结果生成最终物料集合
|
||||
@@ -565,7 +566,7 @@ Private Function MatchAllMaterialTypesWithValidation( _
|
||||
|
||||
ErrorHandler:
|
||||
If Not logger Is Nothing Then
|
||||
logger.Record 0, "M09.MatchAllMaterialTypesWithValidation", "SystemError", _
|
||||
logger.Record productionOrderNo, "M09.MatchAllMaterialTypesWithValidation", "SystemError", _
|
||||
"匹配物料类型失败: " & Err.Description, ""
|
||||
End If
|
||||
|
||||
@@ -606,7 +607,8 @@ End Function
|
||||
Private Function ValidateAllMatchResults( _
|
||||
ByVal resultsDict As Object, _
|
||||
ByVal logger As clsErrorLogger, _
|
||||
ByVal params As Object _
|
||||
ByVal params As Object, _
|
||||
ByVal productionOrderNo As String _
|
||||
) As Object
|
||||
On Error GoTo ErrorHandler
|
||||
|
||||
@@ -850,12 +852,12 @@ Private Function ValidateAllMatchResults( _
|
||||
' ========================================
|
||||
Dim err As Variant
|
||||
For Each err In errors
|
||||
logger.Record 0, "M09.ValidateAllMatchResults", "BOMMatchError", CStr(err), ""
|
||||
logger.Record productionOrderNo, "M09.ValidateAllMatchResults", "BOMMatchError", CStr(err), ""
|
||||
Next err
|
||||
|
||||
Dim warn As Variant
|
||||
For Each warn In warnings
|
||||
logger.RecordWarning 0, "M09.ValidateAllMatchResults", "ComponentConflict", CStr(warn), ""
|
||||
logger.RecordWarning productionOrderNo, "M09.ValidateAllMatchResults", "ComponentConflict", CStr(warn), ""
|
||||
Next warn
|
||||
|
||||
' ========================================
|
||||
@@ -874,7 +876,7 @@ Private Function ValidateAllMatchResults( _
|
||||
|
||||
ErrorHandler:
|
||||
If Not logger Is Nothing Then
|
||||
logger.Record 0, "M09.ValidateAllMatchResults", "SystemError", _
|
||||
logger.Record productionOrderNo, "M09.ValidateAllMatchResults", "SystemError", _
|
||||
"验证匹配结果失败: " & Err.Description, ""
|
||||
End If
|
||||
|
||||
|
||||
Reference in New Issue
Block a user