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.

Ass_PurchaseApplyController.cs 6.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.AssetManagementSystem;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System;
  7. using System.Linq;
  8. using System.Text;
  9. namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2019-03-25 17:19
  16. /// 描 述:采购申请表
  17. /// </summary>
  18. public class Ass_PurchaseApplyController : MvcControllerBase
  19. {
  20. private Ass_PurchaseApplyIBLL ass_PurchaseApplyIBLL = new Ass_PurchaseApplyBLL();
  21. private Ass_PurchaseIBLL ass_PurchaseIBLL = new Ass_PurchaseBLL();
  22. #region 视图功能
  23. /// <summary>
  24. /// 主页面
  25. /// <summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. public ActionResult Index()
  29. {
  30. return View();
  31. }
  32. /// <summary>
  33. /// 表单页
  34. /// <summary>
  35. /// <returns></returns>
  36. [HttpGet]
  37. public ActionResult Form()
  38. {
  39. ViewBag.PACode = "CGSQ_" + CommonHelper.CreateNo();
  40. return View();
  41. }
  42. /// <summary>
  43. /// 表单查看页
  44. /// </summary>
  45. /// <returns></returns>
  46. [HttpGet]
  47. public ActionResult FormView()
  48. {
  49. return View();
  50. }
  51. #endregion
  52. #region 获取数据
  53. /// <summary>
  54. /// 获取页面显示列表数据
  55. /// <summary>
  56. /// <param name="queryJson">查询参数</param>
  57. /// <returns></returns>
  58. [HttpGet]
  59. [AjaxOnly]
  60. public ActionResult GetPageList(string pagination, string queryJson)
  61. {
  62. Pagination paginationobj = pagination.ToObject<Pagination>();
  63. var data = ass_PurchaseApplyIBLL.GetPageList(paginationobj, queryJson);
  64. var jsonData = new
  65. {
  66. rows = data,
  67. total = paginationobj.total,
  68. page = paginationobj.page,
  69. records = paginationobj.records
  70. };
  71. return Success(jsonData);
  72. }
  73. /// <summary>
  74. /// 获取表单数据
  75. /// <summary>
  76. /// <returns></returns>
  77. [HttpGet]
  78. [AjaxOnly]
  79. public ActionResult GetFormData(string keyValue)
  80. {
  81. var Ass_PurchaseApplyData = ass_PurchaseApplyIBLL.GetAss_PurchaseApplyEntity(keyValue);
  82. var Ass_PurchaseItemApplyData = ass_PurchaseApplyIBLL.GetAss_PurchaseItemApplyList(Ass_PurchaseApplyData.PAId);
  83. foreach (var item in Ass_PurchaseItemApplyData)
  84. {
  85. item.PAAllAmount = item.PAIPrice * item.PAIAmount;
  86. }
  87. var jsonData = new
  88. {
  89. Ass_PurchaseApply = Ass_PurchaseApplyData,
  90. Ass_PurchaseItemApply = Ass_PurchaseItemApplyData,
  91. };
  92. return Success(jsonData);
  93. }
  94. /// <summary>
  95. /// 获取表单数据
  96. /// <summary>
  97. /// <returns></returns>
  98. [HttpGet]
  99. [AjaxOnly]
  100. public ActionResult GetFormDataByProcessId(string processId)
  101. {
  102. var Ass_PurchaseApplyData = ass_PurchaseApplyIBLL.GetEntityByProcessId(processId);
  103. var Ass_PurchaseItemApplyData = ass_PurchaseApplyIBLL.GetAss_PurchaseItemApplyList(Ass_PurchaseApplyData.PAId);
  104. foreach (var item in Ass_PurchaseItemApplyData)
  105. {
  106. item.PAAllAmount = item.PAIPrice * item.PAIAmount;
  107. }
  108. var jsonData = new
  109. {
  110. Ass_PurchaseApply = Ass_PurchaseApplyData,
  111. Ass_PurchaseItemApply = Ass_PurchaseItemApplyData,
  112. };
  113. return Success(jsonData);
  114. }
  115. /// <summary>
  116. /// 获取表单数据
  117. /// <summary>
  118. /// <returns></returns>
  119. [HttpGet]
  120. [AjaxOnly]
  121. public ActionResult GetFormDataByPId(string pid)
  122. {
  123. var ass_PurchaseEntity = ass_PurchaseIBLL.GetAss_PurchaseEntity(pid);
  124. var Ass_PurchaseApplyData = ass_PurchaseApplyIBLL.GetAss_PurchaseApplyEntity(ass_PurchaseEntity.PAId);
  125. var Ass_PurchaseItemApplyData = ass_PurchaseApplyIBLL.GetAss_PurchaseItemApplyList(Ass_PurchaseApplyData.PAId);
  126. var jsonData = new
  127. {
  128. Ass_PurchaseApply = Ass_PurchaseApplyData,
  129. Ass_PurchaseItemApply = Ass_PurchaseItemApplyData,
  130. };
  131. return Success(jsonData);
  132. }
  133. #endregion
  134. #region 提交数据
  135. /// <summary>
  136. /// 删除实体数据
  137. /// <param name="keyValue">主键</param>
  138. /// <summary>
  139. /// <returns></returns>
  140. [HttpPost]
  141. [AjaxOnly]
  142. public ActionResult DeleteForm(string keyValue)
  143. {
  144. ass_PurchaseApplyIBLL.DeleteEntity(keyValue);
  145. return Success("删除成功!");
  146. }
  147. /// <summary>
  148. /// 保存实体数据(新增、修改)
  149. /// <param name="keyValue">主键</param>
  150. /// <summary>
  151. /// <returns></returns>
  152. [HttpPost]
  153. [ValidateAntiForgeryToken]
  154. [AjaxOnly]
  155. public ActionResult SaveForm(string keyValue, string strEntity, string strass_PurchaseItemApplyList)
  156. {
  157. Ass_PurchaseApplyEntity entity = strEntity.ToObject<Ass_PurchaseApplyEntity>();
  158. entity.PAStatus = 0;
  159. entity.PStatus = 0;
  160. entity.PACreateTime = DateTime.Now;
  161. List<Ass_PurchaseItemApplyEntity> ass_PurchaseItemApplyList = strass_PurchaseItemApplyList.ToObject<List<Ass_PurchaseItemApplyEntity>>();
  162. StringBuilder nameOfCollection = new StringBuilder();
  163. //将所有名字的名字集中到一个字段中, 方便查询
  164. foreach (var item in ass_PurchaseItemApplyList)
  165. {
  166. nameOfCollection.Append(item.PAIName);
  167. }
  168. entity.NameOfCollection = nameOfCollection.ToString();
  169. ass_PurchaseApplyIBLL.SaveEntity(keyValue, entity, ass_PurchaseItemApplyList);
  170. return Success("保存成功!");
  171. }
  172. #endregion
  173. #region 扩展数据
  174. /// <summary>
  175. /// 提交采购申请单
  176. /// </summary>
  177. /// <param name="keyValue">采购申请表主键</param>
  178. /// <param name="pastatus">审核状态</param>
  179. /// <param name="processId">流程Id</param>
  180. /// <returns></returns>
  181. public ActionResult ModifyPAStatus(string keyValue, int pastatus, string processId)
  182. {
  183. ass_PurchaseApplyIBLL.ModifyPAStatus(keyValue, pastatus, processId);
  184. return Success("提交成功!");
  185. }
  186. #endregion
  187. }
  188. }