fix(pda): display physical remaining cartons after partial picks

This commit is contained in:
2026-10-02 13:47:41 +08:00
parent 8d2d80ec11
commit 7aebbd2a70
3 changed files with 62 additions and 3 deletions
+14
View File
@@ -9,6 +9,20 @@ export function isSealedPalletItem(item) {
return item?.unitType === 'SEALED_PALLET'
}
// Physical cartons still absent from the picked count, independent of whether
// the operator has handled the line as partial or skipped.
export function remainingPhysicalCartons(items, states = {}, partialQuantities = {}) {
const count = (value) => Number.isFinite(Number(value)) ? Math.max(0, Number(value)) : 0
return items.reduce((total, item) => {
const planned = count(item.plannedPackageCount ?? item.qty)
const hasServerCount = item.pickedPackageCount !== null && item.pickedPackageCount !== undefined && item.pickedPackageCount !== ''
const picked = hasServerCount ? count(item.pickedPackageCount)
: states[item.id] === ITEM_STATUS.PICKED ? planned
: states[item.id] === ITEM_STATUS.PARTIAL ? count(partialQuantities[item.id]) : 0
return total + Math.max(0, planned - picked)
}, 0)
}
export function summarizeInventoryResources(resources) {
const list = Array.isArray(resources) ? resources : []
const locationCodes = [...new Set(list