fix(selfop): render inventory turnover cells and data status
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Quantity } from './types'
|
||||
import type { Quantity, WarehouseOverview } from './types'
|
||||
import type { TurnoverCharts, TurnoverTotal, TurnoverWindowMetric } from './turnoverTypes'
|
||||
import type { EChartsOption } from 'echarts'
|
||||
import { reasonsText } from './state'
|
||||
@@ -21,6 +21,22 @@ export function totalText(total: TurnoverTotal) {
|
||||
if (total.value == null && total.knownSubtotal == null && total.unknownSkuCount === 0) return turnoverReasonsText(total.reasonCodes)
|
||||
return total.value != null ? turnoverNumber(total.value) : `已知 ${turnoverNumber(total.knownSubtotal)};${total.unknownSkuCount} SKU待核验`
|
||||
}
|
||||
export function turnoverTotalNote(total: TurnoverTotal) {
|
||||
if (total.value != null) return '已确认'
|
||||
const known = total.knownSubtotal == null ? '暂无已知小计' : `已知小计 ${turnoverNumber(total.knownSubtotal)}`
|
||||
return `${known} · ${total.unknownSkuCount} SKU待核验`
|
||||
}
|
||||
export function inventoryCollectionNotice(warehouse: WarehouseOverview | undefined) {
|
||||
const task = warehouse?.currentTask
|
||||
if (!task || !['DEAD', 'RETRY_WAIT'].includes(task.taskStatus) || task.latestAttempt?.status !== 'FAILED') return ''
|
||||
const reasons: Record<string, string> = {
|
||||
SELFOP_STOCK_DUPLICATE: '库存分页出现重复记录',
|
||||
SELFOP_STOCK_COUNT_MISMATCH: '库存扫描条数与来源总数不符',
|
||||
SELFOP_PAGE_TOTAL_CHANGED: '库存扫描过程中分页总数变化',
|
||||
}
|
||||
const reason = reasons[task.latestAttempt.errorCode ?? ''] ?? '库存采集未成功'
|
||||
return `${task.taskStatus === 'RETRY_WAIT' ? '库存采集失败,等待重试' : '库存采集失败,已停止自动重试'}:${reason}。任务 ${task.taskNo}`
|
||||
}
|
||||
export function windowText(metric: TurnoverWindowMetric | undefined) {
|
||||
if (!metric) return '—'
|
||||
return metric.dataStatus === 'COMPLETE' ? turnoverNumber(metric.outboundQuantity) : `已采集 ${turnoverNumber(metric.observedQuantity)},覆盖不足`
|
||||
|
||||
Reference in New Issue
Block a user