mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 16:28:12 +00:00
release order document fix
This commit is contained in:
@@ -1265,7 +1265,9 @@ export class TrainSchedulingService {
|
||||
performedBy: 'DOCUMENT_GENERATION',
|
||||
});
|
||||
const html = this.buildImportLoadListHtml(loadList);
|
||||
const buffer = await this.pdfDocuments.htmlToPdfBuffer(html);
|
||||
// Generic render — NOT the release-order fallback (would mislabel this as a
|
||||
// gate-clearance / release order when Chromium is unavailable).
|
||||
const buffer = await this.pdfDocuments.renderDocumentHtml(html, 'Import marshalling / load list');
|
||||
const reference = loadList.trainNumber ?? loadList.trainScheduleId;
|
||||
return {
|
||||
filename: `import-marshalling-${this.safeDocumentName(reference)}.pdf`,
|
||||
@@ -1283,7 +1285,8 @@ export class TrainSchedulingService {
|
||||
}
|
||||
|
||||
const html = this.buildExportLoadListHtml(schedule);
|
||||
const buffer = await this.pdfDocuments.htmlToPdfBuffer(html);
|
||||
// Generic render — NOT the release-order fallback (see importLoadListDocument).
|
||||
const buffer = await this.pdfDocuments.renderDocumentHtml(html, 'Export marshalling / load list');
|
||||
const reference = schedule.trainNumber ?? schedule.id;
|
||||
return {
|
||||
filename: `export-marshalling-${this.safeDocumentName(reference)}.pdf`,
|
||||
|
||||
@@ -20,6 +20,18 @@ export class WarehouseReleaseDocumentService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Render arbitrary document HTML to PDF via the shared renderer WITHOUT the
|
||||
* release-order fallback. Non-release documents (e.g. the import/export
|
||||
* marshalling load list) must use this so a Chromium-less fallback degrades to
|
||||
* a plain-text dump of *their own* content — instead of masquerading as a
|
||||
* "Warehouse Gate Clearance / Release Order", which the release-specific
|
||||
* fallback would otherwise draw regardless of the input HTML.
|
||||
*/
|
||||
renderDocumentHtml(html: string, label = 'Document'): Promise<Buffer> {
|
||||
return this.pdf.htmlToPdfBuffer(html, { label });
|
||||
}
|
||||
|
||||
private htmlToBasicPdfBuffer(html: string): Buffer {
|
||||
const doc = this.extractReleaseDocument(html);
|
||||
const body: string[] = [
|
||||
|
||||
Reference in New Issue
Block a user