tag = 'QTY' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::QTY) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 3, description: 'QUANTITY DETAILS', required: true ) tag.add(:tag, data) structure << tag #============================================================================== # Quantity Details # #============================================================================== quantity_details = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '11' => { description: 'Split quantity', identifier: 'split_quantity', }, '12' => { description: 'Despatch quantity', identifier: 'despatch_quantity' }, '21' => { description: 'Ordered quantity', identifier: 'ordered_quantity' }, '47' => { description: 'Invoiced quantity', identifier: 'invoiced_quantity' }, '59' => { description: 'Numbers of consumer units in the traded unit', identifier: 'numbers_or_consumer_units_in_the_traded_unit' }, '129' => { description: 'Units per unit price', identifier: 'units_per_unit_price' }, '153' => { description: 'Statistical sales quantity', identifier: 'statistical_sales_quantitiy' }, '160' => { description: 'Minimum production batch', identifier: 'minimum_production_batch' } }, description: 'Quantity type code qualifier', required: true ) quantity_details.add(:quantity_type_code_qualifier, data) data = Eancom::Edifact::Data.new( type: String, length: 1..35, description: 'Quantity', required: true ) quantity_details.add(:quantity, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, description: 'Measurement unit code', required: false ) quantity_details.add(:measurement_unit_code, data) structure << quantity_details #============================================================================== Eancom.register_structure(tag: 'QTY', structure: structure)