Exemplo n.º 1
0
        internal XDocument GenerateTcsXDoc(XDocEntity entity, CusDataMsg cusMsg)
        {
            XDocument  tcsDoc  = XDocument.Parse(entity.XDoc.ToString());
            XDocument  msgDoc  = XDocument.Parse(cusMsg.MessageXml);
            XNamespace tcs     = entity.NS;
            XElement   tcsHead = tcsDoc.Root.Element("MessageHead");
            XElement   tcsBody = tcsDoc.Root.Element("MessageBody");

            //MessageHead赋值
            tcsHead.Element("MessageId").Value   = cusMsg.MessageId;
            tcsHead.Element("MessageTime").Value = string.Format("{0}{1}{2}{3}{4}{5}",
                                                                 DateTime.Now.Year.ToString(),
                                                                 DateTime.Now.Month.ToString().PadLeft(2, '0'),
                                                                 DateTime.Now.Day.ToString().PadLeft(2, '0'),
                                                                 DateTime.Now.Hour.ToString().PadLeft(2, '0'),
                                                                 DateTime.Now.Minute.ToString().PadLeft(2, '0'),
                                                                 DateTime.Now.Second.ToString().PadLeft(2, '0'));
            //TcsFlow赋值
            XElement flowEle = tcsBody.Element(tcs + "TcsFlow201").Element(tcs + "TcsFlow");

            flowEle.Element(tcs + "MessageId").Value = cusMsg.MessageId;
            flowEle.Element(tcs + "TaskId").Value    = cusMsg.TaskId;

            XElement declDocEle = tcsBody.Element(tcs + "TcsFlow201").Element(tcs + "TcsData").Element(tcs + "DeclarationDocument");

            //TcsDocumentNo赋值
            declDocEle.Element(tcs + "TcsDocumentNo").Value = cusMsg.TcsDocumentNo;
            //报关相关数据赋值
            XElement entryInfoEle      = declDocEle.Element(tcs + "EntryInformation");
            XElement declHeadEle       = msgDoc.Root.Element("EnvelopBody").Element("DECL_HEAD");
            XElement declListsEle      = msgDoc.Root.Element("EnvelopBody").Element("DECL_LISTS");
            XElement declContainersEle = msgDoc.Root.Element("EnvelopBody").Element("DECL_CONTAINERS");
            XElement declCertificates  = msgDoc.Root.Element("EnvelopBody").Element("DECL_CERTIFICATES");

            TransformEntryHeadData(declHeadEle);

            //EntryIdentityInformationList
            ParseEntryIdentityInformationList(entryInfoEle.Element(tcs + "EntryIdentityInformationList"), declHeadEle, tcs);
            //LogisticsLocationInformationList
            ParseLogisticsLocationInformationList(entryInfoEle.Element(tcs + "LogisticsLocationInformationList"), declHeadEle, tcs);
            //EportLocationInformationList
            ParseEportLocationInformationList(entryInfoEle.Element(tcs + "EportLocationInformationList"), declHeadEle, tcs);
            //BaseInformation
            ParseBaseInformation(entryInfoEle.Element(tcs + "BaseInformation"), declHeadEle);
            //GoodsInformationList
            ParseGoodsInformationList(entryInfoEle.Element(tcs + "GoodsInformationList"), declListsEle, tcs);
            //EntryContainerInformationList
            ParseEntryContainerInformationList(entryInfoEle.Element(tcs + "EntryContainerInformationList"), declContainersEle, tcs);
            //DocumentAttachedInformationList
            ParseDocumentAttachedInformationList(entryInfoEle.Element(tcs + "DocumentAttachedInformationList"), declCertificates, tcs);

            ParseTransitInformation(declDocEle, tcs, declHeadEle);

            return(tcsDoc);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 从配置文件获得版本升级信息
        /// </summary>
        /// <param name="docEntity">升级配置文件信息</param>
        /// <returns>升级信息实体</returns>
        internal UpdateInfo GetVersionIdFromConfig(XDocEntity docEntity)
        {
            XDocument  configDoc = docEntity.XDoc;
            UpdateInfo info      = new UpdateInfo()
            {
                AppName     = configDoc.Root.Element("ProgramName").Value,
                SysName     = configDoc.Root.Element("SoftName").Value,
                PackageName = configDoc.Root.Element("PacketName").Value,
                PackageUrl  = configDoc.Root.Element("PacketUrl").Value,
                Version     = configDoc.Root.Element("Version").Value
            };

            return(info);
        }