优化
This commit is contained in:
@@ -20,16 +20,42 @@ const inbounds = Array.from({ length: 15 }, (_, index) => ({
|
||||
|
||||
test('one container candidate aggregates fifteen independent one-inbound plans', () => {
|
||||
const candidate = normalizeReceivingCandidate({
|
||||
containerNo: 'C10000000', status: 'WAIT_SIGN', planCount: 15, inboundCodeCount: 15,
|
||||
sourceContainerBookingId: '2093166483653849089', containerNo: 'C10000000', status: 'WAIT_SIGN',
|
||||
plannedArrivalAt: '2026-08-29T09:30:00', totalOrderCount: 15, planCount: 15, inboundCodeCount: 15,
|
||||
missingInboundCodeCount: 0, plannedInboundCodeCount: 15, pendingPlanCount: 0, allPlansReady: true, operable: true, blockReason: '',
|
||||
destinationCodes: ['ABE3', 'US-LAX-01'], plannedPalletCount: 15,
|
||||
totalPackages: 60, receivedPackages: 0, currentAccount: false
|
||||
})
|
||||
assert.deepEqual(candidate, {
|
||||
containerNo: 'C10000000', status: 'WAIT_SIGN', planCount: 15, inboundCodeCount: 15,
|
||||
sourceContainerBookingId: '2093166483653849089', containerNo: 'C10000000', status: 'WAIT_SIGN',
|
||||
plannedArrivalAt: '2026-08-29T09:30:00', totalOrderCount: 15, planCount: 15, inboundCodeCount: 15,
|
||||
missingInboundCodeCount: 0, plannedInboundCodeCount: 15, pendingPlanCount: 0, allPlansReady: true, operable: true, blockReason: '',
|
||||
destinationCodes: ['ABE3', 'US-LAX-01'], plannedPalletCount: 15,
|
||||
totalPackages: 60, receivedPackages: 0, currentAccount: false
|
||||
})
|
||||
assert.equal(candidate.planCount, candidate.inboundCodeCount)
|
||||
assert.equal(candidate.sourceContainerBookingId, '2093166483653849089')
|
||||
})
|
||||
|
||||
test('incomplete containers remain visible but fail closed from server readiness facts', () => {
|
||||
const candidate = normalizeReceivingCandidate({
|
||||
sourceContainerBookingId: '2093166483653849099', containerNo: 'C10000001',
|
||||
plannedArrivalAt: null, totalOrderCount: 15, inboundCodeCount: 12, planCount: 10,
|
||||
missingInboundCodeCount: 3, plannedInboundCodeCount: 10, pendingPlanCount: 5, allPlansReady: false, operable: false,
|
||||
blockReason: '存在3票缺少入仓码'
|
||||
})
|
||||
assert.equal(candidate.totalOrderCount, 15)
|
||||
assert.equal(candidate.planCount, 10)
|
||||
assert.equal(candidate.plannedInboundCodeCount, 10)
|
||||
assert.equal(candidate.pendingPlanCount, 5)
|
||||
assert.equal(candidate.missingInboundCodeCount, 3)
|
||||
assert.equal(candidate.allPlansReady, false)
|
||||
assert.equal(candidate.operable, false)
|
||||
assert.equal(candidate.blockReason, '存在3票缺少入仓码')
|
||||
|
||||
const absentGate = normalizeReceivingCandidate({ containerNo: 'OLD-CONTRACT' })
|
||||
assert.equal(absentGate.allPlansReady, false)
|
||||
assert.equal(absentGate.operable, false)
|
||||
})
|
||||
|
||||
test('current recovery retains all independent-plan inbound facts while progress remains container-level', () => {
|
||||
@@ -53,7 +79,7 @@ test('container UI locks and signs once across independent plans, then renders o
|
||||
read('../src/api/inbound.js')
|
||||
])
|
||||
|
||||
assert.match(operation, /item\.inboundCodeCount[\s\S]*item\.totalPackages[\s\S]*item\.plannedPalletCount[\s\S]*item\.destinationCodes/)
|
||||
assert.match(operation, /item\.totalOrderCount[\s\S]*item\.inboundCodeCount[\s\S]*item\.planCount[\s\S]*item\.pendingPlanCount/)
|
||||
assert.match(summary, /inboundCodeCount[\s\S]*plannedPalletCount[\s\S]*totalPackages/)
|
||||
assert.doesNotMatch(operation, /v-for="[^"]*inbound[^"]*"/)
|
||||
assert.match(operation, /v-if="activeInbound"[\s\S]*activeInbound\.inboundCode[\s\S]*activeInbound\.pendingPackages/)
|
||||
@@ -70,10 +96,19 @@ test('container UI locks and signs once across independent plans, then renders o
|
||||
})
|
||||
|
||||
test('PDA does not infer container eligibility from partial plan workflow states', async () => {
|
||||
const operation = await read('../src/pages/operation/operation.vue')
|
||||
const [operation, adapter, inbound] = await Promise.all([
|
||||
read('../src/pages/operation/operation.vue'), read('../src/api/receiving-adapter.js'), read('../src/api/inbound.js')
|
||||
])
|
||||
for (const internalStatus of ['PENDING_ASSIGNMENT', 'INBOUND_PLANNED', 'PDA_PENDING', 'ASSIGNED', 'PICKING']) {
|
||||
assert.doesNotMatch(operation, new RegExp(internalStatus))
|
||||
}
|
||||
assert.match(operation, /listReceivingCandidates\(\)/)
|
||||
assert.match(operation, /statusLabel\(status\)[\s\S]*WAIT_SIGN[\s\S]*SIGNED[\s\S]*RECEIVING[\s\S]*COMPLETED/)
|
||||
assert.match(adapter, /allPlansReady: value\.allPlansReady === true/)
|
||||
assert.match(adapter, /operable: value\.operable === true/)
|
||||
assert.match(operation, /if \(!candidate\.operable\) \{ receiving\.selected = candidate; this\.detailOpen = true; return \}/)
|
||||
assert.match(operation, /if \(!this\.selected\?\.containerNo \|\| !this\.selected\?\.allPlansReady \|\| !this\.selected\?\.operable/)
|
||||
assert.match(operation, /catch \(error\) \{ await this\.recoverCurrentAfterConflict\(error, true\) \}/)
|
||||
assert.match(operation, /preserveEvidence \? error : null[\s\S]*this\.candidateError = preserveEvidence \? error : null/)
|
||||
assert.doesNotMatch(inbound, /sort\(/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user