Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

173 rindas
5.6 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.AssetManagementSystem;
  4. using System.Web.Mvc;
  5. using Learun.Application.TwoDevelopment.LR_CodeDemo;
  6. using System.Collections.Generic;
  7. namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  11. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2022-11-07 14:25
  14. /// 描 述:经费开支申报
  15. /// </summary>
  16. public class FundsApplyController : MvcControllerBase
  17. {
  18. private FundsApplyIBLL fundsApplyIBLL = new FundsApplyBLL();
  19. private FundsApplyDetailIBLL fundsApplyDetailIBLL = new FundsApplyDetailBLL();
  20. #region 视图功能
  21. /// <summary>
  22. /// 主页面
  23. /// <summary>
  24. /// <returns></returns>
  25. [HttpGet]
  26. public ActionResult Index()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 表单页
  32. /// <summary>
  33. /// <returns></returns>
  34. [HttpGet]
  35. public ActionResult Form()
  36. {
  37. ViewBag.EnCode = fundsApplyIBLL.GetCode();
  38. return View();
  39. }
  40. [HttpGet]
  41. public ActionResult FormView()
  42. {
  43. return View();
  44. }
  45. #endregion
  46. #region 获取数据
  47. /// <summary>
  48. /// 获取页面显示列表数据
  49. /// </summary>
  50. /// <param name="pagination">分页参数</param>
  51. /// <param name="queryJson">查询参数</param>
  52. /// <returns></returns>
  53. [HttpGet]
  54. [AjaxOnly]
  55. public ActionResult GetPageList(string pagination, string queryJson)
  56. {
  57. Pagination paginationobj = pagination.ToObject<Pagination>();
  58. var data = fundsApplyIBLL.GetPageList(paginationobj, queryJson);
  59. var jsonData = new
  60. {
  61. rows = data,
  62. total = paginationobj.total,
  63. page = paginationobj.page,
  64. records = paginationobj.records
  65. };
  66. return Success(jsonData);
  67. }
  68. /// <summary>
  69. /// 获取表单数据
  70. /// </summary>
  71. /// <param name="keyValue">主键</param>
  72. /// <returns></returns>
  73. [HttpGet]
  74. [AjaxOnly]
  75. public ActionResult GetFormData(string keyValue)
  76. {
  77. var FundsApplyData = fundsApplyIBLL.GetFundsApplyEntity(keyValue);
  78. var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(keyValue);
  79. var jsonData = new
  80. {
  81. FundsApply = FundsApplyData,
  82. FundsApplyDetail = FundsApplyDetailData,
  83. };
  84. return Success(jsonData);
  85. }
  86. /// <summary>
  87. /// 获取表单数据
  88. /// </summary>
  89. /// <param name="processId">流程实例主键</param>
  90. /// <returns></returns>
  91. [HttpGet]
  92. [AjaxOnly]
  93. public ActionResult GetFormDataByProcessId(string processId)
  94. {
  95. var FundsApplyData = fundsApplyIBLL.GetEntityByProcessId(processId);
  96. var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(FundsApplyData.Id);
  97. var jsonData = new
  98. {
  99. FundsApply = FundsApplyData,
  100. FundsApplyDetail = FundsApplyDetailData,
  101. };
  102. return Success(jsonData);
  103. }
  104. #endregion
  105. #region 提交数据
  106. /// <summary>
  107. /// 删除实体数据
  108. /// </summary>
  109. /// <param name="keyValue">主键</param>
  110. /// <returns></returns>
  111. [HttpPost]
  112. [AjaxOnly]
  113. public ActionResult DeleteForm(string keyValue)
  114. {
  115. fundsApplyIBLL.DeleteEntity(keyValue);
  116. return Success("删除成功!");
  117. }
  118. /// <summary>
  119. /// 保存实体数据(新增、修改)
  120. /// </summary>
  121. /// <param name="keyValue">主键</param>
  122. /// <param name="strEntity">实体</param>
  123. /// <returns></returns>
  124. [HttpPost]
  125. [ValidateAntiForgeryToken]
  126. [AjaxOnly]
  127. public ActionResult SaveForm(string keyValue, string strEntity, string fundsApplyDetailList)
  128. {
  129. FundsApplyEntity entity = strEntity.ToObject<FundsApplyEntity>();
  130. List<FundsApplyDetailEntity> detailList = fundsApplyDetailList.ToObject<List<FundsApplyDetailEntity>>();
  131. var code = entity.EnCode;
  132. var savecode = fundsApplyIBLL.SaveCode(entity.EnCode, keyValue);
  133. entity.EnCode = savecode;
  134. var encode = savecode.Substring(13).ToInt();
  135. if (encode > 99)
  136. {
  137. return Fail("保存失败,经费开支单今日数量已超上限,请您明日编辑!");
  138. }
  139. if (code != entity.EnCode)
  140. {
  141. fundsApplyIBLL.SaveEntity(keyValue, entity, detailList);
  142. return Success("保存成功,经费开支申报单号已重复,系统已为您自动变更!");
  143. }
  144. fundsApplyIBLL.SaveEntity(keyValue, entity, detailList);
  145. return Success("保存成功!");
  146. }
  147. /// <summary>
  148. /// 提交
  149. /// </summary>
  150. /// <param name="keyValue">主键</param>
  151. /// <returns></returns>
  152. [HttpPost]
  153. [AjaxOnly]
  154. public ActionResult ChangeStatusById(string keyValue, string processId)
  155. {
  156. fundsApplyIBLL.ChangeStatusById(keyValue, 1, processId);
  157. return Success("操作成功!");
  158. }
  159. #endregion
  160. }
  161. }