eancom 0.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +190 -5
- data/.gitlab-ci.yml +25 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +22 -18
- data/README.md +46 -0
- data/bin/console +3 -2
- data/definitions/desadv/d01b.rb +251 -0
- data/definitions/desadv/d96a.rb +208 -87
- data/definitions/invoic/d01b.rb +559 -0
- data/definitions/invoic/d96a.rb +389 -0
- data/definitions/invrpt/d01b.rb +134 -0
- data/definitions/invrpt/d96a.rb +125 -0
- data/definitions/orders/d01b.rb +182 -0
- data/definitions/orders/d96b.rb +198 -0
- data/definitions/ordrsp/d01b.rb +251 -0
- data/definitions/ordrsp/d96b.rb +226 -0
- data/definitions/pricat/d01b.rb +225 -0
- data/definitions/pricat/d96b.rb +207 -0
- data/definitions/retann/d01b.rb +172 -0
- data/definitions/retann/d96b.rb +221 -0
- data/definitions/segments/ajt.rb +47 -0
- data/definitions/segments/alc.rb +328 -0
- data/definitions/segments/ali.rb +93 -0
- data/definitions/segments/bgm.rb +395 -0
- data/definitions/segments/cav.rb +122 -0
- data/definitions/segments/cci.rb +136 -0
- data/definitions/segments/cdi.rb +39 -0
- data/definitions/segments/cnt.rb +82 -0
- data/definitions/segments/cps.rb +76 -0
- data/definitions/segments/cta.rb +89 -0
- data/definitions/segments/cux.rb +174 -0
- data/definitions/segments/dgs.rb +34 -0
- data/definitions/segments/doc.rb +45 -0
- data/definitions/segments/dtm.rb +243 -0
- data/definitions/segments/efi.rb +67 -0
- data/definitions/segments/eqd.rb +37 -0
- data/definitions/segments/ftx.rb +165 -0
- data/definitions/segments/gin.rb +113 -0
- data/definitions/segments/imd.rb +360 -0
- data/definitions/segments/inv.rb +94 -0
- data/definitions/segments/lin.rb +133 -0
- data/definitions/segments/loc.rb +137 -0
- data/definitions/segments/mea.rb +189 -0
- data/definitions/segments/moa.rb +228 -0
- data/definitions/segments/nad.rb +314 -0
- data/definitions/segments/pac.rb +262 -0
- data/definitions/segments/pat.rb +171 -0
- data/definitions/segments/pcd.rb +72 -0
- data/definitions/segments/pci.rb +110 -0
- data/definitions/segments/pgi.rb +152 -0
- data/definitions/segments/pia.rb +501 -0
- data/definitions/segments/pri.rb +208 -0
- data/definitions/segments/qty.rb +293 -0
- data/definitions/segments/rff.rb +210 -0
- data/definitions/segments/rte.rb +52 -0
- data/definitions/segments/tax.rb +266 -0
- data/definitions/segments/tdt.rb +278 -0
- data/definitions/segments/tod.rb +64 -0
- data/definitions/segments/tru.rb +34 -0
- data/definitions/segments/una.rb +85 -0
- data/definitions/segments/unb.rb +284 -0
- data/definitions/segments/unh.rb +183 -0
- data/definitions/segments/uns.rb +40 -0
- data/definitions/segments/unt.rb +48 -0
- data/definitions/segments/unz.rb +48 -0
- data/definitions/slsrpt/d01b.rb +206 -0
- data/definitions/slsrpt/d96a.rb +199 -0
- data/eancom.gemspec +2 -1
- data/lib/eancom.rb +61 -16
- data/lib/eancom/definition.rb +1 -1
- data/lib/eancom/edifact.rb +60 -13
- data/lib/eancom/edifact/body.rb +63 -0
- data/lib/eancom/edifact/composite.rb +38 -0
- data/lib/eancom/edifact/data.rb +108 -0
- data/lib/eancom/edifact/document.rb +43 -11
- data/lib/eancom/edifact/document_element.rb +26 -0
- data/lib/eancom/edifact/footer.rb +7 -0
- data/lib/eancom/edifact/header.rb +15 -0
- data/lib/eancom/edifact/item.rb +40 -0
- data/lib/eancom/edifact/message.rb +24 -16
- data/lib/eancom/edifact/segment.rb +131 -12
- data/lib/eancom/edifact/segments/ajt.rb +32 -0
- data/lib/eancom/edifact/segments/alc.rb +61 -0
- data/lib/eancom/edifact/segments/ali.rb +50 -0
- data/lib/eancom/edifact/segments/bgm.rb +46 -0
- data/lib/eancom/edifact/segments/cav.rb +47 -0
- data/lib/eancom/edifact/segments/cci.rb +53 -0
- data/lib/eancom/edifact/segments/cdi.rb +30 -0
- data/lib/eancom/edifact/segments/cnt.rb +40 -0
- data/lib/eancom/edifact/segments/cps.rb +33 -0
- data/lib/eancom/edifact/segments/cta.rb +30 -0
- data/lib/eancom/edifact/segments/cux.rb +60 -0
- data/lib/eancom/edifact/segments/dgs.rb +31 -0
- data/lib/eancom/edifact/segments/doc.rb +30 -0
- data/lib/eancom/edifact/segments/dtm.rb +47 -0
- data/lib/eancom/edifact/segments/efi.rb +38 -0
- data/lib/eancom/edifact/segments/eqd.rb +30 -0
- data/lib/eancom/edifact/segments/ftx.rb +63 -0
- data/lib/eancom/edifact/segments/gin.rb +45 -0
- data/lib/eancom/edifact/segments/imd.rb +69 -0
- data/lib/eancom/edifact/segments/inv.rb +43 -0
- data/lib/eancom/edifact/segments/lin.rb +47 -0
- data/lib/eancom/edifact/segments/loc.rb +46 -0
- data/lib/eancom/edifact/segments/mea.rb +54 -0
- data/lib/eancom/edifact/segments/moa.rb +45 -0
- data/lib/eancom/edifact/segments/nad.rb +112 -0
- data/lib/eancom/edifact/segments/pac.rb +56 -0
- data/lib/eancom/edifact/segments/pat.rb +37 -0
- data/lib/eancom/edifact/segments/pcd.rb +33 -0
- data/lib/eancom/edifact/segments/pci.rb +40 -0
- data/lib/eancom/edifact/segments/pgi.rb +45 -0
- data/lib/eancom/edifact/segments/pia.rb +108 -0
- data/lib/eancom/edifact/segments/pri.rb +53 -0
- data/lib/eancom/edifact/segments/qty.rb +44 -0
- data/lib/eancom/edifact/segments/rff.rb +47 -0
- data/lib/eancom/edifact/segments/rte.rb +33 -0
- data/lib/eancom/edifact/segments/tax.rb +78 -0
- data/lib/eancom/edifact/segments/tdt.rb +57 -0
- data/lib/eancom/edifact/segments/tod.rb +33 -0
- data/lib/eancom/edifact/segments/tru.rb +31 -0
- data/lib/eancom/edifact/segments/una.rb +52 -0
- data/lib/eancom/edifact/segments/unb.rb +68 -0
- data/lib/eancom/edifact/segments/unh.rb +50 -0
- data/lib/eancom/edifact/segments/uns.rb +32 -0
- data/lib/eancom/edifact/segments/unt.rb +28 -0
- data/lib/eancom/edifact/segments/unz.rb +28 -0
- data/lib/eancom/edifact/structure.rb +90 -0
- data/lib/eancom/factory.rb +9 -8
- data/lib/eancom/parser.rb +7 -0
- data/lib/eancom/parser/document.rb +60 -0
- data/lib/eancom/parser/segment.rb +71 -0
- data/lib/eancom/version.rb +1 -1
- data/pricat.json +1 -0
- metadata +141 -9
- data/lib/eancom/edifact/element.rb +0 -16
- data/lib/eancom/edifact/envelope.rb +0 -24
@@ -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,39 @@
|
|
1
|
+
tag = 'CDI'
|
2
|
+
Eancom.register_segment(tag: tag, klass: Eancom::Edifact::CDI)
|
3
|
+
|
4
|
+
structure = Eancom::Edifact::Structure.new(tag: tag)
|
5
|
+
|
6
|
+
#==============================================================================
|
7
|
+
# Tag #
|
8
|
+
#==============================================================================
|
9
|
+
tag = Eancom::Edifact::Composite.new
|
10
|
+
data = Eancom::Edifact::Data.new(
|
11
|
+
type: String,
|
12
|
+
length: 1..3,
|
13
|
+
dictionary: nil,
|
14
|
+
description: 'Message Header',
|
15
|
+
required: true
|
16
|
+
)
|
17
|
+
tag.add(:tag, data)
|
18
|
+
structure << tag
|
19
|
+
#==============================================================================
|
20
|
+
# Contact function code #
|
21
|
+
#==============================================================================
|
22
|
+
physical_or_logical_state_type_code_qualifier = Eancom::Edifact::Composite.new()
|
23
|
+
|
24
|
+
data = Eancom::Edifact::Data.new(
|
25
|
+
type: String,
|
26
|
+
length: 1..3,
|
27
|
+
dictionary: {
|
28
|
+
'3E' => {
|
29
|
+
description: 'Upon return (GS1 temporary code)',
|
30
|
+
identifier: 'upon_return'
|
31
|
+
}
|
32
|
+
},
|
33
|
+
description: 'Physical or logical state type code qualifier',
|
34
|
+
required: true
|
35
|
+
)
|
36
|
+
physical_or_logical_state_type_code_qualifier.add(:physical_or_logical_state_type_code_qualifier, data)
|
37
|
+
|
38
|
+
structure << physical_or_logical_state_type_code_qualifier
|
39
|
+
Eancom.register_structure(tag: 'CDI', structure: structure)
|
@@ -0,0 +1,82 @@
|
|
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
|
+
'3' => {
|
37
|
+
description: 'Number of line and sub items in message',
|
38
|
+
identifier: 'number_of_line_and_sub_items_in_message'
|
39
|
+
},
|
40
|
+
'7' => {
|
41
|
+
description: 'Total gross weight',
|
42
|
+
identifier: 'total_gross_weight'
|
43
|
+
},
|
44
|
+
'11' => {
|
45
|
+
description: 'Total number of packages',
|
46
|
+
identifier: 'total_number_packages'
|
47
|
+
},
|
48
|
+
'26' => {
|
49
|
+
description: 'Total gross measurment/cube',
|
50
|
+
identifier: 'total_gross_measurement'
|
51
|
+
},
|
52
|
+
'29' => {
|
53
|
+
description: 'Total net weight of consigmnet',
|
54
|
+
identifier: 'total_net_weight'
|
55
|
+
}
|
56
|
+
},
|
57
|
+
description: "control total type code quantifier",
|
58
|
+
required: true
|
59
|
+
)
|
60
|
+
control.add(:control_total_type_code_quantifier, data)
|
61
|
+
|
62
|
+
data = Eancom::Edifact::Data.new(
|
63
|
+
type: String,
|
64
|
+
length: 1..18,
|
65
|
+
dictionary: nil,
|
66
|
+
description: "Control total value",
|
67
|
+
required: true
|
68
|
+
)
|
69
|
+
control.add(:control_total_value, data)
|
70
|
+
|
71
|
+
data = Eancom::Edifact::Data.new(
|
72
|
+
type: String,
|
73
|
+
length: 1..3,
|
74
|
+
dictionary: nil,
|
75
|
+
description: "Measurment unit code",
|
76
|
+
required: false
|
77
|
+
)
|
78
|
+
control.add(:measurment_unit_code, data)
|
79
|
+
|
80
|
+
structure << control
|
81
|
+
#==============================================================================
|
82
|
+
Eancom.register_structure(tag: 'CNT', structure: structure)
|
@@ -0,0 +1,76 @@
|
|
1
|
+
tag = 'CPS'
|
2
|
+
Eancom.register_segment(tag: tag, klass: Eancom::Edifact::CPS)
|
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
|
+
# Hierarchical structure level identifier #
|
21
|
+
#==============================================================================
|
22
|
+
hierarchical_structure_level_identifier = Eancom::Edifact::Composite.new()
|
23
|
+
|
24
|
+
data = Eancom::Edifact::Data.new(
|
25
|
+
type: String,
|
26
|
+
length: 1..35,
|
27
|
+
description: "Hierarchical structure level identifier",
|
28
|
+
required: true
|
29
|
+
)
|
30
|
+
hierarchical_structure_level_identifier.add(:hierarchical_structure_level_identifier, data)
|
31
|
+
|
32
|
+
structure << hierarchical_structure_level_identifier
|
33
|
+
#==============================================================================
|
34
|
+
# Hierarchical structure parent identifier #
|
35
|
+
#==============================================================================
|
36
|
+
hierarchical_structure_parent_identifier = Eancom::Edifact::Composite.new()
|
37
|
+
|
38
|
+
data = Eancom::Edifact::Data.new(
|
39
|
+
type: String,
|
40
|
+
length: 1..35,
|
41
|
+
description: "Hierarchical structure parent identifier",
|
42
|
+
required: false
|
43
|
+
)
|
44
|
+
hierarchical_structure_parent_identifier.add(:hierarchical_structure_parent_identifier, data)
|
45
|
+
|
46
|
+
structure << hierarchical_structure_parent_identifier
|
47
|
+
#==============================================================================
|
48
|
+
# Hierarchical structure level identifier #
|
49
|
+
#==============================================================================
|
50
|
+
packaging_level_code = Eancom::Edifact::Composite.new()
|
51
|
+
|
52
|
+
data = Eancom::Edifact::Data.new(
|
53
|
+
type: String,
|
54
|
+
length: 0..3,
|
55
|
+
dictionary: {
|
56
|
+
'1E' => {
|
57
|
+
description: 'Highest (GS1 Temporary Code)',
|
58
|
+
identifier: 'highest'
|
59
|
+
},
|
60
|
+
'4' => {
|
61
|
+
description: 'No packaging hierarchy',
|
62
|
+
identifier: 'no_packing_hierarchy'
|
63
|
+
},
|
64
|
+
'5' => {
|
65
|
+
description: 'Shipment Level',
|
66
|
+
identifier: 'shipment_level'
|
67
|
+
}
|
68
|
+
},
|
69
|
+
description: "Packaging level code",
|
70
|
+
required: false
|
71
|
+
)
|
72
|
+
packaging_level_code.add(:packaging_level_code, data)
|
73
|
+
|
74
|
+
structure << packaging_level_code
|
75
|
+
#==============================================================================
|
76
|
+
Eancom.register_structure(tag: 'CPS', structure: structure)
|