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: 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: 3, dictionary: { '7' => { description: 'Place of Delivery', identifier: 'place_of_delivery' }, '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 #============================================================================== # 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: { '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_agancy_code, data) structure << location_identification #============================================================================== Eancom.register_structure(tag: 'LOC', structure: structure)