booking operations and trains scheduling also allocations

This commit is contained in:
marshal
2026-06-10 00:48:32 +03:00
parent 675975bc08
commit 5774d7db9d
180 changed files with 13423 additions and 3877 deletions

View File

@@ -0,0 +1,2 @@
/** Ensures government bookings outrank commercial priority (max ~1,500 today). */
export const GOVERNMENT_PRIORITY_BONUS = 50_000;

View File

@@ -36,6 +36,7 @@ import {
SHIPPING_LINES_REPOSITORY,
} from './interfaces/shipping-lines.repository.interface';
import { DEFAULT_APPROVAL_RULE_ROWS } from './approval-rules.defaults';
import { GOVERNMENT_PRIORITY_BONUS } from './government-priority.constants';
export interface BookingContainerEvalInput {
containerTypeId: string;
@@ -54,6 +55,7 @@ export interface BookingEvaluationInput {
paymentCurrency: string;
tradeDirection: string;
isHazardous: boolean;
isGovernment?: boolean;
allowConsolidation?: boolean;
shippingLineId?: string | null;
containers: BookingContainerEvalInput[];
@@ -180,6 +182,10 @@ export class RuleEngineService {
}
}
if (input.isGovernment) {
priorityScore += GOVERNMENT_PRIORITY_BONUS;
}
let shippingLineMapped = false;
if (input.shippingLineId) {
const line = await this.shippingLinesRepo.findById(input.shippingLineId);