fix(pda): display physical remaining cartons after partial picks
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user