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.

262 lines
8.5 KiB

4 days ago
  1. using Newtonsoft.Json;
  2. using NFine.Application;
  3. using NFine.Application.SRM;
  4. using NFine.Code;
  5. using NFine.Domain._03_Entity;
  6. using NFine.Domain._03_Entity.SRM;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.IO;
  11. using System.Linq;
  12. using System.Web;
  13. using System.Web.Mvc;
  14. namespace NFine.Web.Areas.SRM.Controllers
  15. {
  16. public class RFQAddController : ControllerBase
  17. {
  18. // GET: SRM/RFQAdd
  19. RFQManagerApp APP = new RFQManagerApp();
  20. public ActionResult Index()
  21. {
  22. return View();
  23. }
  24. public ActionResult ICSSORRFQByPU()
  25. {
  26. return View();
  27. }
  28. public ActionResult ICSSORRFQByPO()
  29. {
  30. return View();
  31. }
  32. public ActionResult ICSBicDoc_AddFCS()
  33. {
  34. return View();
  35. }
  36. public ActionResult GetPUROrganize(string workpoint)
  37. {
  38. DataTable table = APP.GetPUROrganize(workpoint);
  39. return Content(JsonConvert.SerializeObject(table));
  40. }
  41. public ActionResult GetPurTeam(string code)
  42. {
  43. DataTable table = APP.GetPURTeam(code);
  44. return Content(JsonConvert.SerializeObject(table));
  45. }
  46. public ActionResult GetSercode(string workpoint)
  47. {
  48. string sercode = APP.GetSercode(workpoint);
  49. return Content(sercode);
  50. }
  51. //public ActionResult AddRFQ(string queryjson)
  52. //{
  53. // try
  54. // {
  55. // APP.AddRFQ(queryjson);
  56. // return Success("创建成功!");
  57. // }
  58. // catch (Exception ex)
  59. // {
  60. // return Error(ex.Message);
  61. // }
  62. //}
  63. [HttpPost]
  64. public ActionResult AddRFQ(ICSSORRFQ details)
  65. {
  66. try
  67. {
  68. APP.AddRFQ(details);
  69. return Success("询报价创建成功!");
  70. }
  71. catch (Exception ex)
  72. {
  73. return Error(ex.Message);
  74. }
  75. }
  76. public void updateS(string ID, string paymentcondition)
  77. {
  78. APP.updateS(ID, paymentcondition);
  79. }
  80. public void updateiss(string ID, string isshowprice)
  81. {
  82. APP.updateiss(ID, isshowprice);
  83. }
  84. public ActionResult GetInvType()
  85. {
  86. return Content(JsonConvert.SerializeObject(APP.GetInvType()));
  87. }
  88. //[HttpPost]
  89. //public ActionResult UpLoadFileImport(string RFQNO)
  90. //{
  91. // try
  92. // {
  93. // string msg = "";
  94. // string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  95. // string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  96. // //获取上传的文件集合
  97. // HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  98. // string FileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName) + Path.GetExtension(httpFile[0].FileName);
  99. // string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\SORRFQFile\\" + RFQNO + "\\");
  100. // if (!Directory.Exists(Paths))
  101. // {
  102. // Directory.CreateDirectory(Paths);
  103. // }
  104. // string PathName = System.Web.HttpContext.Current.Server.MapPath("~\\File\\SORRFQFile\\" + RFQNO + "\\" + FileName);
  105. // int iLen = httpFile[0].ContentLength;
  106. // byte[] bData = new byte[iLen];
  107. // httpFile[0].InputStream.Read(bData, 0, iLen);
  108. // FileStream fs = new FileStream(PathName, FileMode.OpenOrCreate);
  109. // fs.Write(bData, 0, bData.Length);
  110. // fs.Flush();
  111. // fs.Close();
  112. // fs.Dispose();
  113. // //int count = App.UpLoadFile(FileName);
  114. // //if (count > 0)
  115. // //{
  116. // msg = "上传成功!";
  117. // var JsonData = new
  118. // {
  119. // Flag = true,
  120. // msg = msg,
  121. // FileName = FileName,
  122. // PathName = PathName,
  123. // };
  124. // return Content(JsonData.ToJson());
  125. // }
  126. // catch (Exception ex)
  127. // {
  128. // return Error(ex.Message);
  129. // }
  130. //}
  131. [HttpPost]
  132. public ActionResult UpLoadFileImport(string RFQNO)
  133. {
  134. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  135. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  136. string FileName = "";
  137. string Name = "";
  138. //获取上传的文件集合
  139. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  140. try
  141. {
  142. for (int i = 0; i < httpFile.Count; i++)
  143. {
  144. FileName = Path.GetFileNameWithoutExtension(httpFile[i].FileName) + Path.GetExtension(httpFile[i].FileName);
  145. string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\SORRFQFile\\" + RFQNO + "\\");
  146. if (!Directory.Exists(Paths))
  147. {
  148. Directory.CreateDirectory(Paths);
  149. }
  150. string PathName = System.Web.HttpContext.Current.Server.MapPath("~\\File\\SORRFQFile\\" + RFQNO + "\\" + FileName);
  151. int iLen = httpFile[0].ContentLength;
  152. byte[] bData = new byte[iLen];
  153. httpFile[0].InputStream.Read(bData, 0, iLen);
  154. FileStream fs = new FileStream(PathName, FileMode.OpenOrCreate);
  155. fs.Write(bData, 0, bData.Length);
  156. fs.Flush();
  157. fs.Close();
  158. fs.Dispose();
  159. Name = "" + FileName + ";";
  160. }
  161. }
  162. catch (Exception ex)
  163. {
  164. return Error(ex.Message);
  165. }
  166. return Success("上传成功!");
  167. }
  168. [HttpGet]
  169. [HandlerAjaxOnly]
  170. public ActionResult GetSORRVenDorFile(string rfqcode)
  171. {
  172. DataTable ListData = APP.GetSORRVenDorFile(rfqcode);
  173. var JsonData = new
  174. {
  175. rows = ListData,
  176. };
  177. return Content(JsonData.ToJson());
  178. }
  179. /// <summary>
  180. /// 采购订单信息
  181. /// </summary>
  182. /// <param name="STNO"></param>
  183. /// <param name="pagination"></param>
  184. /// <param name="WorkPoint"></param>GetItemDocByPO
  185. /// <returns></returns>
  186. public ActionResult GetItemDocByPO(string queryJson, Pagination pagination, string WorkPoint)
  187. {
  188. WorkPoint = WorkPoint.Substring(1, WorkPoint.Length - 2);
  189. DataTable ListData = APP.GetItemDocByPO(queryJson, ref pagination, WorkPoint);
  190. var JsonData = new
  191. {
  192. total = pagination.total,
  193. page = pagination.page,
  194. records = pagination.records,
  195. rows = ListData,
  196. };
  197. return Content(JsonData.ToJson());
  198. }
  199. /// <summary>
  200. /// 请购单信息
  201. /// </summary>
  202. /// <param name="STNO"></param>
  203. /// <param name="pagination"></param>
  204. /// <param name="WorkPoint"></param>GetItemDocByPO
  205. /// <returns></returns>
  206. public ActionResult GetRFByPU(string queryJson, Pagination pagination, string WorkPoint)
  207. {
  208. WorkPoint = WorkPoint.Substring(1, WorkPoint.Length - 2);
  209. DataTable ListData = APP.GetRFByPU(queryJson, ref pagination, WorkPoint);
  210. var JsonData = new
  211. {
  212. total = pagination.total,
  213. page = pagination.page,
  214. records = pagination.records,
  215. rows = ListData,
  216. };
  217. return Content(JsonData.ToJson());
  218. }
  219. [HttpGet]
  220. [HandlerAjaxOnly]
  221. public ActionResult GetBidItemCode(string WorkPoint, string Vendor)
  222. {
  223. try
  224. {
  225. string BidItemCode = APP.GetBidItemCode(WorkPoint, Vendor);
  226. var JsonData = new
  227. {
  228. BidItemCode = BidItemCode,
  229. };
  230. return Content(JsonData.ToJson());
  231. }
  232. catch (Exception ex)
  233. {
  234. return Error(ex.Message);
  235. }
  236. }
  237. }
  238. }