tag = 'BGM' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::BGM) 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 #============================================================================== # Document/Message Name # #============================================================================== document_message_name = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '9' => { description: 'Price/sales catalogue', identifier: 'price_sales_catalogue' }, '11' => { description: 'Federal label approval', identifier: 'federal_label_approval' }, '35' => { description: 'Inventory report', identifier: 'inventory_report' }, '51' => { description: 'Price/sales catalogue response', identifier: 'price_sales_catalogue_response' }, '67' => { description: 'Commercial dispute', identifier: 'commercial_dispute' }, '78' => { description: 'Inventory movement advice', identifier: 'inventory_report' }, '82' => { description: 'Metered service invoice', identifier: 'metered_service_invoice' }, '83' => { description: 'Credit note related financial adjustments', identifier: 'credit_note_related_financial_adjustments' }, '84' => { description: 'Debit note related financial adjustments', identifier: 'debit_note_related_financial_adjustments' }, '130' => { description: 'Invoice Data sheet', identifier: 'invoice_data_sheet' }, '172' => { description: 'Authorisation plan and suggest orders', identifier: 'authorisation_plan_and_suggest_orders' }, '173' => { description: 'Authorization plan and ship orders', identifier: 'authorisation_plan_and_ship_orders' }, '220' => { description: 'Order', identifier: 'order' }, '221' => { description: 'Blanket order', identifier: 'blanket_order' }, '224' => { description: 'Rush order', identifier: 'rush_order' }, '225' => { description: 'Repair order', identifier: 'repair_order' }, '226' => { description: 'Call off order', identifier: 'call_off_order' }, '227' => { description: 'Consignment order', identifier: 'consignment_order' }, '231' => { description: 'Purchase order response', identifier: 'purchase_order_response' }, '237' => { description: 'Cross docking services order', identifier: 'cross_docking_services_order' }, '258' => { description: 'Standing order', identifier: 'standing_order' }, '261' => { description: 'Self billed credit_note', identifier: 'self_billed_credit_note' }, '262' => { description: 'Consolidated credit note - goods and services', identifier: 'consolidated_credit_note_goods_and_services' }, '263' => { description: 'Inventory adjustement status report', identifier: 'inventory_adjustement_status_report' }, '308' => { description: 'Delcredere credit note', identifier: 'delcredere_credit_note' }, '325' => { description: 'Proforma Invoice', identifier: 'proforma_invoice' }, '345' => { description: 'Ready for despatch advice', identifier: 'ready_for_despatch_advice' }, '351' => { description: 'Despatch advice', identifier: 'despatch_advice' }, '380' => { description: 'Commercial Invoice', identifier: 'commercial_invoice' }, '381' => { description: 'Credit note - goods and services', identifier: 'credit_note_goods_and_services' }, '382' => { description: 'Commission note', identifier: 'commission_note' }, '383' => { description: 'Debit note - goods and services', identifier: 'debit_note_goods_and_services' }, '384' => { description: 'Corrected Invoice', identifier: 'corrected_invoice' }, '385' => { description: 'Consolidated invoice', identifier: 'consolidated_invoice' }, '386' => { description: 'Prepayment invoice', identifier: 'prepayment_invoice' }, '388' => { description: 'Tax invoice', identifier: 'tax_invoice' }, '389' => { description: 'Self-billed invoice', identifier: 'self_billed_invoice' }, '390' => { description: 'Delcredere invoice', identifier: 'delcredere_invoice' }, '393' => { description: 'Factored invoice', identifier: 'factored_invoice' }, '400' => { description: 'Exceptional order', identifier: 'exceptional_order' }, '401' => { description: 'Transshipment order', identifier: 'transshipment_order' }, '402' => { description: 'Cross docking order', identifier: 'cross_docking_order' }, '527' => { description: 'Self billed debit note', identifier: 'self_billed_debit_note' }, '24E' => { description: 'Price/sales catalogue not containing pricing information (GS1 Temporary Code)', identifier: 'price_sales_catalogue_not_containing_pricing_information' }, '25E' => { description: 'Price/sales catalogue containing pricing information (GS1 Temporary Code)', identifier: 'price_sales_catalogue_containing_pricing_information' }, '35E' => { description: 'Return advice (GS1 Temporary Code)', identifier: 'return_advice' }, 'YA5' => { description: 'Itermediate handling cross docking despatch advice (GS1 Temporary Code).', identifier: 'intermediate_handling_cross_docking_despatch_advice' }, 'YA6' => { description: 'Pre-pack cross docking [transshipment] despatch advice (GS1 Temporary Code).', identifier: 'pre_pakc_cross_docking_despatch_advice' }, 'YA7' => { description: 'Consignment despatch advice (GS1 Temporary Code).', identifier: 'consignment_despatch_advice' }, 'YB3' => { description: 'Ready for transshipment despatch advice (GS1 Temporary Code).', identifier: 'ready_for_transshipment_despatch_advice' }, '22E' => { description: 'Manufacturer raised order (GS1 Temporary Code)', identifier: 'manufacturer_raised_order' }, '23E' => { description: 'Manufacturer raised consignment order', identifier: 'manufacturer_raised_consignment_order' }, '73E' => { description: 'Sales Report', identifier: 'sales_report' }, '70E' => { description: 'Announcement for returns (GS1 Temporary Code)', identifier: 'announcement_for_returns' }, '2E' => { description: 'Data distribution profile (GS1 Temporary Code)', identifier: 'data_distribution_profile' } }, description: "Document name code.", required: true ) document_message_name.add(:document_name_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..17, dictionary: nil, description: "Code list identification code", required: false ) document_message_name.add(:code_list_identification_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '9' => { description: 'GS1', identifier: 'gs1' } }, description: "Code list responsible agency code.", required: false ) document_message_name.add(:code_list_responsible_agency_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..35, dictionary: nil, description: "Document name", required: false ) document_message_name.add(:document_name, data) structure << document_message_name #============================================================================== # Document/Message Identification # #============================================================================== document_message_identification = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..35, dictionary: nil, description: "Despatch Advice number assigned by the document sender.\nFor global unique identification of documents Global Document Identifier (GDTI) is available.", required: true ) document_message_identification.add(:document_identifier, data) structure << document_message_identification #============================================================================== # Message function code # #============================================================================== message_function_code = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '1' => { description: 'Cancellation', identifier: 'cancellation' }, '2' => { description: 'Addition', identifier: 'addition' }, '3' => { description: 'Deletion', identifier: 'deletion' }, '4' => { description: 'Change', identifier: 'change' }, '5' => { description: 'Replace', identifier: 'replace' }, '6' => { description: 'Confirmation', identifier: 'confirmation' }, '7' => { description: 'Duplicate', identifier: 'duplicate' }, '9' => { description: 'Original', identifier: 'original' }, '11' => { description: 'Response', identifier: 'response' }, '12' => { description: 'Not processed', identifier: 'not_processed' }, '16' => { description: 'Proposal', identifier: 'proposal' }, '27' => { description: 'Not accepted', identifier: 'not_accepted' }, '29' => { description: 'Order Response', identifier: 'order_response' }, '31' => { description: 'Copy', identifier: 'copy' }, '42' => { description: 'Confirmation_via_specific_means', identifier: 'confirmation_via_specific_means' }, '43' => { description: 'Additional transmission', identifier: 'additional_transmission' }, '45' => { description: 'Accepted with reserves', identifier: 'accepted_with_reserves' }, '46' => { description: 'Provisional', identifier: 'provisional' }, '47' => { description: 'Definitive', identifier: 'definitive' } }, description: 'Message function code', required: true ) message_function_code.add(:message_function_code, data) structure << message_function_code #============================================================================== Eancom.register_structure(tag: 'BGM', structure: structure)