Ejemplo n.º 1
0
        public static string FileConsult(string preinspcode)
        {
            DataTable dt   = Inspection.FileConsult(preinspcode);
            string    json = "";

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string downfile = HttpRuntime.AppDomainAppPath + @"\TempFile\tempPdf\" + dr["inspcode"] + ".pdf";
                    bool   bf       = true;
                    if (!File.Exists(downfile))
                    {
                        //PDF获取文件
                        System.Uri Uri      = new Uri("ftp://" + ConfigurationManager.AppSettings["FTPServer"] + ":" + ConfigurationManager.AppSettings["FTPPortNO"]);
                        string     UserName = ConfigurationManager.AppSettings["FTPUserName"];
                        string     Password = ConfigurationManager.AppSettings["FTPPassword"];
                        FtpHelper  ftp      = new FtpHelper(Uri, UserName, Password);
                        bf = ftp.DownloadFile("/" + dr["filename"].ToString2() + "", downfile);
                    }
                    if (bf)
                    {
                        //pdf转picture
                        string picPath = HttpRuntime.AppDomainAppPath + @"\TempFile\tempPic\";
                        json = ConvertPDF.pdfToPic(downfile, picPath, dr["inspcode"].ToString2());
                    }
                }
            }
            return(json);
        }