fix: release completed attempts before later failures

This commit is contained in:
阿白叔 committed 2026-10-31 09:25:30 +08:00
1 parent f0a0131aac
commit 5ed8444d5d
6 files changed
+81 -7

No files matched your search

+11 -2
View File
@@ -26,6 +26,7 @@ Dim QP_PinIndex
Dim QP_PinContext
Dim QP_ComponentUidIndex, QP_ComponentRefdesIndex, QP_ComponentLocationIndex
Dim QP_FallbackIdentityUsed
Dim QP_FallbackIdentityWarnings
Dim QP_ComponentIndexContext
Dim QP_NativeCallActive
Dim QP_BatchMode, QP_OwnedProject, QP_BatchState, QP_BatchCode, QP_BatchMessage
@@ -71,6 +72,7 @@ Set QP_ComponentRefdesIndex = Nothing
Set QP_ComponentLocationIndex = Nothing
QP_ComponentIndexContext = ""
QP_FallbackIdentityUsed = False
Set QP_FallbackIdentityWarnings = CreateObject("Scripting.Dictionary")
QP_CurrentJobId = ""
QP_ExitCode = 0
QP_Stage = "session_startup"
@@ -807,12 +809,18 @@ Function QPComponentIdentityKey(ByRef Comp)
If Number <> 0 Then Err.Raise vbObjectError + 872, _
"QuickPartReplace.Discovery", "component Refdes is unreadable; operation stopped before any replacement"
If Len(Trim(CStr(Uid))) > 0 Then
QPComponentIdentityKey = CStr(Uid)
QPComponentIdentityKey = Trim(CStr(Uid))
Exit Function
Else
QP_FallbackIdentityUsed = True
If Len(Trim(CStr(Refdes))) > 0 Then
QPComponentIdentityKey = "@REFDES|" & Trim(CStr(Refdes))
QPLog QP_Root, "WARN", "component_uid_missing_using_refdes_fallback refdes=" & CStr(Refdes)
If Not IsObject(QP_FallbackIdentityWarnings) Then _
Set QP_FallbackIdentityWarnings = CreateObject("Scripting.Dictionary")
If Not QP_FallbackIdentityWarnings.Exists(LCase(Trim(CStr(Refdes)))) Then
QP_FallbackIdentityWarnings.Add LCase(Trim(CStr(Refdes))), True
QPLog QP_Root, "WARN", "component_uid_missing_using_refdes_fallback refdes=" & CStr(Refdes)
End If
Else
Err.Raise vbObjectError + 872, "QuickPartReplace.Discovery", "component UID and Refdes are empty"
End If
@@ -1216,6 +1224,7 @@ Sub QPCaptureAndSelect(ByRef Command, ByVal SnapshotPath)
Dim Selectors, Selector, Uid, ValueAttr, ValueText, MatchedUids, UntouchedCount, NativeRead
QP_FallbackIdentityUsed = False
Set QP_FallbackIdentityWarnings = CreateObject("Scripting.Dictionary")
If StrComp(CStr(Command("old_part_number")), CStr(Command("new_part_number")), vbTextCompare) = 0 Then _
Err.Raise vbObjectError + 829, "QuickPartReplace", "source and target must differ"
QPInvalidatePinIndex