You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
9.8 KiB

4 days ago
  1. using NFine.Application.SRM;
  2. using NFine.Code;
  3. using NFine.Domain._03_Entity.SRM;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Web;
  10. using System.Web.Mvc;
  11. namespace NFine.Web.Areas.SRM.Controllers
  12. {
  13. public class BicDoc_BidController : ControllerBase
  14. {
  15. private BicDoc_SellerApp App = new BicDoc_SellerApp();
  16. //
  17. // GET: /SRM/BicDoc_Bid/
  18. public ActionResult ICSBidding_Bid()
  19. {
  20. return View();
  21. }
  22. public ActionResult ICSBiddingAdd_Bid()
  23. {
  24. return View();
  25. }
  26. public ActionResult ICSBiddingAdd_BidInfo()
  27. {
  28. return View();
  29. }
  30. [HttpGet]
  31. [HandlerAjaxOnly]
  32. public ActionResult GetGridJson(Pagination pagination, string queryJson)
  33. {
  34. DataTable ListData = App.GetGridJsonBid(queryJson, ref pagination);
  35. var JsonData = new
  36. {
  37. total = pagination.total,
  38. page = pagination.page,
  39. records = pagination.records,
  40. rows = ListData,
  41. };
  42. return Content(JsonData.ToJson());
  43. }
  44. [HttpGet]
  45. [HandlerAjaxOnly]
  46. public ActionResult GetSubGridJson(string STNO, Pagination pagination, string WorkPoint)
  47. {
  48. DataTable ListData = App.GetSubGridJsonBid(STNO, ref pagination, WorkPoint);
  49. var JsonData = new
  50. {
  51. total = pagination.total,
  52. page = pagination.page,
  53. records = pagination.records,
  54. rows = ListData,
  55. };
  56. return Content(JsonData.ToJson());
  57. }
  58. public ActionResult SearchBidDocBDInfoByBidCode(string BidCode, Pagination pagination)
  59. {
  60. DataTable ListData = App.SearchBidDocBDInfoByBidCode(BidCode, ref pagination);
  61. var JsonData = new
  62. {
  63. total = pagination.total,
  64. page = pagination.page,
  65. records = pagination.records,
  66. rows = ListData,
  67. };
  68. return Content(JsonData.ToJson());
  69. }
  70. public ActionResult SearchBidDocGYSInfoByBidCode(string BidCode, Pagination pagination)
  71. {
  72. DataTable ListDatas = App.SearchBidDocGYSInfoByBidCode(BidCode, ref pagination);
  73. var JsonData = new
  74. {
  75. total = pagination.total,
  76. page = pagination.page,
  77. records = pagination.records,
  78. rows = ListDatas,
  79. };
  80. return Content(JsonData.ToJson());
  81. }
  82. [HttpGet]
  83. [HandlerAjaxOnly]
  84. public ActionResult GetBidInfoByBidCodeAndBDID(string BidCode, string ID, string WorkPoint)
  85. {
  86. DataTable ListData = App.GetBidInfoByBidCodeAndBDID(BidCode, ID, WorkPoint);
  87. var JsonData = new
  88. {
  89. rows = ListData,
  90. };
  91. return Content(JsonData.ToJson());
  92. }
  93. public ActionResult SearchBidDocBDInfoByBidCodeAndID(string BidCode, string ID, string WorkPoint)
  94. {
  95. DataTable ListData = App.SearchBidDocBDInfoByBidCodeAndID(BidCode, ID, WorkPoint);
  96. var JsonData = new
  97. {
  98. rows = ListData,
  99. };
  100. return Content(JsonData.ToJson());
  101. }
  102. [HttpPost]
  103. public ActionResult SaveFormZB(ICSBidInfoDetail main)
  104. {
  105. try
  106. {
  107. App.SaveFormZB(main);
  108. return Success("保存成功");
  109. }
  110. catch (Exception ex)
  111. {
  112. return Error(ex.Message);
  113. }
  114. }
  115. public ActionResult SaveFormTiJiaoZB(string BidCode, ICSBidInfoDetail main)
  116. {
  117. try
  118. {
  119. App.SaveFormTiJiaoZB(BidCode, main);
  120. return Success("保存成功");
  121. }
  122. catch (Exception ex)
  123. {
  124. return Error(ex.Message);
  125. }
  126. }
  127. public ActionResult SaveFormQuX(string BidCode, string WorkPoint)
  128. {
  129. try
  130. {
  131. App.SaveFormQuX(BidCode, WorkPoint);
  132. return Success("保存成功");
  133. }
  134. catch (Exception ex)
  135. {
  136. return Error(ex.Message);
  137. }
  138. }
  139. public ActionResult SelectColumnName(string BidCode)
  140. {
  141. var data = App.SelectColumnName(BidCode);
  142. return Content(data.ToJson());
  143. }
  144. [HttpGet]
  145. public ActionResult GetListGridJsonTOZ(Pagination pagination, string BidCode)
  146. {
  147. DataTable ListData = App.GetListGridJsonTOZ(BidCode, ref pagination);
  148. var JsonData = new
  149. {
  150. total = pagination.total,
  151. page = pagination.page,
  152. records = pagination.records,
  153. rows = ListData,
  154. };
  155. return Content(JsonData.ToJson());
  156. }
  157. [HttpGet]
  158. public ActionResult GetListGridJsonTOZSUM(Pagination pagination, string BidCode)
  159. {
  160. DataTable ListData = App.GetListGridJsonTOZSUM(BidCode, ref pagination);
  161. var JsonData = new
  162. {
  163. total = pagination.total,
  164. page = pagination.page,
  165. records = pagination.records,
  166. rows = ListData,
  167. };
  168. return Content(JsonData.ToJson());
  169. }
  170. [HttpGet]
  171. [HandlerAjaxOnly]
  172. public ActionResult GetECNSubmitPerson(string BidCode)
  173. {
  174. DataTable dt = App.GetECNSubmitPerson(BidCode);
  175. return Content(dt.ToJson());
  176. }
  177. [HttpPost]
  178. public void DownloadFile( string BidCode)
  179. {
  180. //获取服务器中的文件路径
  181. List<string> listFJ = new List<string>();//保存附件路径
  182. string filePath = Server.MapPath("~\\File\\ZTBFile\\ddddXX二期开发计划.xlsx");
  183. listFJ.Add(filePath);
  184. //foreach (string path in list)
  185. //{
  186. // string filepath = Server.MapPath("../../UploadFile/GongGong/" + path);
  187. // //FTD.Unit.PublicMethod.DownloadFile(Server.MapPath("~"), filepath);
  188. // listFJ.Add(filepath);
  189. // listFJName.Add(path);
  190. //}
  191. string time = DateTime.Now.Ticks.ToString();
  192. //压缩文件
  193. //ZipFileMain(listFJ.ToArray(), null, Server.MapPath("~\\File\\ZTBFile\\" + time + ".zip"), 9);
  194. //下载文件
  195. DownloadFile("文件.zip", Server.MapPath("~\\File\\ZTBFile\\" + time + ".zip"));
  196. //FTD.Unit.PublicMethod.DownloadFile(Server.MapPath("~"), "../../UploadFile/GongGong/" + time + ".zip");
  197. }
  198. private void DownloadFile(string fileName, string filePath)
  199. {
  200. FileInfo fileInfo = new FileInfo(filePath);
  201. Response.Clear();
  202. Response.ClearContent();
  203. Response.ClearHeaders();
  204. Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
  205. Response.AddHeader("Content-Length", fileInfo.Length.ToString());
  206. Response.AddHeader("Content-Transfer-Encoding", "binary");
  207. Response.ContentType = "application/octet-stream";
  208. Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
  209. Response.WriteFile(fileInfo.FullName);
  210. Response.Flush();
  211. System.IO.File.Delete(filePath);//删除已下载文件
  212. Response.End();
  213. }
  214. /// <summary>
  215. /// 压缩文件
  216. /// </summary>
  217. /// <param name="filenames">要压缩的所有文件(完全路径)</param>
  218. /// <param name="filename">名称</param>
  219. /// <param name="name">压缩后文件路径</param>
  220. /// <param name="Level">压缩级别</param>
  221. //public void ZipFileMain(string[] filenames, string[] filename, string name, int Level)
  222. //{
  223. // ZipOutputStream s = new ZipOutputStream(System.IO.File.Create(name));
  224. // Crc32 crc = new Crc32();
  225. // //压缩级别
  226. // s.SetLevel(Level);// 0 - store only to 9 - means best compression
  227. // try
  228. // {
  229. // int m = 0;
  230. // foreach (string file in filenames)
  231. // {
  232. // //打开压缩文件
  233. // FileStream fs = System.IO.File.OpenRead(file);//文件地址
  234. // byte[] buffer = new byte[fs.Length];
  235. // fs.Read(buffer, 0, buffer.Length);
  236. // //建立压缩实体
  237. // ZipEntry entity = new ZipEntry(filename[m].ToString());//源文件名
  238. // //时间
  239. // entity.DateTime = DateTime.Now;
  240. // //控件大小
  241. // entity.Size = fs.Length;
  242. // fs.Close();
  243. // crc.Reset();
  244. // crc.Update(buffer);
  245. // entity.Crc = crc.Value;
  246. // s.PutNextEntry(entity);
  247. // s.Write(buffer, 0, buffer.Length);
  248. // m++;
  249. // }
  250. // }
  251. // catch (Exception)
  252. // {
  253. // throw;
  254. // }
  255. // finally
  256. // {
  257. // s.Finish();
  258. // s.Close();
  259. // }
  260. //}
  261. }
  262. }