test: close phase five inventory snapshot coverage

This commit is contained in:
2026-09-02 03:51:07 +08:00
parent a4a4306154
commit 79c390ad58
5 changed files with 59 additions and 6 deletions
@@ -30,6 +30,13 @@ function validPdf(response) {
async function reusablePallets(context, warehouseId) {
const cacheKey = asId(warehouseId)
const override = context.context?.measurementPalletOverride
if (asId(override?.warehouseId) === cacheKey && asId(override?.id)
&& String(override?.code || '').trim()) {
context.assert(MODULE, '使用编排层提供的本轮专用称重托盘', null, true,
`warehouseId=${warehouseId}, palletId=${asId(override.id)}`, OPTIONS)
return [{ id: asId(override.id), code: String(override.code) }]
}
const allowAnyExistingPallet = context.context?.allowAnyExistingPallet === true
const scopedCacheKey = `${cacheKey}:${allowAnyExistingPallet ? 'any' : 'fixed'}`
if (reusablePalletsByWarehouse.has(scopedCacheKey)) return reusablePalletsByWarehouse.get(scopedCacheKey)
@@ -185,7 +192,7 @@ async function provisionWarehouseResources(context, { inboundId, tenantId, wareh
context.createdResources.inboundWarehouseResources ??= {}
context.createdResources.inboundWarehouseResources[inboundId] = {
marker: context.marker, tenantId: '0', warehouseId: asId(warehouseId), palletCount,
reusablePalletCodes: REUSABLE_PALLET_CODES, resources,
reusablePalletCodes: candidates.map((item) => item.code), resources,
}
return { palletId: palletIds[0], palletIds, palletCount, resources }
}