mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 14:08:11 +00:00
- Introduced new boolean fields (isHazardous, isReefer, isReturn) in UnitDraft and related interfaces to allow individual container handling options. - Updated emptyUnit function to initialize these new fields. - Modified GlCreateBookingForm to handle and display these options for each container. - Adjusted calculations for hazardous, reefer, and return quantities based on the new handling options. - Updated the schema for container units and booking container lines to include handling options. - Added migration to support the new return flag in the database. - Enhanced various components to reflect gross weight calculations, ensuring consistency across the application.
55 lines
2.0 KiB
TypeScript
55 lines
2.0 KiB
TypeScript
import { BaseEntity } from '@edr/api-common';
|
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
import { BookingContainer } from './booking-container.entity';
|
|
|
|
/**
|
|
* One physical container under a booking_container line — its number, seal, and
|
|
* per-unit VGM. Entered at booking time (by the customer in Path A or by GL ET
|
|
* in Path B). See §5.10.
|
|
*/
|
|
@Entity({ schema: 'freight', name: 'booking_container_units' })
|
|
@Index(['bookingContainerId'])
|
|
export class BookingContainerUnit extends BaseEntity {
|
|
@Column({ name: 'booking_container_id', type: 'uuid' })
|
|
bookingContainerId!: string;
|
|
|
|
@ManyToOne(() => BookingContainer, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'booking_container_id' })
|
|
bookingContainer?: BookingContainer;
|
|
|
|
@Column({ name: 'container_number', type: 'varchar', length: 64 })
|
|
containerNumber!: string;
|
|
|
|
@Column({ name: 'seal_number', type: 'varchar', length: 64, nullable: true })
|
|
sealNumber?: string | null;
|
|
|
|
@Column({ name: 'vgm_tons', type: 'numeric', precision: 10, scale: 3 })
|
|
vgmTons!: number;
|
|
|
|
@Column({ name: 'is_hazardous', type: 'boolean', default: false })
|
|
isHazardous!: boolean;
|
|
|
|
@Column({ name: 'is_reefer', type: 'boolean', default: false })
|
|
isReefer!: boolean;
|
|
|
|
/** This container ships back empty after unloading (equipment return). */
|
|
@Column({ name: 'is_return', type: 'boolean', default: false })
|
|
isReturn!: boolean;
|
|
|
|
@Column({ name: 'sort_order', type: 'smallint', default: 0 })
|
|
sortOrder!: number;
|
|
|
|
/** Whether this container has been received into the port (auto-set when its
|
|
* self-haul truck arrives). */
|
|
@Column({ name: 'received_to_port', type: 'boolean', default: false })
|
|
receivedToPort!: boolean;
|
|
|
|
@Column({ name: 'received_at', type: 'timestamptz', nullable: true })
|
|
receivedAt?: Date | null;
|
|
|
|
/** The GRN this container was received under (assigned when staff confirm the
|
|
* Goods Received Note for a batch of received containers). */
|
|
@Column({ name: 'grn_number', type: 'varchar', length: 100, nullable: true })
|
|
grnNumber?: string | null;
|
|
}
|