21 lines
767 B
TypeScript
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}`
|
|
}
|