优化
This commit is contained in:
@@ -11,6 +11,24 @@ export function isSealedPalletItem(item) {
|
||||
|| item?.indivisible === true
|
||||
}
|
||||
|
||||
export function summarizeInventoryResources(resources) {
|
||||
const list = Array.isArray(resources) ? resources : []
|
||||
const locationCodes = [...new Set(list
|
||||
.map((resource) => String(resource?.locationCode || '').trim())
|
||||
.filter(Boolean))]
|
||||
const availableCounts = list
|
||||
.map((resource) => resource?.availablePackageCount)
|
||||
.filter((value) => value !== null && value !== undefined && value !== '')
|
||||
.map(Number)
|
||||
.filter(Number.isFinite)
|
||||
return {
|
||||
location: locationCodes.join('、'),
|
||||
availablePackageCount: availableCounts.length
|
||||
? availableCounts.reduce((total, value) => total + Math.max(0, value), 0)
|
||||
: null
|
||||
}
|
||||
}
|
||||
|
||||
export function createItemStates(items) {
|
||||
return items.reduce((states, item) => {
|
||||
states[item.id] = ITEM_STATUS.PENDING
|
||||
|
||||
Reference in New Issue
Block a user