Skip to main content

Send pictures to Maersk AEMS (API)

AEMS (Automated Estimate Management System) is Maersk’s maintenance-order platform. In ConPDS Checker, an EDI destination whose protocol is API sends case pictures into AEMS by:

  1. Finding the right maintenance order for the container (equipment).
  2. Uploading image files to Maersk’s blob service.
  3. Updating the maintenance order JSON so those files appear as attached images (same rules as the legacy DepotMaster integration).

This page is the user-facing workflow. For implementation references (source files, tests), see the companion file in the main repository: docs/workflows/aems-api-picture-send.md.


What you configure (administrator)

Administrators define an EDI destination with:

FieldUsed for AEMS as
ProtocolAPI
SenderMaersk shop code (sent as maintenanceShopCodes)
UsernameOAuth client id
PasswordOAuth client secret
ParamsSee below (PARAMS text, one KEY=value per line)

Params (PARAMS)

KeyMeaning
TEST_MODE=1Use Maersk stage hosts (api-stage.maersk.com). Omit or 0 for production.
MAERSK_MODERepair mode filter sent to AEMS as maintenanceRepairModes (see repair mode codes). Use (all) to not filter by mode (ConPDS omits the parameter).
ORDER_STATUSNumeric maintenance order status type sent as maintenanceOrderStatusTypes when listing orders. Default in software is 200 if omitted. This controls which orders are returned for the container (for example open / pending work — exact meaning is defined by Maersk for your shop).
DRY_RUN=1Preview only: real sign-in and order lookup, but no picture upload and no order update. Useful for validating credentials and filters.
SEND_DELAYMinutes to wait before the worker runs (same as other EDI destinations).
Multiple equipment types

Each request sends one MAERSK_MODE value. If you routinely send box vs reefer with different codes, configure separate destinations (e.g. “AEMS Box”, “AEMS Reefer”) with the appropriate MAERSK_MODE on each.

MAERSK_MODE repair mode codes

These codes are passed through to Maersk as the maintenance repair mode filter (MAERSK_MODE in PARAMS). Use the value that matches how the estimate is registered in AEMS for your operation.

Dry container (“box”) — common codes

MAERSK_MODEEquipment / context
02Box (dry)
03Box (dry)
04Box (dry)
05Box (dry)

Reefer unit — common codes

MAERSK_MODEEquipment / context
26Reefer unit
41Reefer unit
43Reefer unit
45Reefer unit

Set exactly one of these per destination (unless you use (all) to disable the filter).

ORDER_STATUS and several open orders

With the default ORDER_STATUS=200 (or whatever your admin configured), AEMS may return more than one maintenance order for the same container — for example multiple pending estimates that all match the query.

ConPDS does not guess which order to use. The app loads the list and asks you to choose a maintenanceOrderNumber before pictures are uploaded (see Choosing an estimate when several match).


Choosing an estimate when several match

What you do in the Send modal

  1. Open Send for the case (all pictures or a selection).
  2. Choose your AEMS / API destination.
  3. Click Send (or complete any extra fields that destination requires).

The app calls the backend without a pre-selected order id. The backend runs an AEMS preflight job: OAuth token + list maintenance orders for this container, shop, status (ORDER_STATUS), and optional repair mode (MAERSK_MODE).

If exactly one order matches, the client continues automatically with that order.

If more than one order matches, the Send modal shows an extra control:

  • Section label: AEMS estimate (uppercase styling in the UI).
  • A dropdown (SelectPicker) listing each maintenanceOrderNumber.
  • Helper text: “Multiple estimates found for this container. Select which estimate to upload pictures to.”

You pick the right estimate, then press Send again. The second request includes the selected aems_order_id, so uploads go to that maintenance order only.

Wireframe (layout)

+--------------------------------------------------+
| Send To [x] |
| Terminal / Container / Case date … |
| |
| DESTINATION |
| [ AEMS_MY_SHOP v ] |
| |
| AEMS ESTIMATE |
| [ MO-2025-004412 v ] |
| Multiple estimates found for this container. |
| Select which estimate to upload pictures to. |
| |
| [ Send ] [ Cancel ] |
+--------------------------------------------------+

API workflow — how pictures are attached (live send)

After an order is chosen, the worker (Celery) runs the real integration:

Important behavior:

  • Capacity: AEMS stores up to 5 images on the order-level attachedImages, then up to 5 per line on maintenanceOrderLines[].attachedImages. ConPDS only fills empty slots; it does not replace existing photos.
  • Video: .MP4 files are skipped for AEMS in the current handler.
  • Dry run (DRY_RUN=1): the sequence stops after OAuth + listing orders (and preview data for the modal). No GET full order by id for attach planning, no upload, no PUT, no EDI_SENT updates — see the technical doc for details.

Dry run vs live send (summary)

Dry run (DRY_RUN=1 or env EDI_DRY_RUN=1)Live send
OAuthYesYes
List / resolve ordersYesYes
Upload blobsNoYes
Update maintenance orderNoYes
Mark pictures sent in DBNoYes
Send log rowPreview path does not enqueue like a normal job; see technical docNormal queued / scheduled send + log entry


Glossary

TermMeaning
maintenanceOrderNumberThe AEMS estimate / maintenance order id you select in the UI.
PreflightBackground step that lists matching orders when you have not yet chosen an order.
Hot / live sendNormal send: upload + order update.