feat(supply-chain): 是否考核动销按产品类型判定(OEM 考核,其余不考核)

This commit is contained in:
居居 2026-09-29 13:40:36 +08:00
parent 95f5915c6a
commit 7b3a7acb12
3 changed files with 6 additions and 5 deletions

View File

@ -32,7 +32,7 @@ async function main() {
periodEnd: result.periodEnd,
sourceRows: result.sourceRows,
archiveRows: result.rows.length,
eligibleRows: result.rows.filter((row) => row.row.assessmentStatus === '考核').length,
eligibleRows: result.rows.filter((row) => row.row.eligible).length,
taggedRows: result.rows.filter((row) => row.row.sabcRating).length,
ratings: result.rows.reduce<Record<string, number>>((counts, row) => {
if (row.row.sabcRating) counts[row.row.sabcRating] = (counts[row.row.sabcRating] ?? 0) + 1

View File

@ -380,6 +380,8 @@ function createBlankRow(
const category = target.categoryL2
const categoryClassValue = configuration?.categoryGroup ?? ''
const newPeriodDays = newProductPeriodDays(categoryClassValue)
// 「不考核原因」取产品全量档案的「产品类型」;是否考核动销:OEM=考核,其他非空类型=不考核,无类型留空。
const productionType = String(target.productionType ?? '').trim()
return {
id: target.id,
styleCode: target.spu,
@ -410,9 +412,8 @@ function createBlankRow(
afterSaleAmount: '',
grossMargin: '',
afterSaleRatio: '',
assessmentStatus: '',
// 「不考核原因」取产品全量档案的「产品类型」(OEM/ODM 等)。
noAssessmentReason: target.productionType ?? '',
assessmentStatus: productionType ? (productionType === 'OEM' ? '考核' : '不考核') : '',
noAssessmentReason: productionType,
sameProductCode: replacement.sameProductCode,
eligible: isSabcEligibleProduct(target),
}
@ -464,7 +465,6 @@ function applyValues(
row.averageDailySales = formatDecimal(classification.averageDailySales, 8)
row.feeRatio = classification.feeRatio === null ? '异常' : formatDecimal(classification.feeRatio, 8)
row.grossMargin = formatDecimal(classification.grossMargin, 8)
row.assessmentStatus = '考核'
return row
}

View File

@ -351,6 +351,7 @@ describe('supply-chain-product-sabc rules', () => {
productName: '电脑椅',
productStatus: '销售',
productAttribute: '成品',
productionType: 'OEM',
brand: '品牌',
productTag: '',
sabcRating: '',