tag = 'PAC' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::PAC) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 3, description: "Message Header", required: true ) tag.add(:tag, data) structure << tag #============================================================================== # Document/Message Name # #============================================================================== package_quantity = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( # TODO: int type: String, length: 1..8, description: "Package quantity", required: false ) package_quantity.add(:package_quantity, data) structure << package_quantity #============================================================================== # Packaging Details # #============================================================================== packaging_details = Eancom::Edifact::Composite.new() packaging_level_code = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '1' => { description: 'Inner', identifier: 'inner' }, '3' => { description: 'Outer', identifier: 'outer' } }, description: "Packaging level code", required: false ) packaging_details.add(:packaging_level_code, packaging_level_code) packaging_related_description_code = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '50' => { description: 'Package barcoded EAN-13 or EAN-8', identifier: 'package_barcoded_ean13_or_ean8' }, '51' => { description: 'Package barcoded ITF-14', identifier: 'package_barcoded_itf14' }, '52' => { description: 'Package barcoded UCC or EAN-128', identifier: 'package_barcoded_ucc_or_ean128' }, '78' => { description: 'Package bar-coded and EPC tagged', identifier: 'package_barcoded_and_epc_tagged' }, '79' => { description: 'Package EPC tagged only', identifier: 'package_epc_tagged_only' }, }, description: "Packaging related description code", required: false ) packaging_details.add(:packaging_related_description_code, packaging_related_description_code) packaging_terms_and_conditions = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '1' => { description: 'Packaging cost paid by supplier', identifier: 'packaging_cost_paid_by_supplier' }, '2' => { description: 'Packaging cost paid by recipient', identifier: 'packaging_cost_paid_by_recipient' }, '3' => { description: 'Packaging cost not charged (returnable)', identifier: 'packaging_cost_not_charged' }, '24' => { description: 'Rented', identifier: 'rented' }, '25' => { description: 'Safe return deposit', identifier: 'safe_return_deposit' }, '26' => { description: 'Not reusable', identifier: 'not_reusable' }, '27' => { description: 'Package exchangeable at the point of delivery', identifier: 'package_exchangeable_at_the_point_of_delivery' }, }, description: "Packaging terms and conditions code", required: false ) packaging_details.add(:packaging_terms_and_conditions, packaging_terms_and_conditions) structure << packaging_details #============================================================================== # Package Type # #============================================================================== package_type = Eancom::Edifact::Composite.new() package_type_description_code = Eancom::Edifact::Data.new( type: String, length: 0..17, dictionary: { '09' => { description: 'Returnable pallet (GS1 Temporary Code)', identifier: 'returnable_pallet' }, '201' => { description: 'Pallet ISO 1 - 1/1 EURO Pallet (GS1 Temporary Code)', identifier: 'pallet_iso_1_euro_pallet' }, 'PK' => { # TODO: Find out what this is used for # PK means package. This should explain its use. description: 'PK: Function Unknown', identifier: 'pk_function_unknown' }, 'SL' => { # TODO: Find out what this is used for # SL means slipsheet. This should explain its use. description: 'SL: Function Unknown', identifier: 'sl_function_unknown' }, }, description: "Package type description code", required: false ) package_type.add(:package_type_description_code, package_type_description_code) code_list_identification_code = Eancom::Edifact::Data.new( type: String, length: 0..17, description: "Code list identification code", required: false ) package_type.add(:code_list_identification_code, code_list_identification_code) code_list_responsible_agency_code = Eancom::Edifact::Data.new( type: String, length: 0..17, dictionary: { '9' => { description: 'GS1', identifier: 'gs1' } }, description: "Code list responsible agency code", required: false ) package_type.add(:code_list_responsible_agency_code, code_list_responsible_agency_code) type_of_packages = Eancom::Edifact::Data.new( type: String, length: 0..35, description: "Type of packages", required: false ) package_type.add(:type_of_packages, type_of_packages) structure << package_type #============================================================================== # Package Type Identification # #============================================================================== package_type_identification = Eancom::Edifact::Composite.new() description_format_code = Eancom::Edifact::Data.new( type: String, length: 0..3, description: "Description format code", required: false ) package_type_identification.add(:description_format_code, description_format_code) type_of_packages = Eancom::Edifact::Data.new( type: String, length: 0..35, description: "Type of packages", required: false ) package_type_identification.add(:type_of_packages_1, type_of_packages) item_type_identification_code = Eancom::Edifact::Data.new( type: String, length: 0..3, description: "Item type identification code", required: false ) package_type_identification.add(:item_type_identification_code_1, item_type_identification_code) package_type_identification.add(:type_of_packages_2, type_of_packages) package_type_identification.add(:item_type_identification_code_2, item_type_identification_code) structure << package_type_identification #============================================================================== # Returnable Package Details # #============================================================================== returnable_package_details = Eancom::Edifact::Composite.new() returnable_package_freight_payment_responsibility_code = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '1' => { description: 'Paid by customer', identifier: 'paid_by_customer' }, '2' => { description: 'Free', identifier: 'free' }, '3' => { description: 'Paid by supplier', identifier: 'paid_by_supplier' } }, description: "Returnable package freight", required: false ) returnable_package_details.add(:returnable_package_freight_payment_responsibility_code, returnable_package_freight_payment_responsibility_code) returnable_package_load_contents_code = Eancom::Edifact::Data.new( type: String, length: 0..3, description: "Returnable package load contents code", required: false ) returnable_package_details.add(:returnable_package_load_contents_code, returnable_package_load_contents_code) structure << returnable_package_details #============================================================================== Eancom.register_structure(tag: 'PAC', structure: structure)