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.

CodeRuleController.cs 4.4 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. using Learun.Application.Base.SystemModule;
  2. using Learun.Util;
  3. using System.Web.Mvc;
  4. namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  8. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  9. /// 创建人:陈彬彬
  10. /// 日 期:2017.04.01
  11. /// 描 述:单据编号
  12. /// </summary>
  13. public class CodeRuleController : MvcControllerBase
  14. {
  15. CodeRuleIBLL codeRuleIBLL = new CodeRuleBLL();
  16. #region 视图功能
  17. /// <summary>
  18. /// 单据编号管理
  19. /// </summary>
  20. /// <returns></returns>
  21. [HttpGet]
  22. public ActionResult Index()
  23. {
  24. return View();
  25. }
  26. /// <summary>
  27. /// 表单
  28. /// </summary>
  29. /// <returns></returns>
  30. [HttpGet]
  31. public ActionResult Form()
  32. {
  33. return View();
  34. }
  35. /// <summary>
  36. /// 单据编号规则
  37. /// </summary>
  38. /// <returns></returns>
  39. [HttpGet]
  40. public ActionResult FormatForm() {
  41. return View();
  42. }
  43. #endregion
  44. #region 获取数据
  45. /// <summary>
  46. /// 获取分页数据
  47. /// </summary>
  48. /// <param name="pagination">分页参数</param>
  49. /// <param name="keyword">关键字</param>
  50. /// <returns></returns>
  51. [HttpGet]
  52. [AjaxOnly]
  53. public ActionResult GetPageList(string pagination, string keyword)
  54. {
  55. Pagination paginationobj = pagination.ToObject<Pagination>();
  56. var data = codeRuleIBLL.GetPageList(paginationobj, keyword);
  57. var jsonData = new
  58. {
  59. rows = data,
  60. total = paginationobj.total,
  61. page = paginationobj.page,
  62. records = paginationobj.records,
  63. };
  64. return JsonResult(jsonData);
  65. }
  66. /// <summary>
  67. /// 获取列表数据
  68. /// </summary>
  69. /// <returns></returns>
  70. [HttpGet]
  71. [AjaxOnly]
  72. public ActionResult GetList()
  73. {
  74. var data = codeRuleIBLL.GetList();
  75. return JsonResult(data);
  76. }
  77. #endregion
  78. #region 数据验证
  79. /// <summary>
  80. /// 规则编码不能重复
  81. /// </summary>
  82. /// <param name="keyValue">主键</param>
  83. /// <param name="F_EnCode">规则编码</param>
  84. /// <returns></returns>
  85. [HttpGet]
  86. [AjaxOnly]
  87. public ActionResult ExistEnCode(string keyValue, string F_EnCode)
  88. {
  89. bool res = codeRuleIBLL.ExistEnCode(F_EnCode, keyValue);
  90. return JsonResult(res);
  91. }
  92. /// <summary>
  93. /// 规则名不能重复
  94. /// </summary>
  95. /// <param name="keyValue">主键</param>
  96. /// <param name="F_FullName"> 规则名</param>
  97. /// <returns></returns>
  98. [HttpGet]
  99. [AjaxOnly]
  100. public ActionResult ExistFullName(string keyValue, string F_FullName)
  101. {
  102. bool res = codeRuleIBLL.ExistFullName(F_FullName, keyValue);
  103. return JsonResult(res);
  104. }
  105. #endregion
  106. #region 提交数据
  107. /// <summary>
  108. /// 保存表单数据
  109. /// </summary>
  110. /// <param name="keyValue"></param>
  111. /// <param name="entity"></param>
  112. /// <returns></returns>
  113. [HttpPost]
  114. [ValidateAntiForgeryToken]
  115. [AjaxOnly]
  116. public ActionResult SaveForm(string keyValue, CodeRuleEntity entity)
  117. {
  118. codeRuleIBLL.SaveEntity(keyValue, entity);
  119. return Success("保存成功!");
  120. }
  121. /// <summary>
  122. /// 删除表单数据
  123. /// </summary>
  124. /// <param name="keyValue"></param>
  125. /// <returns></returns>
  126. [HttpPost]
  127. [AjaxOnly]
  128. public ActionResult DeleteForm(string keyValue)
  129. {
  130. codeRuleIBLL.VirtualDelete(keyValue);
  131. return Success("删除成功!");
  132. }
  133. #endregion
  134. #region 扩展方法
  135. /// <summary>
  136. /// 获取单据编码
  137. /// </summary>
  138. /// <returns></returns>
  139. [HttpGet]
  140. [AjaxOnly]
  141. public ActionResult GetEnCode(string code)
  142. {
  143. var data = codeRuleIBLL.GetBillCode(code);
  144. return SuccessString(data);
  145. }
  146. #endregion
  147. }
  148. }