25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

193 satır
6.5 KiB

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