装柜优化
This commit is contained in:
@@ -142,14 +142,14 @@ function syncDrafts(next: SmartLoadingPlan, preserved: Record<string, number> =
|
||||
for (const key of Object.keys(quantityDrafts)) delete quantityDrafts[key]
|
||||
for (const item of next.items || []) quantityDrafts[item.id] = preserved[item.id] ?? item.packageCount
|
||||
}
|
||||
function acceptPlan(next: SmartLoadingPlan, preserved: Record<string, number> = {}) {
|
||||
function acceptPlan(next: SmartLoadingPlan, preserved: Record<string, number> = {}, syncContainerStatus = true) {
|
||||
plan.value = next
|
||||
noDraft.value = false
|
||||
syncDrafts(next, preserved)
|
||||
const container = selectedContainer.value
|
||||
if (container) {
|
||||
container.planId = next.id
|
||||
container.planStatus = next.status
|
||||
if (syncContainerStatus) container.planStatus = next.status
|
||||
}
|
||||
}
|
||||
function clearSelectionData() {
|
||||
@@ -178,7 +178,7 @@ async function loadSelectedData(preserved: Record<string, number> = {}) {
|
||||
])
|
||||
if (request !== selectionRequest) return
|
||||
candidates.value = candidateResult
|
||||
if (planResult.value) acceptPlan(planResult.value, preserved)
|
||||
if (planResult.value) acceptPlan(planResult.value, preserved, false)
|
||||
else noDraft.value = planResult.missing
|
||||
} catch (error) {
|
||||
if (request === selectionRequest) selectionError.value = getApiErrorDetails(error, '柜次装柜数据加载失败')
|
||||
|
||||
Reference in New Issue
Block a user