Verify real CBB BOM imports and handle first-open native database updates

This commit is contained in:
阿白叔 committed 2026-10-15 15:20:19 +08:00
1 parent a332e7bd59
commit 1b39d802bd
9 files changed
+504 -9

No files matched your search

@@ -124,7 +124,7 @@ Else
QP_FailureDescription = QP_FailureDescription & "; failed project close was not verified: " & CloseError
End If
End If
WScript.StdErr.WriteLine CStr(QP_FailureSource) & ": " & CStr(QP_FailureDescription)
WScript.StdErr.WriteLine "stage=" & QP_Stage & " " & CStr(QP_FailureSource) & ": " & CStr(QP_FailureDescription)
QPFail QP_Root, FailureState, QP_FailureNumber, QP_FailureSource, QP_FailureDescription
If Len(CStr(QP_CurrentJobId)) = 0 Then
QP_ExitCode = 3
@@ -656,6 +656,7 @@ Sub QPDiscoverSheets()
Dim Documents, Schematics, Schematic, Sheets, Sheet, Text, Count
If Not QP_DiscoveryMode Or Not QP_OwnedProject Then _
Err.Raise vbObjectError + 872, "QuickPartReplace.Discovery", "sheet discovery does not own the project"
QP_Stage = "discovery_enumerate_sheets"
Set Documents = QP_App.SchematicSheetDocuments()
Set Schematics = Documents.GetAvailableSchematics()
Text = "project_path" & vbTab & "schematic_name" & vbTab & "sheet_number" & vbCrLf
@@ -674,6 +675,7 @@ Sub QPDiscoverSheets()
QPWriteUtf8 QP_Fso.BuildPath(QP_Root, "sheets.tsv"), Text
If QP_Fso.FileExists(QP_Fso.BuildPath(QP_Root, "inventory-request.tsv")) Then _
QPDiscoverInventory Documents
QP_Stage = "discovery_close_project"
QP_App.CloseProject
If Len(CStr(QP_App.GetProjectData().GetProjectFilePath())) > 0 Then _
Err.Raise vbObjectError + 872, "QuickPartReplace.Discovery", "project did not close after sheet discovery"
@@ -696,6 +698,7 @@ Sub QPDiscoverInventory(ByRef Documents)
For Each Schematic In Schematics
Set Sheets = Documents.GetAvailableSheets(CStr(Schematic))
For Each Sheet In Sheets
QP_Stage = "inventory_open_sheet " & CStr(Schematic) & ":" & CStr(Sheet)
Set Document = Documents.Open(CStr(Schematic), CStr(Sheet))
If Document Is Nothing Then Err.Raise vbObjectError + 872, _
"QuickPartReplace.Discovery", "inventory sheet could not be opened"
@@ -705,8 +708,10 @@ Sub QPDiscoverInventory(ByRef Documents)
"QuickPartReplace.Discovery", "inventory sheet did not become active"
If CStr(View.GetName(0)) <> CStr(Schematic) Or CStr(View.Block.SheetNum) <> CStr(Sheet) Then _
Err.Raise vbObjectError + 872, "QuickPartReplace.Discovery", "inventory sheet identity changed"
QP_Stage = "inventory_query " & CStr(Schematic) & ":" & CStr(Sheet)
Set Components = View.Query(VDM_COMP, VD_ALL)
For Each Comp In Components
QP_Stage = "inventory_read_component " & CStr(Schematic) & ":" & CStr(Sheet)
PartNumber = ""
Set PartAttr = QPFindCurrentAttribute(Comp, "Part Number")
If Not PartAttr Is Nothing Then PartNumber = QPEffectiveAttributeValue(PartAttr)
@@ -732,6 +737,7 @@ Sub QPDiscoverInventory(ByRef Documents)
End If
End If
Next
QP_Stage = "inventory_close_sheet " & CStr(Schematic) & ":" & CStr(Sheet)
Document.Close False, ""
Count = Count + 1
QPProgress "inventory_sheets", Count, 0