tag = 'LOC' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::LOC) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: "Message Header", required: true ) tag.add(:tag, data) structure << tag #============================================================================== # Location Function Qualifier # #============================================================================== location_function_qualifier = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '1' => { description: 'Place of terms of delivery', identifier: 'place_of_terms_of_delivery' }, '5' => { description: 'Place of departure', identifier: 'place_of_departure' }, '7' => { description: 'Place of Delivery', identifier: 'place_of_delivery' }, '14' => { description: 'Location of goods', identifier: 'location_of_goods' }, '18' => { description: 'Warehouse', identifier: 'warehouse' }, '19' => { description: 'Factory/plant', identifier: 'factory_plant' }, '150' => { description: 'Container stack position', identifier: 'container_stack_position' }, '162' => { description: 'Place or location of sale', identifier: 'place_or_location_of_sale' }, }, description: "Location Function Qualifier", required: true ) location_function_qualifier.add(:location_function_qualifier, data) structure << location_function_qualifier #============================================================================== # First Location Identification # #============================================================================== location_identification = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..25, dictionary: nil, description: "Location Name Code", required: true ) location_identification.add(:location_name_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..17, dictionary: nil, description: "Code list identification code", required: false ) location_identification.add(:code_list_identification_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '3' => { description: 'IATA (International Air Transport Association', identifier: 'iata' }, '9' => { description: 'GS1', identifier: 'gs1' }, '92' => { description: 'Assigned by buyer or buyers agent', identifier: 'assigned_by_buyer_or_buyers_agent' }, }, description: "Code list responsible agency code", required: false ) location_identification.add(:code_list_responsible_agency_code, data) data = Eancom::Edifact::Data.new( type: String, length: 1..25, dictionary: nil, description: 'First related location name code', required: false ) location_identification.add(:first_related_name_code, data) structure << location_identification #============================================================================== # Second Location Identification # #============================================================================== second_location_identification = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..25, dictionary: nil, description: 'Second related location name code', required: false ) second_location_identification.add(:second_location_identification, data) structure << second_location_identification #============================================================================== Eancom.register_structure(tag: 'LOC', structure: structure)