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.

TSSchemeController.cs 4.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. using Learun.Application.Extention.TaskScheduling;
  2. using Learun.Util;
  3. using System.Web.Mvc;
  4. namespace Learun.Application.Web.Areas.LR_TaskScheduling.Controllers
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
  8. /// Copyright (c) 2013-2018 上海力软信息技术有限公司
  9. /// 创 建:超级管理员
  10. /// 日 期:2018-10-19 16:07
  11. /// 描 述:任务计划模板
  12. /// </summary>
  13. public class TSSchemeController : MvcControllerBase
  14. {
  15. private TSSchemeIBLL tSSchemeIBLL = new TSSchemeBLL();
  16. private TSProcessIBLL tSProcessIBLL = new TSProcessBLL();
  17. #region 视图功能
  18. /// <summary>
  19. /// 主页面
  20. /// <summary>
  21. /// <returns></returns>
  22. [HttpGet]
  23. public ActionResult Index()
  24. {
  25. return View();
  26. }
  27. /// <summary>
  28. /// 表单页
  29. /// <summary>
  30. /// <returns></returns>
  31. [HttpGet]
  32. public ActionResult Form()
  33. {
  34. return View();
  35. }
  36. /// <summary>
  37. /// 新增明细页
  38. /// <summary>
  39. /// <returns></returns>
  40. [HttpGet]
  41. public ActionResult AddDetailedForm()
  42. {
  43. return View();
  44. }
  45. /// <summary>
  46. /// 查看预置表达式
  47. /// <summary>
  48. /// <returns></returns>
  49. [HttpGet]
  50. public ActionResult SelectExpressForm()
  51. {
  52. return View();
  53. }
  54. #endregion
  55. #region 获取数据
  56. /// <summary>
  57. /// 获取列表分页数据
  58. /// <param name="pagination">分页参数</param>
  59. /// <summary>
  60. /// <returns></returns>
  61. [HttpGet]
  62. [AjaxOnly]
  63. public ActionResult GetPageList(string pagination, string queryJson)
  64. {
  65. Pagination paginationobj = pagination.ToObject<Pagination>();
  66. var data = tSSchemeIBLL.GetPageList(paginationobj, queryJson);
  67. var jsonData = new
  68. {
  69. rows = data,
  70. total = paginationobj.total,
  71. page = paginationobj.page,
  72. records = paginationobj.records
  73. };
  74. return Success(jsonData);
  75. }
  76. /// <summary>
  77. /// 获取表单数据
  78. /// <param name="keyValue">主键</param>
  79. /// <summary>
  80. /// <returns></returns>
  81. [HttpGet]
  82. [AjaxOnly]
  83. public ActionResult GetFormData(string keyValue)
  84. {
  85. var schemeInfoEntity = tSSchemeIBLL.GetSchemeInfoEntity(keyValue);
  86. var schemeEntity = tSSchemeIBLL.GetSchemeEntityByInfo(schemeInfoEntity.F_Id);
  87. var data = new
  88. {
  89. schemeInfoEntity,
  90. schemeEntity
  91. };
  92. return Success(data);
  93. }
  94. #endregion
  95. #region 提交数据
  96. /// <summary>
  97. /// 删除实体数据
  98. /// <param name="keyValue">主键</param>
  99. /// <summary>
  100. /// <returns></returns>
  101. [HttpPost]
  102. [AjaxOnly]
  103. public ActionResult DeleteForm(string keyValue)
  104. {
  105. tSSchemeIBLL.DeleteEntity(keyValue);
  106. return Success("删除成功!");
  107. }
  108. /// <summary>
  109. /// 保存实体数据(新增、修改)
  110. /// <param name="keyValue">主键</param>
  111. /// <summary>
  112. /// <returns></returns>
  113. [HttpPost]
  114. [ValidateAntiForgeryToken]
  115. [AjaxOnly]
  116. public ActionResult SaveForm(string keyValue,string strSchemeInfo,string strScheme)
  117. {
  118. TSSchemeInfoEntity tSSchemeInfoEntity = strSchemeInfo.ToObject<TSSchemeInfoEntity>();
  119. TSSchemeEntity tSSchemeEntity = new TSSchemeEntity() {
  120. F_Scheme = strScheme,
  121. F_IsActive = 1
  122. };
  123. tSSchemeIBLL.SaveEntity(keyValue, tSSchemeInfoEntity, tSSchemeEntity);
  124. return Success("保存成功!");
  125. }
  126. #endregion
  127. #region 扩展应用
  128. /// <summary>
  129. /// 暂停一个任务
  130. /// </summary>
  131. /// <param name="processId">任务进程主键</param>
  132. /// <returns></returns>
  133. public ActionResult PauseJob(string processId)
  134. {
  135. tSSchemeIBLL.PauseJob(processId);
  136. return Success("操作成功!");
  137. }
  138. /// <summary>
  139. /// 启动一个任务
  140. /// </summary>
  141. /// <param name="processId">任务进程主键</param>
  142. /// <returns></returns>
  143. public ActionResult ResumeJob(string processId)
  144. {
  145. tSSchemeIBLL.EnAbleJob(processId);
  146. return Success("操作成功!");
  147. }
  148. #endregion
  149. }
  150. }