优化
This commit is contained in:
@@ -5,13 +5,19 @@ const CONTAINERS = '/api/platform/v1/containers'
|
||||
function id(value) { return value == null ? '' : String(value) }
|
||||
|
||||
export async function run(context) {
|
||||
const fixture = context.createdResources?.phase3ContainerLoading
|
||||
const loadingRequested = context.options?.modules?.includes('phase3-loading') === true
|
||||
const fixture = loadingRequested
|
||||
? context.createdResources?.phase3Loading
|
||||
: context.createdResources?.phase3Loading || context.createdResources?.phase3ContainerLoading
|
||||
const containerId = id(fixture?.containerBookingId)
|
||||
const planId = id(fixture?.loadingPlanId)
|
||||
const warehouseId = id(fixture?.warehouseId)
|
||||
if (!containerId || !planId || !warehouseId || fixture?.marker !== context.marker) {
|
||||
const markerMatches = fixture?.marker === context.marker
|
||||
|| fixture?.marker === `${context.marker}-CAB`
|
||||
|| fixture?.sourceMarker === `${context.marker}-CAB`
|
||||
if (!containerId || !planId || !warehouseId || !markerMatches) {
|
||||
context.addStep(MODULE, '复用智能装柜产生的货柜 overview fixture', null, false,
|
||||
`containerBookingId=${containerId || 'missing'}, loadingPlanId=${planId || 'missing'}, warehouseId=${warehouseId || 'missing'}`, OPTIONS)
|
||||
`source=${loadingRequested ? 'phase3Loading-required' : 'available-container-fixture'}, containerBookingId=${containerId || 'missing'}, loadingPlanId=${planId || 'missing'}, warehouseId=${warehouseId || 'missing'}`, OPTIONS)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -31,12 +37,15 @@ export async function run(context) {
|
||||
`events=${timeline.length}`, OPTIONS)
|
||||
|
||||
if (overview?.pda) {
|
||||
const expectsPhotos = fixture === context.createdResources?.phase3Loading
|
||||
&& Array.isArray(fixture?.evidenceTypes) && fixture.evidenceTypes.length > 0
|
||||
context.assert(MODULE, 'overview PDA 摘要字段完整', overviewResponse,
|
||||
['taskId', 'taskStatus', 'taskVersion', 'itemCount', 'completedItemCount', 'unresolvedItemCount']
|
||||
.every((field) => overview.pda[field] !== undefined)
|
||||
&& Array.isArray(overview.pda.photoCounts)
|
||||
&& Array.isArray(overview.pda.photos)
|
||||
&& Array.isArray(overview.pda.exceptionReasons),
|
||||
&& Array.isArray(overview.pda.exceptionReasons)
|
||||
&& (!expectsPhotos || overview.pda.photos.length > 0),
|
||||
`taskId=${id(overview.pda.taskId)}, photos=${overview.pda.photos.length}`, OPTIONS)
|
||||
for (const [index, photo] of overview.pda.photos.entries()) {
|
||||
context.assert(MODULE, `overview PDA 照片摘要 ${index + 1} 字段完整`, overviewResponse,
|
||||
|
||||
Reference in New Issue
Block a user