This commit is contained in:
2026-10-21 21:30:24 +08:00
parent 234216b3eb
commit 5356a8c898
28 changed files with 1543 additions and 45 deletions
@@ -34,7 +34,7 @@ test('real Jackson long counts accept safe decimal strings without changing pall
function server(fault = '') {
const calls = [], assertions = [], saved = new Map(), loadingActors = new Map()
const detail = { dispatchNo: 'DP-A', status: 'ACTIVE', stage: 'BEFORE_LOADING', reviewState: 'DRAFT', recordVersion: '9007199254740998',
counts: { packageCount: 3, pickedPackageCount: 0, shippedPackageCount: 0 }, reviews: {},
counts: { packageCount: 3, pickedPackageCount: 0, shippedPackageCount: 0 }, reviews: {}, publishLooseboardDemand: false,
dispatchInfo: { estimatedArrivalAt: '2026-10-21T10:00:00Z', fbaAppointments: [{ appointmentNo: 'FBA-ORIGINAL' }] }, vehicleInfo: {} }
const trip = { tripNo: 'TR-A', status: 'PLANNED', warehouseId: '92', recordVersion: 4, tripPurpose: 'DELIVERY', stops }
let driverVersion = 0, uploadComplete = false, driverReviewed = false, nextPlate = '', checkpointError = false, nextTrip, nextDetail
@@ -103,6 +103,7 @@ function server(fault = '') {
pallets: [pallet()], missingFields: ['PLT-A:palletSpaces'] })
}
if (method === 'PUT' && path === D) {
assert.equal(body.publishLooseboardDemand, detail.publishLooseboardDemand)
if (detail.stage !== 'BEFORE_LOADING') {
if (fault === 'edit-mutates-on-rejection') detail.counts.pickedPackageCount--
return conflict('仅装车前可编辑,请显式退回;已经扫码不得改派')
@@ -180,6 +181,15 @@ function server(fault = '') {
const prepare = s => prepareFleetTrip(s.context, 'native', 'DP-A', '92')
test('review preparation uses the current confirmed appointment when arrival is unset', async () => {
const s = server(), at = new Date(Date.now() + 72 * 3600000).toISOString()
s.detail.dispatchInfo.estimatedArrivalAt = null
s.detail.dispatchInfo.fbaAppointments = [{ status: 'PENDING', confirmedAt: null }, { status: 'SUCCESS', confirmedAt: at }]
const proof = await prepare(s)
assert.equal(proof.updateRequest.estimatedArrivalAt, at)
assert.ok(Date.parse(proof.expectedDriverEndAt) > Date.parse(at))
})
function jacksonCountWire(s) {
const names = new Set(['itemCount', 'palletCount', 'packageCount', 'pickedPackageCount', 'shippedPackageCount', 'scheduledPackages', 'pickedPackages'])
const serialize = value => Array.isArray(value) ? value.map(serialize)