feat(train-scheduling): show loaded empties on the marshalling document

Empty containers loaded onto an export departure carry no booking and no
wagon allocation, so their wagons printed as EMPTY — no cargo allocated —
staff checking the paper against the consist found boxes the list denied.
Those wagons now print the container numbers with cargo type EMPTY
CONTAINER, count toward the 40ft/20ft tallies, and get their own summary
tile; only genuinely bare wagons keep the empty wording.
This commit is contained in:
Hagernesh
2026-08-14 11:30:25 +00:00
parent b4f2ec1c75
commit 1adc19baef
2 changed files with 84 additions and 2 deletions

View File

@@ -1132,6 +1132,36 @@ describe('TrainSchedulingService', () => {
expect(html).toContain('2 (1 empty)');
});
it('lists loaded empty containers by number and states they are empty', () => {
const schedule = {
id: 'schedule-1',
trainNumber: '8301',
direction: 'EXPORT',
trainSet: {
wagons: [makeWagon(1, 'W-001', []), makeWagon(2, 'W-002', []), makeWagon(3, 'W-003', [])],
},
scheduleBookings: [],
};
const html = (service as never as {
buildExportLoadListHtml: (s: unknown, o?: unknown) => string;
}).buildExportLoadListHtml(schedule, {
emptyContainers: [
{ containerNumber: 'CMU9876543', containerSize: '40', wagonSequenceNo: 1 },
{ containerNumber: 'TEMU1112223', containerSize: '20', wagonSequenceNo: 2 },
{ containerNumber: 'TEMU4445556', containerSize: '20', wagonSequenceNo: 2 },
],
});
expect(html).toContain('CMU9876543');
expect(html).toContain('TEMU1112223, TEMU4445556');
expect(html.match(/EMPTY CONTAINER/g)).toHaveLength(2);
// Wagon 3 carries nothing at all, so it keeps the bare-wagon wording.
expect(html.match(/EMPTY — no cargo allocated/g)).toHaveLength(1);
expect(html).toContain('3 (1 empty)');
expect(html).toContain('<span>Empty containers</span><strong>3</strong>');
});
it('renders wagons in consist order regardless of the order the relation returns', () => {
const schedule = {
id: 'schedule-1',