tag = 'TDT' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::TDT) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 3, dictionary: nil, description: "Message Header", required: true ) tag.add(:tag, data) structure << tag #============================================================================== # Transport stage code qualifier # #============================================================================== transport_stage_code_qualifier = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '10' => { description: 'Pre-carriage transport', identifier: 'pre_carriage_transport' }, '12' => { description: 'At departure', identifier: 'at_departure' }, '13' => { description: 'At destination', identifier: 'at_destination' }, '20' => { description: 'Main-carriage transport', identifier: 'main_carriage_transport' }, '30' => { description: 'On-carriage transport', identifier: 'on_carriage_transport' } }, description: "Transport stage code qualifier", required: true ) transport_stage_code_qualifier.add(:transport_stage_code_qualifier, data) structure << transport_stage_code_qualifier #============================================================================== # Means of transport journey identifier # #============================================================================== means_of_transport_journey_identifier = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..17, dictionary: nil, description: 'Means of transport journey identifier', required: false ) means_of_transport_journey_identifier.add(:means_of_transport_journey_identifier, data) structure << means_of_transport_journey_identifier #============================================================================== # Mode of transport # #============================================================================== mode_of_transport = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '10' => { description: '10', identifier: '10' }, '20' => { description: '20', identifier: '20' }, '30' => { description: '30', identifier: '30' }, '40' => { description: '40', identifier: '40' }, '50' => { description: '50', identifier: '50' }, '60' => { description: '60', identifier: '60' } }, description: 'Transport mode name code', required: true ) mode_of_transport.add(:transport_mode_name_code, data) structure << mode_of_transport #============================================================================== # Transport Means # #============================================================================== transport_means = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..8, dictionary: { '12' => { description: 'Ship tanker', identifier: 'ship_tanker' }, '23' => { description: 'Rail bulk order', identifier: 'rail_bulk_order' }, '25' => { description: '25', identifier: '25' }, '31' => { description: 'Truck', identifier: 'truck' }, '32' => { description: 'Road tanker', identifier: 'road_tanker' } }, description: 'Transport means description code', required: false ) transport_means.add(:transport_means_description_code, data) data = Eancom::Edifact::Data.new( type: String, length: 1..17, dictionary: nil, description: 'Transport means description', required: false ) transport_means.add(:transport_means_description, data) structure << transport_means #============================================================================== # Carrier # #============================================================================== carrier = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..17, dictionary: nil, description: 'Carrier identifier GLN - Format n13', required: false ) carrier.add(:carrier_identifier, data) data = Eancom::Edifact::Data.new( type: String, length: 1..17, dictionary: nil, description: 'Code list identification code', required: false ) carrier.add(:code_list_identification_code_1, data) data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '9' => { description: 'GS1', identifier: 'gs1' } }, description: 'Code list responsible agency', required: false ) carrier.add(:code_list_responsible_agency_1, data) data = Eancom::Edifact::Data.new( type: String, length: 1..35, dictionary: nil, description: 'Carrier name', required: false ) carrier.add(:carrier_name, data) structure << carrier #============================================================================== # Transit direction identicator code #============================================================================== transit_direction_identicator_code = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { 'BS' => { description: 'Buyer to supplier', identifier: 'buyer_to_supplier' }, 'SB' => { description: 'Supplier to buyer', identifier: 'supplier_to_buyer' } }, description: 'Transit direction identicator code', required: false ) transit_direction_identicator_code.add(:transit_direction_identicator_code, data) structure << transit_direction_identicator_code #============================================================================== # Transport Identification # #============================================================================== transport_identification = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..9, dictionary: nil, description: 'Transport means identification name identifier', required: false ) transport_identification.add(:transport_means_identification_name_identifier, data) data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: 'Code list identification code', required: false ) transport_identification.add(:code_list_identification_code_2, data) data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: 'Code list responsible agency code', required: false ) transport_identification.add(:code_list_responsible_agency_2, data) data = Eancom::Edifact::Data.new( type: String, length: 1..35, dictionary: nil, description: 'Transport means identification name', required: false ) transport_identification.add(:transport_means_identification_name, data) data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: 'Transport means nationality code', required: false ) transport_identification.add(:transport_means_nationality_code, data) structure << transport_identification #============================================================================== Eancom.register_structure(tag: 'TDT', structure: structure)