eancom 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -3
  3. data/.gitlab-ci.yml +11 -13
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -4
  6. data/Gemfile.lock +23 -103
  7. data/README.md +46 -0
  8. data/definitions/desadv/d01b.rb +139 -93
  9. data/definitions/desadv/d96a.rb +187 -101
  10. data/definitions/invoic/d01b.rb +559 -0
  11. data/definitions/invoic/d96a.rb +389 -0
  12. data/definitions/invrpt/d01b.rb +134 -0
  13. data/definitions/invrpt/d96a.rb +125 -0
  14. data/definitions/orders/d01b.rb +182 -0
  15. data/definitions/orders/d96b.rb +198 -0
  16. data/definitions/ordrsp/d01b.rb +251 -0
  17. data/definitions/ordrsp/d96b.rb +226 -0
  18. data/definitions/pricat/d01b.rb +225 -0
  19. data/definitions/pricat/d96b.rb +207 -0
  20. data/definitions/retann/d01b.rb +172 -0
  21. data/definitions/retann/d96b.rb +221 -0
  22. data/definitions/segments/ajt.rb +47 -0
  23. data/definitions/segments/alc.rb +128 -36
  24. data/definitions/segments/bgm.rb +128 -0
  25. data/definitions/segments/cdi.rb +39 -0
  26. data/definitions/segments/cnt.rb +4 -0
  27. data/definitions/segments/cta.rb +89 -0
  28. data/definitions/segments/cux.rb +9 -2
  29. data/definitions/segments/dgs.rb +34 -0
  30. data/definitions/segments/doc.rb +45 -0
  31. data/definitions/segments/dtm.rb +85 -1
  32. data/definitions/segments/efi.rb +67 -0
  33. data/definitions/segments/eqd.rb +37 -0
  34. data/definitions/segments/ftx.rb +24 -2
  35. data/definitions/segments/gin.rb +113 -0
  36. data/definitions/segments/imd.rb +5 -1
  37. data/definitions/segments/inv.rb +94 -0
  38. data/definitions/segments/lin.rb +23 -3
  39. data/definitions/segments/loc.rb +52 -4
  40. data/definitions/segments/moa.rb +86 -2
  41. data/definitions/segments/nad.rb +69 -9
  42. data/definitions/segments/pac.rb +12 -0
  43. data/definitions/segments/pat.rb +171 -0
  44. data/definitions/segments/pcd.rb +72 -0
  45. data/definitions/segments/pci.rb +110 -0
  46. data/definitions/segments/pgi.rb +6 -2
  47. data/definitions/segments/pia.rb +21 -21
  48. data/definitions/segments/pri.rb +21 -1
  49. data/definitions/segments/qty.rb +219 -5
  50. data/definitions/segments/rff.rb +51 -7
  51. data/definitions/segments/rte.rb +52 -0
  52. data/definitions/segments/tax.rb +17 -10
  53. data/definitions/segments/tdt.rb +24 -0
  54. data/definitions/segments/tod.rb +64 -0
  55. data/definitions/segments/tru.rb +34 -0
  56. data/definitions/segments/una.rb +7 -7
  57. data/definitions/segments/unb.rb +4 -4
  58. data/definitions/segments/unh.rb +70 -5
  59. data/definitions/segments/uns.rb +2 -2
  60. data/definitions/segments/unt.rb +2 -2
  61. data/definitions/slsrpt/d01b.rb +104 -100
  62. data/definitions/slsrpt/d96a.rb +104 -99
  63. data/eancom.gemspec +5 -8
  64. data/lib/eancom/edifact/document.rb +2 -2
  65. data/lib/eancom/edifact/footer.rb +1 -0
  66. data/lib/eancom/edifact/segment.rb +2 -2
  67. data/lib/eancom/edifact/segments/ajt.rb +32 -0
  68. data/lib/eancom/edifact/segments/ali.rb +2 -4
  69. data/lib/eancom/edifact/segments/bgm.rb +4 -3
  70. data/lib/eancom/edifact/segments/cdi.rb +30 -0
  71. data/lib/eancom/edifact/segments/cnt.rb +8 -1
  72. data/lib/eancom/edifact/segments/cps.rb +4 -1
  73. data/lib/eancom/edifact/segments/cta.rb +30 -0
  74. data/lib/eancom/edifact/segments/cux.rb +1 -1
  75. data/lib/eancom/edifact/segments/dgs.rb +31 -0
  76. data/lib/eancom/edifact/segments/doc.rb +30 -0
  77. data/lib/eancom/edifact/segments/dtm.rb +10 -6
  78. data/lib/eancom/edifact/segments/efi.rb +38 -0
  79. data/lib/eancom/edifact/segments/eqd.rb +30 -0
  80. data/lib/eancom/edifact/segments/ftx.rb +2 -2
  81. data/lib/eancom/edifact/segments/gin.rb +45 -0
  82. data/lib/eancom/edifact/segments/imd.rb +1 -1
  83. data/lib/eancom/edifact/segments/inv.rb +43 -0
  84. data/lib/eancom/edifact/segments/lin.rb +7 -3
  85. data/lib/eancom/edifact/segments/loc.rb +8 -5
  86. data/lib/eancom/edifact/segments/mea.rb +1 -0
  87. data/lib/eancom/edifact/segments/moa.rb +3 -3
  88. data/lib/eancom/edifact/segments/nad.rb +11 -6
  89. data/lib/eancom/edifact/segments/pac.rb +3 -1
  90. data/lib/eancom/edifact/segments/pat.rb +37 -0
  91. data/lib/eancom/edifact/segments/pcd.rb +33 -0
  92. data/lib/eancom/edifact/segments/pci.rb +40 -0
  93. data/lib/eancom/edifact/segments/pia.rb +1 -0
  94. data/lib/eancom/edifact/segments/pri.rb +0 -1
  95. data/lib/eancom/edifact/segments/qty.rb +9 -5
  96. data/lib/eancom/edifact/segments/rff.rb +8 -2
  97. data/lib/eancom/edifact/segments/rte.rb +33 -0
  98. data/lib/eancom/edifact/segments/tax.rb +7 -1
  99. data/lib/eancom/edifact/segments/tdt.rb +4 -1
  100. data/lib/eancom/edifact/segments/tod.rb +33 -0
  101. data/lib/eancom/edifact/segments/tru.rb +31 -0
  102. data/lib/eancom/edifact/segments/una.rb +2 -1
  103. data/lib/eancom/edifact/segments/unb.rb +4 -5
  104. data/lib/eancom/edifact/segments/unh.rb +6 -4
  105. data/lib/eancom/edifact/segments/uns.rb +3 -0
  106. data/lib/eancom/edifact/structure.rb +0 -1
  107. data/lib/eancom/edifact.rb +15 -1
  108. data/lib/eancom/factory.rb +1 -1
  109. data/lib/eancom/parser/document.rb +2 -10
  110. data/lib/eancom/version.rb +1 -1
  111. data/lib/eancom.rb +3 -1
  112. data/pricat.json +1 -0
  113. metadata +51 -52
  114. data/.rspec_status +0 -225
  115. data/.rubocop.yml +0 -2
@@ -0,0 +1,172 @@
1
+ Eancom::Definition.create(name: 'D01B', type: :retann) do |document, config|
2
+ document.header do |header|
3
+ header.segment Eancom::Edifact::UNA.new
4
+
5
+ header.segment Eancom::Edifact::UNB.new(
6
+ syntax_identifier: 'UNOC',
7
+ syntax_version_number: '3',
8
+ interchange_sender_identification: config.header.interchange_sender_identification,
9
+ sender_identifiction_code_qualifier: '14',
10
+ interchange_recipient_identification: config.header.interchange_recipient_identification,
11
+ recipient_identifiction_code_qualifier: '14',
12
+ date: config.header.date,
13
+ time: config.header.time,
14
+ interchange_control_reference: config.header.interchange_control_reference,
15
+ application_reference: config.header.application_reference,
16
+ interchange_agreement_identifier: config.header.interchange_agreement_identifier
17
+ )
18
+
19
+ header.segment Eancom::Edifact::UNH.new(
20
+ message_reference_number: config.header.message_reference_number,
21
+ message_type: config.header.message_type,
22
+ message_version_number: config.header.message_version_number,
23
+ message_release_number: config.header.message_release_number,
24
+ controlling_agency: config.header.controlling_agency,
25
+ association_assigned_code: config.header.association_assigned_code
26
+ )
27
+ end
28
+
29
+ document.body do |body|
30
+ messages = config.body.messages
31
+ messages.each do |message|
32
+ body.segment Eancom::Edifact::BGM.new(
33
+ document_name_code: message.document_name_code,
34
+ code_list_identification_code: '',
35
+ code_list_responsible_agency_code: '9',
36
+ document_identifier: message.document_identifier,
37
+ message_function_code: message.message_function_code
38
+ )
39
+
40
+ date_time_messages = message.date_time_messages
41
+ date_time_messages.each_with_index do |dtm, index|
42
+ next unless index == 0
43
+ structure = Eancom.find_structure(tag: 'DTM')
44
+ key = dtm.identifier.intern.to_sym
45
+ body.segment Eancom::Edifact::DTM.new(
46
+ type: structure.dictionary_lookup(:type, dtm.identifier),
47
+ date_time: dtm[key].date_time,
48
+ format: '102'
49
+ )
50
+ end
51
+
52
+ body.segment Eancom::Edifact::DOC.new(
53
+ document_name_code: config.header.document_name_code
54
+ )
55
+
56
+ references = message.references
57
+ references.each_with_index do |rff, index|
58
+ next unless index == 0
59
+ structure = Eancom.find_structure(tag: 'RFF')
60
+ key = rff.identifier.intern.to_sym
61
+ body.segment Eancom::Edifact::RFF.new(
62
+ reference_code_qualifier: structure.dictionary_lookup(:reference_code_qualifier, rff.identifier),
63
+ reference_identifier: rff[key].reference_identifier
64
+ )
65
+ end
66
+
67
+ date_time_messages.each_with_index do |dtm, index|
68
+ next unless index == 1
69
+ structure = Eancom.find_structure(tag: 'DTM')
70
+ key = dtm.identifier.intern.to_sym
71
+ body.segment Eancom::Edifact::DTM.new(
72
+ type: structure.dictionary_lookup(:type, dtm.identifier),
73
+ date_time: dtm[key].date_time,
74
+ format: '102'
75
+ )
76
+ end
77
+ nads = message.nads
78
+ nads.each_with_index do |nad, index|
79
+ next unless index == 0
80
+ structure = Eancom.find_structure(tag: 'NAD')
81
+ key = nad.identifier.intern.to_sym
82
+ body.segment Eancom::Edifact::NAD.new(
83
+ party_function_code_qualifier: structure.dictionary_lookup(:party_function_code_qualifier, nad.identifier),
84
+ party_identifier: nad[key].party_identifier,
85
+ code_list_responsible_agency_code_1: '9'
86
+ )
87
+ end
88
+ structure = Eancom.find_structure(tag: 'LOC')
89
+ code_list_identification_code = if message.code_list_identification_code.nil?
90
+ ''
91
+ else
92
+ message.code_list_identification_code
93
+ end
94
+ body.segment Eancom::Edifact::LOC.new(
95
+ location_function_qualifier: structure.dictionary_lookup(:location_function_qualifier, message.location.location_function_qualifier),
96
+ location_name_code: message.location.location_name_code,
97
+ code_list_identification_code: code_list_identification_code,
98
+ code_list_responsible_agency_code: structure.dictionary_lookup(:code_list_responsible_agency_code,
99
+ message.location.code_list_responsible_agency_code)
100
+ )
101
+ nads = message.nads
102
+ nads.each_with_index do |nad, index|
103
+ next unless index == 1
104
+ structure = Eancom.find_structure(tag: 'NAD')
105
+ key = nad.identifier.intern.to_sym
106
+ body.segment Eancom::Edifact::NAD.new(
107
+ party_function_code_qualifier: structure.dictionary_lookup(:party_function_code_qualifier, nad.identifier),
108
+ party_identifier: nad[key].party_identifier,
109
+ code_list_responsible_agency_code_1: '9'
110
+ )
111
+ end
112
+
113
+ items = message.items
114
+ items.each_with_index do |item, index|
115
+
116
+ structure = Eancom.find_structure(tag: 'LIN')
117
+ body.segment Eancom::Edifact::LIN.new(
118
+ line_item_identifier_1: (index + 1).to_s,
119
+ item_identifier: item.ean,
120
+ item_type_identification_code: structure.dictionary_lookup(:item_type_identification_code, item.item_type_identification_code)
121
+ )
122
+ qty = item.quantities
123
+ qty.each_with_index do |qty, index|
124
+ structure = Eancom.find_structure(tag: 'QTY')
125
+ key = qty.identifier.intern.to_sym
126
+ body.segment Eancom::Edifact::QTY.new(
127
+ quantity_type_code_qualifier: structure.dictionary_lookup(:quantity_type_code_qualifier, qty.identifier),
128
+ quantity: qty[key].quantity
129
+ )
130
+ end
131
+
132
+ structure = Eancom.find_structure(tag: 'CDI')
133
+ body.segment Eancom::Edifact::CDI.new(
134
+ physical_or_logical_state_type_code_qualifier: structure.dictionary_lookup(
135
+ :physical_or_logical_state_type_code_qualifier, item.physical_or_logical_state_type_code_qualifier
136
+ )
137
+ )
138
+ end
139
+ end
140
+ end
141
+
142
+ document.footer do |footer|
143
+ footer.segment Eancom::Edifact::UNS.new(
144
+ section_identification: 'S'
145
+ )
146
+
147
+ messages = config.body.messages
148
+
149
+ messages.each do |message|
150
+ items = message.items
151
+ control_total_value = 0
152
+
153
+ items.each_with_index do |item, index|
154
+
155
+ next unless index == items.size - 1
156
+
157
+ counts = item.counts
158
+ counts.each_with_index do |cnt, index|
159
+ structure = Eancom.find_structure(tag: 'CNT')
160
+ footer.segment Eancom::Edifact::CNT.new(
161
+ control_total_type_code_quantifier: structure.dictionary_lookup(:control_total_type_code_quantifier, cnt.control_total_type_code_quantifier),
162
+ control_total_value: items.size.to_s
163
+ )
164
+ end
165
+ end
166
+ end
167
+ footer.segment Eancom::Edifact::UNT.new(
168
+ number_of_segments_in_message: (document.total_segments + 2).to_s,
169
+ message_reference_number: config.header.message_reference_number
170
+ )
171
+ end
172
+ end
@@ -0,0 +1,221 @@
1
+ Eancom::Definition.create(name: 'D96A', type: :retann) do |document, config|
2
+ document.header do |header|
3
+ header.segment Eancom::Edifact::UNA.new
4
+
5
+ header.segment Eancom::Edifact::UNB.new(
6
+ syntax_identifier: 'UNOC',
7
+ syntax_version_number: '3',
8
+ interchange_sender_identification: config.header.interchange_sender_identification,
9
+ sender_identifiction_code_qualifier: '14',
10
+ interchange_recipient_identification: config.header.interchange_recipient_identification,
11
+ recipient_identifiction_code_qualifier: '14',
12
+ date: config.header.date,
13
+ time: config.header.time,
14
+ interchange_control_reference: config.header.interchange_control_reference,
15
+ application_reference: config.header.application_reference,
16
+ interchange_agreement_identifier: config.header.interchange_agreement_identifier
17
+ )
18
+
19
+ header.segment Eancom::Edifact::UNH.new(
20
+ message_reference_number: config.header.message_reference_number,
21
+ message_type: config.header.message_type,
22
+ message_version_number: config.header.message_version_number,
23
+ message_release_number: config.header.message_release_number,
24
+ controlling_agency: config.header.controlling_agency,
25
+ association_assigned_code: config.header.association_assigned_code
26
+ )
27
+ end
28
+
29
+ document.body do |body|
30
+ messages = config.body.messages
31
+ messages.each do |message|
32
+ body.segment Eancom::Edifact::BGM.new(
33
+ document_name_code: message.document_name_code,
34
+ code_list_identification_code: '',
35
+ code_list_responsible_agency_code: '9',
36
+ document_identifier: message.document_identifier,
37
+ message_function_code: message.message_function_code
38
+ )
39
+
40
+ date_time_messages = message.date_time_messages
41
+ date_time_messages.each_with_index do |dtm, index|
42
+ next unless index == 0
43
+ structure = Eancom.find_structure(tag: 'DTM')
44
+ key = dtm.identifier.intern.to_sym
45
+ body.segment Eancom::Edifact::DTM.new(
46
+ type: structure.dictionary_lookup(:type, dtm.identifier),
47
+ date_time: dtm[key].date_time,
48
+ format: '102'
49
+ )
50
+ end
51
+
52
+ date_time_messages.each_with_index do |dtm, index|
53
+ next unless index == 1
54
+ structure = Eancom.find_structure(tag: 'DTM')
55
+ key = dtm.identifier.intern.to_sym
56
+ body.segment Eancom::Edifact::DTM.new(
57
+ type: structure.dictionary_lookup(:type, dtm.identifier),
58
+ date_time: dtm[key].date_time,
59
+ format: '102'
60
+ )
61
+ end
62
+
63
+ references = message.references
64
+ references.each_with_index do |rff, index|
65
+ next unless index == 0
66
+ structure = Eancom.find_structure(tag: 'RFF')
67
+ key = rff.identifier.intern.to_sym
68
+ body.segment Eancom::Edifact::RFF.new(
69
+ reference_code_qualifier: structure.dictionary_lookup(:reference_code_qualifier, rff.identifier),
70
+ reference_identifier: rff[key].reference_identifier
71
+ )
72
+ end
73
+
74
+ date_time_messages.each_with_index do |dtm, index|
75
+ next unless index == 2
76
+ structure = Eancom.find_structure(tag: 'DTM')
77
+ key = dtm.identifier.intern.to_sym
78
+ body.segment Eancom::Edifact::DTM.new(
79
+ type: structure.dictionary_lookup(:type, dtm.identifier),
80
+ date_time: dtm[key].date_time,
81
+ format: '102'
82
+ )
83
+ end
84
+
85
+ nads = message.nads
86
+ nads.each_with_index do |nad, index|
87
+ next unless index == 0
88
+ structure = Eancom.find_structure(tag: 'NAD')
89
+ key = nad.identifier.intern.to_sym
90
+ body.segment Eancom::Edifact::NAD.new(
91
+ party_function_code_qualifier: structure.dictionary_lookup(:party_function_code_qualifier, nad.identifier),
92
+ party_identifier: nad[key].party_identifier,
93
+ code_list_responsible_agency_code_1: '9'
94
+ )
95
+ end
96
+
97
+ nads.each_with_index do |nad, index|
98
+ next unless index == 1
99
+ structure = Eancom.find_structure(tag: 'NAD')
100
+ key = nad.identifier.intern.to_sym
101
+ body.segment Eancom::Edifact::NAD.new(
102
+ party_function_code_qualifier: structure.dictionary_lookup(:party_function_code_qualifier, nad.identifier),
103
+ party_identifier: nad[key].party_identifier,
104
+ code_list_responsible_agency_code_1: '9'
105
+ )
106
+ end
107
+
108
+ nads.each_with_index do |nad, index|
109
+ next unless index == 2
110
+ structure = Eancom.find_structure(tag: 'NAD')
111
+ key = nad.identifier.intern.to_sym
112
+ body.segment Eancom::Edifact::NAD.new(
113
+ party_function_code_qualifier: structure.dictionary_lookup(:party_function_code_qualifier, nad.identifier),
114
+ party_identifier: nad[key].party_identifier,
115
+ code_list_responsible_agency_code_1: '9'
116
+ )
117
+ end
118
+
119
+ nads.each_with_index do |nad, index|
120
+ next unless index == 3
121
+ structure = Eancom.find_structure(tag: 'NAD')
122
+ key = nad.identifier.intern.to_sym
123
+ body.segment Eancom::Edifact::NAD.new(
124
+ party_function_code_qualifier: structure.dictionary_lookup(:party_function_code_qualifier, nad.identifier),
125
+ party_identifier: nad[key].party_identifier,
126
+ code_list_responsible_agency_code_1: '9'
127
+ )
128
+ end
129
+
130
+ total_quantity = 0
131
+
132
+ items = message.items
133
+
134
+ items.each_with_index do |item, index|
135
+ total_quantity += item.quantity.to_i
136
+
137
+ structure = Eancom.find_structure(tag: 'LIN')
138
+ body.segment Eancom::Edifact::LIN.new(
139
+ line_item_identifier_1: (index + 1).to_s,
140
+ item_identifier: item.ean,
141
+ item_type_identification_code: structure.dictionary_lookup(:item_type_identification_code, item.item_type_identification_code)
142
+ )
143
+
144
+ if additional_product_id = item.additional_product_id
145
+ additional_product_id.each do |id|
146
+ next unless additional_information = id.additional_information
147
+
148
+ structure = Eancom.find_structure(tag: 'PIA')
149
+ body.segment Eancom::Edifact::PIA.new(
150
+ product_identifier_code_qualifier: structure.dictionary_lookup(:product_identifier_code_qualifier, additional_information.product_identifier_code_qualifier),
151
+ item_identifier_1: additional_information.item_identifier_1,
152
+ item_type_identification_code_1: structure.dictionary_lookup(:item_type_identification_code_1, additional_information.item_type_identification_code_1)
153
+ )
154
+ end
155
+ end
156
+
157
+ prices = item.prices
158
+ prices.each do |price|
159
+ next unless price = price.price
160
+
161
+ structure = Eancom.find_structure(tag: 'PRI')
162
+ body.segment Eancom::Edifact::PRI.new(
163
+ price_code_qualifier: structure.dictionary_lookup(:price_code_qualifier, price.price_code_qualifier),
164
+ price_amount: price.price_amount
165
+ )
166
+ end
167
+
168
+ qty = item.quantities
169
+ qty.each_with_index do |qty, index|
170
+ structure = Eancom.find_structure(tag: 'QTY')
171
+ key = qty.identifier.intern.to_sym
172
+ body.segment Eancom::Edifact::QTY.new(
173
+ quantity_type_code_qualifier: structure.dictionary_lookup(:quantity_type_code_qualifier, qty.identifier),
174
+ quantity: qty[key].quantity,
175
+ measurement_unit_code: structure.dictionary_lookup(:measurement_unit_code, qty.measurement_unit_code)
176
+ )
177
+ end
178
+
179
+ structure = Eancom.find_structure(tag: 'CDI')
180
+ body.segment Eancom::Edifact::CDI.new(
181
+ physical_or_logical_state_type_code_qualifier: structure.dictionary_lookup(:physical_or_logical_state_type_code_qualifier, item.physical_or_logical_state_type_code_qualifier)
182
+ )
183
+ end
184
+ end
185
+ end
186
+
187
+ document.footer do |footer|
188
+ footer.segment Eancom::Edifact::UNS.new(
189
+ section_identification: 'S'
190
+ )
191
+
192
+ messages = config.body.messages
193
+
194
+ messages.each do |message|
195
+ items = message.items
196
+
197
+ items.each_with_index do |item, index|
198
+ next unless index == items.size - 1
199
+
200
+ counts = item.counts
201
+ counts.each_with_index do |cnt, index|
202
+ structure = Eancom.find_structure(tag: 'CNT')
203
+ footer.segment Eancom::Edifact::CNT.new(
204
+ control_total_type_code_quantifier: structure.dictionary_lookup(:control_total_type_code_quantifier, cnt.control_total_type_code_quantifier),
205
+ control_total_value: (index + 2).to_s
206
+ )
207
+ end
208
+ end
209
+ end
210
+
211
+ footer.segment Eancom::Edifact::UNT.new(
212
+ number_of_segments_in_message: (document.total_segments + 2).to_s,
213
+ message_reference_number: config.header.message_reference_number
214
+ )
215
+
216
+ footer.segment Eancom::Edifact::UNZ.new(
217
+ interchange_control_count: messages.size.to_s,
218
+ interchange_control_reference: config.header.interchange_control_reference.to_s
219
+ )
220
+ end
221
+ end
@@ -0,0 +1,47 @@
1
+ tag = 'AJT'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::AJT)
3
+
4
+ structure = Eancom::Edifact::Structure.new(tag: tag)
5
+ #==============================================================================
6
+ # Tag #
7
+ #==============================================================================
8
+ tag = Eancom::Edifact::Composite.new
9
+ data = Eancom::Edifact::Data.new(
10
+ type: String,
11
+ length: 1..3,
12
+ dictionary: nil,
13
+ description: 'Message Header',
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+ #==============================================================================
20
+ # HAZARD CODE #
21
+ #==============================================================================
22
+ adjustment_reason_description = Eancom::Edifact::Composite.new
23
+ data = Eancom::Edifact::Data.new(
24
+ type: String,
25
+ length: 1..3,
26
+ dictionary: {
27
+ '3' => {
28
+ description: 'Damaged goods',
29
+ identifier: 'damaged_goods'
30
+ },
31
+ '5' => {
32
+ description: 'Price query',
33
+ identifier: 'price_query'
34
+ },
35
+ '9' => {
36
+ description: 'Invoice error',
37
+ identifier: 'invoice_error'
38
+ }
39
+ },
40
+ description: 'Adjustment reason description',
41
+ required: true
42
+ )
43
+ adjustment_reason_description.add(:adjustment_reason_description, data)
44
+
45
+ structure << adjustment_reason_description
46
+ #==============================================================================
47
+ Eancom.register_structure(tag: 'AJT', structure: structure)