|
14 | 14 | LABEL_INSTRUCTIONS_STEP_2, |
15 | 15 | LABEL_INSTRUCTIONS_STEP_3, |
16 | 16 | LABEL_INSTRUCTIONS_STEP_4, |
| 17 | + TEMPORARY_DEWAR_TEXT, |
17 | 18 | ) |
18 | 19 |
|
19 | 20 | from ..assets.paths import ( |
@@ -165,6 +166,25 @@ def add_instruction_text(self, text: str): |
165 | 166 | new_y="NEXT", |
166 | 167 | ) |
167 | 168 |
|
| 169 | + def add_barcodes(self, dewars: List[Row]): |
| 170 | + for i, dewar in enumerate(dewars): |
| 171 | + if i % 4 == 0: |
| 172 | + y_pos = 10 |
| 173 | + self.add_page() |
| 174 | + |
| 175 | + self.code39("*" + dewar.code + "*", x=35, y=y_pos, w=2, h=25) |
| 176 | + |
| 177 | + self.set_y(y_pos + 26) |
| 178 | + self.set_font("helvetica", size=26, style="B") |
| 179 | + self.cell(w=0, text=dewar.code, align="C", new_y="NEXT", new_x="LMARGIN") |
| 180 | + |
| 181 | + self.set_font("helvetica", size=16, style="B") |
| 182 | + self.multi_cell(w=0, text=TEMPORARY_DEWAR_TEXT, align="C") |
| 183 | + |
| 184 | + self.image(CUT_HERE, x="L", y=y_pos + 55, w=194) |
| 185 | + |
| 186 | + y_pos += 70 |
| 187 | + |
168 | 188 | def add_dewar(self, dewar: Row): |
169 | 189 | if dewar.barCode is None or dewar.externalId is None: |
170 | 190 | raise HTTPException( |
@@ -313,6 +333,8 @@ def get_shipping_labels(shipment_id: int, token: str): |
313 | 333 | for dewar in data: |
314 | 334 | pdf.add_dewar(dewar) |
315 | 335 |
|
| 336 | + pdf.add_barcodes(data) |
| 337 | + |
316 | 338 | headers = { |
317 | 339 | "Content-Disposition": ( |
318 | 340 | "inline;" |
|
0 commit comments