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.

291 lines
7.9 KiB

4 days ago
  1. using NFine.Application.SRM;
  2. using NFine.Code;
  3. using NPOI.HPSF;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Web;
  9. using System.Web.Mvc;
  10. namespace NFine.Web.Areas.SRM.Controllers
  11. {
  12. public class RFQMesController : ControllerBase
  13. {
  14. // GET: SRM/RFQMes
  15. RFQManagerApp app = new RFQManagerApp();
  16. public ActionResult Index()
  17. {
  18. return View();
  19. }
  20. public ActionResult WatchBJ() {
  21. return View();
  22. }
  23. public ActionResult WatchBJByDJ()
  24. {
  25. return View();
  26. }
  27. public ActionResult WatchBJByDJBack()
  28. {
  29. return View();
  30. }
  31. public ActionResult CloseRFQss()
  32. {
  33. return View();
  34. }
  35. public ActionResult GetRfqrow(string rfqcode) {
  36. return Content(app.GetRFQ(rfqcode).ToJson());
  37. }
  38. public ActionResult GetRfqAndBJ(string rfqno, Pagination pagination) {
  39. DataTable table = app.GetRfqAndBJ(rfqno);
  40. var JsonData = new
  41. {
  42. total = pagination.total,
  43. page = pagination.page,
  44. records = pagination.records,
  45. rows = table
  46. };
  47. return Content(JsonData.ToJson());
  48. }
  49. public ActionResult GetRfqSup(string rfqno, Pagination pagination)
  50. {
  51. DataTable table = app.GetRfqSup(rfqno);
  52. var JsonData = new
  53. {
  54. total = pagination.total,
  55. page = pagination.page,
  56. records = pagination.records,
  57. rows = table
  58. };
  59. return Content(JsonData.ToJson());
  60. }
  61. public ActionResult GetRfqSup1(string rfqno, string invcode, string workpoint, string queryJson, Pagination pagination)
  62. {
  63. DataTable table = app.GetRfqSup(rfqno, invcode, workpoint, queryJson, ref pagination);
  64. var JsonData = new
  65. {
  66. total = pagination.total,
  67. page = pagination.page,
  68. records = pagination.records,
  69. rows = table
  70. };
  71. return Content(JsonData.ToJson());
  72. }
  73. //public ActionResult UpLoadFile() {
  74. // HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  75. // string STNO = Request.Form["STNO"].ToString();
  76. //}
  77. public ActionResult UpdatePrice(string json) {
  78. return Content(app.SaveSCprice(json));
  79. }
  80. [HttpPost]
  81. [HandlerAjaxOnly]
  82. public ActionResult Agree(string json) {
  83. return Content(app.AgreeCS(json));
  84. }
  85. /// <summary>
  86. /// 上传到OA
  87. /// </summary>
  88. /// <param name="json"></param>
  89. /// <returns></returns>
  90. [HttpPost]
  91. [HandlerAjaxOnly]
  92. public ActionResult AgreeByOA(string json)
  93. {
  94. try
  95. {
  96. string msg = app.AgreeByOA(json);
  97. if (string.IsNullOrWhiteSpace(msg))
  98. {
  99. return Success("OA推送成功!");
  100. }
  101. else
  102. {
  103. return Error("OA推送失败!");
  104. }
  105. }
  106. catch (Exception ex)
  107. {
  108. return Error("退回失败!失败原因:" + ex.Message);
  109. }
  110. }
  111. /// <summary>
  112. /// 撤销OA流程
  113. /// </summary>
  114. /// <param name="json"></param>
  115. /// <returns></returns>
  116. [HttpPost]
  117. [HandlerAjaxOnly]
  118. public ActionResult CleanAgreeByOA(string json)
  119. {
  120. try
  121. {
  122. string msg = app.CleanAgreeByOA(json);
  123. if (string.IsNullOrWhiteSpace(msg))
  124. {
  125. return Success("OA撤销成功!");
  126. }
  127. else
  128. {
  129. return Error("OA撤销失败!");
  130. }
  131. }
  132. catch (Exception ex)
  133. {
  134. return Error("撤销失败!失败原因:" + ex.Message);
  135. }
  136. }
  137. public ActionResult Reject(string json)
  138. {
  139. return Content(app.RejectCS(json));
  140. }
  141. public ActionResult CreateBJ(string json) {
  142. return Content(app.CreateBJ(json));
  143. }
  144. [HttpPost]
  145. [HandlerAjaxOnly]
  146. public ActionResult CloseRFQPrice(string VenCode, string RFQNO, string ReturnRemark)
  147. {
  148. int result = app.CloseRFQPrice(VenCode, RFQNO,ReturnRemark);
  149. if (result > 0)
  150. {
  151. return Success("操作成功!");
  152. }
  153. else
  154. {
  155. return Error("操作失败!");
  156. }
  157. }
  158. [HttpGet]
  159. [HandlerAjaxOnly]
  160. public ActionResult GetMinPice(string RFQCODE, string ITEMCODE)
  161. {
  162. DataTable ListData = app.GetMinPice(RFQCODE, ITEMCODE);
  163. var JsonData = new
  164. {
  165. rows = ListData,
  166. };
  167. return Content(JsonData.ToJson());
  168. }
  169. [HttpPost]
  170. public void Export(string rfqno, string workpoint)
  171. {
  172. DataTable dt = app.GetPOListExport(rfqno, workpoint);
  173. AsposeCell.Export(dt);
  174. }
  175. /// <summary>
  176. /// 总查询
  177. /// </summary>
  178. /// <param name="pagination"></param>
  179. /// <param name="BidCode"></param>
  180. /// <returns></returns>
  181. [HttpGet]
  182. public ActionResult GetListSORRFQ(Pagination pagination, string rfqno, string workpoint)
  183. {
  184. DataTable ListData = app.GetListSORRFQ(rfqno, workpoint, ref pagination);
  185. var JsonData = new
  186. {
  187. total = pagination.total,
  188. page = pagination.page,
  189. records = pagination.records,
  190. rows = ListData,
  191. };
  192. return Content(JsonData.ToJson());
  193. }
  194. /// <summary>
  195. /// 总查询
  196. /// </summary>
  197. /// <param name="pagination"></param>
  198. /// <param name="BidCode"></param>
  199. /// <returns></returns>
  200. [HttpGet]
  201. public ActionResult GetListSORRFQByDJ(Pagination pagination, string rfqno, string workpoint)
  202. {
  203. DataTable ListData = app.GetListSORRFQByDJ(rfqno, workpoint, ref pagination);
  204. var JsonData = new
  205. {
  206. total = pagination.total,
  207. page = pagination.page,
  208. records = pagination.records,
  209. rows = ListData,
  210. };
  211. return Content(JsonData.ToJson());
  212. }
  213. [HttpGet]
  214. public ActionResult GetListSORRFQbyRemark(string rfqno, string workpoint)
  215. {
  216. DataTable ListData = app.GetListSORRFQbyRemark(rfqno, workpoint);
  217. var JsonData = new
  218. {
  219. rows = ListData,
  220. };
  221. return Content(JsonData.ToJson());
  222. }
  223. [HttpGet]
  224. [HandlerAjaxOnly]
  225. public ActionResult GetVendor(string rfqno,string workpoint)
  226. {
  227. DataTable dt = app.GetVendor(rfqno, workpoint);
  228. return Content(dt.ToJson());
  229. }
  230. [HttpPost]
  231. [HandlerAjaxOnly]
  232. [ValidateAntiForgeryToken]
  233. public ActionResult WatchBJByDJBack(string rfqno,string Vendor,string workpoint)
  234. {
  235. try
  236. {
  237. int i = app.WatchBJByDJBack(rfqno, Vendor, workpoint);
  238. if (i > 0)
  239. {
  240. return Success("退回成功!");
  241. }
  242. else
  243. {
  244. return Error("退回失败!");
  245. }
  246. }
  247. catch (Exception ex)
  248. {
  249. return Error("退回失败!失败原因:" + ex.Message);
  250. }
  251. }
  252. }
  253. }