完成单机TEST统一入口与可靠投递回归收尾
This commit is contained in:
@@ -402,7 +402,7 @@ async function runWorkflow(context, stopBeforeOverseasPda, mixedContainer = fals
|
||||
const bookingId = String(loading.cabinet.id)
|
||||
const base = '/api/platform/v1/last-leg'
|
||||
async function call(name, method, path, body, headers) {
|
||||
const response = await context.requestOverseas(method, path, body, headers)
|
||||
const response = await context.request(method, path, body, undefined, headers)
|
||||
const data = context.apiSuccess(MODULE, `${label}${name}`, response, '', OPTIONS)
|
||||
check(`${label}${name}成功`, response, response?.body?.code === '200' && data != null)
|
||||
return data
|
||||
@@ -410,7 +410,7 @@ async function runWorkflow(context, stopBeforeOverseasPda, mixedContainer = fals
|
||||
let summary
|
||||
let summaryResponse
|
||||
for (let attempt = 0; attempt < 60; attempt++) {
|
||||
const response = await context.requestOverseas('GET', `${base}/orders/container-summaries/${bookingId}`)
|
||||
const response = await context.request('GET', `${base}/orders/container-summaries/${bookingId}`)
|
||||
summaryResponse = response
|
||||
summary = response?.body?.code === '200' ? response.body.data : null
|
||||
if (summary?.orders?.length === group.length) break
|
||||
@@ -463,14 +463,14 @@ async function runWorkflow(context, stopBeforeOverseasPda, mixedContainer = fals
|
||||
try {
|
||||
check(`${label}海外PDA账号和安全投影可用`, null, Boolean(picker?.token))
|
||||
async function call(name, method, path, body) {
|
||||
const response = await context.requestOverseas(method, path, body, {}, picker.token)
|
||||
const response = await context.request(method, path, body, picker.token, {})
|
||||
const data = context.apiSuccess(MODULE, `${label}${name}`, response, '', OPTIONS)
|
||||
check(`${label}${name}成功`, response, response?.body?.code === '200' && data != null)
|
||||
return data
|
||||
}
|
||||
let candidate
|
||||
for (let attempt = 0; attempt < 60; attempt++) {
|
||||
const response = await context.requestOverseas('GET', `${base}/candidates`, undefined, {}, picker.token)
|
||||
const response = await context.request('GET', `${base}/candidates`, undefined, picker.token, {})
|
||||
candidate = response?.body?.data?.find?.((item) => item.containerNo === record.loading.containerNo)
|
||||
if (candidate?.operable && candidate?.allPlansReady) break
|
||||
if (attempt < 59) await new Promise((resolve) => setTimeout(resolve, 1000))
|
||||
@@ -486,7 +486,7 @@ async function runWorkflow(context, stopBeforeOverseasPda, mixedContainer = fals
|
||||
check(`${label}签收成功`, null, signed.status === 'SIGNED')
|
||||
if (mixedContainer) {
|
||||
const completed = await receiveMixedContainer({ group, call, check, marker: context.marker,
|
||||
request: (method, path, body) => context.requestOverseas(method, path, body, {}, picker.token) })
|
||||
request: (method, path, body) => context.request(method, path, body, picker.token, {}) })
|
||||
for (const item of group) {
|
||||
const stock = await call(`${item.label}混柜完成后按入仓码查询库存`, 'POST',
|
||||
'/api/pda/v1/last-leg/inventory/resolve', { code: item.source.inboundCode })
|
||||
@@ -507,8 +507,7 @@ async function runWorkflow(context, stopBeforeOverseasPda, mixedContainer = fals
|
||||
const before = await call('未齐收货前回查柜级事实', 'GET', `${base}/current`)
|
||||
check(`${label}剩余托盘待收箱数准确`, null,
|
||||
Number(before.pendingPackages) === group.reduce((sum, item) => sum + item.expectedCartonMarks.length, 0) - accepted)
|
||||
const premature = await context.requestOverseas('POST', `${base}/current/complete`,
|
||||
{ idempotencyKey: `${context.marker}-premature-${index}`, allowDifference: false }, {}, picker.token)
|
||||
const premature = await context.request('POST', `${base}/current/complete`, { idempotencyKey: `${context.marker}-premature-${index}`, allowDifference: false }, picker.token, {})
|
||||
check(`${label}未收齐不得按正常完成提交`, premature, premature.body?.code === 'A0409')
|
||||
const unchanged = await call('未齐完成被拒后回查柜级事实', 'GET', `${base}/current`)
|
||||
check(`${label}未齐完成拒绝后事实不变且可继续收货`, null,
|
||||
@@ -555,7 +554,7 @@ async function runWorkflow(context, stopBeforeOverseasPda, mixedContainer = fals
|
||||
const customerId = String(group[0].task.tenantId)
|
||||
const warehouseId = group[0].overseas.warehouseId
|
||||
async function call(name, method, path, body, pda = false) {
|
||||
const response = await context.requestOverseas(method, path, body, {}, pda ? token : context.overseasToken)
|
||||
const response = await context.request(method, path, body, pda ? token : context.token, {})
|
||||
const value = context.apiSuccess(MODULE, `${label}${name}`, response, '', OPTIONS)
|
||||
check(`${label}${name}成功`, response, response?.body?.code === '200' && value != null)
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user