Cargo-Planner Docs

Examples

Based on the initial configuration available here, we have provided some data structures you can find inspiration from when creating your integration.

Container types and pallet types can both refer to an id and / or inline data. When using an id, the container and pallet type specifications will be fetched from our container library. You can fetch the container specifications by id and also override the properties by changing their fields in respective data structure.

Refer to the API documentation to find out about all available properties.

Load into custom container

let calculationData = {
  length_dim: 'M',
  weight_dim: 'KG',
  items: [
    {
      label: 'My cargo 1',
      l: 0.5,
      w: 0.4,
      h: 0.3,
      wt: 25,
      qty: 100,
    },
  ],
  container_types: [
    {
      name: 'My container',
      L: 12,
      W: 2,
      H: 2,
      payload: 20000,
    },
  ],
};

Load into container from library

This will load the cargoes into a container type from the library - and also overriding the payload (max weight). You can find available types in the: API documentation

let calculationData = {
  length_dim: 'M',
  weight_dim: 'KG',
  items: [
    {
      label: 'My cargo 1',
      l: 0.5,
      w: 0.4,
      h: 0.3,
      wt: 25,
      qty: 100,
    },
  ],
  container_types: [
    {
      id: 1, //a 20ft DV - id found from the API
      payload: 20000,
    },
  ],
};

Check how many cargoes that can fit into a trailer

This example will check how many cargoes that can be fitted into a 53ft Semi trailer

let calculationData = {
  length_dim: 'M',
  weight_dim: 'KG',
  items: [
    {
      label: 'My cargo 1',
      l: 0.5,
      w: 0.4,
      h: 0.3,
      wt: 25,
      tiltable: true,
      qty: undefined, // No limit load
    },
  ],
  container_types: [
    {
      id: 1080, //a 53ft Semi trailer - id found from the API
      payload: 1080,
    },
  ],
};

Palletized cargoes

Below example will first load the cargoes with the palletize field set to true into the provided pallet type and then load the pallets and the other cargoes into our custom container type

let calculationData = {
  length_dim: 'M',
  weight_dim: 'KG',
  items: [
    {
      label: 'My cargo 1',
      l: 0.5,
      w: 0.4,
      h: 0.3,
      wt: 25,
      qty: 100,
      palletize: true,
    },
    {
      label: 'My cargo 2',
      l: 2,
      w: 1,
      h: 0.5,
      wt: 250,
      qty: 2,
      palletize: false, //default
    },
  ],
  container_types: [
    {
      name: 'My container',
      L: 12,
      W: 2,
      H: 2,
      payload: 20000,
    },
  ],
  pallet_types: [
    {
      name: 'EU',
      L: 1.2,
      W: 0.8,
      H: 0,
      max_height: 2,
      payload: 1000,
    },
  ],
};