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.
 
 
 
 
 
 

159 lines
4.7 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. using Learun.Application.Base.SystemModule;
  8. namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2023-05-05 14:37
  15. /// 描 述:固定资产
  16. /// </summary>
  17. public class Ass_FixAssetsController : MvcControllerBase
  18. {
  19. private Ass_FixAssetsIBLL ass_FixAssetsIBLL = new Ass_FixAssetsBLL();
  20. private CodeRuleIBLL codeRuleIBLL = new CodeRuleBLL();
  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. return View();
  39. }
  40. /// <summary>
  41. /// 表单查看页
  42. /// <summary>
  43. /// <returns></returns>
  44. [HttpGet]
  45. public ActionResult FormView()
  46. {
  47. return View();
  48. }
  49. #endregion
  50. #region 获取数据
  51. /// <summary>
  52. /// 获取页面显示列表数据
  53. /// </summary>
  54. /// <param name="pagination">分页参数</param>
  55. /// <param name="queryJson">查询参数</param>
  56. /// <returns></returns>
  57. [HttpGet]
  58. [AjaxOnly]
  59. public ActionResult GetPageList(string pagination, string queryJson)
  60. {
  61. Pagination paginationobj = pagination.ToObject<Pagination>();
  62. var data = ass_FixAssetsIBLL.GetPageList(paginationobj, queryJson);
  63. var jsonData = new
  64. {
  65. rows = data,
  66. total = paginationobj.total,
  67. page = paginationobj.page,
  68. records = paginationobj.records
  69. };
  70. return Success(jsonData);
  71. }
  72. /// <summary>
  73. /// 获取表单数据
  74. /// </summary>
  75. /// <param name="keyValue">主键</param>
  76. /// <returns></returns>
  77. [HttpGet]
  78. [AjaxOnly]
  79. public ActionResult GetFormData(string keyValue)
  80. {
  81. var Ass_FixAssetsData = ass_FixAssetsIBLL.GetAss_FixAssetsEntity(keyValue);
  82. var jsonData = new
  83. {
  84. Ass_FixAssets = Ass_FixAssetsData,
  85. };
  86. return Success(jsonData);
  87. }
  88. /// <summary>
  89. /// 获取表单数据
  90. /// </summary>
  91. /// <param name="processId">流程实例主键</param>
  92. /// <returns></returns>
  93. [HttpGet]
  94. [AjaxOnly]
  95. public ActionResult GetFormDataByProcessId(string processId)
  96. {
  97. var Ass_FixAssetsData = ass_FixAssetsIBLL.GetEntityByProcessId(processId);
  98. var jsonData = new
  99. {
  100. Ass_FixAssets = Ass_FixAssetsData,
  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. ass_FixAssetsIBLL.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)
  128. {
  129. Ass_FixAssetsEntity entity = strEntity.ToObject<Ass_FixAssetsEntity>();
  130. var model = ass_FixAssetsIBLL.GetEntityByCode(entity.FACode);
  131. if (string.IsNullOrEmpty(keyValue))
  132. {
  133. if (model != null)
  134. {
  135. return Fail("资产编号已存在!");
  136. }
  137. }
  138. else
  139. {
  140. if (model != null && model.FAId != keyValue)
  141. {
  142. return Fail("资产编号已存在!");
  143. }
  144. }
  145. ass_FixAssetsIBLL.SaveEntity(keyValue, entity);
  146. return Success("保存成功!");
  147. }
  148. #endregion
  149. }
  150. }