pl-pound-qrcode-display.ts 767 B

1234567891011121314151617181920
  1. import type { Plan, TransportInventoryLink } from '@/api/pl'
  2. export function formatTransportInventoryLinkLabel(
  3. record: TransportInventoryLink,
  4. plan?: Plan | null
  5. ): string {
  6. const product = (record.productName || '').trim() || '—'
  7. let stopLabel = '地磅单'
  8. if (record.stopType === 'load') {
  9. stopLabel = '装货'
  10. } else if (record.stopType === 'delivery') {
  11. const deliveries = plan?.deliveries || []
  12. const match = record.stopId
  13. ? deliveries.find((item) => item.id && String(item.id) === String(record.stopId))
  14. : undefined
  15. stopLabel = match?.seq ? `送货 #${match.seq}` : '送货'
  16. }
  17. const batch = (record.batchNo || '').trim()
  18. return batch ? `${stopLabel} · ${product} · ${batch}` : `${stopLabel} · ${product}`
  19. }