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.

245 lines
8.2 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_SellerController : ControllerBase
  14. {
  15. private BicDoc_SellerApp App = new BicDoc_SellerApp();
  16. //
  17. // GET: /SRM/BicDoc_Seller/
  18. public ActionResult ICSBidding_Seller()
  19. {
  20. return View();
  21. }
  22. public ActionResult ICSBiddingAdd_Seller()
  23. {
  24. return View();
  25. }
  26. public ActionResult GetGridJson(Pagination pagination, string queryJson)
  27. {
  28. DataTable ListData = App.GetGridJson(queryJson, ref pagination);
  29. var JsonData = new
  30. {
  31. total = pagination.total,
  32. page = pagination.page,
  33. records = pagination.records,
  34. rows = ListData,
  35. };
  36. return Content(JsonData.ToJson());
  37. }
  38. [HttpGet]
  39. [HandlerAjaxOnly]
  40. public ActionResult GetSubGridJson(string STNO, Pagination pagination,string WorkPoint)
  41. {
  42. DataTable ListData = App.GetSubGridJson(STNO, ref pagination, WorkPoint);
  43. var JsonData = new
  44. {
  45. total = pagination.total,
  46. page = pagination.page,
  47. records = pagination.records,
  48. rows = ListData,
  49. };
  50. return Content(JsonData.ToJson());
  51. }
  52. //public ActionResult GetICSBidDoc(string BidCode, string WorkPoint, Pagination pagination)
  53. //{
  54. // DataTable ListData = App.GetICSBidDoc(BidCode, WorkPoint, ref pagination);
  55. // var JsonData = new
  56. // {
  57. // total = pagination.total,
  58. // page = pagination.page,
  59. // records = pagination.records,
  60. // rows = ListData,
  61. // };
  62. // return Content(JsonData.ToJson());
  63. //}
  64. //[HttpGet]
  65. //[HandlerAjaxOnly]
  66. //public ActionResult GetICSBidDoc(Pagination pagination, string BidCode, string WorkPoint)
  67. //{
  68. // DataTable ListData = App.GetICSBidDoc(ref pagination, BidCode, WorkPoint);
  69. // var JsonData = new
  70. // {
  71. // total = pagination.total,
  72. // page = pagination.page,
  73. // records = pagination.records,
  74. // rows = ListData,
  75. // };
  76. // return Content(JsonData.ToJson());
  77. //}
  78. public ActionResult SearchBidDocBDInfoByBidCodeSeller(string BidCode, string WorkPoint, Pagination pagination)
  79. {
  80. DataTable ListData = App.SearchBidDocBDInfoByBidCodeSeller(BidCode, WorkPoint, ref pagination);
  81. var JsonData = new
  82. {
  83. total = pagination.total,
  84. page = pagination.page,
  85. records = pagination.records,
  86. rows = ListData,
  87. };
  88. return Content(JsonData.ToJson());
  89. }
  90. [HttpPost]
  91. public ActionResult SaveForm(ICSBidInfoDetail main)
  92. {
  93. try
  94. {
  95. App.SaveForm(main);
  96. return Success("保存成功");
  97. }
  98. catch (Exception ex)
  99. {
  100. return Error(ex.Message);
  101. }
  102. }
  103. public ActionResult SaveFormTiJiao(string keyValue, string BidCode, string TBCount,string WorkPoint)
  104. {
  105. try
  106. {
  107. App.SaveFormTiJiao(keyValue, BidCode, TBCount, WorkPoint);
  108. return Success("保存成功");
  109. }
  110. catch (Exception ex)
  111. {
  112. return Error(ex.Message);
  113. }
  114. }
  115. public ActionResult SaveFormQTiJiao(string keyValue, string BidCode)
  116. {
  117. try
  118. {
  119. App.SaveFormQTiJiao(keyValue, BidCode);
  120. return Success("取消保存成功");
  121. }
  122. catch (Exception ex)
  123. {
  124. return Error(ex.Message);
  125. }
  126. }
  127. [HttpPost]
  128. public ActionResult UpLoadFileImport(string BidCode, string ID)
  129. {
  130. string FileName = "";
  131. string PathName = "";
  132. string UserName = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  133. //获取上传的文件集合
  134. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  135. for (int i = 0; i < httpFile.Count; i++)
  136. {
  137. //获取送货单号
  138. //string STNO = Request.Form["STNO"].ToString();
  139. string fileName =UserName.Substring(0,4)+"_"+Path.GetFileNameWithoutExtension(httpFile[i].FileName)
  140. + Path.GetExtension(httpFile[i].FileName);
  141. string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\GYSZTBFile\\" + BidCode);
  142. if (!Directory.Exists(Paths))
  143. {
  144. Directory.CreateDirectory(Paths);
  145. }
  146. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\GYSZTBFile\\" + BidCode + "\\" + fileName);
  147. int iLen = httpFile[0].ContentLength;
  148. byte[] bData = new byte[iLen];
  149. httpFile[0].InputStream.Read(bData, 0, iLen);
  150. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  151. fs.Write(bData, 0, bData.Length);
  152. fs.Flush();
  153. fs.Close();
  154. fs.Dispose();
  155. FileName += "" + fileName + ";";
  156. PathName += "" + filePath + ";";
  157. }
  158. int count = App.UpLoadFile(FileName, PathName, BidCode);
  159. if (count > 0)
  160. {
  161. return Success("上传成功!");
  162. }
  163. else
  164. {
  165. return Error("上传失败");
  166. }
  167. }
  168. [HttpGet]
  169. [HandlerAjaxOnly]
  170. public ActionResult GetICSBidDocInfoSum(string BidCode, string WorkPoint, string Status)
  171. {
  172. DataTable ListData = App.GetICSBidDocInfoSum(BidCode, WorkPoint, Status);
  173. var JsonData = new
  174. {
  175. rows = ListData,
  176. };
  177. return Content(JsonData.ToJson());
  178. }
  179. [HttpGet]
  180. [HandlerAjaxOnly]
  181. public ActionResult GetCGFile(string BidCode, string WorkPoint)
  182. {
  183. DataTable ListData = App.GetCGFile(BidCode, WorkPoint);
  184. var JsonData = new
  185. {
  186. rows = ListData,
  187. };
  188. return Content(JsonData.ToJson());
  189. }
  190. [HttpGet]
  191. [HandlerAjaxOnly]
  192. public ActionResult GetVenDorFile(string BidCode, string WorkPoint)
  193. {
  194. DataTable ListData = App.GetVenDorFile(BidCode, WorkPoint);
  195. var JsonData = new
  196. {
  197. rows = ListData,
  198. };
  199. return Content(JsonData.ToJson());
  200. }
  201. [HttpGet]
  202. [HandlerAjaxOnly]
  203. public ActionResult GetVenDorFileTB(string BidCode, string WorkPoint)
  204. {
  205. DataTable ListData = App.GetVenDorFileTB(BidCode, WorkPoint);
  206. var JsonData = new
  207. {
  208. rows = ListData,
  209. };
  210. return Content(JsonData.ToJson());
  211. }
  212. /// <summary>
  213. /// 调用OA接口
  214. /// </summary>
  215. /// <param name="TEMPVENDORCODE">公司名称</param>
  216. /// <returns></returns>
  217. [HttpPost]
  218. public ActionResult SellerSubmitOARejict(string BidCode, string WorkPoint)
  219. {
  220. try
  221. {
  222. string msg = App.SellerSubmitOARejict(BidCode, WorkPoint);
  223. var JsonData = new
  224. {
  225. msg = msg,
  226. };
  227. return Content(JsonData.ToJson());
  228. }
  229. catch (Exception ex)
  230. {
  231. return Error("推送失败" + ex.Message);
  232. }
  233. }
  234. }
  235. }