test(firstleg): assert atomic smart coload recommendation
This commit is contained in:
@@ -21,8 +21,8 @@ test('同柜不可拆组HTTP验收锁定公开接口与防绕过矩阵', async (
|
||||
'组成员不能单独调整箱数',
|
||||
'组成员不能单独删除',
|
||||
'整组原子移除',
|
||||
'目标同柜组整体超容时智能推荐明确拒绝',
|
||||
'整组容量不足时推荐事务零漂移',
|
||||
'目标同柜组整体超容时智能推荐跳过整组',
|
||||
'整组容量不足时智能推荐全不取且不产生部分成员',
|
||||
'推荐候选仅含当前目标同柜组且成员身份精确',
|
||||
'ACTIVE同柜组整组取消成功',
|
||||
'同柜组PDA原子批次记录部分拣货异常',
|
||||
|
||||
@@ -516,7 +516,8 @@ export async function run(context) {
|
||||
const groupedCandidates = candidates.filter((item) => id(item?.coLoadGroupId) === groupId)
|
||||
context.assert(MODULE, '每个组成员候选携带相同整组事实', candidateResponse,
|
||||
groupedCandidates.length === 2 && groupedCandidates.every((item) => Number(item?.memberCount) === 2
|
||||
&& Number(item?.groupTotalBoxes) === first.packages + second.packages && item?.locked !== true),
|
||||
&& Number(item?.groupTotalBoxes) === first.packages + second.packages && item?.locked !== true
|
||||
&& String(item?.blockReason || '').includes('同柜不可拆组整体超过当前柜剩余容量')),
|
||||
`count=${groupedCandidates.length}, groupTotal=${first.packages + second.packages}`, OPTIONS)
|
||||
|
||||
let isolatedCandidates = candidates
|
||||
@@ -565,15 +566,13 @@ export async function run(context) {
|
||||
expectedVersion: Number(plan?.version),
|
||||
operationId: `${context.marker}-coload-capacity-recommend`.slice(0, 128),
|
||||
})
|
||||
const capacityRejected = recommendResponse?.http === 200 && code(recommendResponse) === 'A0422'
|
||||
&& String(recommendResponse?.body?.message || '').includes('同柜不可拆组整体超过货柜')
|
||||
context.assert(MODULE, '目标同柜组整体超容时智能推荐明确拒绝', recommendResponse,
|
||||
capacityRejected,
|
||||
evidence(recommendResponse, `targetGroupId=${groupId}, members=${[first.inboundId, second.inboundId].join('|')}, message=${recommendResponse?.body?.message || 'none'}`), OPTIONS)
|
||||
const afterRecommend = await readPlan(context, planId, '回读整组容量拒绝后计划')
|
||||
context.assert(MODULE, '整组容量不足时推荐事务零漂移', afterRecommend.response,
|
||||
planSignature(beforeRecommend) === planSignature(afterRecommend.data),
|
||||
`before=${planSignature(beforeRecommend)}, after=${planSignature(afterRecommend.data)}`, OPTIONS)
|
||||
const capacityRecommendation = context.apiSuccess(MODULE, '目标同柜组整体超容时智能推荐跳过整组',
|
||||
recommendResponse, evidence(recommendResponse, `targetGroupId=${groupId}`), OPTIONS)
|
||||
const capacityGroupItems = (capacityRecommendation?.items || [])
|
||||
.filter((item) => [first.inboundId, second.inboundId].includes(id(item?.inboundId)))
|
||||
context.assert(MODULE, '整组容量不足时智能推荐全不取且不产生部分成员', recommendResponse,
|
||||
capacityGroupItems.length === 0,
|
||||
`targetGroupId=${groupId}, assignedMembers=${capacityGroupItems.map((item) => id(item?.inboundId)).join('|') || 'none'}, before=${planSignature(beforeRecommend)}, after=${planSignature(capacityRecommendation)}`, OPTIONS)
|
||||
|
||||
const recommendSimulationResponse = await context.request('POST', '/api/platform/v1/containers', {
|
||||
channelCode: first.channelCode, warehouseId: first.warehouseId, containerType: '40HC',
|
||||
|
||||
Reference in New Issue
Block a user