Example #1
0
        public string 查询进场码头(string 英文船名, string 航次, string 提单号)
        {
            string 进场码头url = m_运抵报告对比进场码头url.Replace("#英文船名#", 英文船名);

            进场码头url = 进场码头url.Replace("#航次#", 航次);
            进场码头url = 进场码头url.Replace("#提单号#", 提单号);

            WebProxy webProxy = new WebProxy();

            webProxy.Encoding = Encoding.UTF8;
            string htmlInfo = webProxy.GetToString(进场码头url);

            return(nbedi.PageAnalyze.Parse查询进场码头(htmlInfo));
        }
Example #2
0
        /// <summary>
        /// 查询英文船名、航次、箱号、箱型、进港时间(运抵时间)、提单号
        /// </summary>
        /// <param name="提单号"></param>
        /// <returns></returns>
        public IList<集装箱数据> 查询集装箱数据(string 提单号, string 英文船名, string 航次)
        {
            List<集装箱数据> jzx = new List<集装箱数据>();

            WebProxy webProxy = new WebProxy();
            webProxy.Encoding = Encoding.UTF8;

            string htmlInfo = webProxy.GetToString(m_运抵报告url);

            HtmlAgilityPack.HtmlDocument _html = new HtmlAgilityPack.HtmlDocument();
            _html.LoadHtml(htmlInfo);

            HtmlAgilityPack.HtmlNode node_viewState = _html.DocumentNode.SelectSingleNode("/html[1]/body[1]/center[1]/input[1]/@value[1]");
            string viewState = node_viewState.Attributes["value"].Value;
            string postData = m_PostData运抵报告_first.Replace("#VIEWSTATE#", System.Web.HttpUtility.UrlEncode(viewState));

            HtmlAgilityPack.HtmlNode node_viewStateEncrypted = _html.DocumentNode.SelectSingleNode("/html[1]/body[1]/center[1]/input[2]/@value[1]");
            string viewStateEncrypted = node_viewStateEncrypted.Attributes["value"].Value;
            postData = postData.Replace("#VIEWSTATEENCRYPTED#", System.Web.HttpUtility.UrlEncode(viewStateEncrypted));

            HtmlAgilityPack.HtmlNode node_eventValidation = _html.DocumentNode.SelectSingleNode("/html[1]/body[1]/center[1]/input[3]/@value[1]");
            string eventValidation = node_eventValidation.Attributes["value"].Value;
            postData = postData.Replace("#EVENTVALIDATION#", System.Web.HttpUtility.UrlEncode(eventValidation));

            postData = postData.Replace("#提单号#", 提单号);
            postData = postData.Replace("#当前页数#", "1");

            htmlInfo = webProxy.PostToString(m_运抵报告url, postData);
            foreach (集装箱数据 item in nbedi.PageAnalyze.Parse查询集装箱数据(htmlInfo))
            {
                if (item.提单号 == 提单号 && item.船舶英文名称 == 英文船名 && item.航次 == 航次)
                {
                    jzx.Add(item);
                }
            }

            int pageCount = GetPageCount运抵报告(htmlInfo);

            if (pageCount > 1)
            {
                postData = m_PostData运抵报告_next.Replace("#VIEWSTATE#", System.Web.HttpUtility.UrlEncode(viewState));
                postData = postData.Replace("#VIEWSTATEENCRYPTED#", System.Web.HttpUtility.UrlEncode(viewStateEncrypted));
                postData = postData.Replace("#EVENTVALIDATION#", System.Web.HttpUtility.UrlEncode(eventValidation));
                postData = postData.Replace("#提单号#", 提单号);
            }

            for (int i = 2; i <= pageCount; i++)
            {
                System.Threading.Thread.Sleep(1000);

                postData = postData.Replace("#当前页数#", i.ToString());

                htmlInfo = webProxy.PostToString(m_运抵报告url, postData);
                foreach (集装箱数据 item in nbedi.PageAnalyze.Parse查询集装箱数据(htmlInfo))
                {
                    if (item.提单号 == 提单号 && item.船舶英文名称 == 英文船名 && item.航次 == 航次)
                    {
                        jzx.Add(item);
                    }
                }
            }

            foreach (集装箱数据 x in jzx)
            {
                x.堆场区 = 查询进场码头(x.船舶英文名称, x.航次, x.提单号);
            }

            return jzx;
        }
Example #3
0
        public string 查询进场码头(string 英文船名, string 航次, string 提单号)
        {
            string 进场码头url = m_运抵报告对比进场码头url.Replace("#英文船名#", 英文船名);
            进场码头url = 进场码头url.Replace("#航次#", 航次);
            进场码头url = 进场码头url.Replace("#提单号#", 提单号);

            WebProxy webProxy = new WebProxy();
            webProxy.Encoding = Encoding.UTF8;
            string htmlInfo = webProxy.GetToString(进场码头url);
            return nbedi.PageAnalyze.Parse查询进场码头(htmlInfo);
        }
Example #4
0
        /// <summary>
        /// 查询英文船名、航次、箱号、箱型、进港时间(运抵时间)、提单号
        /// </summary>
        /// <param name="提单号"></param>
        /// <returns></returns>
        public IList <集装箱数据> 查询集装箱数据(string 提单号, string 英文船名, string 航次)
        {
            List <集装箱数据> jzx = new List <集装箱数据>();

            WebProxy webProxy = new WebProxy();

            webProxy.Encoding = Encoding.UTF8;

            string htmlInfo = webProxy.GetToString(m_运抵报告url);

            HtmlAgilityPack.HtmlDocument _html = new HtmlAgilityPack.HtmlDocument();
            _html.LoadHtml(htmlInfo);

            HtmlAgilityPack.HtmlNode node_viewState = _html.DocumentNode.SelectSingleNode("/html[1]/body[1]/center[1]/input[1]/@value[1]");
            string viewState = node_viewState.Attributes["value"].Value;
            string postData  = m_PostData运抵报告_first.Replace("#VIEWSTATE#", System.Web.HttpUtility.UrlEncode(viewState));

            HtmlAgilityPack.HtmlNode node_viewStateEncrypted = _html.DocumentNode.SelectSingleNode("/html[1]/body[1]/center[1]/input[2]/@value[1]");
            string viewStateEncrypted = node_viewStateEncrypted.Attributes["value"].Value;

            postData = postData.Replace("#VIEWSTATEENCRYPTED#", System.Web.HttpUtility.UrlEncode(viewStateEncrypted));

            HtmlAgilityPack.HtmlNode node_eventValidation = _html.DocumentNode.SelectSingleNode("/html[1]/body[1]/center[1]/input[3]/@value[1]");
            string eventValidation = node_eventValidation.Attributes["value"].Value;

            postData = postData.Replace("#EVENTVALIDATION#", System.Web.HttpUtility.UrlEncode(eventValidation));

            postData = postData.Replace("#提单号#", 提单号);
            postData = postData.Replace("#当前页数#", "1");

            htmlInfo = webProxy.PostToString(m_运抵报告url, postData);
            foreach (集装箱数据 item in nbedi.PageAnalyze.Parse查询集装箱数据(htmlInfo))
            {
                if (item.提单号 == 提单号 && item.船舶英文名称 == 英文船名 && item.航次 == 航次)
                {
                    jzx.Add(item);
                }
            }

            int pageCount = GetPageCount运抵报告(htmlInfo);

            if (pageCount > 1)
            {
                postData = m_PostData运抵报告_next.Replace("#VIEWSTATE#", System.Web.HttpUtility.UrlEncode(viewState));
                postData = postData.Replace("#VIEWSTATEENCRYPTED#", System.Web.HttpUtility.UrlEncode(viewStateEncrypted));
                postData = postData.Replace("#EVENTVALIDATION#", System.Web.HttpUtility.UrlEncode(eventValidation));
                postData = postData.Replace("#提单号#", 提单号);
            }

            for (int i = 2; i <= pageCount; i++)
            {
                System.Threading.Thread.Sleep(1000);

                postData = postData.Replace("#当前页数#", i.ToString());

                htmlInfo = webProxy.PostToString(m_运抵报告url, postData);
                foreach (集装箱数据 item in nbedi.PageAnalyze.Parse查询集装箱数据(htmlInfo))
                {
                    if (item.提单号 == 提单号 && item.船舶英文名称 == 英文船名 && item.航次 == 航次)
                    {
                        jzx.Add(item);
                    }
                }
            }

            foreach (集装箱数据 x in jzx)
            {
                x.堆场区 = 查询进场码头(x.船舶英文名称, x.航次, x.提单号);
            }

            return(jzx);
        }