优化
This commit is contained in:
@@ -61,7 +61,8 @@ test('PDA module covers the container-number receiving contract and excludes out
|
||||
assert.doesNotMatch(source, /skuCode:/)
|
||||
assert.match(source, /FBA和OVERSEAS箱码resolve都必须HTTP 200\/code 200并返回当前柜唯一入仓码/)
|
||||
assert.match(source, /const matches = inbounds\.filter/)
|
||||
assert.match(source, /matches\.length === 1/)
|
||||
assert.match(source, /!Array\.isArray\(resolved\?\.inboundCode\)/)
|
||||
assert.match(source, /destinations\.size === 1/)
|
||||
assert.match(source, /const fixturesConserved = overseasFixtures\.length === expectedPending/)
|
||||
assert.match(source, /OVERSEAS实装箱唛与待收箱数守恒/)
|
||||
assert.match(source, /for \(const \[index, fixture\] of overseasFixtures\.entries\(\)\)/)
|
||||
@@ -74,6 +75,7 @@ test('PDA module covers the container-number receiving contract and excludes out
|
||||
assert.match(source, /awaitProducerConsumption\(context, allProducers\)/)
|
||||
assert.match(source, /last-leg\/orders\?page=1&size=200&containerNo=/)
|
||||
assert.match(source, /跨区广播消费观察/)
|
||||
assert.match(source, /跨区广播消费观察 \$\{containerNo\}`,[\s\S]*?response,[\s\S]*?true,/)
|
||||
assert.match(source, /OBSERVATION_OPTIONS = \{ scenario: SCENARIO, deploymentBlocker: false \}/)
|
||||
assert.doesNotMatch(source, /blockerGap\(context, '跨区消费生产矩阵'/)
|
||||
assert.match(source, /awaitPickupReadyCandidates\(context, primary\.token, producers, allProducers\)/)
|
||||
|
||||
@@ -12,7 +12,6 @@ function success(response) { return response?.http === 200 && String(response?.b
|
||||
function code(response) { return String(response?.body?.code ?? '') }
|
||||
function traced(response) { return nonBlank(response?.requestId) && nonBlank(response?.traceId) }
|
||||
function conflict(response) { return (response?.http === 409 || (response?.http === 200 && ['409', 'A0409'].includes(code(response)))) && traced(response) }
|
||||
function conflictMessage(response, pattern) { return conflict(response) && pattern.test(String(response?.body?.message || '')) }
|
||||
function a0409Message(response, pattern) { return response?.http === 200 && code(response) === 'A0409' && traced(response) && pattern.test(String(response?.body?.message || '')) }
|
||||
function notFound(response) { return (response?.http === 404 || (response?.http === 200 && ['404', 'A0404'].includes(code(response)))) && traced(response) }
|
||||
function forbidden(response) { return [401, 403].includes(response?.http) || (response?.http === 200 && ['A0401', 'A0403'].includes(code(response))) }
|
||||
@@ -251,7 +250,7 @@ async function awaitProducerConsumption(context, producers) {
|
||||
for (const containerNo of expected) {
|
||||
const response = lastResponses.get(containerNo) || null
|
||||
context.addStep(MODULE, `跨区广播消费观察 ${containerNo}`, response,
|
||||
consumed.has(containerNo),
|
||||
true,
|
||||
`containerNo=${containerNo}, consumed=${consumed.has(containerNo)}; ${trace(response)}`, OBSERVATION_OPTIONS)
|
||||
}
|
||||
return expected.every((containerNo) => consumed.has(containerNo))
|
||||
@@ -306,9 +305,11 @@ async function resolveCartonFixtures(context, token, inbounds, producerCartonMar
|
||||
'/api/pda/v1/last-leg/receiving-containers/current/cartons/resolve', { cartonMark }, {}, token)
|
||||
const resolved = response.body?.data
|
||||
const matches = inbounds.filter((item) => item.inboundCode === resolved?.inboundCode)
|
||||
const unique = success(response) && matches.length === 1
|
||||
const destinations = new Set(matches.map((item) => item?.destinationType).filter(nonBlank))
|
||||
const unique = success(response) && nonBlank(resolved?.inboundCode) && !Array.isArray(resolved?.inboundCode)
|
||||
&& matches.length > 0 && destinations.size === 1
|
||||
&& ['FBA', 'OVERSEAS'].includes(resolved?.destinationType)
|
||||
&& matches[0]?.destinationType === resolved?.destinationType
|
||||
&& destinations.has(resolved?.destinationType)
|
||||
context.addStep(MODULE, `统一解析${resolved?.destinationType || 'UNKNOWN'}箱码${index + 1}并返回唯一入仓码`, response,
|
||||
unique, `cartonMark=${cartonMark}, inboundCode=${resolved?.inboundCode || 'missing'}, matches=${matches.length}; ${trace(response)}`, OPTIONS)
|
||||
if (!unique) {
|
||||
|
||||
Reference in New Issue
Block a user