Files
admin-web/src/shared/domain/containerSpecifications.ts
T
2026-09-15 10:38:03 +08:00

25 lines
1.4 KiB
TypeScript

export const CONTAINER_SPECIFICATIONS = [
{ type: '40GP', recommendedMinCbm: 56, capacityCbm: 58, maxWeightKg: 19500, description: '美线电商较少使用,通常优先选择 40HQ' },
{ type: '40HQ', recommendedMinCbm: 65, capacityCbm: 68, maxWeightKg: 19500, description: '轻泡货首选,适合家居、玩具、日用品' },
{ type: '45HQ', recommendedMinCbm: 82, capacityCbm: 86, maxWeightKg: 19500, description: '抛货量大时考虑,底盘和海外仓预约资源较少' },
] as const
export const DEFAULT_CONTAINER_TYPE = '40HQ' as const
export type ContainerSpecification = (typeof CONTAINER_SPECIFICATIONS)[number]
export type ContainerType = ContainerSpecification['type']
export function containerSpecification(containerType: string | null | undefined): ContainerSpecification | null {
const normalized = String(containerType || '').trim().toUpperCase()
return CONTAINER_SPECIFICATIONS.find((item) => item.type === normalized) || null
}
export function applyContainerSpecification<T extends { containerType: string; capacityCbm: number | null; maxWeightKg: number | null }>(target: T, containerType: string) {
const specification = containerSpecification(containerType)
if (!specification) return false
target.containerType = specification.type
target.capacityCbm = specification.capacityCbm
target.maxWeightKg = specification.maxWeightKg
return true
}