作者 朱兆平

update:

1. 增加运抵批量删除接口

Signed-off-by: mrz <17966059@qq.com>
@@ -28,3 +28,4 @@ kakoRevice/ @@ -28,3 +28,4 @@ kakoRevice/
28 /dist/ 28 /dist/
29 /nbdist/ 29 /nbdist/
30 /.nb-gradle/ 30 /.nb-gradle/
  31 +/customTemplate/
@@ -2,10 +2,12 @@ package com.tianbo.analysis.controller; @@ -2,10 +2,12 @@ package com.tianbo.analysis.controller;
2 2
3 3
4 import com.tianbo.analysis.model.AdvanceArrive; 4 import com.tianbo.analysis.model.AdvanceArrive;
  5 +import com.tianbo.analysis.model.BatchSend;
5 import com.tianbo.analysis.model.ResultJson; 6 import com.tianbo.analysis.model.ResultJson;
6 import com.tianbo.analysis.service.ArriveMasterService; 7 import com.tianbo.analysis.service.ArriveMasterService;
7 import com.tianbo.analysis.tools.WaybillTools; 8 import com.tianbo.analysis.tools.WaybillTools;
8 import io.swagger.annotations.ApiOperation; 9 import io.swagger.annotations.ApiOperation;
  10 +import org.apache.commons.lang.StringUtils;
9 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.web.bind.annotation.*; 12 import org.springframework.web.bind.annotation.*;
11 13
@@ -39,4 +41,30 @@ public class ArrivedAMasterController { @@ -39,4 +41,30 @@ public class ArrivedAMasterController {
39 return result>0? new ResultJson("200","提前运抵状态已更新"):new ResultJson("提前运抵状态更新失败"); 41 return result>0? new ResultJson("200","提前运抵状态已更新"):new ResultJson("提前运抵状态更新失败");
40 } 42 }
41 43
  44 + @PostMapping("batchDel")
  45 + public ResultJson batchDel(@RequestBody BatchSend batchSend, @CookieValue("username") String username, @CookieValue("userid") String userid){
  46 + if (StringUtils.isEmpty(batchSend.businessAlterLog.getAlterReason())){
  47 + return new ResultJson("400","未提交删除申请原因");
  48 + }
  49 +
  50 + if (StringUtils.isEmpty(batchSend.businessAlterLog.getContantname())){
  51 + return new ResultJson("400","未提交删除申请联系人或电话");
  52 + }
  53 +
  54 + if (StringUtils.isEmpty(batchSend.businessAlterLog.getContenttel())){
  55 + return new ResultJson("400","未提交删除申请电话");
  56 + }
  57 +
  58 + if (batchSend.billListDes==null || batchSend.billListDes.isEmpty()){
  59 + return new ResultJson("400","未选择运单");
  60 + }
  61 +
  62 + boolean b = arriveMasterService.batchDel(batchSend, username);
  63 + if (b){
  64 + return new ResultJson("200","批量删除申请发送成功");
  65 + }else {
  66 + return new ResultJson("400","批量删除申请发送失败");
  67 + }
  68 + }
  69 +
42 } 70 }
@@ -18,4 +18,6 @@ public interface ARRIVEDMASTERMapper { @@ -18,4 +18,6 @@ public interface ARRIVEDMASTERMapper {
18 int updateByPrimaryKeySelective(ARRIVEDMASTER record); 18 int updateByPrimaryKeySelective(ARRIVEDMASTER record);
19 19
20 int updateByPrimaryKey(ARRIVEDMASTER record); 20 int updateByPrimaryKey(ARRIVEDMASTER record);
  21 +
  22 + int updateDelStatusByPrimaryKey(List<ARRIVEDMASTER> record);
21 } 23 }
@@ -18,4 +18,6 @@ public interface ARRIVEDSECONDARYMapper { @@ -18,4 +18,6 @@ public interface ARRIVEDSECONDARYMapper {
18 int updateByPrimaryKeySelective(ARRIVEDSECONDARY record); 18 int updateByPrimaryKeySelective(ARRIVEDSECONDARY record);
19 19
20 int updateByPrimaryKey(ARRIVEDSECONDARY record); 20 int updateByPrimaryKey(ARRIVEDSECONDARY record);
  21 +
  22 + int updateDelStatusByPrimaryKey(List<ARRIVEDSECONDARY> record);
21 } 23 }
1 package com.tianbo.analysis.service; 1 package com.tianbo.analysis.service;
2 2
3 import com.tianbo.analysis.model.AdvanceArrive; 3 import com.tianbo.analysis.model.AdvanceArrive;
  4 +import com.tianbo.analysis.model.BatchSend;
4 import com.tianbo.analysis.model.PREPAREMASTER; 5 import com.tianbo.analysis.model.PREPAREMASTER;
5 import org.jetbrains.annotations.NotNull; 6 import org.jetbrains.annotations.NotNull;
6 7
@@ -25,4 +26,6 @@ public interface ArriveMasterService { @@ -25,4 +26,6 @@ public interface ArriveMasterService {
25 * todo: 提前运抵货代管理 26 * todo: 提前运抵货代管理
26 */ 27 */
27 boolean checkSender(String wayBillno); 28 boolean checkSender(String wayBillno);
  29 +
  30 + boolean batchDel(BatchSend batchSend, String username);
28 } 31 }
@@ -4,16 +4,23 @@ import com.tianbo.analysis.dao.*; @@ -4,16 +4,23 @@ import com.tianbo.analysis.dao.*;
4 import com.tianbo.analysis.model.*; 4 import com.tianbo.analysis.model.*;
5 import com.tianbo.analysis.service.ArriveMasterService; 5 import com.tianbo.analysis.service.ArriveMasterService;
6 import com.tianbo.analysis.tools.WaybillTools; 6 import com.tianbo.analysis.tools.WaybillTools;
  7 +import com.tianbo.analysis.tools.XSDValidateWithXML;
  8 +import com.tianbo.util.Date.DateUtil;
7 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
  10 +import org.apache.commons.io.FileUtils;
8 import org.jetbrains.annotations.NotNull; 11 import org.jetbrains.annotations.NotNull;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.beans.factory.annotation.Value;
9 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
  15 +import org.springframework.util.ResourceUtils;
  16 +import org.thymeleaf.TemplateEngine;
  17 +import org.thymeleaf.context.Context;
10 18
11 import javax.annotation.Resource; 19 import javax.annotation.Resource;
  20 +import java.io.File;
12 import java.math.BigDecimal; 21 import java.math.BigDecimal;
13 -import java.util.Arrays;  
14 -import java.util.Date;  
15 -import java.util.List;  
16 -import java.util.UUID; 22 +import java.nio.charset.StandardCharsets;
  23 +import java.util.*;
17 24
18 @Service 25 @Service
19 @Slf4j 26 @Slf4j
@@ -34,6 +41,15 @@ public class ArriveMasterServiceImpl implements ArriveMasterService { @@ -34,6 +41,15 @@ public class ArriveMasterServiceImpl implements ArriveMasterService {
34 @Resource 41 @Resource
35 SENDLOGMapper sendlogMapper; 42 SENDLOGMapper sendlogMapper;
36 43
  44 + @Autowired
  45 + private TemplateEngine templateEngine;
  46 +
  47 + @Value("${customs.xml-path}")
  48 + private String saveXmlDir;
  49 +
  50 + @Value("${customs.transport-number}")
  51 + private String transportNo;
  52 +
37 @Override 53 @Override
38 public boolean arrivedAhead(AdvanceArrive carAndWayBill) { 54 public boolean arrivedAhead(AdvanceArrive carAndWayBill) {
39 try { 55 try {
@@ -234,4 +250,151 @@ public class ArriveMasterServiceImpl implements ArriveMasterService { @@ -234,4 +250,151 @@ public class ArriveMasterServiceImpl implements ArriveMasterService {
234 public boolean checkSender(String wayBillno) { 250 public boolean checkSender(String wayBillno) {
235 return false; 251 return false;
236 } 252 }
  253 +
  254 + @Override
  255 + public boolean batchDel(BatchSend batchSend, String username) {
  256 + CustomsHead customsHead = new CustomsHead();
  257 + String nowStr = DateUtil.getCurrentTime17();
  258 + String messageID = "CN_"
  259 + + "MT3201"
  260 + + "_1P0_"
  261 + + transportNo+
  262 + "_" + nowStr;
  263 +
  264 + customsHead.setMessageId(messageID);
  265 + customsHead.setSendTime(nowStr);
  266 +
  267 + //航班信息存储
  268 + HashMap<String, String> flightMap = new HashMap<>();
  269 + ArrayList<Map> bills = new ArrayList<>();
  270 +
  271 +
  272 + /**
  273 + * noList: master;fc68f797-58f9-4276-850d-f772ab54e041;Y87489;2018/7/16 0:00:00;871-52149624;NO;4620
  274 + * noList: sub;e430bacf-d34d-49c4-a646-c6bab53245d9;Y87489;2018/7/16 0:00:00;871-52149624;5758599033;4620
  275 + * noList: sub;4ff7853f-0315-4632-ad0f-6a028054513d;Y87489;2018/7/16 0:00:00;871-52149624;5758599022;4620
  276 + * noList: sub;52dc1407-d686-42ac-87cd-ddacdb84ca18;Y87489;2018/7/16 0:00:00;871-52149624;5758599044;4620
  277 + * noList: sub;26bf643c-cf5b-4af2-8394-51585c02d88d;Y87489;2018/7/16 0:00:00;871-52149624;5758599077;4620
  278 + */
  279 + if (batchSend.billListDes!=null && !batchSend.billListDes.isEmpty() && batchSend.businessAlterLog!=null){
  280 + for (String item : batchSend.billListDes) {
  281 + HashMap<String, String> billsMap = new HashMap<>();
  282 + String[] split = item.split(";");
  283 + //单证类别:master为主单,sub为分单
  284 + String billType = split[0];
  285 + String billAutoId = split[1];
  286 + //航班号
  287 + String flightNo = split[2];
  288 + //航班日期
  289 + String flightDateString = split[3];
  290 + // 主单号
  291 + String billMasterNo = split[4].replace("-","");
  292 + // 分单号
  293 + String billSecNo = split[5];
  294 + // 申报关区
  295 + String customCode = split[6];
  296 +
  297 + flightMap.put("flightNo",flightNo);
  298 + flightMap.put("flightDate",flightDateString);
  299 + //设置关区
  300 + customsHead.setReceiverID(customCode);
  301 +
  302 + billsMap.put("billAutoId",billAutoId);
  303 + billsMap.put("billMasterNo",billMasterNo);
  304 + billsMap.put("billSecNo",billMasterNo +"_" +billSecNo);
  305 + billsMap.put("billType",billType);
  306 + bills.add(billsMap);
  307 + }
  308 + }
  309 +
  310 + Context context = new Context();
  311 + context.setVariable("bills",bills);
  312 + context.setVariable("head",customsHead);
  313 + context.setVariable("flight",flightMap);
  314 + context.setVariable("reason",batchSend.businessAlterLog);
  315 + context.setLocale(Locale.SIMPLIFIED_CHINESE);
  316 +
  317 + //生成的文件名
  318 + String fileName = messageID + ".xml";
  319 + //生成的报文路径,带斜杠
  320 + String filePath = saveXmlDir+fileName;
  321 + try {
  322 + File file = ResourceUtils.getFile(filePath);
  323 + /**
  324 + * 中文的地方在模板中要用utext,否则中文会被 escape 转义
  325 + */
  326 + String xmlStr = templateEngine.process("mt3201/MT3201_D.xml",context);
  327 + System.out.println("xmlStr = " + xmlStr);
  328 + boolean valied = XSDValidateWithXML.validateXMLSchema("xsd/Manifest_Arrival_Air_Delete_3201_3.xsd",xmlStr);
  329 +
  330 + if (valied){
  331 + // 生成报文
  332 + FileUtils.writeStringToFile(file,xmlStr, StandardCharsets.UTF_8);
  333 + log.info("[PRE-BATCH-SEND]-SUCCESS,批量删除发送成功");
  334 +
  335 + // 更新运单状态,含主单表和分单表
  336 + Boolean b = updateBatchStatus(batchSend, bills, username);
  337 + return b;
  338 + }else {
  339 + return false;
  340 + }
  341 + } catch (Exception e) {
  342 + log.error("[PRE-BATCH-DEL]-批量删除发生异常,{}",e.getMessage());
  343 + return false;
  344 + }
  345 + }
  346 +
  347 + private Boolean updateBatchStatus(BatchSend batchSend,ArrayList<Map> bills,String username) {
  348 + //存储更新主单状态的列表
  349 + ArrayList<ARRIVEDMASTER> masters = new ArrayList<>();
  350 + ArrayList<ARRIVEDSECONDARY> subs = new ArrayList<>();
  351 + List<SENDLOG> sendlogList = new ArrayList<>();
  352 +
  353 + for (Map<String,String> item : bills) {
  354 + // 批量插入发送日志
  355 + SENDLOG sendlog = new SENDLOG();
  356 + sendlog.setAutoid(UUID.randomUUID().toString());
  357 + sendlog.setMessageautoid(item.get("billAutoId"));
  358 + sendlog.setMessagetype(batchSend.businessAlterLog.getBusinesstype());
  359 + sendlog.setCreatedate(new Date());
  360 + sendlog.setReceiption("新舱单系统发送运抵舱单批量删除报");
  361 + sendlog.setOpauthor(username);
  362 + sendlog.setSendpeice(new Long(0));
  363 + sendlog.setSendweight(new BigDecimal(0));
  364 + sendlogList.add(sendlog);
  365 +
  366 + if ("master".equals(item.get("billType"))){
  367 + ARRIVEDMASTER master = new ARRIVEDMASTER();
  368 + master.setAutoid(item.get("billAutoId"));
  369 + masters.add(master);
  370 + }else {
  371 + ARRIVEDSECONDARY scondary = new ARRIVEDSECONDARY();
  372 + scondary.setAutoid(item.get("billAutoId"));
  373 + subs.add(scondary);
  374 + }
  375 + }
  376 + int i = sendlogMapper.batchInsert(sendlogList);
  377 + if (i>0){
  378 + log.info("[PRE-BATCH-DEL-LOG-INSERT]-SUCCESS");
  379 + }else {
  380 + log.error("[PRE-BATCH-DEL-LOG-INSERT]-FAILD");
  381 + return false;
  382 + }
  383 +
  384 + /**
  385 + * 以下两个批量更新语句无法返回具体影响行数,返回为-1
  386 + * 要么得配置在mybatis-config.xml,如下
  387 + * <configuration>
  388 + * <settings>
  389 + * <setting name="defaultExecutorType" value="SIMPLE"/>
  390 + * <setting name="defaultExecutorType" value="BATCH"/>
  391 + * </settings>
  392 + * </configuration>
  393 + */
  394 +
  395 + int i1 = arrivedmasterMapper.updateDelStatusByPrimaryKey(masters);
  396 + int i2 = arrivedsecondaryMapper.updateDelStatusByPrimaryKey(subs);
  397 +
  398 + return true;
  399 + }
237 } 400 }
@@ -360,4 +360,14 @@ @@ -360,4 +360,14 @@
360 ARRIVED_AHEAD = #{arrivedAhead,jdbcType=VARCHAR} 360 ARRIVED_AHEAD = #{arrivedAhead,jdbcType=VARCHAR}
361 where AUTOID = #{autoid,jdbcType=VARCHAR} 361 where AUTOID = #{autoid,jdbcType=VARCHAR}
362 </update> 362 </update>
  363 +
  364 + <update id="updateDelStatusByPrimaryKey" parameterType="java.util.List">
  365 + BEGIN
  366 + <foreach collection="list" item="item" index="index" separator=";">
  367 + UPDATE CGONMS.ARRIVEDMASTER
  368 + SET STATUS = '08'
  369 + WHERE AUTOID = #{item.autoid,jdbcType=VARCHAR}
  370 + </foreach>
  371 + ;END;
  372 + </update>
363 </mapper> 373 </mapper>
@@ -372,4 +372,14 @@ @@ -372,4 +372,14 @@
372 STATUS = #{status,jdbcType=VARCHAR} 372 STATUS = #{status,jdbcType=VARCHAR}
373 where AUTOID = #{autoid,jdbcType=VARCHAR} 373 where AUTOID = #{autoid,jdbcType=VARCHAR}
374 </update> 374 </update>
  375 +
  376 + <update id="updateDelStatusByPrimaryKey" parameterType="java.util.List">
  377 + BEGIN
  378 + <foreach collection="list" item="item" index="index" separator=";">
  379 + UPDATE CGONMS.ARRIVEDSECONDARY
  380 + SET STATUS = '08'
  381 + WHERE AUTOID = #{item.autoid,jdbcType=VARCHAR}
  382 + </foreach>
  383 + ;END;
  384 + </update>
375 </mapper> 385 </mapper>
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT3201:1">
  3 + <Head th:object="${head}">
  4 + <MessageID th:text="*{messageId}"></MessageID>
  5 + <FunctionCode>3</FunctionCode>
  6 + <MessageType>MT3201</MessageType>
  7 + <SenderID>460470678920X_DXPENT0000460002</SenderID>
  8 + <ReceiverID th:text="*{receiverID}"></ReceiverID>
  9 + <SendTime th:text="*{sendTime}"></SendTime>
  10 + <Version>1.0</Version>
  11 + </Head>
  12 + <Declaration th:object="${flight}">
  13 + <DeclarationOfficeID th:text="${head.receiverID}"></DeclarationOfficeID>
  14 + <BorderTransportMeans>
  15 + <JourneyID th:text="|*{flightNo}/*{#dates.format(flightDate,'yyyyMMdd')}|"></JourneyID>
  16 + </BorderTransportMeans>
  17 + <th:block th:each="bill : ${bills}">
  18 + <Consignment>
  19 + <TransportContractDocument>
  20 + <ID th:text="${bill.billMasterNo}"></ID>
  21 + </TransportContractDocument>
  22 + <th:block th:if="${bill.billType == 'sub'}">
  23 + <AssociatedTransportDocument>
  24 + <ID th:text="${bill.billSecNo}"></ID>
  25 + </AssociatedTransportDocument>
  26 + </th:block>
  27 + </Consignment>
  28 + </th:block>
  29 + <AdditionalInformation th:object="${reason}">
  30 + <Reason th:utext="*{alterReason}"></Reason>
  31 + <ContactName th:utext="*{contantname}"></ContactName>
  32 + <ContactTel th:text="*{contenttel}"></ContactTel>
  33 + </AdditionalInformation>
  34 + </Declaration>
  35 +</Manifest>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!-- edited with XMLSpy v2008 (http://www.altova.com) by lei_ying (szc) -->
  3 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT3201:1" xmlns:xdb="http://xmlns.oracle.com/xdb" targetNamespace="urn:Declaration:datamodel:standard:CN:MT3201:1" elementFormDefault="qualified" attributeFormDefault="unqualified">
  4 + <!--******中国海关空运出口运抵报告删除报文定义文档******-->
  5 + <!--命名空间:urn:Declaration:datamodel:standard:CN:MT3201:1-->
  6 +
  7 +
  8 +
  9 +
  10 + <!--******根元素定义******-->
  11 + <!--运抵报告以Manifest作为根节点-->
  12 + <xs:element name="Manifest" type="Manifest">
  13 + <xs:annotation>
  14 + <xs:documentation>空运出口运抵报告删除</xs:documentation>
  15 + </xs:annotation>
  16 + </xs:element>
  17 + <!--******根元素结构定义******-->
  18 +
  19 +
  20 + <xs:complexType name="Manifest">
  21 + <xs:annotation>
  22 + <xs:documentation>空运出口运抵报告删除</xs:documentation>
  23 + </xs:annotation>
  24 + <xs:sequence>
  25 + <xs:element name="Head" type="Head">
  26 + <xs:annotation>
  27 + <xs:documentation>报文头(循环次数:1)</xs:documentation>
  28 + </xs:annotation>
  29 + </xs:element>
  30 + <xs:element name="Declaration">
  31 + <xs:annotation>
  32 + <xs:documentation>报文体(循环次数:1)</xs:documentation>
  33 + </xs:annotation>
  34 + <xs:complexType>
  35 + <xs:complexContent>
  36 + <xs:extension base="Declaration"/>
  37 + </xs:complexContent>
  38 + </xs:complexType>
  39 +
  40 + </xs:element>
  41 + </xs:sequence>
  42 + </xs:complexType>
  43 + <!--******报文头结构定义******-->
  44 + <!--MessageType/报文类型代码:MT3201-->
  45 + <!--FunctionCode/报文功能代码:3-->
  46 +
  47 + <xs:complexType name="Head">
  48 + <xs:annotation>
  49 + <xs:documentation>报文头</xs:documentation>
  50 + </xs:annotation>
  51 + <xs:sequence>
  52 + <xs:element name="MessageID" >
  53 + <xs:annotation>
  54 + <xs:documentation>报文编号(循环次数:1)</xs:documentation>
  55 + </xs:annotation>
  56 + </xs:element>
  57 + <xs:element name="FunctionCode" fixed="3">
  58 + <xs:annotation>
  59 + <xs:documentation>报文功能代码(循环次数:1)</xs:documentation>
  60 + </xs:annotation>
  61 + </xs:element>
  62 + <xs:element name="MessageType" fixed="MT3201">
  63 + <xs:annotation>
  64 + <xs:documentation>报文类型代码(循环次数:1)</xs:documentation>
  65 + </xs:annotation>
  66 + </xs:element>
  67 + <xs:element name="SenderID" >
  68 + <xs:annotation>
  69 + <xs:documentation>发送方代码(循环次数:1)</xs:documentation>
  70 + </xs:annotation>
  71 + </xs:element>
  72 + <xs:element name="ReceiverID" >
  73 + <xs:annotation>
  74 + <xs:documentation>接受方代码(循环次数:1)</xs:documentation>
  75 + </xs:annotation>
  76 + </xs:element>
  77 + <xs:element name="SendTime" >
  78 + <xs:annotation>
  79 + <xs:documentation>发送时间(循环次数:1)</xs:documentation>
  80 + </xs:annotation>
  81 + </xs:element>
  82 + <xs:element name="Version" >
  83 + <xs:annotation>
  84 + <xs:documentation>报文版本号(循环次数:1)</xs:documentation>
  85 + </xs:annotation>
  86 + </xs:element>
  87 + </xs:sequence>
  88 + </xs:complexType>
  89 + <!--******报文体结构定义******-->
  90 +
  91 +
  92 + <xs:complexType name="Declaration">
  93 + <xs:annotation>
  94 + <xs:documentation>报文体</xs:documentation>
  95 + </xs:annotation>
  96 + <xs:sequence>
  97 + <xs:element name="DeclarationOfficeID" >
  98 + <xs:annotation>
  99 + <xs:documentation>065 Customs office of declaration,coded 申报地海关代码(循环次数:1)</xs:documentation>
  100 + </xs:annotation>
  101 + </xs:element>
  102 + <xs:element name="BorderTransportMeans" type="BorderTransportMeans">
  103 + <xs:annotation>
  104 + <xs:documentation>运输工具数据段(循环次数:1)</xs:documentation>
  105 + </xs:annotation>
  106 + </xs:element>
  107 + <xs:element name="UnloadingLocation" type="UnloadingLocation" minOccurs="0" maxOccurs="0">
  108 + <xs:annotation>
  109 + <xs:documentation>卸货地数据段(循环次数:0)</xs:documentation>
  110 + </xs:annotation>
  111 + </xs:element>
  112 + <xs:element name="Consignment" type="Consignment" maxOccurs="4999">
  113 + <xs:annotation>
  114 + <xs:documentation>提(运)单数据段(循环次数:1-9999)</xs:documentation>
  115 + </xs:annotation>
  116 + </xs:element>
  117 + <xs:element name="TransportEquipment" type="TransportEquipment" minOccurs="0" maxOccurs="0">
  118 + <xs:annotation>
  119 + <xs:documentation>集装箱数据段(循环次数:0)</xs:documentation>
  120 + </xs:annotation>
  121 + </xs:element>
  122 + <xs:element name="AdditionalInformation" type="AdditionalInformation" minOccurs="0">
  123 + <xs:annotation>
  124 + <xs:documentation>备注(循环次数:0-1)</xs:documentation>
  125 + </xs:annotation>
  126 + </xs:element>
  127 + </xs:sequence>
  128 + </xs:complexType>
  129 + <!--******茎元素结构定义******-->
  130 + <!--******运输工具数据段******-->
  131 +
  132 + <xs:complexType name="BorderTransportMeans">
  133 + <xs:annotation>
  134 + <xs:documentation>运输工具数据段</xs:documentation>
  135 + </xs:annotation>
  136 + <xs:sequence>
  137 + <xs:element name="JourneyID" >
  138 + <xs:annotation>
  139 + <xs:documentation>149 Conveyance reference number 航次航班编号(循环次数:1)</xs:documentation>
  140 + </xs:annotation>
  141 + </xs:element>
  142 + <xs:element name="TypeCode" minOccurs="0" maxOccurs="0">
  143 + <xs:annotation>
  144 + <xs:documentation>183 Mode/type of means of transport crossing the border code 运输方式代码(循环次数:0)</xs:documentation>
  145 + </xs:annotation>
  146 + </xs:element>
  147 + <xs:element name="ID" minOccurs="0" maxOccurs="0">
  148 + <xs:annotation>
  149 + <xs:documentation>167 Identification of means of transport crossing the border code 运输工具代码(循环次数:0)</xs:documentation>
  150 + </xs:annotation>
  151 + </xs:element>
  152 + <xs:element name="Name" minOccurs="0" maxOccurs="0">
  153 + <xs:annotation>
  154 + <xs:documentation>160 Identification of means of transport crossing the border 运输工具名称(循环次数:0)</xs:documentation>
  155 + </xs:annotation>
  156 + </xs:element>
  157 + </xs:sequence>
  158 + </xs:complexType>
  159 + <!--******卸货地数据段******-->
  160 + <xs:complexType name="UnloadingLocation">
  161 + <xs:annotation>
  162 + <xs:documentation>卸货地数据段</xs:documentation>
  163 + </xs:annotation>
  164 + <xs:sequence>
  165 + <xs:element name="ID" >
  166 + <xs:annotation>
  167 + <xs:documentation>080 Place of discharge code 卸货地代码(循环次数:1)</xs:documentation>
  168 + </xs:annotation>
  169 + </xs:element>
  170 + <xs:element name="ArrivalDate" >
  171 + <xs:annotation>
  172 + <xs:documentation>173 Date of arrival at place of discharge 到达卸货地日期(循环次数:1)</xs:documentation>
  173 + </xs:annotation>
  174 + </xs:element>
  175 + </xs:sequence>
  176 + </xs:complexType>
  177 + <!--******提(运)单数据段******-->
  178 +
  179 + <xs:complexType name="Consignment">
  180 + <xs:annotation>
  181 + <xs:documentation>提(运)单数据段</xs:documentation>
  182 + </xs:annotation>
  183 + <xs:sequence>
  184 + <xs:element name="TransportContractDocument" type="TransportContractDocument">
  185 + <xs:annotation>
  186 + <xs:documentation>运输合同信息(循环次数:1)</xs:documentation>
  187 + </xs:annotation>
  188 + </xs:element>
  189 + <xs:element name="AssociatedTransportDocument" type="AssociatedTransportDocument" minOccurs="0">
  190 + <xs:annotation>
  191 + <xs:documentation>运输合同附加信息(循环次数:0-1)</xs:documentation>
  192 + </xs:annotation>
  193 + </xs:element>
  194 + <xs:element name="ConsignmentPackaging" type="ConsignmentPackaging" minOccurs="0" maxOccurs="0">
  195 + <xs:annotation>
  196 + <xs:documentation>货物总件数+包装种类代码(循环次数:0)</xs:documentation>
  197 + </xs:annotation>
  198 + </xs:element>
  199 + <xs:element name="TotalGrossMassMeasure" minOccurs="0" maxOccurs="0">
  200 + <xs:annotation>
  201 + <xs:documentation>131 Total gross weight 货物总毛重(循环次数:0)</xs:documentation>
  202 + </xs:annotation>
  203 + </xs:element>
  204 + <xs:element name="ConsignmentItem" type="ConsignmentItem" minOccurs="0" maxOccurs="0">
  205 + <xs:annotation>
  206 + <xs:documentation>商品项信息(循环次数:0)</xs:documentation>
  207 + </xs:annotation>
  208 + </xs:element>
  209 + </xs:sequence>
  210 + </xs:complexType>
  211 + <!--运输合同信息-->
  212 + <xs:complexType name="TransportContractDocument">
  213 + <xs:annotation>
  214 + <xs:documentation>运输合同信息</xs:documentation>
  215 + </xs:annotation>
  216 + <xs:sequence>
  217 + <xs:element name="ID" >
  218 + <xs:annotation>
  219 + <xs:documentation>015 Transport document number 总提(运)单号(循环次数:1)</xs:documentation>
  220 + </xs:annotation>
  221 + </xs:element>
  222 + </xs:sequence>
  223 + </xs:complexType>
  224 + <!--运输合同附加信息-->
  225 + <xs:complexType name="AssociatedTransportDocument">
  226 + <xs:annotation>
  227 + <xs:documentation>运输合同附加信息</xs:documentation>
  228 + </xs:annotation>
  229 + <xs:sequence>
  230 + <xs:element name="ID" >
  231 + <xs:annotation>
  232 + <xs:documentation>189 Associated transport document number 分提(运)单号(循环次数:1)</xs:documentation>
  233 + </xs:annotation>
  234 + </xs:element>
  235 + </xs:sequence>
  236 + </xs:complexType>
  237 + <!--货物总件数/包装种类代码-->
  238 + <xs:complexType name="ConsignmentPackaging">
  239 + <xs:annotation>
  240 + <xs:documentation>货物总件数/包装种类代码</xs:documentation>
  241 + </xs:annotation>
  242 + <xs:sequence>
  243 + <xs:element name="QuantityQuantity" >
  244 + <xs:annotation>
  245 + <xs:documentation>146 Total number of packages 货物总件数(循环次数:1)</xs:documentation>
  246 + </xs:annotation>
  247 + </xs:element>
  248 + <xs:element name="TypeCode" >
  249 + <xs:annotation>
  250 + <xs:documentation>141 Type of packages identification 包装种类代码(循环次数:1)</xs:documentation>
  251 + </xs:annotation>
  252 + </xs:element>
  253 + </xs:sequence>
  254 + </xs:complexType>
  255 + <!--商品项信息-->
  256 + <xs:complexType name="ConsignmentItem">
  257 + <xs:annotation>
  258 + <xs:documentation>商品项信息</xs:documentation>
  259 + </xs:annotation>
  260 + <xs:sequence>
  261 + <xs:element name="SequenceNumeric" >
  262 + <xs:annotation>
  263 + <xs:documentation>006 Consignment item sequence number 商品项序号(循环次数:1)</xs:documentation>
  264 + </xs:annotation>
  265 + </xs:element>
  266 + <xs:element name="ConsignmentItemPackaging" type="ConsignmentItemPackaging">
  267 + <xs:annotation>
  268 + <xs:documentation>商品项包装信息(循环次数:1)</xs:documentation>
  269 + </xs:annotation>
  270 + </xs:element>
  271 + <xs:element name="Commodity" type="Commodity">
  272 + <xs:annotation>
  273 + <xs:documentation>商品项简要描述(循环次数:1)</xs:documentation>
  274 + </xs:annotation>
  275 + </xs:element>
  276 + <xs:element name="AdditionalInformation" type="AdditionalInformation">
  277 + <xs:annotation>
  278 + <xs:documentation>商品项补充描述(循环次数:1)</xs:documentation>
  279 + </xs:annotation>
  280 + </xs:element>
  281 + </xs:sequence>
  282 + </xs:complexType>
  283 + <!--商品项详细包装信息-->
  284 + <xs:complexType name="ConsignmentItemPackaging">
  285 + <xs:annotation>
  286 + <xs:documentation>商品项详细包装信息</xs:documentation>
  287 + </xs:annotation>
  288 + <xs:sequence>
  289 + <xs:element name="MarksNumbers" >
  290 + <xs:annotation>
  291 + <xs:documentation>142 Shipping marks 唛头(循环次数:1)</xs:documentation>
  292 + </xs:annotation>
  293 + </xs:element>
  294 + </xs:sequence>
  295 + </xs:complexType>
  296 + <!--商品项简要描述-->
  297 + <xs:complexType name="Commodity">
  298 + <xs:annotation>
  299 + <xs:documentation>商品项简要描述</xs:documentation>
  300 + </xs:annotation>
  301 + <xs:sequence>
  302 + <xs:element name="CargoDescription" >
  303 + <xs:annotation>
  304 + <xs:documentation>138 Brief cargo description 商品项简要描述(循环次数:1)</xs:documentation>
  305 + </xs:annotation>
  306 + </xs:element>
  307 + </xs:sequence>
  308 + </xs:complexType>
  309 + <!--******集装箱数据段******-->
  310 + <xs:complexType name="TransportEquipment">
  311 + <xs:annotation>
  312 + <xs:documentation>集装箱数据段</xs:documentation>
  313 + </xs:annotation>
  314 + <xs:sequence>
  315 + <xs:element name="EquipmentIdentification" type="EquipmentIdentification">
  316 + <xs:annotation>
  317 + <xs:documentation>集装箱(器)编号信息(循环次数:1)</xs:documentation>
  318 + </xs:annotation>
  319 + </xs:element>
  320 + <xs:element name="CharacteristicCode" >
  321 + <xs:annotation>
  322 + <xs:documentation>152 Equipment size and type identification 集装箱(器)尺寸和类型(循环次数:1)</xs:documentation>
  323 + </xs:annotation>
  324 + </xs:element>
  325 + <xs:element name="FullnessCode" >
  326 + <xs:annotation>
  327 + <xs:documentation>154 Transport equipment loaded status 重箱或者空箱标识代码(循环次数:1)</xs:documentation>
  328 + </xs:annotation>
  329 + </xs:element>
  330 + <xs:element name="SealID" maxOccurs="9">
  331 + <xs:annotation>
  332 + <xs:documentation>165 Seal number 封志类型/号码和施加封志人类型(循环次数:1-9)</xs:documentation>
  333 + </xs:annotation><xs:complexType>
  334 + <xs:attribute name="AgencyCode">
  335 + <xs:annotation>
  336 + <xs:documentation>230 Seal agency,coded 施加封志人类型</xs:documentation>
  337 + </xs:annotation>
  338 + </xs:attribute>
  339 + </xs:complexType>
  340 + </xs:element>
  341 + </xs:sequence>
  342 + </xs:complexType>
  343 + <!--集装箱(器)编号信息-->
  344 + <xs:complexType name="EquipmentIdentification">
  345 + <xs:annotation>
  346 + <xs:documentation>集装箱(器)编号信息</xs:documentation>
  347 + </xs:annotation>
  348 + <xs:sequence>
  349 + <xs:element name="ID" >
  350 + <xs:annotation>
  351 + <xs:documentation>159 Equipment identification number 集装箱(器)编号(循环次数:1)</xs:documentation>
  352 + </xs:annotation>
  353 + </xs:element>
  354 + </xs:sequence>
  355 + </xs:complexType>
  356 + <!--******补充信息数据段******-->
  357 +
  358 +
  359 +
  360 + <xs:complexType name="AdditionalInformation">
  361 + <xs:annotation>
  362 + <xs:documentation>补充信息数据段</xs:documentation>
  363 + </xs:annotation>
  364 + <xs:sequence>
  365 + <xs:element name="Reason" minOccurs="0">
  366 + <xs:annotation>
  367 + <xs:documentation>变更原因描述</xs:documentation>
  368 + </xs:annotation>
  369 + </xs:element>
  370 + <xs:element name="ContactName" minOccurs="0">
  371 + <xs:annotation>
  372 + <xs:documentation>变更申请联系人姓名</xs:documentation>
  373 + </xs:annotation>
  374 + </xs:element>
  375 + <xs:element name="ContactTel" minOccurs="0">
  376 + <xs:annotation>
  377 + <xs:documentation>变更申请联系人电话</xs:documentation>
  378 + </xs:annotation>
  379 + </xs:element>
  380 + <xs:element name="Content" minOccurs="0">
  381 + <xs:annotation>
  382 + <xs:documentation>105 Free text 备注(循环次数:1)</xs:documentation>
  383 + </xs:annotation>
  384 + </xs:element>
  385 + </xs:sequence>
  386 + </xs:complexType>
  387 +</xs:schema>