fix(supply-chain): 按GBSFY前缀纠正索菲亚品牌

This commit is contained in:
居居 2026-10-19 15:46:05 +08:00 committed by WuYongJie
parent d5b5a60141
commit 8aa17b7a34
2 changed files with 23 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import {
PRODUCT_DEVELOPMENT_ARCHIVE_SOURCE_CODE,
SupplyChainProductArchiveSyncService,
mapProductCatalogWideArchiveSource,
normalizeProductArchiveBrand,
} from '../supply-chain-product-archive-sync.service'
import {
recordProductArchiveFieldChanges,
@ -101,6 +102,20 @@ describe('supply-chain product archive wide-catalog sync', () => {
)
})
it('corrects mislabeled Sofia products from the GBSFY SKU prefix', () => {
const mapped = mapProductCatalogWideArchiveSource({
...createSourceRecord(),
archive_spu: 'GBSFY-XG0293',
archive_sku: 'GBSFY-XG029301',
barcode_business_key: 'GBSFY-XG029301N1441V01',
brand_name: '其他品牌-普通大货',
})
expect(mapped?.archive.brand).toBe('代理品牌-索菲亚')
expect(normalizeProductArchiveBrand('gbsfy-ad036001', '')).toBe('代理品牌-索菲亚')
expect(normalizeProductArchiveBrand('CZ014006', '其他品牌-普通大货')).toBe('其他品牌-普通大货')
})
it('leaves the image empty when the current SKU has no image', () => {
const mapped = mapProductCatalogWideArchiveSource({
...createSourceRecord(),

View File

@ -87,6 +87,13 @@ export function resolveProductArchivePackageType(value: string) {
return PACKAGE_TYPE_BY_SET_COUNT[value.trim()] ?? ''
}
/** 索菲亚货号以 GBSFY 开头;源品牌字段偶有误标,以货号前缀纠正。 */
export function normalizeProductArchiveBrand(sku: string, brand: string) {
return sku.trim().toUpperCase().startsWith('GBSFY')
? '代理品牌-索菲亚'
: brand.trim()
}
export function calculateProductArchiveVolume(
length: string,
width: string,
@ -160,7 +167,7 @@ export function mapProductCatalogWideArchiveSource(
installDocId: text(record.drawing_id),
installMethod: text(record.install_method),
spec: text(record.archive_spec),
brand: text(record.brand_name),
brand: normalizeProductArchiveBrand(text(record.archive_sku), text(record.brand_name)),
orderType: normalizeProductArchiveOrderType(record.purchase_order_method),
inOutWarehouse: text(record.factory_warehouse),
isSeasonal: '',