Module edifact.d03a.logistics
ballerinax/edifact.d03a.logistics Ballerina library
Overview
UN/EDIFACT D03A Logistics group EDI parser: reads and writes the 28 messages covering forwarding and multimodal transport instructions, bookings and status reports, freight cost and rate information, dangerous goods notifications, cargo handling and movement, vessel call and tank status, passenger lists, and worker registration and insurance history.
UN/EDIFACT is the United Nations standard for electronic data interchange, used to exchange business documents such as orders, invoices and despatch advices between trading partners.
Key Features
- Typed records for all 28 messages in the logistics group, each in its own submodule, so a program only pulls in the records for the messages it handles.
- Envelope-aware parsing and serialization: an interchange is read from
UNBthroughUNZ, including theUNH/UNTmessage header and trailer. - Round-trips in both directions — EDI text to records, and records back to
conformant EDI text with the
UNTsegment count recomputed. - Generated from the UN/EDIFACT D03A directory with the Ballerina EDI tool, so the records follow the published specification.
Quickstart
To use the edifact.d03a.logistics package in your Ballerina application, modify the .bal file as follows:
Step 1: Import the module
Import the package and the submodules for the messages you handle.
import ballerina/io; import ballerinax/edifact.d03a.logistics; import ballerinax/edifact.d03a.logistics.mCALINF;
Step 2: Read an EDI message
Convert an EDIFACT interchange into a Ballerina record.
public function main() returns error? { string ediText = check io:fileReadString("calinf.edi"); mCALINF:EDI_CALINF_CALINF message = check logistics:fromEdiString(ediText, logistics:EDI_CALINF).ensureType(); io:println(message); }
logistics:getEDINames() returns every message name this package
supports. interchangeFromEdiString gives access to the full UNB/UNZ
interchange, and headersFromEdiString reads just the headers.
Step 3: Write an EDI message
Convert a Ballerina record back into an EDIFACT interchange.
string ediText = check logistics:toEdiString(message, logistics:EDI_CALINF);
Use interchangeToEdiString to write the full interchange rather than the
message body alone.
Step 4: Run the Ballerina application
bal run
Supported messages
| Message | Description | Module |
|---|---|---|
CALINF | Vessel call information | edifact.d03a.logistics.mCALINF |
CASINT | Request for legal administration action in civil proceedings | edifact.d03a.logistics.mCASINT |
CASRES | Legal administration response in civil proceedings | edifact.d03a.logistics.mCASRES |
CHACCO | Chart of accounts | edifact.d03a.logistics.mCHACCO |
CLASET | Classification information set | edifact.d03a.logistics.mCLASET |
DGRECA | Dangerous goods recapitulation | edifact.d03a.logistics.mDGRECA |
HANMOV | Cargo/goods handling and movement | edifact.d03a.logistics.mHANMOV |
IFCSUM | Forwarding and consolidation summary | edifact.d03a.logistics.mIFCSUM |
IFTCCA | Forwarding and transport shipment charge calculation | edifact.d03a.logistics.mIFTCCA |
IFTDGN | Dangerous goods notification | edifact.d03a.logistics.mIFTDGN |
IFTFCC | International transport freight costs and other charges | edifact.d03a.logistics.mIFTFCC |
IFTMAN | Arrival notice | edifact.d03a.logistics.mIFTMAN |
IFTMBC | Booking confirmation | edifact.d03a.logistics.mIFTMBC |
IFTMBF | Firm booking | edifact.d03a.logistics.mIFTMBF |
IFTMBP | Provisional booking | edifact.d03a.logistics.mIFTMBP |
IFTMCA | Consignment advice | edifact.d03a.logistics.mIFTMCA |
IFTMCS | Instruction contract status | edifact.d03a.logistics.mIFTMCS |
IFTMIN | Instruction | edifact.d03a.logistics.mIFTMIN |
IFTRIN | Forwarding and transport rate information | edifact.d03a.logistics.mIFTRIN |
IFTSAI | Forwarding and transport schedule and availability information | edifact.d03a.logistics.mIFTSAI |
IFTSTA | International multimodal status report | edifact.d03a.logistics.mIFTSTA |
PAXLST | Passenger list | edifact.d03a.logistics.mPAXLST |
SANCRT | International movement of goods governmental regulatory | edifact.d03a.logistics.mSANCRT |
SSIMOD | Modification of identity details | edifact.d03a.logistics.mSSIMOD |
SSRECH | Worker's insurance history | edifact.d03a.logistics.mSSRECH |
SSREGW | Notification of registration of a worker | edifact.d03a.logistics.mSSREGW |
TANSTA | Tank status report | edifact.d03a.logistics.mTANSTA |
TPFREP | Terminal performance | edifact.d03a.logistics.mTPFREP |