fix(overseas): reuse original resource command after reopening conversion

This commit is contained in:
2026-10-05 02:13:24 +08:00
parent ea24496b11
commit 058b0778a2
4 changed files with 41 additions and 5 deletions
@@ -740,7 +740,8 @@ async function loadContainerPreview(sourceContainerBookingId = selectedContainer
const preview = await getContainerInboundPlanPreview(sourceContainerBookingId)
if (request !== containerPreviewRequest || selectedContainerBookingId.value !== sourceContainerBookingId || !containerConvertOpen.value) return
containerPreview.value = preview
if (!preserveResult) containerConversionIdempotencyKey = idempotencyKey('container-inbound-plan')
if (!preserveResult) containerConversionIdempotencyKey = preview.resourceRetry
? preview.resourceRetry.idempotencyKey : idempotencyKey('container-inbound-plan')
} catch (error) {
if (request !== containerPreviewRequest || selectedContainerBookingId.value !== sourceContainerBookingId || !containerConvertOpen.value) return
containerPreviewError.value = getApiErrorDetails(error, '加载整柜入库计划预览失败,请重试').message
@@ -757,6 +758,7 @@ async function confirmContainerInboundPlans() {
if (!preview?.ready || preview.pendingOrderCount <= 0 || actionLoading.value) return
if (!containerConversionIdempotencyKey) containerConversionIdempotencyKey = idempotencyKey('container-inbound-plan')
const bookingId = preview.sourceContainerBookingId
const commandSnapshot = preview.resourceRetry ?? preview
const existingPlanNos = new Set(preview.groups.flatMap((group) => group.orders)
.filter((order) => order.readiness !== 'READY' && order.existingPlanNo)
.map((order) => String(order.existingPlanNo)))
@@ -765,8 +767,8 @@ async function confirmContainerInboundPlans() {
try {
const plans = await convertLastMileContainerToInboundPlans({
sourceContainerBookingId: bookingId,
snapshotVersion: preview.snapshotVersion,
snapshotHash: preview.snapshotHash,
snapshotVersion: commandSnapshot.snapshotVersion,
snapshotHash: commandSnapshot.snapshotHash,
}, containerConversionIdempotencyKey)
if (selectedContainerBookingId.value !== bookingId || !containerConvertOpen.value) return
const existingPlanCount = plans.filter((plan) => existingPlanNos.has(plan.planNo)).length