This commit is contained in:
2026-10-22 11:56:47 +08:00
parent 5d71af1ac9
commit de96e47d74
71 changed files with 1296 additions and 332 deletions
+4 -12
View File
@@ -7,7 +7,7 @@ import { parseCrossCustomerArguments, runCrossCustomer } from './fleet-cross-cus
import { guardFleetWrites, redactFleetWrite, findFleetActorPhone } from './fleet-test-env-acceptance.mjs'
import { confirmFleetLoading } from './admin-test-env-modules/fleet-trip-fulfillment.mjs'
import { testPlannedCapacity } from './admin-test-env-modules/fleet-booking-reservation-acceptance.mjs'
import { pickAll, saveReceiptAndComplete, arrangeDispatchDelivery } from './admin-test-env-modules/phase5-overseas-fulfillment.mjs'
import { pickAll, saveReceiptAndComplete, readAutomaticDispatchDelivery } from './admin-test-env-modules/phase5-overseas-fulfillment.mjs'
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')
const API = '/api/platform/v1/last-leg', POOL = `${API}/fleet/capacity-offers`, IAM = '/api/platform/v1/iam'
@@ -486,7 +486,7 @@ async function poolScenario(context, fixture, { execute = false, readInventory,
&& task.items.length === 4 && members.every(member => task.items.some(row => id(row.customerId) === member.customerId
&& row.palletNo === member.palletNo && Number(row.pickedPackages) === 1)))
await confirmFleetLoading(context, MODULE, tripProof, fixture.pdaToken, fixture.loadingMeasurements)
const arranged = await arrangeDispatchDelivery(context, fixture.dispatchNo)
const arranged = await readAutomaticDispatchDelivery(context, fixture.dispatchNo)
check('One native platform arrangement covers all four real sources and both customers', arranged?.deliveries?.length === 2
&& arranged.outbounds?.length === 2 && arranged.deliveries.reduce((sum, row) => sum + Number(row.packageCount), 0) === 4)
for (const member of members) {
@@ -495,16 +495,8 @@ async function poolScenario(context, fixture, { execute = false, readInventory,
Object.assign(member, { outboundNo: matches[0].outboundNo, deliveryNo: matches[0].deliveryNo })
}
const readyTask = await request('GET', `/api/pda/v1/last-leg/dispatches/${encode(fixture.dispatchNo)}`, undefined, fixture.pdaToken)
check('Arrangement leaves native main ready in AFTER_LOADING', readyTask.status === 'ACTIVE' && readyTask.stage === 'AFTER_LOADING' && readyTask.actions?.DEPART?.allowed === true)
const departBody = { recordVersion: readyTask.recordVersion, idempotencyKey: key('DEPART'), remark: context.marker }
const departPath = `/api/pda/v1/last-leg/dispatches/${encode(fixture.dispatchNo)}/depart`
const departed = await request('POST', departPath, departBody, fixture.pdaToken)
check('One native actual departure covers four sources and two customer deliveries', departed.dispatchNo === fixture.dispatchNo
&& departed.status === 'ACTIVE' && departed.stage === 'DELIVERING' && Number(departed.result?.shippedPackages) === 4
&& departed.result.deliveries.length === 2)
const departReplay = await request('POST', departPath, departBody, fixture.pdaToken)
check('Departure original-key replay preserves exact version and documents', departReplay.replayed === true
&& id(departReplay.recordVersion) === id(departed.recordVersion) && JSON.stringify(departReplay.result) === JSON.stringify(departed.result))
check('Automatic departure covers four sources and both customers', readyTask.dispatchNo === fixture.dispatchNo
&& readyTask.status === 'ACTIVE' && readyTask.stage === 'DELIVERING' && Number(readyTask.counts?.shippedPackageCount) === 4)
for (const [index, delivery] of arranged.deliveries.entries()) {
const actual = await request('GET', `${API}/delivery-orders/${encode(delivery.deliveryNo)}?customerId=${encode(delivery.customerId)}`)
check('Actual departure has already set the customer delivery to DELIVERING', actual.order.status === 'DELIVERING')