Restore Container History

The Restore Container History action is used to reconstruct missing segments in a container’s history based on event data. This process helps fill gaps where expected historical records are missing, using available event information to generate and link new records. This action is available from the More Actions submenu.

Purpose of Restoration

Restoration fills in history records for containers where a previous or next record is missing, yet related events exist. The system analyzes these events and reconstructs missing history by:

  • Cloning an adjacent valid history record.

  • Updating its values based on the new event.

  • Linking the current and newly created records together.

This ensures a continuous, logical sequence in the container’s timeline.

How It Works

  1. Date Range Input

    • Enter the date range using the Date Start and Date End fields.

  2. Start and Stop

    • Click to begin the restoration process.

    • Click to interrupt the process at any time.

    • If is clicked again after stopping, the restoration restarts from the beginning (from the first date in the range).

Restoration Process

  1. All container events within the selected period are loaded.

  2. Events created from the M&R Module (e.g., during port container expense creation) are excluded.

  3. If any container’s first event lacks a reference to either a previous or next history record, restoration is skipped (no anchor point available).

  4. Each event and its container history record are reviewed sequentially.

System Logic for Linking Adjacent History Records

When restoring container history, the system attempts to automatically establish links between adjacent records — both previous and next — based on event chronology.

Handling Missing Previous Record

If a container history entry does not have a reference to a previous record:

  • The system searches for the most recent earlier event for the same container.

  • The corresponding history record is retrieved.

  • If that record also lacks a reference to a 'next' entry, restoration is skipped.

  • If a valid 'next' reference is found:

    • The earlier history record is cloned.

    • A link to this new 'previous' record is established in the current entry.

Handling Missing Next Record

If a container history entry does not have a reference to a next record:

  • The system searches for the next chronological event for the container.

  • The corresponding history record is retrieved.

  • If that record lacks a reference to a 'previous' entry, restoration is skipped.

  • If a valid 'previous' reference is found:

    • The next history record is cloned and adjusted to match the current event.

    • A link to this new 'next' record is established in the current entry.

Event-Based History Updates

Restored records are modified similarly to how status changes are handled in the Change Container Status action. However, the updates are applied to history records — not the container object.

Each event type updates the history with specific field values. Below is a summary of the changes applied per event:

Field Updates by Event Type

LOADED

  • Status is set to Loaded.

  • State is set to Vessel (green container).

  • Status Changed is updated with the event date.

  • Voyage filed is taken directly from the event.

  • The following fields are populated based on voyage transition details:

    • POL, POD, Baroti, Full (F/E), Connected, Cargo.

  • Location fields Port and Terminal are reset to 0.

  • Fields Ex-Vessel and Last BL are cleared.

DISCHARGED

  • Status is set to Discharged.

  • State is set to Terminal (yellow container).

  • Status Changed is set to the event date.

  • Location fields Port and Terminal are taken from the event.

  • Ex-Vessel is populated using the vessel name from the voyage.

  • The following fields are reset to default/ empty: Voyage, Cargo, Connected, Full (F/E), Voyage BL.

  • Baroti is updated based on voyage transition.

GATE IN/ GATE OUT

  • Status is set to GateIn or GateOut, depending on the event.

  • State is set to Terminal (yellow container).

  • Status Changed reflects the event date.

  • Location fields Port and Terminal are set from the event.

  • For GateOut, Baroti is reset.

STUFFED

  • Status is set to Stuffed.

  • State remains Terminal (yellow container).

  • Status Changed is set to the event date.

  • Full (F/E) checkbox will be enabled.

UNSTUFFED

  • Status is set to Unstuffed.

  • State remains Terminal (yellow container).

  • Status Changed is set to the event date.

  • Port is updated from the event.

  • The following fields are reset: Full (F/E), Connected, Cargo.

REDELIVERED

  • Status is set to Redelivered.

  • State is set to Terminal (yellow container).

  • Status Changed reflects the event date.

  • Port and Terminal are taken from the event.

  • Ownership fields Owner Type and Lease are reset.

TO SUBLEASE

  • Status is set to ToSublease.

  • State is set to Sublease (blue container).

  • Status Changed is set to the event date.

  • Location fields Port and Terminal are updated from the event.

  • Last BL and Baroti are cleared or reset.

FROM SUBLEASE

  • Status is set to FromSublease.

  • State is returned to Terminal (yellow container).

  • Status Changed is set to the event date.

  • Port and Terminal are updated from the event.

  • Lessee is reset.

LEASED

  • Status is set to Leased.

  • State remains Terminal (yellow container).

  • Status Changed is updated with the event date.

  • Port and Terminal are set from the event.

  • Lease field is retrieved from the related Lease Agreement in the event.

SOLD

  • Status is set to Sold.

  • State remains Terminal (yellow container).

  • Status Changed is set to the event date.

  • Owner Type is reset to None.

  • Baroti is also reset.

SHIPPER OWN CONTAINER

  • Status is set to ShipperOwnContainer.

  • State remains Terminal (yellow container).

  • Status Changed is set to the event date.

  • Port and Terminal are populated from the event.

  • Owner Type is set to ShipperOwn.

ROLLED FROM PREVIOUS VOYAGE

  • Status is set to RolledFromPreviousVoyage.

  • State is set to Vessel (green container).

  • Status Changed is set to the event date.

TO REPAIR

  • Status is set to ToRepair.

  • State is set to Terminal (yellow container).

  • Status Changed is updated with the event date.

  • Baroti is reset.

TOTAL LOST

  • Status is set to TotalLost.

  • State is set to TotalLost (red container).

  • Status Changed is updated with the event date.

  • Owner Type is set to Own.

  • The following fields are reset: Lease, Baroti, Cargo, Full (F/E), Connected.

STOP

  • Status is set to Stop.

  • State is set to Terminal (yellow container).

  • Status Changed is set to the event date.