eancom 0.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.gitignore +187 -6
  4. data/.gitlab-ci.yml +27 -0
  5. data/.rspec_status +225 -0
  6. data/.rubocop.yml +2 -0
  7. data/.ruby-version +1 -0
  8. data/Gemfile +4 -2
  9. data/Gemfile.lock +87 -3
  10. data/bin/console +3 -2
  11. data/definitions/desadv/d01b.rb +205 -0
  12. data/definitions/desadv/d96a.rb +108 -73
  13. data/definitions/segments/alc.rb +236 -0
  14. data/definitions/segments/ali.rb +93 -0
  15. data/definitions/segments/bgm.rb +267 -0
  16. data/definitions/segments/cav.rb +122 -0
  17. data/definitions/segments/cci.rb +136 -0
  18. data/definitions/segments/cnt.rb +78 -0
  19. data/definitions/segments/cps.rb +76 -0
  20. data/definitions/segments/cux.rb +167 -0
  21. data/definitions/segments/dtm.rb +159 -0
  22. data/definitions/segments/ftx.rb +143 -0
  23. data/definitions/segments/imd.rb +356 -0
  24. data/definitions/segments/lin.rb +113 -0
  25. data/definitions/segments/loc.rb +89 -0
  26. data/definitions/segments/mea.rb +189 -0
  27. data/definitions/segments/moa.rb +144 -0
  28. data/definitions/segments/nad.rb +254 -0
  29. data/definitions/segments/pac.rb +250 -0
  30. data/definitions/segments/pgi.rb +148 -0
  31. data/definitions/segments/pia.rb +501 -0
  32. data/definitions/segments/pri.rb +188 -0
  33. data/definitions/segments/qty.rb +79 -0
  34. data/definitions/segments/rff.rb +166 -0
  35. data/definitions/segments/tax.rb +259 -0
  36. data/definitions/segments/tdt.rb +254 -0
  37. data/definitions/segments/una.rb +85 -0
  38. data/definitions/segments/unb.rb +284 -0
  39. data/definitions/segments/unh.rb +118 -0
  40. data/definitions/segments/uns.rb +40 -0
  41. data/definitions/segments/unt.rb +48 -0
  42. data/definitions/segments/unz.rb +48 -0
  43. data/definitions/slsrpt/d01b.rb +201 -0
  44. data/definitions/slsrpt/d96a.rb +194 -0
  45. data/eancom.gemspec +9 -5
  46. data/lib/eancom/definition.rb +1 -1
  47. data/lib/eancom/edifact/body.rb +63 -0
  48. data/lib/eancom/edifact/composite.rb +38 -0
  49. data/lib/eancom/edifact/data.rb +108 -0
  50. data/lib/eancom/edifact/document.rb +43 -11
  51. data/lib/eancom/edifact/document_element.rb +26 -0
  52. data/lib/eancom/edifact/footer.rb +6 -0
  53. data/lib/eancom/edifact/header.rb +15 -0
  54. data/lib/eancom/edifact/item.rb +40 -0
  55. data/lib/eancom/edifact/message.rb +24 -16
  56. data/lib/eancom/edifact/segment.rb +131 -12
  57. data/lib/eancom/edifact/segments/alc.rb +61 -0
  58. data/lib/eancom/edifact/segments/ali.rb +52 -0
  59. data/lib/eancom/edifact/segments/bgm.rb +45 -0
  60. data/lib/eancom/edifact/segments/cav.rb +47 -0
  61. data/lib/eancom/edifact/segments/cci.rb +53 -0
  62. data/lib/eancom/edifact/segments/cnt.rb +33 -0
  63. data/lib/eancom/edifact/segments/cps.rb +30 -0
  64. data/lib/eancom/edifact/segments/cux.rb +60 -0
  65. data/lib/eancom/edifact/segments/dtm.rb +43 -0
  66. data/lib/eancom/edifact/segments/ftx.rb +63 -0
  67. data/lib/eancom/edifact/segments/imd.rb +69 -0
  68. data/lib/eancom/edifact/segments/lin.rb +43 -0
  69. data/lib/eancom/edifact/segments/loc.rb +43 -0
  70. data/lib/eancom/edifact/segments/mea.rb +53 -0
  71. data/lib/eancom/edifact/segments/moa.rb +45 -0
  72. data/lib/eancom/edifact/segments/nad.rb +107 -0
  73. data/lib/eancom/edifact/segments/pac.rb +54 -0
  74. data/lib/eancom/edifact/segments/pgi.rb +45 -0
  75. data/lib/eancom/edifact/segments/pia.rb +107 -0
  76. data/lib/eancom/edifact/segments/pri.rb +54 -0
  77. data/lib/eancom/edifact/segments/qty.rb +40 -0
  78. data/lib/eancom/edifact/segments/rff.rb +41 -0
  79. data/lib/eancom/edifact/segments/tax.rb +72 -0
  80. data/lib/eancom/edifact/segments/tdt.rb +54 -0
  81. data/lib/eancom/edifact/segments/una.rb +51 -0
  82. data/lib/eancom/edifact/segments/unb.rb +69 -0
  83. data/lib/eancom/edifact/segments/unh.rb +46 -0
  84. data/lib/eancom/edifact/segments/uns.rb +29 -0
  85. data/lib/eancom/edifact/segments/unt.rb +28 -0
  86. data/lib/eancom/edifact/segments/unz.rb +28 -0
  87. data/lib/eancom/edifact/structure.rb +91 -0
  88. data/lib/eancom/edifact.rb +45 -12
  89. data/lib/eancom/factory.rb +8 -7
  90. data/lib/eancom/parser/document.rb +68 -0
  91. data/lib/eancom/parser/segment.rb +71 -0
  92. data/lib/eancom/parser.rb +7 -0
  93. data/lib/eancom/version.rb +1 -1
  94. data/lib/eancom.rb +59 -16
  95. metadata +138 -5
  96. data/lib/eancom/edifact/element.rb +0 -16
  97. data/lib/eancom/edifact/envelope.rb +0 -24
@@ -0,0 +1,93 @@
1
+ tag = 'ALI'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::ALI)
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: 3,
12
+ dictionary: nil,
13
+ description: "Message Header",
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+ #==============================================================================
20
+ # Country of origin name code #
21
+ #==============================================================================
22
+ country_of_origin_name_code = Eancom::Edifact::Composite.new()
23
+
24
+ data = Eancom::Edifact::Data.new(
25
+ type: String,
26
+ length: 0..3,
27
+ dictionary: nil,
28
+ description: 'Use ISO 3366 two alpha',
29
+ required: false
30
+ )
31
+ country_of_origin_name_code.add(:country_of_origin_name_code, data)
32
+
33
+ structure << country_of_origin_name_code
34
+ #==============================================================================
35
+ # Duty regime type code #
36
+ #==============================================================================
37
+ duty_regime_type_code = Eancom::Edifact::Composite.new()
38
+
39
+ data = Eancom::Edifact::Data.new(
40
+ type: String,
41
+ length: 0..3,
42
+ dictionary: nil,
43
+ description: 'Duty regime type code',
44
+ required: false
45
+ )
46
+ duty_regime_type_code.add(:duty_regime_type_code, data)
47
+
48
+ structure << duty_regime_type_code
49
+ #==============================================================================
50
+ # Special condition code #
51
+ #==============================================================================
52
+ special_condition_code = Eancom::Edifact::Composite.new()
53
+
54
+ dict = {
55
+ '6' => {
56
+ description: 'Subject to bonus',
57
+ identifier: 'subject_to_bonus'
58
+ },
59
+ '8' => {
60
+ description: 'Subject to discount',
61
+ identifier: 'subject_to_discount',
62
+ },
63
+ }
64
+
65
+
66
+ data = Eancom::Edifact::Data.new(
67
+ type: String,
68
+ length: 0..3,
69
+ dictionary: dict,
70
+ description: 'Special Condition Code',
71
+ required: false
72
+ )
73
+
74
+ special_condition_code.add(:special_condition_code_1, data)
75
+ structure << special_condition_code
76
+
77
+ special_condition_code = Eancom::Edifact::Composite.new()
78
+ special_condition_code.add(:special_condition_code_2, data)
79
+ structure << special_condition_code
80
+
81
+ special_condition_code = Eancom::Edifact::Composite.new()
82
+ special_condition_code.add(:special_condition_code_3, data)
83
+ structure << special_condition_code
84
+
85
+ special_condition_code = Eancom::Edifact::Composite.new()
86
+ special_condition_code.add(:special_condition_code_4, data)
87
+ structure << special_condition_code
88
+
89
+ special_condition_code = Eancom::Edifact::Composite.new()
90
+ special_condition_code.add(:special_condition_code_5, data)
91
+ structure << special_condition_code
92
+ #==============================================================================
93
+ Eancom.register_structure(tag: 'ALI', structure: structure)
@@ -0,0 +1,267 @@
1
+ tag = 'BGM'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::BGM)
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: 3,
12
+ dictionary: nil,
13
+ description: "Message Header",
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+ #==============================================================================
20
+ # Document/Message Name #
21
+ #==============================================================================
22
+ document_message_name = Eancom::Edifact::Composite.new()
23
+
24
+ data = Eancom::Edifact::Data.new(
25
+ type: String,
26
+ length: 1..3,
27
+ dictionary: {
28
+ '9' => {
29
+ description: 'Price/sales catalogue',
30
+ identifier: 'price_sales_catalogue'
31
+ },
32
+ '11' => {
33
+ description: 'Federal label approval',
34
+ identifier: 'federal_label_approval'
35
+ },
36
+ '67' => {
37
+ description: 'Commercial dispute',
38
+ identifier: 'commercial_dispute'
39
+ },
40
+ '82' => {
41
+ description: 'Metered service invoice',
42
+ identifier: 'metered_service_invoice'
43
+ },
44
+ '83' => {
45
+ description: 'Credit note related financial adjustments',
46
+ identifier: 'credit_note_related_financial_adjustments'
47
+ },
48
+ '84' => {
49
+ description: 'Debit note related financial adjustments',
50
+ identifier: 'debit_note_related_financial_adjustments'
51
+ },
52
+ '130' => {
53
+ description: 'Invoice Data sheet',
54
+ identifier: 'invoice_data_sheet'
55
+ },
56
+ '231' => {
57
+ description: 'Purchase order response',
58
+ identifier: 'purchase_order_response'
59
+ },
60
+ '261' => {
61
+ description: 'Self billed credit_note',
62
+ identifier: 'self_billed_credit_note'
63
+ },
64
+ '262' => {
65
+ description: 'Consolidated credit note - goods and services',
66
+ identifier: 'consolidated_credit_note_goods_and_services'
67
+ },
68
+ '308' => {
69
+ description: 'Delcredere credit note',
70
+ identifier: 'delcredere_credit_note'
71
+ },
72
+ '325' => {
73
+ description: 'Proforma Invoice',
74
+ identifier: 'proforma_invoice'
75
+ },
76
+ '345' => {
77
+ description: 'Ready for despatch advice',
78
+ identifier: 'ready_for_despatch_advice'
79
+ },
80
+ '351' => {
81
+ description: 'Despatch advice',
82
+ identifier: 'despatch_advice'
83
+ },
84
+ '380' => {
85
+ description: 'Commercial Invoice',
86
+ identifier: 'commercial_invoice'
87
+ },
88
+ '381' => {
89
+ description: 'Credit note - goods and services',
90
+ identifier: 'credit_note_goods_and_services'
91
+ },
92
+ '382' => {
93
+ description: 'Commission note',
94
+ identifier: 'commission_note'
95
+ },
96
+ '383' => {
97
+ description: 'Debit note - goods and services',
98
+ identifier: 'debit_note_goods_and_services'
99
+ },
100
+ '384' => {
101
+ description: 'Corrected Invoice',
102
+ identifier: 'corrected_invoice'
103
+ },
104
+ '385' => {
105
+ description: 'Consolidated invoice',
106
+ identifier: 'consolidated_invoice'
107
+ },
108
+ '386' => {
109
+ description: 'Prepayment invoice',
110
+ identifier: 'prepayment_invoice'
111
+ },
112
+ '388' => {
113
+ description: 'Tax invoice',
114
+ identifier: 'tax_invoice'
115
+ },
116
+ '389' => {
117
+ description: 'Self-billed invoice',
118
+ identifier: 'self_billed_invoice'
119
+ },
120
+ '390' => {
121
+ description: 'Delcredere invoice',
122
+ identifier: 'delcredere_invoice'
123
+ },
124
+ '393' => {
125
+ description: 'Factored invoice',
126
+ identifier: 'factored_invoice'
127
+ },
128
+ '527' => {
129
+ description: 'Self billed debit note',
130
+ identifier: 'self_billed_debit_note'
131
+ },
132
+ '35E' => {
133
+ description: 'Return advice (GS1 Temporary Code)',
134
+ identifier: 'return_advice'
135
+ },
136
+ 'YA5' => {
137
+ description: 'Itermediate handling cross docking despatch advice (GS1 Temporary Code).',
138
+ identifier: 'intermediate_handling_cross_docking_despatch_advice'
139
+ },
140
+ 'YA6' => {
141
+ description: 'Pre-pack cross docking [transshipment] despatch advice (GS1 Temporary Code).',
142
+ identifier: 'pre_pakc_cross_docking_despatch_advice'
143
+ },
144
+ 'YA7' => {
145
+ description: 'Consignment despatch advice (GS1 Temporary Code).',
146
+ identifier: 'consignment_despatch_advice'
147
+ },
148
+ 'YB3' => {
149
+ description: 'Ready for transshipment despatch advice (GS1 Temporary Code).',
150
+ identifier: 'ready_for_transshipment_despatch_advice'
151
+ },
152
+ '73E' => {
153
+ description: 'Sales Report',
154
+ identifier: 'sales_report'
155
+ }
156
+ },
157
+ description: "Document name code.",
158
+ required: true
159
+ )
160
+ document_message_name.add(:document_name_code, data)
161
+
162
+ data = Eancom::Edifact::Data.new(
163
+ type: String,
164
+ length: 0..17,
165
+ dictionary: nil,
166
+ description: "Code list identification code",
167
+ required: false
168
+ )
169
+ document_message_name.add(:code_list_identification_code, data)
170
+
171
+ data = Eancom::Edifact::Data.new(
172
+ type: String,
173
+ length: 0..3,
174
+ dictionary: {
175
+ '9' => {
176
+ description: 'GS1',
177
+ identifier: 'gs1'
178
+ }
179
+ },
180
+ description: "Code list responsible agency code.",
181
+ required: false
182
+ )
183
+ document_message_name.add(:code_list_responsible_agency_code, data)
184
+
185
+ data = Eancom::Edifact::Data.new(
186
+ type: String,
187
+ length: 0..35,
188
+ dictionary: nil,
189
+ description: "Document name",
190
+ required: false
191
+ )
192
+ document_message_name.add(:document_name, data)
193
+
194
+ structure << document_message_name
195
+ #==============================================================================
196
+ # Document/Message Identification #
197
+ #==============================================================================
198
+ document_message_identification = Eancom::Edifact::Composite.new()
199
+
200
+ data = Eancom::Edifact::Data.new(
201
+ type: String,
202
+ length: 1..35,
203
+ dictionary: nil,
204
+ description: "Despatch Advice number assigned by the document sender.\nFor global unique identification of documents Global Document Identifier (GDTI) is available.",
205
+ required: true
206
+ )
207
+ document_message_identification.add(:document_identifier, data)
208
+
209
+ structure << document_message_identification
210
+ #==============================================================================
211
+ # Message function code #
212
+ #==============================================================================
213
+ message_function_code = Eancom::Edifact::Composite.new()
214
+
215
+ data = Eancom::Edifact::Data.new(
216
+ type: String,
217
+ length: 1..3,
218
+ dictionary: {
219
+ '1' => {
220
+ description: 'Cancellation',
221
+ identifier: 'cancellation'
222
+ },
223
+ '2' => {
224
+ description: 'Addition',
225
+ identifier: 'addition'
226
+ },
227
+ '4' => {
228
+ description: 'Change',
229
+ identifier: 'change'
230
+ },
231
+ '5' => {
232
+ description: 'Replace',
233
+ identifier: 'replace'
234
+ },
235
+ '7' => {
236
+ description: 'Duplicate',
237
+ identifier: 'duplicate'
238
+ },
239
+ '9' => {
240
+ description: 'Original',
241
+ identifier: 'original'
242
+ },
243
+ '11' => {
244
+ description: 'Response',
245
+ identifier: 'response'
246
+ },
247
+ '29' => {
248
+ description: 'Order Response',
249
+ identifier: 'order_response'
250
+ },
251
+ '31' => {
252
+ description: 'Copy',
253
+ identifier: 'copy'
254
+ },
255
+ '42' => {
256
+ description: 'Confirmation_via_specific_means',
257
+ identifier: 'confirmation_via_specific_means'
258
+ }
259
+ },
260
+ description: 'Message function code',
261
+ required: true
262
+ )
263
+ message_function_code.add(:message_function_code, data)
264
+
265
+ structure << message_function_code
266
+ #==============================================================================
267
+ Eancom.register_structure(tag: 'BGM', structure: structure)
@@ -0,0 +1,122 @@
1
+ tag = 'CAV'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::CAV)
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: 3,
12
+ dictionary: nil,
13
+ description: "Message Header",
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+ #==============================================================================
20
+ # Characterisitc Value #
21
+ #==============================================================================
22
+ characterisitc_value = Eancom::Edifact::Composite.new()
23
+
24
+ data = Eancom::Edifact::Data.new(
25
+ type: String,
26
+ length: 0..3,
27
+ dictionary: {
28
+ '1' => {
29
+ description: 'Chest/bust width',
30
+ identifier: 'chest_bust_width',
31
+ },
32
+ '2' => {
33
+ description: 'Hip width',
34
+ identifier: 'hip_width',
35
+ },
36
+ '3' => {
37
+ description: 'outside leg length',
38
+ identifier: 'outside_leg_length',
39
+ },
40
+ '*' => {
41
+ description: 'N/A',
42
+ identifier: 'n_a'
43
+ }
44
+ },
45
+ description: 'Characterisitc value description code',
46
+ required: false
47
+ )
48
+ characterisitc_value.add(:characterisitc_value_description_code, data)
49
+
50
+ data = Eancom::Edifact::Data.new(
51
+ type: String,
52
+ length: 0..17,
53
+ dictionary: nil,
54
+ description: 'Code list identification code',
55
+ required: false
56
+ )
57
+ characterisitc_value.add(:code_list_identification_code, data)
58
+
59
+ data = Eancom::Edifact::Data.new(
60
+ type: String,
61
+ length: 0..3,
62
+ dictionary: {
63
+ '9' => {
64
+ description: 'GS1',
65
+ identifier: 'gs1',
66
+ },
67
+ '60' => {
68
+ description: 'Assigned by national trade agency',
69
+ identifier: 'assigned_by_national_trade_agency',
70
+ },
71
+ '91' => {
72
+ description: 'Assigned by supplier or suppliers agent',
73
+ identifier: 'assigned_by_supplier_or_suppliers_agent',
74
+ },
75
+ '92' => {
76
+ description: 'Assigned by buyer or buyers agent',
77
+ identifier: 'assigned_by_buyer_or_buyers_agent',
78
+ },
79
+ '174' => {
80
+ description: 'DE, DIN',
81
+ identifier: 'de_din',
82
+ },
83
+ },
84
+ description: 'Code List responsibility Agency code',
85
+ required: false
86
+ )
87
+ characterisitc_value.add(:code_list_respobsibility_agency_code, data)
88
+
89
+ data = Eancom::Edifact::Data.new(
90
+ type: String,
91
+ length: 0..35,
92
+ dictionary: {
93
+ 'RIGHTRET5' => {
94
+ description: 'FULL',
95
+ identifier: 'full',
96
+ },
97
+ 'RIGHTRET6' => {
98
+ description: 'PARTIAL',
99
+ identifier: 'partial',
100
+ },
101
+ '*' => {
102
+ description: 'N/A',
103
+ identifier: 'n_a',
104
+ }
105
+ },
106
+ description: 'Characterisitc value description',
107
+ required: false
108
+ )
109
+ characterisitc_value.add(:characterisitc_value_description_1, data)
110
+
111
+ data = Eancom::Edifact::Data.new(
112
+ type: String,
113
+ length: 0..35,
114
+ dictionary: nil,
115
+ description: 'Characterisitc value description',
116
+ required: false
117
+ )
118
+ characterisitc_value.add(:characterisitc_value_description_2, data)
119
+
120
+ structure << characterisitc_value
121
+ #==============================================================================
122
+ Eancom.register_structure(tag: 'CAV', structure: structure)
@@ -0,0 +1,136 @@
1
+ tag = 'CCI'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::CCI)
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: 3,
12
+ dictionary: nil,
13
+ description: "Message Header",
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+ #==============================================================================
20
+ # Class Type code #
21
+ #==============================================================================
22
+ class_type_code = Eancom::Edifact::Composite.new()
23
+
24
+ data = Eancom::Edifact::Data.new(
25
+ type: String,
26
+ length: 0..3,
27
+ dictionary: {
28
+ '11' => {
29
+ description: 'Product',
30
+ identifier: 'product',
31
+ },
32
+ },
33
+ description: "Class Type Code",
34
+ required: false
35
+ )
36
+ class_type_code.add(:class_type_code, data)
37
+
38
+ structure << class_type_code
39
+ #==============================================================================
40
+ # Measurment details #
41
+ #==============================================================================
42
+ measurment_details = Eancom::Edifact::Composite.new()
43
+
44
+ data = Eancom::Edifact::Data.new(
45
+ type: String,
46
+ length: 0..3,
47
+ dictionary: nil,
48
+ description: "Measurment attribute code",
49
+ required: false
50
+ )
51
+ measurment_details.add(:measurment_attribute_code, data)
52
+
53
+ structure << measurment_details
54
+ #==============================================================================
55
+ # Product Characteristic #
56
+ #==============================================================================
57
+ prodcut_characteristic = Eancom::Edifact::Composite.new()
58
+
59
+ data = Eancom::Edifact::Data.new(
60
+ type: String,
61
+ length: 1..17,
62
+ dictionary: {
63
+ 'ORGANIC' => {
64
+ description: 'Organic Trade Item',
65
+ identifier: 'organic',
66
+ },
67
+ 'PACKMAT' => {
68
+ description: 'Packing Material',
69
+ identifier: 'packmat',
70
+ },
71
+ 'MATERIAL' => {
72
+ description: 'Material',
73
+ identifier: 'material',
74
+ },
75
+ 'UOM' => {
76
+ description: 'Ordering and Selling Unit of Measure',
77
+ identifier: 'ordering_and_selling_unit_of_measure',
78
+ },
79
+ },
80
+ description: "Characteristic description code",
81
+ required: true
82
+ )
83
+ prodcut_characteristic.add(:characteristic_description_code, data)
84
+
85
+ data = Eancom::Edifact::Data.new(
86
+ type: String,
87
+ length: 0..17,
88
+ dictionary: nil,
89
+ description: "Code list identification code",
90
+ required: false
91
+ )
92
+ prodcut_characteristic.add(:code_list_identification_code, data)
93
+
94
+ data = Eancom::Edifact::Data.new(
95
+ type: String,
96
+ length: 0..3,
97
+ dictionary: {
98
+ '9' => {
99
+ description: 'GS1',
100
+ identifier: 'gs1',
101
+ },
102
+ '60' => {
103
+ description: 'Assigned by national trade agency',
104
+ identifier: 'assigned_by_national_trade_agency',
105
+ },
106
+ '91' => {
107
+ description: 'Assigned by supplier or suppliers agent',
108
+ identifier: 'assigned_by_supplier_or_suppliers_agent',
109
+ },
110
+ '92' => {
111
+ description: 'Assigned by buyer or buyers agent',
112
+ identifier: 'assigned_by_buyer_or_buyers_agent',
113
+ },
114
+ '174' => {
115
+ description: 'DE, DIN',
116
+ identifier: 'de_din',
117
+ },
118
+ },
119
+ description: 'Code List responsibility Agency code',
120
+ required: false
121
+ )
122
+ prodcut_characteristic.add(:code_list_respobsibility_agency_code, data)
123
+
124
+ data = Eancom::Edifact::Data.new(
125
+ type: String,
126
+ length: 0..3,
127
+ dictionary: nil,
128
+ description: 'Characteristic description',
129
+ required: false
130
+ )
131
+ prodcut_characteristic.add(:characterisitc_description_1, data)
132
+ prodcut_characteristic.add(:characterisitc_description_2, data)
133
+
134
+ structure << prodcut_characteristic
135
+ #==============================================================================
136
+ Eancom.register_structure(tag: 'CCI', structure: structure)
@@ -0,0 +1,78 @@
1
+ tag = 'CNT'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::CNT)
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: 3,
12
+ dictionary: nil,
13
+ description: "Message Header",
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+ #==============================================================================
20
+ # Controle #
21
+ #==============================================================================
22
+ control = Eancom::Edifact::Composite.new()
23
+
24
+ data = Eancom::Edifact::Data.new(
25
+ type: String,
26
+ length: 1..3,
27
+ dictionary: {
28
+ '1' => {
29
+ description: 'Total value of the quantity segments at line level in a message',
30
+ identifier: 'total_value'
31
+ },
32
+ '2' => {
33
+ description: 'Number of line items in message',
34
+ identifier: 'total_line_items'
35
+ },
36
+ '7' => {
37
+ description: 'Total gross weight',
38
+ identifier: 'total_gross_weight'
39
+ },
40
+ '11' => {
41
+ description: 'Total number of packages',
42
+ identifier: 'total_number_packages'
43
+ },
44
+ '26' => {
45
+ description: 'Total gross measurment/cube',
46
+ identifier: 'total_gross_measurement'
47
+ },
48
+ '29' => {
49
+ description: 'Total net weight of consigmnet',
50
+ identifier: 'total_net_weight'
51
+ }
52
+ },
53
+ description: "control total type code quantifier",
54
+ required: true
55
+ )
56
+ control.add(:control_total_type_code_quantifier, data)
57
+
58
+ data = Eancom::Edifact::Data.new(
59
+ type: String,
60
+ length: 1..18,
61
+ dictionary: nil,
62
+ description: "Control total value",
63
+ required: true
64
+ )
65
+ control.add(:control_total_value, data)
66
+
67
+ data = Eancom::Edifact::Data.new(
68
+ type: String,
69
+ length: 1..3,
70
+ dictionary: nil,
71
+ description: "Measurment unit code",
72
+ required: false
73
+ )
74
+ control.add(:measurment_unit_code, data)
75
+
76
+ structure << control
77
+ #==============================================================================
78
+ Eancom.register_structure(tag: 'CNT', structure: structure)