fix: prefer pending pallet for carton scan

This commit is contained in:
2026-09-20 16:10:48 +08:00
parent 117431a4fb
commit 1e171ec81c
2 changed files with 16 additions and 1 deletions
+5 -1
View File
@@ -92,7 +92,11 @@ export function classifyScan(items, states, scanCode, scannedBoxCodes = {}) {
return { type: 'pallet', item: palletItem }
}
const item = items.find((entry) => (entry.boxCodes || []).includes(scanCode)) || null
const matchingItems = items.filter((entry) => (entry.boxCodes || []).includes(scanCode))
const item = matchingItems.find((entry) => {
const status = states[entry.id] || ITEM_STATUS.PENDING
return status !== ITEM_STATUS.PICKED && status !== ITEM_STATUS.SKIPPED
}) || matchingItems[0] || null
if (!item) return { type: 'unknown', item: null }
if (isSealedPalletItem(item)) {
const status = states[item.id] || ITEM_STATUS.PENDING