From 0d016bc5fcd6b7ee09f1969335949c9d7c636714 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Wed, 9 Sep 2026 18:33:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E8=B4=A2=E5=8A=A1=E9=AA=8C?= =?UTF-8?q?=E6=94=B6FBA=E5=86=85=E9=83=A8=E7=BC=96=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../finance-full-fixtures-contract.test.mjs | 3 +++ .../finance-full-fixtures.mjs | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/scripts/admin-test-env-modules/finance-full-fixtures-contract.test.mjs b/scripts/admin-test-env-modules/finance-full-fixtures-contract.test.mjs index ab28ff460..26230cb77 100644 --- a/scripts/admin-test-env-modules/finance-full-fixtures-contract.test.mjs +++ b/scripts/admin-test-env-modules/finance-full-fixtures-contract.test.mjs @@ -18,6 +18,9 @@ test('finance fixture module is independently exported and marker isolated', () test('fixture covers weight, volume, manual order, and container allocation contracts', () => { for (const basis of ['WEIGHT_KG', 'VOLUME_CBM', 'MANUAL_ORDER_FEE', 'CONTAINER_SHARED']) assert.match(source, new RegExp(basis)) assert.match(source, /chargeMode: pricingProfile\.chargeUnit/) + assert.match(source, /warehouse-admin\?tenantId=0&page=/) + assert.match(source, /item\?\.internalCode && item\?\.warehouseCode/) + assert.match(source, /fbaInternalCodes\.has\(String\(rate\.destinationCode\)/) assert.match(source, /customer-rules\/versions\?tenantId=/) assert.match(source, /taxMode: 'TAX_EXCLUDED'/) assert.match(source, /inbound\?\.summary\?\.businessType \|\| profile\.businessType/) diff --git a/scripts/admin-test-env-modules/finance-full-fixtures.mjs b/scripts/admin-test-env-modules/finance-full-fixtures.mjs index cea821aa6..da7911eeb 100644 --- a/scripts/admin-test-env-modules/finance-full-fixtures.mjs +++ b/scripts/admin-test-env-modules/finance-full-fixtures.mjs @@ -298,6 +298,23 @@ async function uploadVoucher(context, customerId) { async function loadPricingEvidence(context) { if (context.financeFixtureHooks?.loadPricingEvidence) return context.financeFixtureHooks.loadPricingEvidence(context) + const fbaInternalCodes = new Set() + let warehousePage = 1 + let warehouseTotal = 0 + do { + const warehouseResponse = await context.request('GET', + `/api/platform/v1/warehouse-admin?tenantId=0&page=${warehousePage}&size=200&warehouseType=FBA&status=ACTIVE`) + const warehouseResult = context.apiSuccess(MODULE, `读取具备内部编号的 FBA 仓第 ${warehousePage} 页`, + warehouseResponse, '', OPTIONS) + const warehouses = rows(warehouseResult) + warehouseTotal = Number(warehouseResult?.total || warehouses.length) + warehouses.filter((item) => item?.internalCode && item?.warehouseCode) + .forEach((item) => fbaInternalCodes.add(String(item.warehouseCode).trim().toUpperCase())) + if (warehouses.length === 0) break + warehousePage += 1 + } while ((warehousePage - 1) * 200 < warehouseTotal) + context.assert(MODULE, '自动计费候选使用已配置内部编号的 FBA 仓', null, + fbaInternalCodes.size > 0, `warehouses=${fbaInternalCodes.size}`, OPTIONS) const response = await context.request('GET', '/api/platform/v1/fba-pricing/carrier-rates/price-books?status=ACTIVE') const versions = context.apiSuccess(MODULE, '读取真实生效价格配置', response, '', OPTIONS) const active = rows(versions).filter((item) => item?.status === 'ACTIVE') @@ -308,6 +325,7 @@ async function loadPricingEvidence(context) { const rates = Array.isArray(detail?.rates) ? detail.rates : [] for (const rate of rates) { if (rate?.destinationType !== 'FBA' || !rate?.originWarehouseId || !rate?.channelCode || !rate?.pricingTaxMode || !rate?.destinationCode) continue + if (!fbaInternalCodes.has(String(rate.destinationCode).trim().toUpperCase())) continue if (!['KG', 'CBM'].includes(rate.chargeUnit) || profiles.some((item) => item.chargeUnit === rate.chargeUnit)) continue const matches = rates.filter((item) => id(item.originWarehouseId) === id(rate.originWarehouseId) && item.channelCode === rate.channelCode && item.destinationType === rate.destinationType