如何将EDI报文转换为CSV格式文件?
阅读原文时间:2022年02月08日阅读:2

如果您对EDI项目实施有一定的了解,想必您一定知道,在正式开始EDI项目实施之前,都会有EDI顾问与您接洽,沟通EDI项目需求。其中,会包含EDI通信双方使用哪种传输协议,传输的报文是符合什么标准的,传输的业务报文都包含哪些种类,标准的EDI报文转换成什么格式,是否与企业现有业务系统集成。以上问题,在项目需求沟通初期都务必要确认清楚。

以上,我们提到标准的EDI报文转换成什么格式,这一问题其实也是很多客户在项目实施中比较纠结的一点。实际上,这主要取决于您企业的信息化情况。通常,企业如已有业务系统,为了实现数据自动化处理,都会选择与现有的业务系统集成,支持的方式有很多,比如金蝶、用友可以通过数据库表方式与EDI系统集成,某客户的物流管理系统选择API方式与EDI系统集成,诸如此类。当然,也存在部分客户没有业务系统的情况,那EDI数据转换成什么格式才方便业务人员读取、操作呢?

本文以X12 830报文转换为CSV格式文件为例,从收到X12 830报文开始,依次按照系统处理顺序,介绍如何使用知行EDI系统将X12 830报文转换为CSV格式。实际上,CSV这种方案不只是适用于没有业务系统的企业,有的业务系统也是支持直接导入CSV格式文件的,同样也适用CSV方案。

以下,是一个完整的X12 830报文转换为CSV格式的工作流。其中,经由3个端口处理,最终解析得到CSV格式的830文件。

X12ToXML端口

首先,配置X12端口转换类型(Translation Type)为X12 to XML,用于将X12标准报文转换为XML格式。此外,还要配置Sender Id Qualifier及Sender Identifier等信息。

配置完后,在Input界面上传需要转换为CSV格式的X12 830报文。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

ISA*00*          *00*          *ZZ*O0013000111111 *ZZ*123456         *200227*0700*U*00200*000000045*0*P*>

GS*PS*O00130001111*123456*20200227*0700*000000045*X*004010

ST*830*450001

BFR*05**21*DL*A*20200217**20200227

N1*MI

PER*SC**TE*123456788

N1*ST*ABC*92*1100

N1*SU*CAB Automotive

LIN*00020*BP*12AB4356*PO*1234546543

UIT*PC

PID*F****HOUSING-TEST

FST*4032*C*D*20200217*20200217

FST*6048*C*D*20200224*20200224

SHP*01*6048*050*20200210

SHP*02*75456*050*20200210

CTT*1

SE*15*450001

GE*1*000000045

IEA*1*000000045

系统默认已开启自动处理,当前X12ToXML端口会自动将X12 830报文转换为XML格式。在Output页面中可以下载并查看。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

    

00

                  

        00

                  

        ZZ

        O0013000111111

        ZZ

        123456        

        200227

        0700

        U

        00200

        000000045

        0

        P

        >

    

    

PS

            O00130001111

            123456

            20200227

            0700

            000000045

            X

            004010

        

        

            

830

                    450001

                

                

                    05

                    

                    21

                    DL

                    A

                    20200217

                    

                    20200227

                

                

                    

                        MI

                    

                    

                        SC

                        

                        TE

                        123456788

                    

                

                

                    

                        ST

                        ABC

                        92

                        1100

                    

                

                

                    

                        SU

                        CAB Automotive

                    

                

                

                    

                        00020

                        BP

                        12AB4356

                        PO

                        1234546543

                    

                    

                        

                            PC

                        

                    

                    

                        F

                        

                        

                        

                        HOUSING-TEST

                    

                    

                        

                            4032

                            C

                            D

                            20200217

                            20200217

                        

                    

                    

                        

                            6048

                            C

                            D

                            20200224

                            20200224

                        

                    

                    

                        

                            01

                            6048

                            050

                            20200210

                        

                    

                    

                        

                            02

                            75456

                            050

                            20200210

                        

                    

                

                

                    1

                

            

        

    

XMlMap830端口

经由X12ToXML端口端口处理后,得到以上XML格式文件。接下来,通过XMlMap830端口处理可以将原本多层复杂结构的知行EDI系统默认XML格式文件转换为单层结构的XML文件。与上一步X12转换为XML不同的是,XMlMap830端口是需要通过界面操作拖拽完成数据关系映射来完成。

转化后,得到以下单层结构的XML格式文件,以便后续CSV端口处理。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

  <_830>

    

    21

    DL

    A

    20200217

    20200227

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    SC

    TE

    123456788

    1100

    ABC

    

    

    

    

    

    

    

    

    

    

    CAB Automotive

    

    

    

    

    

    

    

    

    

    00020

    12AB4356

    HOUSING-TEST

    

    1234546543

    PC

    

    

    

    

    

    

    

    

    

    4032

    C

    D

    20200217

    20200217

    

    6048

    

    

    20200210

    

    

    

    

  

  <_830>

    

    21

    DL

    A

    20200217

    20200227

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    SC

    TE

    123456788

    1100

    ABC

    

    

    

    

    

    

    

    

    

    

    CAB Automotive

    

    

    

    

    

    

    

    

    

    00020

    12AB4356

    HOUSING-TEST

    

    1234546543

    PC

    

    

    

    

    

    

    

    

    

    6048

    C

    D

    20200224

    20200224

    

    6048

    

    

    20200210

    

    

    

    

  

XMlMap830端口

最后一步,通过CSV端口就可以将XML格式的文件转换为CSV格式。无需代码,使用端口现有功能即可快速将XML格式转换为CSV格式文件。

1

2

3

"ForecastNo","ReleaseNo","ScheduleType","ScheduleQtyType","StartDate","ForecastCreateDate","NotesID","Notes","RoutingSequenceCode","CarrierCode","TransportMethodCode","RoutingInformation","MaterialReleaseIssuerID","MaterialReleaseIssuerName","MaterialReleaseIssuerAddress1","MaterialReleaseIssuerAddress2","MaterialReleaseIssuerCity","MaterialReleaseIssuerState","MaterialReleaseIssuerPostal","MaterialReleaseIssuerCountry","MaterialReleaseIssuerContactCode","MaterialReleaseIssuerCommunicationType","MaterialReleaseIssuerCommunicationNumber","ShiptoID","ShiptoName","ShiptoAddress1","ShiptoAddress2","ShiptoCity","ShiptoState","ShiptoPostal","ShiptoCountry","ShiptoContactCode","ShiptoCommunicationType","ShiptoCommunicationNumber","SupplierID","SupplierName","SupplierAddress1","SupplierAddress2","SupplierCity","SupplierState","SupplierPostal","SupplierCountry","SupplierContactCode","SupplierCommunicationType","SupplierCommunicationNumber","POLineNumber","BuyerPartNumber","PartDescription","PartRevisionLevel","PONumber","Unit","UnitPrice","ExpeditorName","ExpeditorTel","MaterialSchedulerName","MaterialSchedulerTel","ResourceAuthorizationCode","AuthorizationThroughDate","AuthorizationCumulatedQuantity","CumulativeStartDate","Quantity","ForecastCode","ForecastTime","ScheduleStartDate","ScheduleEndDate","ForecastReferenceNumber","LastReceivedQty","CumulativeQtyReceived","CumulativeScrapQtyReceived","LastReceivedDate","CumulativeQtyReceivedStartDate","CumulativeQtyReceivedEndDate","CumulativeScrapQtyReceivedStartDate","CumulativeScrapQtyReceivedEndDate"

"","21","DL","A","20200217","20200227","","","","","","","","","","","","","","","SC","TE","123456788","1100","ABC","","","","","","","","","","","CAB Automotive","","","","","","","","","","00020","12AB4356","HOUSING-TEST","","1234546543","PC","","","","","","","","","","4032","C","D","20200217","20200217","","6048","","","20200210","","","",""

"","21","DL","A","20200217","20200227","","","","","","","","","","","","","","","SC","TE","123456788","1100","ABC","","","","","","","","","","","CAB Automotive","","","","","","","","","","00020","12AB4356","HOUSING-TEST","","1234546543","PC","","","","","","","","","","6048","C","D","20200224","20200224","","6048","","","20200210","","","",""

经过以上3个端口的一次处理,原本生涩难懂的X12 830报文已经转为了CSV格式。不论是直接导入现有业务系统或是直接打开查看,您就能轻松地读取到重要的业务信息。