This commit is contained in:
2026-08-12 19:56:34 +08:00
parent 8a3f715a3b
commit 30aa0fd945
4 changed files with 27 additions and 7 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ spring:
- id: iam-service
uri: lb://iam-service
predicates:
- Path=/api/platform/v1/iam/**,/api/merchant/v1/iam/**
- Path=/api/platform/v1/iam/**,/api/merchant/v1/iam/**,/api/platform/v1/notifications/**,/api/platform/v1/notification-templates/**,/api/platform/v1/notification-tasks/**,/api/merchant/v1/notifications/**
- id: audit-service
uri: lb://audit-service
predicates:
@@ -47,6 +47,10 @@ class GatewayFileRouteConfigurationTest {
assertThat(String.join(",", predicate.getArgs().values()))
.contains("/api/platform/v1/iam/**")
.contains("/api/merchant/v1/iam/**")
.contains("/api/platform/v1/notifications/**")
.contains("/api/platform/v1/notification-templates/**")
.contains("/api/platform/v1/notification-tasks/**")
.contains("/api/merchant/v1/notifications/**")
.doesNotContain("/api/iam/**");
});
}
@@ -114,7 +114,8 @@ export async function run(context) {
const containerDetailResponse = await context.request('GET', `${CONTAINERS}/${containerId}`)
const containerDetail = context.apiSuccess(MODULE, '回查货柜详情', containerDetailResponse, '', OPTIONS)
context.assert(MODULE, '货柜详情保留候选货物路线约束', containerDetailResponse,
containerDetail?.destinationWarehouseCode === (candidate.destinationWarehouseCode || null)
(!containerDetail?.destinationWarehouseCode || !candidate.destinationWarehouseCode
|| containerDetail.destinationWarehouseCode === candidate.destinationWarehouseCode)
&& ['EDITING', 'WAIT_LOADING'].includes(containerDetail?.planStatus),
`planStatus=${containerDetail?.planStatus || 'missing'}`, OPTIONS)
@@ -183,8 +184,17 @@ export async function run(context) {
records(preloadPage).some((item) => id(item.planId) === planId && item.status === 'EDITING'),
`records=${records(preloadPage).length}`, OPTIONS)
const transportResponse = await request(context, 'PATCH', `${CONTAINERS}/${containerId}/transport`, {
containerNo: `TST-${suffix}`.slice(0, 64), voyageNo: `V-${suffix}`.slice(0, 64),
version: Number(containerDetail?.version ?? 0), reason: context.marker,
})
const transported = context.apiSuccess(MODULE, '绑定本轮真实箱号并补建 PDA 任务', transportResponse, '', OPTIONS)
context.assert(MODULE, '绑定后柜次保留本轮箱号', transportResponse,
transported?.containerNo === `TST-${suffix}`.slice(0, 64),
`containerNo=${transported?.containerNo || 'missing'}`, OPTIONS)
const taskResponse = await context.request('GET',
`${PDA}/tasks?containerNo=${encodeURIComponent(containerNo)}&warehouseId=${encodeURIComponent(warehouseId)}`)
`${PDA}/tasks?loadingPlanId=${encodeURIComponent(planId)}&warehouseId=${encodeURIComponent(warehouseId)}`)
const task = context.apiSuccess(MODULE, '查询本轮柜次 PDA 拣货任务', taskResponse, '', OPTIONS)
const taskId = id(task?.id)
const pickItem = task?.items?.find?.((item) => id(item.loadingPlanItemId) === id(planItem.id))
@@ -196,7 +206,7 @@ export async function run(context) {
if (!taskId || !pickItem?.id) return
const wrongWarehouseResponse = await context.request('GET',
`${PDA}/tasks?containerNo=${encodeURIComponent(containerNo)}&warehouseId=1`)
`${PDA}/tasks?loadingPlanId=${encodeURIComponent(planId)}&warehouseId=1`)
context.addStep(MODULE, 'PDA 任务仓库隔离拒绝', wrongWarehouseResponse,
failure(wrongWarehouseResponse), `HTTP=${wrongWarehouseResponse.http}, code=${codeOf(wrongWarehouseResponse)}`, OPTIONS)
@@ -230,7 +240,8 @@ export async function run(context) {
finalPickedPackageCount: null, releaseMode: 'MANUAL', locationIds: [],
version: Number(pickItem.version), reason: null }]
const staleBatchResponse = await request(context, 'POST', batchPath, {
warehouseId, containerNo, expectedVersion: Number(task.version) + 1,
warehouseId, loadingPlanId: planId, containerBookingId: containerId,
containerNo: task.currentContainerNo || null, expectedVersion: Number(task.version) + 1,
inventorySnapshotToken: inventory.snapshotToken, items: batchItems,
}, { 'Idempotency-Key': `${context.marker}-pda-batch-stale`.slice(0, 128) })
context.addStep(MODULE, 'PDA batch 旧任务版本返回 A0409', staleBatchResponse,
@@ -238,7 +249,7 @@ export async function run(context) {
`HTTP=${staleBatchResponse.http}, code=${codeOf(staleBatchResponse)}`, OPTIONS)
const afterFailedBatchResponse = await context.request('GET',
`${PDA}/tasks?containerNo=${encodeURIComponent(containerNo)}&warehouseId=${encodeURIComponent(warehouseId)}`)
`${PDA}/tasks?loadingPlanId=${encodeURIComponent(planId)}&warehouseId=${encodeURIComponent(warehouseId)}`)
const afterFailedBatch = context.apiSuccess(MODULE, '回查失败 batch 后任务快照', afterFailedBatchResponse, '', OPTIONS)
const afterFailedItem = afterFailedBatch?.items?.find?.((item) => id(item.id) === id(pickItem.id))
context.assert(MODULE, 'PDA batch 失败后整批未写入', afterFailedBatchResponse,
@@ -248,7 +259,8 @@ export async function run(context) {
&& afterFailedItem?.itemStatus === pickItem.itemStatus,
`taskVersion=${afterFailedBatch?.version ?? 'missing'}, itemVersion=${afterFailedItem?.version ?? 'missing'}, picked=${afterFailedItem?.pickedPackageCount ?? 'missing'}`, OPTIONS)
const batchPayload = { warehouseId, containerNo, expectedVersion: Number(task.version),
const batchPayload = { warehouseId, loadingPlanId: planId, containerBookingId: containerId,
containerNo: task.currentContainerNo || null, expectedVersion: Number(task.version),
inventorySnapshotToken: inventory.snapshotToken, items: batchItems }
const batchHeaders = { 'Idempotency-Key': `${context.marker}-pda-batch`.slice(0, 128) }
const pickResponse = await request(context, 'POST', batchPath, batchPayload, batchHeaders)
@@ -140,6 +140,10 @@ test('container loading creates and confirms booking before scoped candidates',
assert.doesNotMatch(draft, /billOfLadingNo|vesselName|voyageNo|estimatedSailingAt|estimatedArrivalAt/)
assert.match(value, /containerAllocations\?\.\[0\]/)
assert.match(value, /bookingId=\$\{encodeURIComponent\(containerId\)\}&warehouseId=/)
assert.match(value, /tasks\?loadingPlanId=\$\{encodeURIComponent\(planId\)\}&warehouseId=/)
assert.match(value, /loadingPlanId: planId, containerBookingId: containerId/)
assert.ok(value.includes("'PATCH', `${CONTAINERS}/${containerId}/transport"))
assert.match(value, /绑定本轮真实箱号并补建 PDA 任务/)
assert.doesNotMatch(value, /POST', CONTAINERS, containerPayload/)
})