Files
shanxia2.0/web-admin/src/utils/pl-pound-qrcode-display.ts
T
2026-08-27 14:23:18 +08:00

21 lines
767 B
TypeScript

import type { Plan, TransportInventoryLink } from '@/api/pl'
export function formatTransportInventoryLinkLabel(
record: TransportInventoryLink,
plan?: Plan | null
): string {
const product = (record.productName || '').trim() || '—'
let stopLabel = '地磅单'
if (record.stopType === 'load') {
stopLabel = '装货'
} else if (record.stopType === 'delivery') {
const deliveries = plan?.deliveries || []
const match = record.stopId
? deliveries.find((item) => item.id && String(item.id) === String(record.stopId))
: undefined
stopLabel = match?.seq ? `送货 #${match.seq}` : '送货'
}
const batch = (record.batchNo || '').trim()
return batch ? `${stopLabel} · ${product} · ${batch}` : `${stopLabel} · ${product}`
}