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.

175 lines
5.8 KiB

4 days ago
  1. using NFine.Code;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Mvc;
  8. using NFine.Application.SRM;
  9. namespace NFine.Web.Areas.SRM.Controllers
  10. {
  11. public class PriceArticleController : ControllerBase
  12. {
  13. PriceArticleApp App = new PriceArticleApp();
  14. //
  15. // GET: /SRM/PriceArticle/
  16. public ActionResult Index()
  17. {
  18. return View();
  19. }
  20. public ActionResult PriceArtList()
  21. {
  22. return View();
  23. }
  24. public ActionResult PriceArtStage(){
  25. return View();
  26. }
  27. public ActionResult PriceArticComit()
  28. {
  29. return View();
  30. }
  31. /// <summary>
  32. /// 获取组名称
  33. /// </summary>
  34. /// <param name="pagination"></param>
  35. /// <param name="queryJson"></param>
  36. /// <returns></returns>
  37. [HttpGet]
  38. [HandlerAjaxOnly]
  39. public ActionResult GetGridJson(Pagination pagination, string queryJson)
  40. {
  41. DataTable ListData = App.GetGridPurchug(queryJson, ref pagination);
  42. var JsonData = new
  43. {
  44. total = pagination.total,
  45. page = pagination.page,
  46. records = pagination.records,
  47. rows = ListData,
  48. };
  49. return Content(JsonData.ToJson());
  50. }
  51. /// <summary>
  52. /// 获取组名称
  53. /// </summary>
  54. /// <param name="pagination"></param>
  55. /// <param name="queryJson"></param>
  56. /// <returns></returns>
  57. [HttpGet]
  58. [HandlerAjaxOnly]
  59. public ActionResult GetCompareCodeMaterial(Pagination pagination, string queryJson)
  60. {
  61. DataTable ListData = App.GetCompareCodeMaterial(queryJson, ref pagination);
  62. var JsonData = new
  63. {
  64. total = pagination.total,
  65. page = pagination.page,
  66. records = pagination.records,
  67. rows = ListData,
  68. };
  69. return Content(JsonData.ToJson());
  70. }
  71. /// <summary>
  72. /// 询报价报表
  73. /// </summary>
  74. /// <param name="pagination"></param>
  75. /// <param name="queryJson"></param>
  76. /// <returns></returns>
  77. [HttpGet]
  78. [HandlerAjaxOnly]
  79. public ActionResult GetCompareCodeMateriaList(Pagination pagination, string queryJson)
  80. {
  81. DataTable ListData = App.GetCompareCodeMateriaList(queryJson, ref pagination);
  82. var JsonData = new
  83. {
  84. total = pagination.total,
  85. page = pagination.page,
  86. records = pagination.records,
  87. rows = ListData,
  88. };
  89. return Content(JsonData.ToJson());
  90. }
  91. /// <summary>
  92. /// 获取组名称
  93. /// </summary>
  94. /// <param name="pagination"></param>
  95. /// <param name="queryJson"></param>
  96. /// <returns></returns>
  97. [HttpGet]
  98. [HandlerAjaxOnly]
  99. public ActionResult GetCompareCodeMaterials(Pagination pagination, string queryJson)
  100. {
  101. DataTable ListData = App.GetCompareCodeMaterials(queryJson, ref pagination);
  102. var JsonData = new
  103. {
  104. total = pagination.total,
  105. page = pagination.page,
  106. records = pagination.records,
  107. rows = ListData,
  108. };
  109. return Content(JsonData.ToJson());
  110. }
  111. /// <summary>
  112. /// 比价物资设定
  113. /// </summary>
  114. /// <param name="queryJson"></param>
  115. /// <param name="STNO"></param>
  116. /// <returns></returns>
  117. [HttpPost]
  118. [HandlerAjaxOnly]
  119. public ActionResult SaveItemCode(string queryJson, string PURCHUG, string PURCHUGName)
  120. {
  121. queryJson = queryJson.Substring(1, queryJson.Length - 2);
  122. string msg = App.CheckSTNO_ItemCode(queryJson, PURCHUG, PURCHUGName);
  123. if (!string.IsNullOrEmpty(msg))
  124. {
  125. return Error(msg);
  126. }
  127. else
  128. {
  129. return Success("添加成功!");
  130. }
  131. }
  132. /// <summary>
  133. /// 取消比价物资设定
  134. /// </summary>
  135. /// <param name="queryJson"></param>
  136. /// <param name="STNO"></param>
  137. /// <returns></returns>
  138. [HttpPost]
  139. [HandlerAjaxOnly]
  140. public ActionResult UpdateItemCode(string queryJson, string PURCHUG, string PURCHUGName)
  141. {
  142. queryJson = queryJson.Substring(1, queryJson.Length - 2);
  143. string msg = App.UpdateItemCode(queryJson, PURCHUG, PURCHUGName);
  144. if (!string.IsNullOrEmpty(msg))
  145. {
  146. return Error(msg);
  147. }
  148. else
  149. {
  150. return Success("添加成功!");
  151. }
  152. }
  153. [HttpPost]
  154. public void Export(string keyValue)
  155. {
  156. keyValue = keyValue.TrimEnd(',');
  157. //var data = maintainApp.GetList2(ids); //preselldetailApp.GetList2(keyValue, keyword);
  158. DataTable dt = App.GetPOListExport(keyValue);
  159. AsposeCell.Export(dt);
  160. //NPOIExcel helper = new NPOIExcel();
  161. //string title= DateTime.Now.ToString("yyyyMMddHHmmss");
  162. //string path= Server.MapPath("/File/");
  163. //helper.ToExcel(dt, title, "sheet1", path);
  164. }
  165. [HttpPost]
  166. public void ExportAll(string keyValue, string PURCHUG, string InvType, string PURCHUGCODE, string ITEMCODE, string ITEMName, string INVSTD, string VENCode, string VENName, string CREATETIME)
  167. {
  168. DataTable dt = App.GetPOListExport(PURCHUG, InvType, PURCHUGCODE, ITEMCODE, ITEMName, VENCode, VENName, CREATETIME, INVSTD);
  169. AsposeCell.Export(dt);
  170. }
  171. }
  172. }