tag = 'IMD' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::IMD) 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 #============================================================================== # Description Format Code # #============================================================================== description_format_code = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { 'A' => { description: 'Free-form long description', identifier: 'free_form_long_description' }, 'B' => { description: 'Code and text', identifier: 'code_and_text' }, 'C' => { description: 'Code (from industry code list)', identifier: 'code' }, 'D' => { description: 'Free-from price look up', identifier: 'free_form_price_look_up' }, 'E' => { description: 'Free-form short description', identifier: 'free_form_short_description' }, 'F' => { description: 'Free-form', identifier: 'free_form' }, 'S' => { description: 'Structured (from industry code list)', identifier: 'structured' }, }, description: "Description format code", required: true ) description_format_code.add(:description_format_code, data) structure << description_format_code #============================================================================== # Item Characteristic # #============================================================================== item_characteristic = Eancom::Edifact::Composite.new() item_characteristic_code = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '2' => { description: 'General product form', identifier: 'general_product_form' }, '4' => { description: 'Finish', identifier: 'finish' }, '35' => { description: 'Colour', identifier: 'colour' }, '44' => { description: 'Further identifying characteristic', identifier: 'further_identifying_characteristic' }, '98' => { description: 'Size', identifier: 'Size' }, 'ANM' => { description: 'Article Name', identifier: 'article_name' }, 'BRN' => { description: 'Brand Name', identifier: 'brand_name' }, 'DSC' => { description: 'Description', identifier: 'description' }, 'FN' => { description: 'Function Name', identifier: 'function_name' }, 'IN' => { description: 'Invoice name', identifier: 'invoice_name' }, 'PR' => { description: 'Product range', identifier: 'product_range' }, 'SB' => { description: 'Subbrand', identifier: 'subbrand' }, 'TPE' => { description: 'Article Type', identifier: 'article_type' }, 'STE' => { description: 'Style', identifier: 'style' }, 'XX1' => { description: 'Collar Type', identifier: 'collar_type' }, 'XX3' => { description: 'Colthing Cut', identifier: 'colthing_cut' }, 'XX4' => { description: 'Non marked traded item components', identifier: 'non_marked_traded_item_components' }, 'XX5' => { description: 'Campaign name', identifier: 'campaign_name' }, 'XX6' => { description: 'Season name', identifier: 'season_name' }, 'XX7' => { description: 'Season code', identifier: 'season_code' }, 'SPR' => { # This is only here because Bliss generates erronous PRICATs, omitting the C272 composite. description: 'Bliss Season Name', identifier: 'bliss_season_name' }, 'SMR' => { # This is only here because Bliss generates erronous PRICATs, omitting the C272 composite. description: 'Bliss Season Name', identifier: 'bliss_season_name' }, 'AUT' => { # This is only here because Bliss generates erronous PRICATs, omitting the C272 composite. description: 'Bliss Season Name', identifier: 'bliss_season_name' }, 'WNT' => { # This is only here because Bliss generates erronous PRICATs, omitting the C272 composite. description: 'Bliss Season Name', identifier: 'bliss_season_name' }, }, description: "Item characteristic code", required: true ) item_characteristic.add(:item_characteristic_code, item_characteristic_code) code_list_identification_code = Eancom::Edifact::Data.new( type: String, length: 0..17, description: "Code list identification code", required: false ) item_characteristic.add(:code_list_identification_code, code_list_identification_code) code_list_responsible_agency_code = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '9' => { description: 'GS1', identifier: 'gs1' } }, description: "Code list responsible agency code", required: false ) item_characteristic.add(:code_list_responsible_agency_code, code_list_responsible_agency_code) structure << item_characteristic #============================================================================== # Item Description # #============================================================================== item_description = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..17, dictionary: { 'ORU' => { description: 'Ordering Unit', identifier: 'ordering_unit' }, 'NO' => { description: 'Not an ordering Unit', identifier: 'not_an_ordering_unit' }, 'BU' => { description: 'Base unit', identifier: 'base_unit' }, 'NBU' => { description: 'Not a Base unit', identifier: 'not_a_base_unit' }, 'CU' => { description: 'Consumer unit (GS1 Permanent Code)', identifier: 'consumer_unit' }, 'NCU' => { description: 'Not a Consumer unit (GS1 Permanent Code)', identifier: 'not_a_consumer_unit' }, 'DU' => { description: 'Despatch unit (GS1 Permanent Code)', identifier: 'despatch_unit' }, 'NDU' => { description: 'Not a Despatch unit (GS1 Permanent Code)', identifier: 'not_a_despatch_unit' }, 'IN' => { description: 'Invoicing unit', identifier: 'invoicing_unit' }, 'NIN' => { description: 'Not a Invoicing unit', identifier: 'not_a_invoicing_unit' }, 'TU' => { description: 'Traded unit (GS1 Permanent Code)', identifier: 'traded_unit' }, 'VQ' => { description: 'Variable quantity product (GS1 Permanent Code)', identifier: 'variable_quantity_product' }, 'NVQ' => { description: 'Not a Variable quantity product (GS1 Permanent Code)', identifier: 'not_a_variable_quantity_product' }, 'DST' => { description: 'Display stand', identifier: 'display_stand' }, 'SU' => { description: 'Smallest unit', identifier: 'smallest_unit' }, 'CA' => { description: 'Case', identifier: 'case' }, 'DSP' => { description: 'Display shipper', identifier: 'display_shipper' }, 'MM' => { description: 'Mixed module', identifier: 'mixed_module' }, 'MP' => { description: 'Multipack', identifier: 'multipack' }, 'PIP' => { description: 'Packer or inner pack', identifier: 'packer_or_inner_pack' }, 'PAL' => { description: 'Pallet', identifier: 'pallet' }, 'PPK' => { description: 'Prepack', identifier: 'prepack' }, 'PAS' => { description: 'Prepack assortment', identifier: 'prepack_assortment' }, 'SPK' => { description: 'Setpack', identifier: 'setpack' }, 'NOT' => { description: 'Not, not an NOS item (GS1 Permanent Code)', identifier: 'not_not_an_nos_item' }, '*' => { description: 'N/A', identifier: 'na' } }, description: 'Item description code', required: false ) item_description.add(:item_description_code, data) code_list_identification_code_1 = Eancom::Edifact::Data.new( type: String, length: 0..17, description: 'Code list identification code', required: false ) item_description.add(:code_list_identification_code_1, code_list_identification_code_1) code_list_responsible_agency_code_1 = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '9' => { description: 'GS1', identifier: 'gs1' }, '91' => { description: "Assigned by supplier or supplier's agent", identifier: 'assigned_by_supplier_or_suppliers_agent' }, '92' => { description: "Assigned by buyer or buyer's agent", identifier: "assigned_by_buyer_or_buyers_agent" } }, description: 'Code list responsible agency code', required: false ) item_description.add(:code_list_responsible_agency_code_1, code_list_responsible_agency_code_1) description = Eancom::Edifact::Data.new( type: String, length: 0..256, description: 'Item description', required: false ) item_description.add(:item_description_1, description) item_description.add(:item_description_2, description) language_name_code = Eancom::Edifact::Data.new( type: String, length: 0..3, description: 'Language name code', required: false ) item_description.add(:language_name_code, language_name_code) structure << item_description #============================================================================== # Surface or Layer Code # #============================================================================== surface_or_layer_code = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: nil, description: "Surface or layer code", required: false ) surface_or_layer_code.add(:surface_or_layer_code, data) structure << surface_or_layer_code #============================================================================== Eancom.register_structure(tag: 'IMD', structure: structure)