diff --git a/furniture-3d-system/src/server/services/bom-costing/bom-costing-structure-blueprint.test.ts b/furniture-3d-system/src/server/services/bom-costing/bom-costing-structure-blueprint.test.ts index 69eef8ee..6cf91860 100644 --- a/furniture-3d-system/src/server/services/bom-costing/bom-costing-structure-blueprint.test.ts +++ b/furniture-3d-system/src/server/services/bom-costing/bom-costing-structure-blueprint.test.ts @@ -227,6 +227,14 @@ describe('BOM v6 结构蓝图与 SKU 展开', () => { relatedSkuIds: [], basis: 'IMAGE', confidence: 0.9, + }, { + factId: 'fact-inner-depth', + kind: 'DIMENSION', + subject: '柜体内部深度', + value: '内深48', + relatedSkuIds: [], + basis: 'SOURCE_TEXT', + confidence: 0.96, }, { factId: 'fact-top', kind: 'PART', @@ -329,8 +337,8 @@ describe('BOM v6 结构蓝图与 SKU 展开', () => { const lastTop = output.result.skus.at(-1)?.bomLines.find( (line) => line.externalLineId === 'enclosure-top', ) - expect(firstTop).toMatchObject({ lengthMm: 1_400, widthMm: 620 }) - expect(lastTop).toMatchObject({ lengthMm: 2_000, widthMm: 620 }) + expect(firstTop).toMatchObject({ lengthMm: 1_400, widthMm: 480 }) + expect(lastTop).toMatchObject({ lengthMm: 2_000, widthMm: 480 }) expect(instantiationRequests).toHaveLength(7) for (const request of instantiationRequests) { expect(request.sku).toHaveLength(1) diff --git a/furniture-3d-system/src/server/services/bom-costing/bom-costing-structure-blueprint.ts b/furniture-3d-system/src/server/services/bom-costing/bom-costing-structure-blueprint.ts index 6583ef9b..2d883edc 100644 --- a/furniture-3d-system/src/server/services/bom-costing/bom-costing-structure-blueprint.ts +++ b/furniture-3d-system/src/server/services/bom-costing/bom-costing-structure-blueprint.ts @@ -694,7 +694,14 @@ function resolveInternalDepthMm(input: { if (!factAppliesToSku(record, input.sku.externalSkuId)) continue const context = `${record.fact.subject} ${record.fact.value}` if (!/内深|内部深|有效深/.test(context)) continue - const value = factMillimeters(record) + const unitlessValue = context.match( + /(?:内深|内部深|有效深)[^0-9]{0,8}([0-9]+(?:\.[0-9]+)?)/, + )?.[1] + const value = factMillimeters(record) ?? ( + unitlessValue + ? toMillimeters(Number(unitlessValue), record.fact.unit) + : undefined + ) if (value && (!input.outerDepthMm || value <= input.outerDepthMm)) return value } return input.outerDepthMm