edi4r 0.9.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/AuthorCopyright +10 -0
- data/COPYING +56 -0
- data/ChangeLog +106 -0
- data/README +66 -0
- data/TO-DO +35 -0
- data/Tutorial +609 -0
- data/VERSION +1 -0
- data/bin/edi2xml.rb +103 -0
- data/bin/editool.rb +151 -0
- data/bin/xml2edi.rb +50 -0
- data/data/edifact/iso9735/SDCD.10000.csv +10 -0
- data/data/edifact/iso9735/SDCD.20000.csv +10 -0
- data/data/edifact/iso9735/SDCD.30000.csv +11 -0
- data/data/edifact/iso9735/SDCD.40000.csv +31 -0
- data/data/edifact/iso9735/SDCD.40100.csv +31 -0
- data/data/edifact/iso9735/SDED.10000.csv +37 -0
- data/data/edifact/iso9735/SDED.20000.csv +37 -0
- data/data/edifact/iso9735/SDED.30000.csv +43 -0
- data/data/edifact/iso9735/SDED.40000.csv +129 -0
- data/data/edifact/iso9735/SDED.40100.csv +130 -0
- data/data/edifact/iso9735/SDMD.10000.csv +0 -0
- data/data/edifact/iso9735/SDMD.20000.csv +0 -0
- data/data/edifact/iso9735/SDMD.30000.csv +6 -0
- data/data/edifact/iso9735/SDMD.40000.csv +17 -0
- data/data/edifact/iso9735/SDMD.40100.csv +17 -0
- data/data/edifact/iso9735/SDSD.10000.csv +8 -0
- data/data/edifact/iso9735/SDSD.20000.csv +8 -0
- data/data/edifact/iso9735/SDSD.30000.csv +12 -0
- data/data/edifact/iso9735/SDSD.40000.csv +34 -0
- data/data/edifact/iso9735/SDSD.40100.csv +34 -0
- data/data/edifact/untdid/EDCD.d01b.csv +200 -0
- data/data/edifact/untdid/EDCD.d96a.csv +161 -0
- data/data/edifact/untdid/EDED.d01b.csv +641 -0
- data/data/edifact/untdid/EDED.d96a.csv +462 -0
- data/data/edifact/untdid/EDMD.d01b.csv +3419 -0
- data/data/edifact/untdid/EDMD.d96a.csv +2144 -0
- data/data/edifact/untdid/EDSD.d01b.csv +158 -0
- data/data/edifact/untdid/EDSD.d96a.csv +127 -0
- data/data/edifact/untdid/IDCD.d01b.csv +95 -0
- data/data/edifact/untdid/IDMD.d01b.csv +238 -0
- data/data/edifact/untdid/IDSD.d01b.csv +75 -0
- data/lib/edi4r.rb +928 -0
- data/lib/edi4r/diagrams.rb +567 -0
- data/lib/edi4r/edi4r-1.2.dtd +20 -0
- data/lib/edi4r/edifact-rexml.rb +221 -0
- data/lib/edi4r/edifact.rb +1627 -0
- data/lib/edi4r/rexml.rb +256 -0
- data/lib/edi4r/standards.rb +495 -0
- data/test/eancom2webedi.rb +380 -0
- data/test/groups.edi +1 -0
- data/test/in1.edi +1 -0
- data/test/in1.inh +3 -0
- data/test/in2.edi +1 -0
- data/test/in2.xml +350 -0
- data/test/test_basics.rb +209 -0
- data/test/test_edi_split.rb +53 -0
- data/test/test_loopback.rb +21 -0
- data/test/test_minidemo.rb +84 -0
- data/test/test_rexml.rb +98 -0
- data/test/test_tut_examples.rb +131 -0
- data/test/webedi2eancom.rb +408 -0
- metadata +110 -0
@@ -0,0 +1,380 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Mapping demo: Inbound, from EANCOM to inhouse
|
4
|
+
#
|
5
|
+
# Inhouse format: GS1 Germany's WebEDI ASCII interface for ORDERS
|
6
|
+
# Output format: EANCOM'02 ORDERS, according to GS1 Germany'
|
7
|
+
# recommendations for application
|
8
|
+
# (EDI-Anwendungsempfehlungen V 2.0 (ORDERS) in EANCOM 2002 S3)
|
9
|
+
# and the general EANCOM 2002 (ORDERS) documentation including
|
10
|
+
# change requests.
|
11
|
+
# Comments:
|
12
|
+
#
|
13
|
+
# Inhouse and output format were selected, because they represent typical
|
14
|
+
# data structures and tasks for users, and because documentation of
|
15
|
+
# these formats is freely available.
|
16
|
+
#
|
17
|
+
# $Id: eancom2webedi.rb,v 1.2 2006/07/03 20:20:09 werntges Exp $
|
18
|
+
#
|
19
|
+
# Author: Heinz W. Werntges (edi@informatik.fh-wiesbaden.de)
|
20
|
+
#
|
21
|
+
# License: This code is put under the Ruby license
|
22
|
+
#
|
23
|
+
# Copyright (c) 2006 Heinz W. Werntges, FH Wiesbaden
|
24
|
+
#
|
25
|
+
|
26
|
+
# Include statement during test setup:
|
27
|
+
|
28
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
29
|
+
require 'edi4r'
|
30
|
+
require 'edi4r/edifact'
|
31
|
+
|
32
|
+
# Regular include statements:
|
33
|
+
|
34
|
+
#require "rubygems"
|
35
|
+
#require_gem "edi4r"
|
36
|
+
#require "edi4r/edifact"
|
37
|
+
|
38
|
+
|
39
|
+
HeaderRec = Struct.new('HeaderRec',
|
40
|
+
:bestellung, :satzartkennung, :iln_lieferanschrift, :iln_kaeufer,
|
41
|
+
:bestellnummer, :releasenummer,
|
42
|
+
:iln_lieferant, :lieferantennummer, :ust_id_lieferant,
|
43
|
+
:abteilung_beim_kaeufer, :ust_id_kaeufer,
|
44
|
+
:iln_rechnungsempfaenger, :abteilung_beim_rechnungsempfaenger, :ust_id_re,
|
45
|
+
:abteilung_der_lieferanschrift,
|
46
|
+
:iln_endempfaenger, :abteilung_beim_endempfaenger,
|
47
|
+
:datum_der_bestellung, :lieferdatum_gefordert, :pick_up_datum,
|
48
|
+
:waehrung, :nr_der_werbeaktion, :von_um, :bis
|
49
|
+
)
|
50
|
+
|
51
|
+
class Struct::HeaderRec
|
52
|
+
|
53
|
+
def initialize
|
54
|
+
self.satzartkennung = '100'
|
55
|
+
self.releasenummer = '11'
|
56
|
+
end
|
57
|
+
|
58
|
+
def to_s
|
59
|
+
[ bestellung, satzartkennung, iln_lieferanschrift, iln_kaeufer,
|
60
|
+
bestellnummer, releasenummer,
|
61
|
+
iln_lieferant, lieferantennummer, ust_id_lieferant,
|
62
|
+
abteilung_beim_kaeufer, ust_id_kaeufer,
|
63
|
+
iln_rechnungsempfaenger, abteilung_beim_rechnungsempfaenger, ust_id_re,
|
64
|
+
abteilung_der_lieferanschrift,
|
65
|
+
iln_endempfaenger, abteilung_beim_endempfaenger,
|
66
|
+
datum_der_bestellung, lieferdatum_gefordert, pick_up_datum,
|
67
|
+
waehrung, nr_der_werbeaktion, von_um, bis, '' ].join(';')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
ItemRec = Struct.new('ItemRec',
|
73
|
+
:bestellung, :satzartkennung, :iln_lieferanschrift, :iln_kaeufer,
|
74
|
+
:bestellnummer,
|
75
|
+
:positionsnummer, :ean, :artikelbezeichnung, :farbe, :groesse,
|
76
|
+
:lieferantenartikelnummer, :kaeuferartikelnummer,
|
77
|
+
:bestellmenge, :einheit, :preisbezugseinheit, :ek, :vk
|
78
|
+
)
|
79
|
+
|
80
|
+
class Struct::ItemRec
|
81
|
+
|
82
|
+
def initialize( header )
|
83
|
+
self.bestellung = header.bestellung
|
84
|
+
self.satzartkennung = '200'
|
85
|
+
self.iln_lieferanschrift = header.iln_lieferanschrift
|
86
|
+
self.iln_kaeufer = header.iln_kaeufer
|
87
|
+
self.bestellnummer = header.bestellnummer
|
88
|
+
end
|
89
|
+
|
90
|
+
def to_s
|
91
|
+
[ bestellung, satzartkennung, iln_lieferanschrift, iln_kaeufer,
|
92
|
+
bestellnummer,
|
93
|
+
positionsnummer, ean, artikelbezeichnung, farbe, groesse,
|
94
|
+
lieferantenartikelnummer, kaeuferartikelnummer,
|
95
|
+
bestellmenge, einheit, preisbezugseinheit, ek, vk, '' ].join(';')
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
class Inhouse_Data
|
101
|
+
|
102
|
+
# Add some constants that cannot be retrieved from EDIFACT
|
103
|
+
|
104
|
+
def initialize
|
105
|
+
@headers_since_last_item = 0
|
106
|
+
@items_since_last_header = 0
|
107
|
+
@records = []
|
108
|
+
end
|
109
|
+
|
110
|
+
# Expect/ensure (HeaderRec, ItemRec+)+
|
111
|
+
|
112
|
+
def add( record )
|
113
|
+
case record.class.to_s
|
114
|
+
when 'Struct::HeaderRec'
|
115
|
+
raise "ItemRec missing" if @headers_since_last_item > 0
|
116
|
+
@headers_since_last_item += 1
|
117
|
+
@items_since_last_header = 0
|
118
|
+
when 'Struct::ItemRec'
|
119
|
+
raise "HeaderRec missing" if @items_since_last_header == 0 and @headers_since_last_item == 0
|
120
|
+
raise "Data inconsistent" if @items_since_last_header > 0 and @headers_since_last_item > 0
|
121
|
+
@headers_since_last_item = 0
|
122
|
+
@items_since_last_header += 1
|
123
|
+
else
|
124
|
+
raise "Illegal object: class = #{record.class}"
|
125
|
+
end
|
126
|
+
@records << record
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
def to_s
|
131
|
+
raise "ItemRec missing" if @headers_since_last_item > 0
|
132
|
+
@records.inject('') {|s, rec| s << rec.to_s << "\r\n"}
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
class Inbound_Mapper
|
138
|
+
include EDI
|
139
|
+
|
140
|
+
def map_header_segments( msg, recs )
|
141
|
+
header = HeaderRec.new
|
142
|
+
msg.each do |seg|
|
143
|
+
seg_name = seg.name
|
144
|
+
seg_name += ' ' + seg.sg_name if seg.sg_name
|
145
|
+
case seg_name
|
146
|
+
when 'UNH'
|
147
|
+
|
148
|
+
when 'BGM'
|
149
|
+
header.bestellung = seg.cC002.d1001
|
150
|
+
header.bestellnummer = seg.cC106.d1004
|
151
|
+
|
152
|
+
# Demo of add-ons "edifact" and "format" to class Time
|
153
|
+
when 'DTM'
|
154
|
+
c507 = seg.cC507
|
155
|
+
case dtfnc=c507.d2005
|
156
|
+
when '137'
|
157
|
+
header.datum_der_bestellung = Time.edifact(c507.d2380, c507.d2379)
|
158
|
+
header.datum_der_bestellung.format='102'
|
159
|
+
when '2'
|
160
|
+
if (dtfmt=c507.d2379)=='719'
|
161
|
+
seg.cC507.d2380 =~ /(\d{8})(\d{4})(\d{8})(\d{4})/
|
162
|
+
raise "Delivery date: Start and end day must be equal" if $1 != $3
|
163
|
+
header.lieferdatum_gefordert = $1
|
164
|
+
header.von_um = $2
|
165
|
+
header.bis = $4 unless $4.empty?
|
166
|
+
else
|
167
|
+
header.lieferdatum_gefordert = Time.edifact(c507.d2380, c507.d2379)
|
168
|
+
header.lieferdatum_gefordert.format='102'
|
169
|
+
end
|
170
|
+
when '200'
|
171
|
+
header.pickup_datum = Time.edifact(c507.d2380, c507.d2379)
|
172
|
+
header.pickup_datum.format='102'
|
173
|
+
else
|
174
|
+
raise "Wrong function in DTM: #{dtfnc}. Expected: 2, 137, 200!"
|
175
|
+
end
|
176
|
+
|
177
|
+
when 'RFF SG1'
|
178
|
+
cde = seg.cC506
|
179
|
+
case cde.d1153
|
180
|
+
when 'PD'
|
181
|
+
header.nr_der_werbeaktion = cde.d1154
|
182
|
+
else
|
183
|
+
raise "Unsupported qualifier in RFF: #{cde.d1153}. Expected: PD!"
|
184
|
+
end
|
185
|
+
|
186
|
+
# Demo: Delegate mapping of a whole SG to some other module
|
187
|
+
when 'NAD SG2'
|
188
|
+
map_nad_sg2( seg.children_and_self, header ) # skipping segment COM...
|
189
|
+
when /\w\w\w SG[235]/
|
190
|
+
# ignore - handled by map_nad_sg2() where appropriate
|
191
|
+
|
192
|
+
when 'CUX SG7'
|
193
|
+
cde = seg.aC504[0]
|
194
|
+
raise "Only '2' expected in DE 6347" if cde.d6347 != '2'
|
195
|
+
raise "Only '9' expected in DE 6343" if cde.d6343 != '9'
|
196
|
+
header.waehrung = cde.d6345
|
197
|
+
|
198
|
+
# NOTE: We *could* have treated items (LIN SG28) also here, like NAD,
|
199
|
+
# but we put them into another method to keep things more modular.
|
200
|
+
|
201
|
+
when 'UNS'
|
202
|
+
# ignore
|
203
|
+
|
204
|
+
else
|
205
|
+
raise "Unsupported segment/group: #{seg_name}!"
|
206
|
+
end
|
207
|
+
end
|
208
|
+
recs.add header
|
209
|
+
header
|
210
|
+
end # map_header_segments
|
211
|
+
|
212
|
+
|
213
|
+
def map_nad_sg2( segs, header )
|
214
|
+
function, gln, additional_id, vat_id, p_dept, order_contact, delivery_contact, gr_contact = nil
|
215
|
+
segs.each do |seg|
|
216
|
+
seg_name = seg.name
|
217
|
+
seg_name += ' ' + seg.sg_name unless seg.sg_name.empty?
|
218
|
+
case seg_name
|
219
|
+
when 'NAD SG2'
|
220
|
+
function = seg.d3035 or raise "Mandatory NAD/3035 empty"
|
221
|
+
gln = seg.cC082.d3039
|
222
|
+
raise "GLN missing or not properly qualified" if gln.nil? or gln.empty? or seg.cC082.d3055 != '9'
|
223
|
+
|
224
|
+
when 'RFF SG3'
|
225
|
+
cde = seg.cC506
|
226
|
+
if cde.d1153=='YC1'
|
227
|
+
additional_id = cde.d1154
|
228
|
+
elsif cde.d1153=='VA'
|
229
|
+
vat_id = cde.d1154
|
230
|
+
else
|
231
|
+
raise "RFF SG3: Qualifier in 1153 not supported: #{cde.d1153}"
|
232
|
+
end
|
233
|
+
|
234
|
+
when 'CTA SG5'
|
235
|
+
case seg.d3139
|
236
|
+
when 'PD'
|
237
|
+
p_dept = seg.cC056.d3413
|
238
|
+
when 'OC'
|
239
|
+
order_contact = seg.cC056.d3413
|
240
|
+
when 'DL'
|
241
|
+
delivery_contact = seg.cC056.d3413
|
242
|
+
when 'GR'
|
243
|
+
gr_contact = seg.cC056.d3413
|
244
|
+
else
|
245
|
+
raise "CTA SG5: Qualifier in 3139 not supported: #{seg.d3139}"
|
246
|
+
end
|
247
|
+
|
248
|
+
else
|
249
|
+
raise "Unsupported segment: #{seg_name}"
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
case function
|
254
|
+
when 'SU'
|
255
|
+
header.iln_lieferant = gln
|
256
|
+
header.lieferantennummer = additional_id
|
257
|
+
header.ust_id_lieferant = vat_id
|
258
|
+
when 'BY'
|
259
|
+
header.iln_kaeufer = gln
|
260
|
+
header.ust_id_kaeufer = vat_id
|
261
|
+
header.abteilung_beim_kaeufer = p_dept
|
262
|
+
when 'IV'
|
263
|
+
header.iln_rechnungsempfaenger = gln
|
264
|
+
header.ust_id_re = vat_id
|
265
|
+
header.abteilung_beim_rechnungsempfaenger = order_contact
|
266
|
+
when 'DP'
|
267
|
+
header.iln_lieferanschrift = gln
|
268
|
+
header.abteilung_der_lieferanschrift = delivery_contact
|
269
|
+
when 'UC'
|
270
|
+
header.iln_endempfaenger = gln
|
271
|
+
header.abteilung_beim_endempfaenger = gr_contact
|
272
|
+
else
|
273
|
+
raise "Unsupported function: #{function}"
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
|
278
|
+
def map_item_segments( segs, recs, header )
|
279
|
+
item = ItemRec.new( header )
|
280
|
+
segs.each do |seg|
|
281
|
+
seg_name = seg.name
|
282
|
+
seg_name += ' ' + seg.sg_name if seg.sg_name
|
283
|
+
case seg_name
|
284
|
+
when 'LIN SG28'
|
285
|
+
item.positionsnummer = seg.d1082
|
286
|
+
item.ean = seg.cC212.d7140
|
287
|
+
raise "Mandatory qual. SRV missing in 7143" unless seg.cC212.d7143=='SRV'
|
288
|
+
|
289
|
+
when 'PIA SG28'
|
290
|
+
raise "PIA SG28 / 4347: Only '1' allowed here" unless seg.d4347=='1'
|
291
|
+
seg.aC212[0..1].each do |cde|
|
292
|
+
case cde.d7143
|
293
|
+
when 'IN'
|
294
|
+
item.kaeuferartikelnummer = cde.d7140
|
295
|
+
raise "PIA SG28/C212/3055: Only '92' allowed here" unless cde.d3055=='92'
|
296
|
+
when 'SA'
|
297
|
+
item.lieferantenartikelnummer = cde.d7140
|
298
|
+
raise "PIA SG28/C212/3055: Only '91' allowed here" unless cde.d3055=='91'
|
299
|
+
else
|
300
|
+
raise "PIA SG28: Qualifier in 7143 not supported: #{cde.d7143}"
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
when 'IMD SG28'
|
305
|
+
if seg.d7077=='A'
|
306
|
+
item.artikelbezeichnung = seg.cC273.a7008[0]
|
307
|
+
elsif seg.d7077=='F'
|
308
|
+
if seg.cC272.d7081 == '35'
|
309
|
+
item.farbe = seg.cC273.a7008[0]
|
310
|
+
elsif seg.cC272.d7081 == '98'
|
311
|
+
item.groesse = seg.cC273.a7008[0]
|
312
|
+
else
|
313
|
+
raise "IMD SG28/C272/7081: Only '35' or '98' allowed here"
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
when 'QTY SG28'
|
318
|
+
cde = seg.cC186
|
319
|
+
raise "QTY SG28/C186/6063: Only '21' allowed here" unless cde.d6063=='21'
|
320
|
+
item.bestellmenge = cde.d6060 or raise "Mandatory DE missing: 6060"
|
321
|
+
item.einheit = cde.d6411 || 'PCE'
|
322
|
+
|
323
|
+
when 'PRI SG32'
|
324
|
+
case (cde = seg.cC509).d5125
|
325
|
+
when 'AAA'
|
326
|
+
item.ek = cde.d5118
|
327
|
+
raise "5387 must bei 'LIU' here!" unless cde.d5387=='LIU'
|
328
|
+
|
329
|
+
when 'AAE'
|
330
|
+
item.vk = cde.d5118
|
331
|
+
raise "5387 must bei 'SRP' here!" unless cde.d5387=='SRP'
|
332
|
+
item.preisbezugseinheit = cde.d5284 || '1'
|
333
|
+
|
334
|
+
else
|
335
|
+
raise "PRI SG32: Qualifier in 5125 not supported: #{cde.d5125}"
|
336
|
+
end
|
337
|
+
|
338
|
+
else
|
339
|
+
raise "Unsupported segment/group: #{seg_name}!"
|
340
|
+
end
|
341
|
+
end
|
342
|
+
recs.add item
|
343
|
+
end
|
344
|
+
|
345
|
+
end # class Inbound_Mapper
|
346
|
+
|
347
|
+
|
348
|
+
#
|
349
|
+
# MAIN
|
350
|
+
#
|
351
|
+
|
352
|
+
# We assume that all input is subject to the same mapping code,
|
353
|
+
# and that all resulting messages go into the same inhouse file.
|
354
|
+
#
|
355
|
+
# Sender and recipient code of this interchange's UNB segment
|
356
|
+
# should match buyer and supplier of all messages.
|
357
|
+
#
|
358
|
+
|
359
|
+
if ARGV.empty?
|
360
|
+
ic = EDI::E::Interchange.parse($stdin)
|
361
|
+
else
|
362
|
+
File.open(ARGV[0]) {|hnd| ic = EDI::E::Interchange.parse(hnd)}
|
363
|
+
end
|
364
|
+
sender_id = ic.header.cS002.d0004
|
365
|
+
recipient_id = ic.header.cS003.d0010
|
366
|
+
|
367
|
+
recs = Inhouse_Data.new
|
368
|
+
mapper = Inbound_Mapper.new
|
369
|
+
ic.each do |msg|
|
370
|
+
|
371
|
+
header = mapper.map_header_segments( msg, recs )
|
372
|
+
raise "sender id mismatch" if sender_id != header.iln_kaeufer
|
373
|
+
raise "recipient id mismatch" if recipient_id != header.iln_lieferant
|
374
|
+
|
375
|
+
msg.find_all {|seg| seg.name=='LIN' && seg.sg_name=='SG28'}.each do |lin|
|
376
|
+
mapper.map_item_segments( lin.descendants_and_self, recs, header )
|
377
|
+
end
|
378
|
+
|
379
|
+
end
|
380
|
+
$stdout.write recs
|
data/test/groups.edi
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
UNA:+.? 'UNB+UNOB:3+sender+recipient+060801:1327+1'UNG+ORDERS+sender-g+recipient-g+060801:1327+1+UN+D:96A'UNE+0+1'UNG+ORDERS+sender+recipient+060801:1327+5+UN+D:96A'UNH+1+ORDERS:D:96A:UN'BGM++220'DTM+137:20060703:102'UNS+S'UNT+5+1'UNE+1+5'UNG+INVOIC+sender+recipient+060801:1327+3+UN+D:01B:EAN010'UNH+1+INVOIC:D:01B:UN:EAN010'BGM+380'DTM+137:20060801132728:204'UNS+S'MOA+86:0'UNT+6+1'UNE+1+3'UNZ+3+1'
|
data/test/in1.edi
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
UNA:+.? 'UNB+UNOC:3+2965197100002:14+2165197000009:14+060501:1611+1146492687.229+++++EANCOM+1'UNH+1+ORDERS:D:01B:UN:EAN010'BGM+220+12345+9'DTM+137:20040712:102'DTM+2:200404141245200404141420:719'RFF+PD:4712'NAD+SU+2165197000009::9'RFF+YC1:23456'RFF+VA:DE1234512345'NAD+BY+2965197100002::9'RFF+VA:DE1234512345'CTA+PD+1144'NAD+IV+2965197400003::9'RFF+VA:DE1234512346'CTA+OC+223'NAD+DP+2965197200009::9'CTA+DL+6677'NAD+UC+2965197300006::9'CTA+GR+9876'CUX+2:EUR:9'LIN+1++2165197000016:SRV'PIA+1+JEBL5023:SA::91+BLJE50:IN::92'IMD+A++:::Jeans?+mehr'IMD+F+35+:::Blau'IMD+F+98+:::50'QTY+21:10'PRI+AAA:30.0::LIU'PRI+AAE:99,0::SRP:1'LIN+2++2165197000023:SRV'PIA+1+JEBL5223:SA::91+BLJE52:IN::92'IMD+A++:::Jeans'IMD+F+35+:::Blau'IMD+F+98+:::52'QTY+21:10'PRI+AAA:40::LIU'PRI+AAE:120::SRP:1'UNS+S'UNT+37+1'UNZ+1+1146492687.229'
|
data/test/in1.inh
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
220;100;2965197200009;2965197100002;12345;11;2165197000009;23456;DE1234512345;1144;DE1234512345;2965197400003;223;DE1234512346;6677;2965197300006;9876;20040712;20040414;;EUR;4712;1245;1420;
|
2
|
+
220;200;2965197200009;2965197100002;12345;1;2165197000016;Jeans;Blau;50;JEBL5023;BLJE50;10;PCE;1;30;99;
|
3
|
+
220;200;2965197200009;2965197100002;12345;2;2165197000023;Jeans;Blau;52;JEBL5223;BLJE52;10;PCE;1;40;120;
|
data/test/in2.edi
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
UNA:+.? 'UNB+UNOC:3+2965197100002:14+2165197000009:14+060501:1611+1146492687.229+++++EANCOM+1'UNH+1+ORDERS:D:01B:UN:EAN010'BGM+220+12345+9'DTM+137:20040712:102'DTM+2:200404141245200404141420:719'RFF+PD:4712'NAD+SU+2165197000009::9'RFF+YC1:23456'RFF+VA:DE1234512345'NAD+BY+2965197100002::9'RFF+VA:DE1234512345'CTA+PD+1144'NAD+IV+2965197400003::9'RFF+VA:DE1234512346'CTA+OC+223'NAD+DP+2965197200009::9'CTA+DL+6677'NAD+UC+2965197300006::9'CTA+GR+9876'CUX+2:EUR:9'LIN+1++2165197000016:SRV'PIA+1+JEBL5023:SA::91++BLJE50:IN::92'IMD+A++:::Jeans?+mehr'IMD+F+35+:::Blau'IMD+F+98+:::50'QTY+21:10'PRI+AAA:30.0::LIU'PRI+AAE:99,0::SRP:1'LIN+2++2165197000023:SRV'PIA+1+JEBL5223:SA::91+BLJE52:IN::92'IMD+A++:::Jeans'IMD+F+35+:::Blau'IMD+F+98+:::52'QTY+21:10'PRI+AAA:40::LIU'PRI+AAE:120::SRP:1'UNS+S'UNT+37+1'UNZ+1+1146492687.229'
|
data/test/in2.xml
ADDED
@@ -0,0 +1,350 @@
|
|
1
|
+
<?xml version='1.0'?>
|
2
|
+
<!DOCTYPE Interchange PUBLIC
|
3
|
+
'-//FH Wiesbaden FB DCSM//DTD XML Representation of EDI data V1.1//EN'
|
4
|
+
'http://edi01.informatik.fh-wiesbaden.de/edi4r/edi4r-1.1.dtd'>
|
5
|
+
<Interchange version='3' standard_key='E'>
|
6
|
+
<Header>
|
7
|
+
<Segment name='UNB'>
|
8
|
+
<CDE name='S001'>
|
9
|
+
<DE name='0001'>UNOC</DE>
|
10
|
+
<DE name='0002'>3</DE>
|
11
|
+
</CDE>
|
12
|
+
<CDE name='S002'>
|
13
|
+
<DE name='0004'>2965197100002</DE>
|
14
|
+
<DE name='0007'>14</DE>
|
15
|
+
</CDE>
|
16
|
+
<CDE name='S003'>
|
17
|
+
<DE name='0010'>2165197000009</DE>
|
18
|
+
<DE name='0007'>14</DE>
|
19
|
+
</CDE>
|
20
|
+
<CDE name='S004'>
|
21
|
+
<DE name='0017'>060501</DE>
|
22
|
+
<DE name='0019'>1611</DE>
|
23
|
+
</CDE>
|
24
|
+
<DE name='0020'>1146492687.229</DE>
|
25
|
+
<DE name='0032'>EANCOM</DE>
|
26
|
+
<DE name='0035'>1</DE>
|
27
|
+
</Segment>
|
28
|
+
<Parameter name='UNA'>UNA:+.? '</Parameter>
|
29
|
+
</Header>
|
30
|
+
<Message>
|
31
|
+
<Header>
|
32
|
+
<Segment name='UNH'>
|
33
|
+
<DE name='0062'>1</DE>
|
34
|
+
<CDE name='S009'>
|
35
|
+
<DE name='0065'>ORDERS</DE>
|
36
|
+
<DE name='0052'>D</DE>
|
37
|
+
<DE name='0054'>01B</DE>
|
38
|
+
<DE name='0051'>UN</DE>
|
39
|
+
<DE name='0057'>EAN010</DE>
|
40
|
+
</CDE>
|
41
|
+
</Segment>
|
42
|
+
</Header>
|
43
|
+
<Segment name='BGM'>
|
44
|
+
<CDE name='C002'>
|
45
|
+
<DE name='1001'>220</DE>
|
46
|
+
</CDE>
|
47
|
+
<CDE name='C106'>
|
48
|
+
<DE name='1004'>12345</DE>
|
49
|
+
</CDE>
|
50
|
+
<DE name='1225'>9</DE>
|
51
|
+
</Segment>
|
52
|
+
<Segment name='DTM'>
|
53
|
+
<CDE name='C507'>
|
54
|
+
<DE name='2005'>137</DE>
|
55
|
+
<DE name='2380'>20040712</DE>
|
56
|
+
<DE name='2379'>102</DE>
|
57
|
+
</CDE>
|
58
|
+
</Segment>
|
59
|
+
<Segment name='DTM'>
|
60
|
+
<CDE name='C507'>
|
61
|
+
<DE name='2005'>2</DE>
|
62
|
+
<DE name='2380'>200404141245200404141420</DE>
|
63
|
+
<DE name='2379'>719</DE>
|
64
|
+
</CDE>
|
65
|
+
</Segment>
|
66
|
+
<SegmentGroup name='SG1'>
|
67
|
+
<Segment name='RFF'>
|
68
|
+
<CDE name='C506'>
|
69
|
+
<DE name='1153'>PD</DE>
|
70
|
+
<DE name='1154'>4712</DE>
|
71
|
+
</CDE>
|
72
|
+
</Segment>
|
73
|
+
</SegmentGroup>
|
74
|
+
<SegmentGroup name='SG2'>
|
75
|
+
<Segment name='NAD'>
|
76
|
+
<DE name='3035'>SU</DE>
|
77
|
+
<CDE name='C082'>
|
78
|
+
<DE name='3039'>2165197000009</DE>
|
79
|
+
<DE name='3055'>9</DE>
|
80
|
+
</CDE>
|
81
|
+
</Segment>
|
82
|
+
<SegmentGroup name='SG3'>
|
83
|
+
<Segment name='RFF'>
|
84
|
+
<CDE name='C506'>
|
85
|
+
<DE name='1153'>YC1</DE>
|
86
|
+
<DE name='1154'>23456</DE>
|
87
|
+
</CDE>
|
88
|
+
</Segment>
|
89
|
+
</SegmentGroup>
|
90
|
+
<SegmentGroup name='SG3'>
|
91
|
+
<Segment name='RFF'>
|
92
|
+
<CDE name='C506'>
|
93
|
+
<DE name='1153'>VA</DE>
|
94
|
+
<DE name='1154'>DE1234512345</DE>
|
95
|
+
</CDE>
|
96
|
+
</Segment>
|
97
|
+
</SegmentGroup>
|
98
|
+
</SegmentGroup>
|
99
|
+
<SegmentGroup name='SG2'>
|
100
|
+
<Segment name='NAD'>
|
101
|
+
<DE name='3035'>BY</DE>
|
102
|
+
<CDE name='C082'>
|
103
|
+
<DE name='3039'>2965197100002</DE>
|
104
|
+
<DE name='3055'>9</DE>
|
105
|
+
</CDE>
|
106
|
+
</Segment>
|
107
|
+
<SegmentGroup name='SG3'>
|
108
|
+
<Segment name='RFF'>
|
109
|
+
<CDE name='C506'>
|
110
|
+
<DE name='1153'>VA</DE>
|
111
|
+
<DE name='1154'>DE1234512345</DE>
|
112
|
+
</CDE>
|
113
|
+
</Segment>
|
114
|
+
</SegmentGroup>
|
115
|
+
<SegmentGroup name='SG5'>
|
116
|
+
<Segment name='CTA'>
|
117
|
+
<DE name='3139'>PD</DE>
|
118
|
+
<CDE name='C056'>
|
119
|
+
<DE name='3413'>1144</DE>
|
120
|
+
</CDE>
|
121
|
+
</Segment>
|
122
|
+
</SegmentGroup>
|
123
|
+
</SegmentGroup>
|
124
|
+
<SegmentGroup name='SG2'>
|
125
|
+
<Segment name='NAD'>
|
126
|
+
<DE name='3035'>IV</DE>
|
127
|
+
<CDE name='C082'>
|
128
|
+
<DE name='3039'>2965197400003</DE>
|
129
|
+
<DE name='3055'>9</DE>
|
130
|
+
</CDE>
|
131
|
+
</Segment>
|
132
|
+
<SegmentGroup name='SG3'>
|
133
|
+
<Segment name='RFF'>
|
134
|
+
<CDE name='C506'>
|
135
|
+
<DE name='1153'>VA</DE>
|
136
|
+
<DE name='1154'>DE1234512346</DE>
|
137
|
+
</CDE>
|
138
|
+
</Segment>
|
139
|
+
</SegmentGroup>
|
140
|
+
<SegmentGroup name='SG5'>
|
141
|
+
<Segment name='CTA'>
|
142
|
+
<DE name='3139'>OC</DE>
|
143
|
+
<CDE name='C056'>
|
144
|
+
<DE name='3413'>223</DE>
|
145
|
+
</CDE>
|
146
|
+
</Segment>
|
147
|
+
</SegmentGroup>
|
148
|
+
</SegmentGroup>
|
149
|
+
<SegmentGroup name='SG2'>
|
150
|
+
<Segment name='NAD'>
|
151
|
+
<DE name='3035'>DP</DE>
|
152
|
+
<CDE name='C082'>
|
153
|
+
<DE name='3039'>2965197200009</DE>
|
154
|
+
<DE name='3055'>9</DE>
|
155
|
+
</CDE>
|
156
|
+
</Segment>
|
157
|
+
<SegmentGroup name='SG5'>
|
158
|
+
<Segment name='CTA'>
|
159
|
+
<DE name='3139'>DL</DE>
|
160
|
+
<CDE name='C056'>
|
161
|
+
<DE name='3413'>6677</DE>
|
162
|
+
</CDE>
|
163
|
+
</Segment>
|
164
|
+
</SegmentGroup>
|
165
|
+
</SegmentGroup>
|
166
|
+
<SegmentGroup name='SG2'>
|
167
|
+
<Segment name='NAD'>
|
168
|
+
<DE name='3035'>UC</DE>
|
169
|
+
<CDE name='C082'>
|
170
|
+
<DE name='3039'>2965197300006</DE>
|
171
|
+
<DE name='3055'>9</DE>
|
172
|
+
</CDE>
|
173
|
+
</Segment>
|
174
|
+
<SegmentGroup name='SG5'>
|
175
|
+
<Segment name='CTA'>
|
176
|
+
<DE name='3139'>GR</DE>
|
177
|
+
<CDE name='C056'>
|
178
|
+
<DE name='3413'>9876</DE>
|
179
|
+
</CDE>
|
180
|
+
</Segment>
|
181
|
+
</SegmentGroup>
|
182
|
+
</SegmentGroup>
|
183
|
+
<SegmentGroup name='SG7'>
|
184
|
+
<Segment name='CUX'>
|
185
|
+
<CDE name='C504'>
|
186
|
+
<DE name='6347'>2</DE>
|
187
|
+
<DE name='6345'>EUR</DE>
|
188
|
+
<DE name='6343'>9</DE>
|
189
|
+
</CDE>
|
190
|
+
</Segment>
|
191
|
+
</SegmentGroup>
|
192
|
+
<SegmentGroup name='SG28'>
|
193
|
+
<Segment name='LIN'>
|
194
|
+
<DE name='1082'>1</DE>
|
195
|
+
<CDE name='C212'>
|
196
|
+
<DE name='7140'>2165197000016</DE>
|
197
|
+
<DE name='7143'>SRV</DE>
|
198
|
+
</CDE>
|
199
|
+
</Segment>
|
200
|
+
<Segment name='PIA'>
|
201
|
+
<DE name='4347'>1</DE>
|
202
|
+
<CDE name='C212'>
|
203
|
+
<DE name='7140'>JEBL5023</DE>
|
204
|
+
<DE name='7143'>SA</DE>
|
205
|
+
<DE name='3055'>91</DE>
|
206
|
+
</CDE>
|
207
|
+
<CDE name='C212' instance='3'>
|
208
|
+
<DE name='7140'>BLJE50</DE>
|
209
|
+
<DE name='7143'>IN</DE>
|
210
|
+
<DE name='3055'>92</DE>
|
211
|
+
</CDE>
|
212
|
+
</Segment>
|
213
|
+
<Segment name='IMD'>
|
214
|
+
<DE name='7077'>A</DE>
|
215
|
+
<CDE name='C273'>
|
216
|
+
<DE name='7008'>Jeans+mehr</DE>
|
217
|
+
</CDE>
|
218
|
+
</Segment>
|
219
|
+
<Segment name='IMD'>
|
220
|
+
<DE name='7077'>F</DE>
|
221
|
+
<CDE name='C272'>
|
222
|
+
<DE name='7081'>35</DE>
|
223
|
+
</CDE>
|
224
|
+
<CDE name='C273'>
|
225
|
+
<DE name='7008'>Blau</DE>
|
226
|
+
</CDE>
|
227
|
+
</Segment>
|
228
|
+
<Segment name='IMD'>
|
229
|
+
<DE name='7077'>F</DE>
|
230
|
+
<CDE name='C272'>
|
231
|
+
<DE name='7081'>98</DE>
|
232
|
+
</CDE>
|
233
|
+
<CDE name='C273'>
|
234
|
+
<DE name='7008'>50</DE>
|
235
|
+
</CDE>
|
236
|
+
</Segment>
|
237
|
+
<Segment name='QTY'>
|
238
|
+
<CDE name='C186'>
|
239
|
+
<DE name='6063'>21</DE>
|
240
|
+
<DE name='6060'>10</DE>
|
241
|
+
</CDE>
|
242
|
+
</Segment>
|
243
|
+
<SegmentGroup name='SG32'>
|
244
|
+
<Segment name='PRI'>
|
245
|
+
<CDE name='C509'>
|
246
|
+
<DE name='5125'>AAA</DE>
|
247
|
+
<DE name='5118'>30</DE>
|
248
|
+
<DE name='5387'>LIU</DE>
|
249
|
+
</CDE>
|
250
|
+
</Segment>
|
251
|
+
</SegmentGroup>
|
252
|
+
<SegmentGroup name='SG32'>
|
253
|
+
<Segment name='PRI'>
|
254
|
+
<CDE name='C509'>
|
255
|
+
<DE name='5125'>AAE</DE>
|
256
|
+
<DE name='5118'>99</DE>
|
257
|
+
<DE name='5387'>SRP</DE>
|
258
|
+
<DE name='5284'>1</DE>
|
259
|
+
</CDE>
|
260
|
+
</Segment>
|
261
|
+
</SegmentGroup>
|
262
|
+
</SegmentGroup>
|
263
|
+
<SegmentGroup name='SG28'>
|
264
|
+
<Segment name='LIN'>
|
265
|
+
<DE name='1082'>2</DE>
|
266
|
+
<CDE name='C212'>
|
267
|
+
<DE name='7140'>2165197000023</DE>
|
268
|
+
<DE name='7143'>SRV</DE>
|
269
|
+
</CDE>
|
270
|
+
</Segment>
|
271
|
+
<Segment name='PIA'>
|
272
|
+
<DE name='4347'>1</DE>
|
273
|
+
<CDE name='C212'>
|
274
|
+
<DE name='7140'>JEBL5223</DE>
|
275
|
+
<DE name='7143'>SA</DE>
|
276
|
+
<DE name='3055'>91</DE>
|
277
|
+
</CDE>
|
278
|
+
<CDE name='C212' instance='2'>
|
279
|
+
<DE name='7140'>BLJE52</DE>
|
280
|
+
<DE name='7143'>IN</DE>
|
281
|
+
<DE name='3055'>92</DE>
|
282
|
+
</CDE>
|
283
|
+
</Segment>
|
284
|
+
<Segment name='IMD'>
|
285
|
+
<DE name='7077'>A</DE>
|
286
|
+
<CDE name='C273'>
|
287
|
+
<DE name='7008'>Jeans</DE>
|
288
|
+
</CDE>
|
289
|
+
</Segment>
|
290
|
+
<Segment name='IMD'>
|
291
|
+
<DE name='7077'>F</DE>
|
292
|
+
<CDE name='C272'>
|
293
|
+
<DE name='7081'>35</DE>
|
294
|
+
</CDE>
|
295
|
+
<CDE name='C273'>
|
296
|
+
<DE name='7008'>Blau</DE>
|
297
|
+
</CDE>
|
298
|
+
</Segment>
|
299
|
+
<Segment name='IMD'>
|
300
|
+
<DE name='7077'>F</DE>
|
301
|
+
<CDE name='C272'>
|
302
|
+
<DE name='7081'>98</DE>
|
303
|
+
</CDE>
|
304
|
+
<CDE name='C273'>
|
305
|
+
<DE name='7008'>52</DE>
|
306
|
+
</CDE>
|
307
|
+
</Segment>
|
308
|
+
<Segment name='QTY'>
|
309
|
+
<CDE name='C186'>
|
310
|
+
<DE name='6063'>21</DE>
|
311
|
+
<DE name='6060'>10</DE>
|
312
|
+
</CDE>
|
313
|
+
</Segment>
|
314
|
+
<SegmentGroup name='SG32'>
|
315
|
+
<Segment name='PRI'>
|
316
|
+
<CDE name='C509'>
|
317
|
+
<DE name='5125'>AAA</DE>
|
318
|
+
<DE name='5118'>40</DE>
|
319
|
+
<DE name='5387'>LIU</DE>
|
320
|
+
</CDE>
|
321
|
+
</Segment>
|
322
|
+
</SegmentGroup>
|
323
|
+
<SegmentGroup name='SG32'>
|
324
|
+
<Segment name='PRI'>
|
325
|
+
<CDE name='C509'>
|
326
|
+
<DE name='5125'>AAE</DE>
|
327
|
+
<DE name='5118'>120</DE>
|
328
|
+
<DE name='5387'>SRP</DE>
|
329
|
+
<DE name='5284'>1</DE>
|
330
|
+
</CDE>
|
331
|
+
</Segment>
|
332
|
+
</SegmentGroup>
|
333
|
+
</SegmentGroup>
|
334
|
+
<Segment name='UNS'>
|
335
|
+
<DE name='0081'>S</DE>
|
336
|
+
</Segment>
|
337
|
+
<Trailer>
|
338
|
+
<Segment name='UNT'>
|
339
|
+
<DE name='0074'>37</DE>
|
340
|
+
<DE name='0062'>1</DE>
|
341
|
+
</Segment>
|
342
|
+
</Trailer>
|
343
|
+
</Message>
|
344
|
+
<Trailer>
|
345
|
+
<Segment name='UNZ'>
|
346
|
+
<DE name='0036'>1</DE>
|
347
|
+
<DE name='0020'>1146492687.229</DE>
|
348
|
+
</Segment>
|
349
|
+
</Trailer>
|
350
|
+
</Interchange>
|