tag = 'UNH' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::UNH) 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 #============================================================================== # Message reference number # #============================================================================== message_reference_number = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..14, dictionary: nil, description: 'Unique reference number assigned to a message within an interchange by the sender. Same reference number as in DE 0062 of the UNT segment of the message.', required: true ) message_reference_number.add(:message_reference_number, data) structure << message_reference_number #============================================================================== # Message Identifier # #============================================================================== message_identifier = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..6, dictionary: { 'ORDERS' => { description: 'Purchase order message' }, 'SLSRPT' => { description: 'Sales data report message' }, 'DESADV' => { description: 'Despatch advice message' }, 'INVRPT' => { description: 'Inventory report message' }, 'PRICAT' => { description: 'Price catalogue message' }, 'ORDRSP' => { description: 'Orders report message' }, 'INVOIC' => { description: 'Invoice message' }, 'RETANN' => { description: 'Announcement for returns message' } }, description: 'Message Type', required: true ) message_identifier.add(:message_type, data) data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { 'D' => { description: 'UN/EDIFACT Directory' } }, description: 'Message version number', required: true ) message_identifier.add(:message_version_number, data) data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '01B' => { description: 'Release 2001 - B' }, '93A' => { description: 'Release 93A' }, '96A' => { description: 'Release 96A' }, 'UN' => { description: 'UN/CEFACT' } }, description: 'Message release number', required: true ) message_identifier.add(:message_release_number, data) data = Eancom::Edifact::Data.new( type: String, length: 1..2, dictionary: { 'UN' => { description: 'UN/CEFACT' }, 'EN' => { description: 'Default value' } }, description: 'Controlling agency', required: true ) message_identifier.add(:controlling_agency, data) data = Eancom::Edifact::Data.new( type: String, length: 1..6, dictionary: { 'EAN001' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN011' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN003' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN004' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN005' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN006' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN007' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN008' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN009' => { description: 'GS1 version control number (GS1 Permanent Code)' }, 'EAN010' => { description: 'GS1 version control number (GS1 Code)' }, 'GDSN23' => { description: 'GDSN version 2.3 (GS1 Permanent Code)' } }, description: 'Association assigned code', required: false ) message_identifier.add(:association_assigned_code, data) structure << message_identifier #============================================================================== # Code list directory version number # #============================================================================== code_list_directory_version_number = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..6, dictionary: nil, description: 'Code list directory version number', required: false ) code_list_directory_version_number.add(:code_list_directory_version_number, data) structure << code_list_directory_version_number #============================================================================== Eancom.register_structure(tag: 'UNH', structure: structure)