修正海外PDA实装箱唛验收夹具
This commit is contained in:
@@ -47,17 +47,19 @@ async function ensureMatsonSupplier(context, records) {
|
||||
return supplierId ? { id: supplierId, name: MATSON_SUPPLIER_NAME, status: 'ACTIVE' } : null
|
||||
}
|
||||
|
||||
export function stableLoadedCartonMarks(items, loadingPlanId) {
|
||||
export function stableLoadedCartonMarks(items) {
|
||||
const used = new Set()
|
||||
return [...(Array.isArray(items) ? items : [])]
|
||||
.sort((left, right) => id(left?.loadingPlanItemId).localeCompare(id(right?.loadingPlanItemId)))
|
||||
.flatMap((item) => {
|
||||
const count = Math.max(0, Number(item?.pickedPackageCount) || 0)
|
||||
const seed = `${loadingPlanId}:${id(item?.loadingPlanItemId)}`
|
||||
const labels = [...new Set((item?.boxCodes || [])
|
||||
.map((value) => String(value || '').trim()).filter((value) => value && !used.has(value)))]
|
||||
.sort((left, right) => createHash('sha256').update(`${seed}:${left}`).digest('hex')
|
||||
.localeCompare(createHash('sha256').update(`${seed}:${right}`).digest('hex')))
|
||||
// Partial loading keeps the lowest carton indexes on the loaded source inbound and
|
||||
// transfers the highest indexes to the remainder child. Mirror that settlement rule
|
||||
// instead of sampling labels, otherwise downstream PDA fixtures may reference cartons
|
||||
// that were deliberately moved out of this container.
|
||||
.sort((left, right) => left.localeCompare(right, undefined, { numeric: true, sensitivity: 'base' }))
|
||||
.slice(0, count)
|
||||
labels.forEach((value) => used.add(value))
|
||||
return labels
|
||||
@@ -1477,7 +1479,7 @@ export async function run(context) {
|
||||
context.createdResources.phase3Loading = {
|
||||
tenantId, orderId: id(source?.orderId), inboundId, preloadPlanId: planId,
|
||||
cartonMark: source?.boxCode || source?.cartonMark || null,
|
||||
cartonMarks: stableLoadedCartonMarks(stagedTask?.items, loadingPlanId),
|
||||
cartonMarks: stableLoadedCartonMarks(stagedTask?.items),
|
||||
fulfillmentType: source?.fulfillmentType || 'STANDARD',
|
||||
skuCodes: [...new Set([...(Array.isArray(source?.skuCodes) ? source.skuCodes : []),
|
||||
...(Array.isArray(incrementalFixture?.skuCodes) ? incrementalFixture.skuCodes : [])])],
|
||||
|
||||
Reference in New Issue
Block a user