tag = 'INV' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::INV) 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 #============================================================================== # Inventory movement direction code # #============================================================================== inventory_movement_direction_code = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '1' => { description: 'Movement out of inventory', identifier: 'movement_out_of_inventory' }, '2' => { description: 'Movement into inventory', identifier: 'movement_into_inventory' } }, description: 'Inventory movement direction code', required: false ) inventory_movement_direction_code.add(:inventory_movement_direction_code, data) structure << inventory_movement_direction_code #============================================================================== # Inventory type code # #============================================================================== inventory_type_code = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: 'Inventory type code', required: false ) inventory_type_code.add(:inventory_type_code, data) structure << inventory_type_code #============================================================================== # Inventory movement reason code # #============================================================================== inventory_movement_reason_code = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: 'Inventory movement reason code', required: false ) inventory_movement_reason_code.add(:inventory_movement_reason_code, data) structure << inventory_movement_reason_code #============================================================================== # Inventory balance method code # #============================================================================== inventory_balance_method_code = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '1' => { description: 'Book-keeping inventory balance', identifier: 'book_keeping_inventory_balance' }, '2' => { description: 'Formal inventory balance', identifier: 'formal_inventory_balance' } }, description: 'Inventory balance method code', required: false ) inventory_balance_method_code.add(:inventory_balance_method_code, data) structure << inventory_balance_method_code #============================================================================== # INSTRUCTION # #============================================================================== # TODO Eancom.register_structure(tag: 'INV', structure: structure)