mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
fix issue and add consolidation
This commit is contained in:
@@ -6081,6 +6081,18 @@ export class TrainSchedulingService {
|
||||
const trainSetWagon = savedWagons[i];
|
||||
if (!slot || !trainSetWagon) continue;
|
||||
|
||||
// Last line of defense behind validateWagonCargoExclusivity: a wagon
|
||||
// with bulk on it carries that one load only — never a container and
|
||||
// never a second bulk booking.
|
||||
if (
|
||||
slot.allocations.length > 1 &&
|
||||
slot.allocations.some((a) => a.loadType === AllocationLoadType.Bulk)
|
||||
) {
|
||||
throw new BadRequestException(
|
||||
`Wagon #${slot.sequenceNo} mixes bulk with other cargo — a wagon carrying bulk takes that one load only`,
|
||||
);
|
||||
}
|
||||
|
||||
for (const alloc of slot.allocations) {
|
||||
const savedAllocation = await manager.getRepository(WagonBookingAllocation).save(
|
||||
manager.getRepository(WagonBookingAllocation).create({
|
||||
|
||||
Reference in New Issue
Block a user