UpLoadHandle.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Text;
  6. using Core.Mes.Client.Comm.Server;
  7. namespace Core.StlMes.Client.Lims.Data.PipeAndOutdec.数据管理.钢管实验管理
  8. {
  9. public class UpLoadHandle
  10. {
  11. public static bool Upload(string CHECK_NO, string cpt, string path, out string filePathNew, string ReportEnd ="")
  12. {
  13. WebClient webClient = new WebClient();
  14. List<FileBean> listPdf = new List<FileBean>();
  15. string url = "";
  16. // string filePathNew = ""; //报告目录
  17. string reportNo = ""; //报告编号
  18. url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=" + cpt + "&format=pdf&CHECK_NO=" + CHECK_NO;
  19. filePathNew = "Lims/pipe/" + path + "/" + CHECK_NO + "/";
  20. reportNo = CHECK_NO + ReportEnd;
  21. byte[] pdf = webClient.DownloadData(url);
  22. FileBean fileBean = new FileBean();
  23. fileBean.setFile(pdf);
  24. fileBean.setFileName(reportNo + ".pdf");
  25. fileBean.setPathName(filePathNew);
  26. listPdf.Add(fileBean);
  27. webClient.Dispose();
  28. return FileHelper.Upload(listPdf);
  29. }
  30. }
  31. }