本文将以OTP项目为依托,对符合 X12 报文标准的 OTP 850 订单进行解读,并将其转换为更易处理的 XML 格式文件。

在此前的文章如何读懂 X12 中,我们对 X12 已经做了详细的解读,接下来开始深入了解 850 订单。

下图为 OTP EDI X12 850 示例报文转换前以及经知行之桥 EDI 系统转换后的效果对比图:

otc终端赋能手册(OTP850订单详解)(1)

OTP X12 850 示例订单详解

OTP会给供应商发送 符合X12 国际标准的 EDI 850 订单,示例如下:

1

2

3

4

5

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

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

<?xml version="1.0" encoding="UTF-8"?>

<EDI_850 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<Version>0.0.3</Version>

<Mode>T</Mode>

<!--采购订单编号-->

<PONumber>999262</PONumber>

<!--版本号-->

<ReleaseNumber>ReleaseNumber</ReleaseNumber>

<!--采购订单日期-->

<PODate>20160721</PODate>

<!--供应商识别号-->

<ContractNumber>12345678</ContractNumber>

<CurrencySpecification>

<!--当地连锁店货币代码-->

<LZCurrencyCode>USD</LZCurrencyCode>

<!--供应商货币代码-->

<VNCurrencyCode>USD</VNCurrencyCode>

</CurrencySpecification>

<!--供应商订单号-->

<VendorOrderNumber>VN123456</VendorOrderNumber>

<VendorOrderNumberDescription>description</VendorOrderNumberDescription>

<!--部门编号-->

<DepartmentNumber>DP123456</DepartmentNumber>

<DepartmentNumberDescription>description</DepartmentNumberDescription>

<!--买方名称-->

<MutuallyDefined>ZZ123456</MutuallyDefined>

<MutuallyDefinedDescription>description</MutuallyDefinedDescription>

<!--集团编号-->

<GroupNumber>6P123456</GroupNumber>

<GroupNumberDescription>description</GroupNumberDescription>

<!--文本信息1-->

<BuyerDebitMemoDescription>Note1</BuyerDebitMemoDescription>

<!--文本信息2-->

<PiggybackDescription>Note2</PiggybackDescription>

<!--文本信息3-->

<TriplebackDescription>Note3</TriplebackDescription>

<ShipmentTransportationInstructions>

<!--预付模式-->

<ShipmentMethodOfPayment>PP</ShipmentMethodOfPayment>

<!--预付信息-->

<LocationQualifier>PrepaidMessage</LocationQualifier>

<!--预付注释-->

<Description>PrepaidNote</Description>

</ShipmentTransportationInstructions>

<ShipmentTransportationInstructions>

<!--全额运费补贴模式-->

<ShipmentMethodOfPayment>CF</ShipmentMethodOfPayment>

<!--全额运费补贴-->

<LocationQualifier>FullFreightAllowanceMessage</LocationQualifier>

<!--全额运费补贴注释-->

<Description>Note</Description>

</ShipmentTransportationInstructions>

<ServicePromotionAllowanceOrChargeInfo>

<!--津贴标识-->

<AllowanceOrChargeIndicator>A</AllowanceOrChargeIndicator>

<!--广告津贴限定符-->

<ServicePromotionAllowanceChargeCode>A260</ServicePromotionAllowanceChargeCode>

<!--广告津贴编码-->

<AgencyServicePromotionAllowanceChargeCode>98al</AgencyServicePromotionAllowanceChargeCode>

<!--广告津贴数目-->

<Amount>100</Amount>

<!--广告津贴百分比限定符-->

<AllowanceOrChargePercentQualifier></AllowanceOrChargePercentQualifier>

<!--广告津贴百分比-->

<Percent>13%</Percent>

<Description></Description>

</ServicePromotionAllowanceOrChargeInfo>

<ServicePromotionAllowanceOrChargeInfo>

<!--收费标识-->

<AllowanceOrChargeIndicator>C</AllowanceOrChargeIndicator>

<!--最低收费限定符-->

<ServicePromotionAllowanceChargeCode>A010</ServicePromotionAllowanceChargeCode>

<!--最低收费编码-->

<AgencyServicePromotionAllowanceChargeCode>98ch</AgencyServicePromotionAllowanceChargeCode>

<!--最低收费数目-->

<Amount>100</Amount>

<!--最低收费百分比限定符-->

<AllowanceOrChargePercentQualifier></AllowanceOrChargePercentQualifier>

<!--最低收费百分比-->

<Percent>3%</Percent>

<Description></Description>

</ServicePromotionAllowanceOrChargeInfo>

<TermsOfSaleOrDefferdTermsOfSale>

<!--定期折扣百分比-->

<DiscountPercent>6%</DiscountPercent>

<!--折扣到期日-->

<DiscountDueDate>20220302</DiscountDueDate>

<!--折扣天数-->

<DiscountDaysDue>31</DiscountDaysDue>

<!--销售条款到期日-->

<NetDueDate>20220402</NetDueDate>

<!--销售条款描述-->

<Description>for sale</Description>

</TermsOfSaleOrDefferdTermsOfSale>

<RequestedShipDateTimeInfo>

<!--要求的发货日期-->

<Date>20221002</Date>

</RequestedShipDateTimeInfo>

<ShipNotBeforeDateTimeInfo>

<!--发货日期不能早于-->

<Date>20220930</Date>

</ShipNotBeforeDateTimeInfo>

<ShipNotAfterDateTimeInfo>

<!--发货日期不能晚于-->

<Date>20221010</Date>

</ShipNotAfterDateTimeInfo>

<DoNotDeliverAfterDateTimeInfo>

<!--交付日期不能晚于-->

<Date>20221031</Date>

</DoNotDeliverAfterDateTimeInfo>

<DoNotDeliverBeforeDateTimeInfo>

<!--交付日期不能早于-->

<Date>20221025</Date>

</DoNotDeliverBeforeDateTimeInfo>

<CarrierDetails>

<!--常规运输路线-->

<IdentificationCode>6547</IdentificationCode>

<!--运输路线描述-->

<Routing>shipmentdec</Routing>

</CarrierDetails>

<ShipToInfo>

<!--发货地名称-->

<Name>OTP RETAIL</Name>

<!--发货地编码-->

<AssignedByBuyerOrAgentId>0091</AssignedByBuyerOrAgentId>

<AddressInfo>

<!--发货方地址信息1-->

<Address>CHANGAN street</Address>

<!--发货方地址信息2-->

<Address2>No.098</Address2>

</AddressInfo>

<GeographicLocation>

<!--发货地城市-->

<CityName>XIAN</CityName>

<!--发货地址-->

<StateOrProvinceCode>YONGING</StateOrProvinceCode>

<!--发货地邮编-->

<PostalCode>710111</PostalCode>

<!--发货地国家编码-->

<CountryCode>CN</CountryCode>

</GeographicLocation>

</ShipToInfo>

<BillToInfo>

<!--付款方名称-->

<Name>billto</Name>

<!--付款方编码-->

<AssignedByBuyerOrAgentId>0034</AssignedByBuyerOrAgentId>

<AddressInfo>

<!--付款方地址信息1-->

<Address>wujiang street</Address>

<!--付款方地址信息2-->

<Address2>No.011</Address2>

</AddressInfo>

<GeographicLocation>

<!--付款方城市-->

<CityName>Suzhou</CityName>

<!--付款方地址-->

<StateOrProvinceCode>shizi</StateOrProvinceCode>

<!--付款方邮编-->

<PostalCode>215000</PostalCode>

<!--付款方国家编码-->

<CountryCode>CN</CountryCode>

</GeographicLocation>

</BillToInfo>

<VendorInfo>

<!--供应商名称-->

<Name>vender</Name>

<!--发货地编码-->

<AssignedByBuyerOrAgentId>0025</AssignedByBuyerOrAgentId>

<AddressInfo>

<!--供应商地址信息1-->

<Address>longhua street</Address>

<!--供应商地址信息2-->

<Address2>No.099</Address2>

</AddressInfo>

<GeographicLocation>

<!--供应商城市-->

<CityName>Haikou</CityName>

<!--供应商地址-->

<StateOrProvinceCode>haian</StateOrProvinceCode>

<!--供应商邮编-->

<PostalCode>571000</PostalCode>

<!--供应商国家编码-->

<CountryCode>CN</CountryCode>

</GeographicLocation>

</VendorInfo>

<BaselineItem>

<!--订购数量-->

<QuantityOrdered>144</QuantityOrdered>

<!--测量单位-->

<UOM>EA</UOM>

<!--单价-->

<UnitPrice>7.6</UnitPrice>

<!--供应商物料编号-->

<VendorItemNumber>123456000201</VendorItemNumber>

<!--产品标识符(SKU)-->

<SKU>00012345</SKU>

<!--产品编号(UCC-12)-->

<UPCConsumerPackageCode12>990</UPCConsumerPackageCode12>

<!--产品描述-->

<MutuallyDefinedNumber>VENDOR-STYLE-123</MutuallyDefinedNumber>

<!--内包装数量-->

<CommodityGrouping>34</CommodityGrouping>

<PriceInfo>

<!--零售价格-->

<UnitPrice>23</UnitPrice>

</PriceInfo>

<DestinationQuantity>

<!--ID-->

<IdentificationCode1>XIAN</IdentificationCode1>

<!--数量-->

<Quantity1>123</Quantity1>

<!--ID-->

<IdentificationCode2>CHENGDU</IdentificationCode2>

<!--数量-->

<Quantity2>345</Quantity2>

<IdentificationCode3></IdentificationCode3>

<Quantity3></Quantity3>

<IdentificationCode4></IdentificationCode4>

<Quantity4></Quantity4>

<IdentificationCode5></IdentificationCode5>

<Quantity5></Quantity5>

<IdentificationCode6></IdentificationCode6>

<Quantity6></Quantity6>

<IdentificationCode7></IdentificationCode7>

<Quantity7></Quantity7>

<IdentificationCode8></IdentificationCode8>

<Quantity8></Quantity8>

<IdentificationCode9></IdentificationCode9>

<Quantity9></Quantity9>

<IdentificationCode10></IdentificationCode10>

<Quantity10></Quantity10>

</DestinationQuantity>

<DeliveryRequestedDateTimeInfo>

<!--要求交付时间-->

<Date>20221002</Date>

</DeliveryRequestedDateTimeInfo>

</BaselineItem>

</EDI_850>

可以看到,经 EDI 系统转换之后的目标 XML 文件中,我们将业务数据与业务字段联系起来,这样的文件可读性更强,并且更方便进行下一步数据处理。

工作流示例

通过上述的讲解想必大家已经了解了 OTP 850 订单在知行之桥 EDI 系统中的转换流程了,以下是上述工作流示例,您可以下载知行之桥EDI系统,导入【示例工作流】以及【X12 850 测试文件】,进行实战操作。

下载示例工作流以及测试文件

在知行之桥 EDI 系统中导入上述工作流以及测试文件。

如下图所示:

otc终端赋能手册(OTP850订单详解)(2)

①先点击右上角的工作区齿轮图标,选择创建工作区,命名为OTP_850。

②然后选择导入工作区,选择OTP_850.arcflow。

③点开OTP_X12ToXML端口,点击上方 输入 ,在 更多 里点击上传文件,上传OTP_850_Sample.edi。

otc终端赋能手册(OTP850订单详解)(3)

④点开OTP_XMLMap_850端口,点击上方 输出 ,点击 OTP_850_Sample_850002059.xml 即可下载文件,看到转换后的结果。

otc终端赋能手册(OTP850订单详解)(4)

端口解读

以下端口是上述工作流的核心要素:

X12端口:即上文命名为OTP_X12ToXML的端口

X12端口可以将 XML 文档转换为 X12 文档,也可以将 X12 文档转换为 XML。本次示例中,需要将 XML Map 处理后的目标XML文件转换为X12 格式。生成 X12 文档时,X12 端口将 XML 转换为 X12 格式的文档,并生成适当的 X12 头,也就是我们上述报文讲解中出现的ISA字段。这个字段包含发送方ID以及接收方ID信息,您可以在X12 端口的设置选项卡中,根据您与文件接收方的实际情况设置以上信息。

XML MAP端口:即上文命名为OTP_XMLMap_850的端口

XML Map 端口提供了一种可视化设计器驱动的方式来将 XML 数据从一种结构转换为另一种结构。

XML Map 端口为转换 XML 结构提供了灵活且直观的界面。首先,应将源模板文件(包含所有输入文档的 XML 结构的文件)和目标模板文件(包含端口应输出的 XML 结构的文件)上传到端口。上述示例中我们已经提前将源模板以及目标模板文件设置好。 上传源和目标模板文件后,映射设计器将填充源和目标 XML 结构。然后,可以将源中的元素拖放到目标中的元素上,以建立映射关系。

以上是对接收 OTP 850 订单报文的解读以及转换的详细介绍,了解更多 OTP 的 EDI 报文信息,欢迎联系知行软件。

更多EDI信息,请参阅:EDI是什么? | EDI通信专家

,