This commit is contained in:
2026-08-12 12:47:06 +08:00
parent e4f65dae5f
commit d9bbd94366
4 changed files with 29 additions and 5 deletions
@@ -54,7 +54,7 @@ function normalizeFixture(context) {
|| !Array.isArray(root.orders) || !Array.isArray(root.feeSources)) return null
const customerId = id(root.customerId)
const orders = new Map(root.orders.map((order) => [id(order.orderId ?? order.id), order]))
const sources = root.feeSources.map((raw) => {
const attemptedSources = root.feeSources.map((raw) => {
const order = orders.get(id(raw.orderId))
return {
raw, feeSourceId: sourceId(raw), customerId: id(raw.customerId ?? customerId),
@@ -65,7 +65,11 @@ function normalizeFixture(context) {
supplierName: raw.supplierName ?? raw.partnerName ?? root.supplierName ?? root.partnerName ?? null,
}
})
return { root, customerId, sources }
return {
root, customerId,
sources: attemptedSources.filter((source) => source.feeSourceId),
uncreatedSources: attemptedSources.filter((source) => !source.feeSourceId),
}
}
async function createStatement(context, sources, action, name, generationMode = 'SELECTED') {
@@ -178,6 +182,15 @@ export async function run(context) {
finish(context, start)
return
}
if (fixture.uncreatedSources.length > 0) {
const evidence = fixture.uncreatedSources.map((source) => {
const raw = source.raw
return `sourceType=${raw.sourceType ?? 'missing'}, billingBasis=${raw.billingBasis ?? 'missing'}, containerBookingId=${id(raw.containerBookingId) || 'missing'}`
}).join('; ')
context.addCoverageGap(MODULE, SCENARIO, '忽略未创建的费用来源尝试',
`Finance 未返回 feeSourceId,不得作为费用来源消费:${evidence}`,
'uncreated-fee-source-attempt', { marker: context.marker, count: fixture.uncreatedSources.length })
}
const invalid = fixture.sources.filter((source) => !source.feeSourceId || !source.customerId
|| !source.businessDate || !source.waybillId || source.marker !== context.marker)
if (invalid.length > 0) {