feat: generate dispatch BOL PDFs

This commit is contained in:
2026-09-11 10:09:06 +08:00
parent 81f4f9163c
commit 220d159cec
16 changed files with 484 additions and 4 deletions
@@ -100,6 +100,24 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
/internal/print/v1/pdfs/dispatch-bol-documents:
post:
summary: Generate vehicle-dispatch BOL documents as fixed A4 PDF pages
operationId: generateDispatchBolPdf
security: [{ internalServiceToken: [] }]
parameters: [{ $ref: '#/components/parameters/RequestId' }]
requestBody:
required: true
content: { application/json: { schema: { $ref: '#/components/schemas/DispatchBolPdfRequest' } } }
responses:
'200':
description: PDF generation succeeded, or a business error was returned as ApiResponse JSON.
headers:
Content-Disposition: { schema: { type: string } }
X-Print-Page-Count: { schema: { type: integer, minimum: 1, maximum: 2000 } }
content:
application/pdf: { schema: { type: string, format: binary } }
application/json: { schema: { $ref: '#/components/schemas/ApiError' } }
components:
securitySchemes:
internalServiceToken:
@@ -186,6 +204,51 @@ components:
description: One document item renders one A4 page in request order.
items:
$ref: '#/components/schemas/FreightA4Document'
DispatchBolPdfRequest:
type: object
required: [templateCode, pageSpec, downloadFileName, documents]
properties:
templateCode: { type: string, enum: [DISPATCH_BILL_OF_LADING_A4_V1] }
pageSpec: { $ref: '#/components/schemas/FreightA4PageSpec' }
downloadFileName: { type: string, maxLength: 120 }
documents:
type: array
minItems: 1
maxItems: 2000
description: One item renders one A4 page; the caller groups and chunks BOL rows in stable order.
items: { $ref: '#/components/schemas/DispatchBolDocument' }
DispatchBolDocument:
type: object
required: [shipFromName, carrierName, fbaWarehouseCode, shipToName, dispatchNo, totalPackages, pageNumber, pageCount, cargoRows]
properties:
shipFromName: { type: string }
shipFromAddress: { type: string }
carrierName: { type: string }
isaNumber: { type: string }
appointmentTime: { type: string }
trailerNumber: { type: string }
sealNumber: { type: string }
fbaWarehouseCode: { type: string }
shipToName: { type: string }
shipToAddress: { type: string }
dispatchNo: { type: string }
fbaShipmentIds: { type: string }
poReferenceNos: { type: string }
totalPackages: { type: integer, minimum: 0 }
pageNumber: { type: integer, minimum: 1 }
pageCount: { type: integer, minimum: 1 }
cargoRows: { type: array, minItems: 1, maxItems: 12, items: { $ref: '#/components/schemas/DispatchBolCargoRow' } }
DispatchBolCargoRow:
type: object
required: [containerNo, palletNo, fbaWarehouseCode, warehouseNo, fbaShipmentId, poReferenceNo, packageCount]
properties:
containerNo: { type: string }
palletNo: { type: string }
fbaWarehouseCode: { type: string }
warehouseNo: { type: string }
fbaShipmentId: { type: string }
poReferenceNo: { type: string }
packageCount: { type: integer, minimum: 0 }
FreightA4PageSpec:
type: object
required: [widthMm, heightMm]