feat(selfop): show customer and SKU volume in inventory turnover
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Quantity, WarehouseOverview } from './types'
|
||||
import type { TurnoverCharts, TurnoverTotal, TurnoverWindowMetric } from './turnoverTypes'
|
||||
import type { TurnoverCharts, TurnoverTotal, TurnoverVolume, TurnoverWindowMetric } from './turnoverTypes'
|
||||
import type { EChartsOption } from 'echarts'
|
||||
import { reasonsText } from './state'
|
||||
const turnoverLabels: Record<string, string> = {
|
||||
@@ -26,6 +26,21 @@ export function turnoverTotalNote(total: TurnoverTotal) {
|
||||
const known = total.knownSubtotal == null ? '暂无已知小计' : `已知小计 ${turnoverNumber(total.knownSubtotal)}`
|
||||
return `${known} · ${total.unknownSkuCount} SKU待核验`
|
||||
}
|
||||
export function volumeNote(volume: TurnoverVolume | undefined, outbound = false) {
|
||||
if (!volume) return '数量或尺寸待确认'
|
||||
const notes: string[] = []
|
||||
if (volume.value == null) notes.push(volume.knownSubtotal == null ? '暂无已知小计' : `已知小计 ${turnoverNumber(volume.knownSubtotal, 6)} m³`)
|
||||
if (volume.missingDimensionSkuCount) notes.push(`缺尺寸 ${volume.missingDimensionSkuCount} SKU / ${turnoverNumber(volume.missingDimensionQuantity)} 件`)
|
||||
if (volume.unknownQuantitySkuCount) notes.push(`数量待确认 ${volume.unknownQuantitySkuCount} SKU`)
|
||||
if (Number(volume.declaredDimensionQuantity) > 0) notes.push(`其中 ${turnoverNumber(volume.declaredDimensionQuantity)} 件按商品尺寸估算`)
|
||||
if (outbound) notes.push('按当前商品尺寸估算')
|
||||
else if (volume.value != null && Number(volume.value) === 0) notes.push('已知体积为0')
|
||||
else if (volume.value != null && !Number(volume.declaredDimensionQuantity)) notes.push('按仓库实测尺寸计算')
|
||||
return notes.join(';') || '数量或尺寸待确认'
|
||||
}
|
||||
export function dimensionSourceText(source: string | null) {
|
||||
return source === 'WAREHOUSE_MEASURED' ? '仓库实测尺寸' : source === 'PRODUCT_DECLARED' ? '商品尺寸估算' : '缺少有效尺寸'
|
||||
}
|
||||
export function inventoryCollectionNotice(warehouse: WarehouseOverview | undefined) {
|
||||
const task = warehouse?.currentTask
|
||||
if (!task || !['DEAD', 'RETRY_WAIT'].includes(task.taskStatus) || task.latestAttempt?.status !== 'FAILED') return ''
|
||||
|
||||
Reference in New Issue
Block a user