feat(supply-chain): 每日任务新增运营总负责人映射步骤
This commit is contained in:
parent
c59647ac9f
commit
2dbc455b86
@ -5,8 +5,9 @@
|
||||
// 3) 同步简尚「替换款管理」换货规则
|
||||
// 4) 以正式库产品全量档案对齐(生产状态 + 创建时间)
|
||||
// 5) 回填产品全量档案「产品类型」(定厂优先,聚水潭 vc_name 兜底)
|
||||
// 6) 以正式库类目档位表同步本地类目配置
|
||||
// 7) 重算指定月份(默认上个月)SABC 并写库
|
||||
// 6) 回填「运营总负责人」(按运营负责人姓名查账号目录映射)
|
||||
// 7) 以正式库类目档位表同步本地类目配置
|
||||
// 8) 重算指定月份(默认上个月)SABC 并写库
|
||||
// 用法:
|
||||
// node scripts/local-sync-archive.mjs [--month=2026-08] [--dry-run] [--skip-sabc]
|
||||
import { spawn } from 'node:child_process'
|
||||
@ -137,9 +138,9 @@ async function main() {
|
||||
}
|
||||
|
||||
if (apply) {
|
||||
console.log(`==> 1/7 同步聚水潭产品档案(${env.JST_REPORT_DB_HOST}/${env.JST_REPORT_DB_NAME} → 本地)`)
|
||||
console.log(`==> 1/8 同步聚水潭产品档案(${env.JST_REPORT_DB_HOST}/${env.JST_REPORT_DB_NAME} → 本地)`)
|
||||
} else {
|
||||
console.log('==> 1/7 预览聚水潭产品档案差异(dry-run,不写库)')
|
||||
console.log('==> 1/8 预览聚水潭产品档案差异(dry-run,不写库)')
|
||||
}
|
||||
const syncArgs = ['scripts/sync-jst-sku-product-archive.ts', '--all', '--batch-size=500', '--concurrency=8']
|
||||
if (apply) {
|
||||
@ -155,7 +156,7 @@ async function main() {
|
||||
printSyncSummary(await run(syncArgs, { capture: true }))
|
||||
|
||||
if (apply) {
|
||||
console.log('==> 2/7 同步聚水潭销售日数据(最近 7 天)')
|
||||
console.log('==> 2/8 同步聚水潭销售日数据(最近 7 天)')
|
||||
await run([
|
||||
'scripts/sync-supply-chain-product-archive-sales-performance-daily.ts',
|
||||
'--apply',
|
||||
@ -165,48 +166,62 @@ async function main() {
|
||||
'--lookback-days=7',
|
||||
])
|
||||
} else {
|
||||
console.log('==> 2/7 已跳过销售日数据同步(dry-run)')
|
||||
console.log('==> 2/8 已跳过销售日数据同步(dry-run)')
|
||||
}
|
||||
|
||||
if (apply) {
|
||||
console.log('==> 3/7 同步简尚替换款管理换货规则')
|
||||
console.log('==> 3/8 同步简尚替换款管理换货规则')
|
||||
await run(['scripts/sync-product-replacement-rules.ts', '--apply', '--confirm=sync-product-replacement-rules'])
|
||||
} else {
|
||||
console.log('==> 3/7 预览替换款规则差异(dry-run,不写库)')
|
||||
console.log('==> 3/8 预览替换款规则差异(dry-run,不写库)')
|
||||
await run(['scripts/sync-product-replacement-rules.ts'])
|
||||
}
|
||||
|
||||
if (apply) {
|
||||
console.log('==> 4/7 以正式库产品全量档案对齐(状态 + 创建时间)')
|
||||
console.log('==> 4/8 以正式库产品全量档案对齐(状态 + 创建时间)')
|
||||
await run(['scripts/reconcile-archive-from-prod.ts', '--apply', '--confirm=reconcile-archive-from-prod'])
|
||||
} else {
|
||||
console.log('==> 4/7 预览正式库对齐差异(dry-run,不写库)')
|
||||
console.log('==> 4/8 预览正式库对齐差异(dry-run,不写库)')
|
||||
await run(['scripts/reconcile-archive-from-prod.ts'])
|
||||
}
|
||||
|
||||
if (apply) {
|
||||
console.log('==> 5/7 回填产品类型(定厂优先,聚水潭 vc_name 兜底)')
|
||||
console.log('==> 5/8 回填产品类型(定厂优先,聚水潭 vc_name 兜底)')
|
||||
await run(['scripts/backfill-product-archive-production-type.ts', '--apply', '--batch-size=200'])
|
||||
} else {
|
||||
console.log('==> 5/7 预览产品类型差异(dry-run,不写库)')
|
||||
console.log('==> 5/8 预览产品类型差异(dry-run,不写库)')
|
||||
await run(['scripts/backfill-product-archive-production-type.ts', '--batch-size=200'])
|
||||
}
|
||||
|
||||
if (apply) {
|
||||
console.log('==> 6/7 同步正式库类目档位配置')
|
||||
console.log('==> 6/8 回填运营总负责人(按运营负责人姓名映射账号目录)')
|
||||
await run([
|
||||
'scripts/sync-supply-chain-product-archive-enrichment.ts',
|
||||
'--apply',
|
||||
'--confirm=sync-supply-chain-product-archive-enrichment',
|
||||
'--ops-director-only',
|
||||
`--expected-database-identity=${databaseIdentity(required('DATABASE_URL'))}`,
|
||||
`--expected-source-database-identity=${sourceIdentity()}`,
|
||||
])
|
||||
} else {
|
||||
console.log('==> 6/8 已跳过运营总负责人映射(dry-run)')
|
||||
}
|
||||
|
||||
if (apply) {
|
||||
console.log('==> 7/8 同步正式库类目档位配置')
|
||||
await run(['scripts/sync-product-category-config.ts', '--apply', '--confirm=sync-product-category-config'])
|
||||
} else {
|
||||
console.log('==> 6/7 预览类目档位差异(dry-run,不写库)')
|
||||
console.log('==> 7/8 预览类目档位差异(dry-run,不写库)')
|
||||
await run(['scripts/sync-product-category-config.ts'])
|
||||
}
|
||||
|
||||
if (apply && !skipSabc) {
|
||||
const year = month.split('-')[0]
|
||||
const monthNumber = String(Number(month.split('-')[1]))
|
||||
console.log(`==> 7/7 重算 ${year}-${monthNumber} SABC 并写库(APPLY)`)
|
||||
console.log(`==> 8/8 重算 ${year}-${monthNumber} SABC 并写库(APPLY)`)
|
||||
await run(['scripts/run-product-sabc.ts', `--year=${year}`, `--month=${monthNumber}`, '--mode=APPLY', '--confirm=run-product-sabc'])
|
||||
} else {
|
||||
console.log('==> 7/7 已跳过 SABC 重算')
|
||||
console.log('==> 8/8 已跳过 SABC 重算')
|
||||
}
|
||||
|
||||
console.log('==> 完成。SABC 页面:http://localhost:3000/supply-chain/management/blank-pages/blank-page-3')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user