Class: Pdf::Label::StorageLocation
- Inherits:
-
BaseService
- Object
- BaseService
- Pdf::Label::StorageLocation
- Includes:
- Base
- Defined in:
- app/services/pdf/label/storage_location.rb
Overview
Generates 4 in × 6 in warehouse storage-location labels (one per page).
Layout (portrait):
┌─────────────────────────────────────┐ ← 432 pt
│ WY-CA Zone: A │ header (36 pt)
├──────────────────┬──────────────────┤
│ Aisle │ Section │ row 1 (160 pt)
│ A13 │ S03 │
├──────────────────┼──────────────────┤
│ Level │ Bin │ row 2 (160 pt)
│ L03 │ B02 │
├─────────────────────────────────────┤
│ [QR] A.A13.S03.L03.B02 │ footer (76 pt)
└─────────────────────────────────────┘ ← 0
Run via: mise exec -- bin/rails pdf:storage_labels
Defined Under Namespace
Classes: Result
Constant Summary collapse
- LABEL_W =
4 in × 6 in (standard DYMO / Zebra thermal label)
(4.0 * 72).freeze
- LABEL_H =
432 pt
(6.0 * 72).freeze
- PAD =
inner cell padding (pt)
6- BORDER =
border line width (pt)
0.5- HEADER_H =
top strip height (pt)
36- FOOTER_H =
bottom strip height (pt)
76- ROW_H =
≈ 160 pt per grid row
(LABEL_H - HEADER_H - FOOTER_H) / 2.0
- COL_W =
= 144 pt per column
LABEL_W / 2.0
- MAX_CODE_PT =
Largest single-code font — capped so 3-char codes (A13) fit with padding
72
Constants included from Base
Base::FONT, Base::NIMBUS_SANS_PATH, Base::NIMBUS_SANS_PATH_BOLD, Base::WY_LOGO_PATH
Instance Method Summary collapse
Instance Method Details
#call(storage_locations, _options = {}) ⇒ Object
41 42 43 44 45 46 47 |
# File 'app/services/pdf/label/storage_location.rb', line 41 def call(storage_locations, = {}) Pdf::Loader.load! pdf = PdfCombinator.new storage_locations.each { |sl| pdf << generate_label(sl) } Result.new(pdf: pdf.to_pdf, file_name: 'storage_locations.pdf') end |