fix: remove sealed smart-loading rows by pallet

This commit is contained in:
2026-09-14 14:35:30 +08:00
parent 85b3606eca
commit afa49bf1f1
4 changed files with 58 additions and 3 deletions
@@ -26,6 +26,7 @@ import {
removeAllUnpickedSmartLoadingItems,
removeSmartLoadingGroup,
removeSmartLoadingItem,
removeSmartLoadingPallet,
} from '../api/platformContainerLoading'
import type {
SmartLoadingCandidate,
@@ -585,10 +586,14 @@ async function remove(source: object) {
const item = itemRow(source)
if (!plan.value || !item.canRemove) return
const row = source as SmartLoadingPlanRow
const sealedPallet = item.unitType === 'SEALED_PALLET' && Boolean(item.palletId)
const confirmed = await ElMessageBox.confirm(row.coLoadGroup
? `确认整组移除 ${row.coLoadGroup.groupNo}(${groupMemberLabel(row.coLoadGroup)}、${row.packageCount} 箱)吗?组内所有入仓片段将联动移除。`
: `确认从当前柜次移除入仓码“${item.inboundCode || '—'}”的 ${item.packageCount} 箱吗?`, row.coLoadGroup ? '移除同柜不可拆组' : '移除装柜明细', {
type: 'warning', confirmButtonText: row.coLoadGroup ? '移除整组' : '移除', cancelButtonText: '取消',
: sealedPallet
? `确认从当前柜次整托移除托盘“${item.palletNo || '—'}”(${item.packageCount} 箱)吗?`
: `确认从当前柜次移除入仓码“${item.inboundCode || '—'}”的 ${item.packageCount} 箱吗?`,
row.coLoadGroup ? '移除同柜不可拆组' : sealedPallet ? '整托移除' : '移除装柜明细', {
type: 'warning', confirmButtonText: row.coLoadGroup ? '移除整组' : sealedPallet ? '整托移除' : '移除', cancelButtonText: '取消',
}).catch(() => false)
if (!confirmed || !plan.value) return
await mutate(async () => {
@@ -598,6 +603,12 @@ async function remove(source: object) {
ElMessage.success(`同柜不可拆组 ${row.coLoadGroup.groupNo} 已整组移除`)
return
}
if (sealedPallet && item.palletId) {
acceptPlan(await removeSmartLoadingPallet(plan.value!.id, item.palletId, plan.value!.version))
await loadCandidateData()
ElMessage.success(`托盘 ${item.palletNo || '—'} 已整托移除`)
return
}
let current = plan.value!
for (const original of item.sourceItems) {
const currentItem = current.items.find((value) => value.id === original.id)