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.
 
 
 
 
 
 

262 lines
7.6 KiB

  1. using System;
  2. using Learun.Util;
  3. using System.Data;
  4. using Learun.Application.TwoDevelopment.PersonnelManagement;
  5. using System.Web.Mvc;
  6. using System.Collections.Generic;
  7. using Learun.Application.Base.SystemModule;
  8. namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 力软敏捷开发框架
  12. /// Copyright (c) 2013-2018 上海力软信息技术有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2019-09-24 15:37
  15. /// 描 述:质量目标管理计划
  16. /// </summary>
  17. public class MP_QualityObjectivesController : MvcControllerBase
  18. {
  19. private MP_QualityObjectivesIBLL mP_QualityObjectivesIBLL = new MP_QualityObjectivesBLL();
  20. private MP_BrowseRecordIBLL mpBrowseRecordIbll = new MP_BrowseRecordBLL();
  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 IndexManagement()
  37. {
  38. return View();
  39. }
  40. /// <summary>
  41. /// 提交材料页面
  42. /// <summary>
  43. /// <returns></returns>
  44. [HttpGet]
  45. public ActionResult IndexChildren()
  46. {
  47. return View();
  48. }
  49. /// <summary>
  50. /// 表单页
  51. /// <summary>
  52. /// <returns></returns>
  53. [HttpGet]
  54. public ActionResult Form()
  55. {
  56. return View();
  57. }
  58. /// <summary>
  59. /// 表单页
  60. /// <summary>
  61. /// <returns></returns>
  62. [HttpGet]
  63. public ActionResult UploadForm()
  64. {
  65. return View();
  66. }
  67. #endregion
  68. #region 获取数据
  69. /// <summary>
  70. /// 获取页面显示列表数据
  71. /// <summary>
  72. /// <param name="queryJson">查询参数</param>
  73. /// <returns></returns>
  74. [HttpGet]
  75. [AjaxOnly]
  76. public ActionResult GetPageList(string pagination, string queryJson)
  77. {
  78. Pagination paginationobj = pagination.ToObject<Pagination>();
  79. var data = mP_QualityObjectivesIBLL.GetPageList(paginationobj, queryJson);
  80. var jsonData = new
  81. {
  82. rows = data,
  83. total = paginationobj.total,
  84. page = paginationobj.page,
  85. records = paginationobj.records
  86. };
  87. return Success(jsonData);
  88. }
  89. /// <summary>
  90. /// 获取表单数据
  91. /// <summary>
  92. /// <returns></returns>
  93. [HttpGet]
  94. [AjaxOnly]
  95. public ActionResult GetFormData(string keyValue)
  96. {
  97. var MP_ManageMentPlanData = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(keyValue);
  98. var jsonData = new
  99. {
  100. MP_ManageMentPlan = MP_ManageMentPlanData,
  101. };
  102. return Success(jsonData);
  103. }
  104. #endregion
  105. #region 提交数据
  106. /// <summary>
  107. /// 删除实体数据
  108. /// <param name="keyValue">主键</param>
  109. /// <summary>
  110. /// <returns></returns>
  111. [HttpPost]
  112. [AjaxOnly]
  113. public ActionResult DeleteForm(string keyValue)
  114. {
  115. mP_QualityObjectivesIBLL.DeleteEntity(keyValue);
  116. return Success("删除成功!");
  117. }
  118. /// <summary>
  119. /// 合格/不合格
  120. /// <param name="keyValue">主键</param>
  121. /// <summary>
  122. /// <returns></returns>
  123. [HttpPost]
  124. [AjaxOnly]
  125. public ActionResult Qqualified(string keyValue, bool status)
  126. {
  127. var entity = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(keyValue);
  128. entity.MPConclusion = status?1:0;
  129. mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity);
  130. return Success("删除成功!");
  131. }
  132. /// <summary>
  133. /// 保存实体数据(新增、修改)
  134. /// <param name="keyValue">主键</param>
  135. /// <summary>
  136. /// <returns></returns>
  137. [HttpPost]
  138. [ValidateAntiForgeryToken]
  139. [AjaxOnly]
  140. public ActionResult SaveForm(string keyValue, string strEntity)
  141. {
  142. MP_ManageMentPlanEntity entity = strEntity.ToObject<MP_ManageMentPlanEntity>();
  143. entity.MPType = 2;
  144. mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity);
  145. return Success("保存成功!");
  146. }
  147. /// <summary>
  148. /// 保存实体数据(新增、修改)
  149. /// <param name="keyValue">主键</param>
  150. /// <summary>
  151. /// <returns></returns>
  152. [HttpPost]
  153. [ValidateAntiForgeryToken]
  154. [AjaxOnly]
  155. public ActionResult UploadForm(string keyValue, string strEntity)
  156. {
  157. MP_ManageMentPlanEntity entity = strEntity.ToObject<MP_ManageMentPlanEntity>();
  158. if (!string.IsNullOrEmpty(keyValue))
  159. {
  160. var entity2 = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(keyValue);
  161. if (!string.IsNullOrEmpty(entity.MPFileTwo))
  162. {
  163. entity.MPStatus = 0;//已提交
  164. entity.MPUploadTimes = $"{DateTime.Now.ToString()}, {entity2.MPUploadTimes}";
  165. entity.SUpdateTime = entity2.SUpdateTime + 1;
  166. }
  167. }
  168. else
  169. {
  170. entity.Create();
  171. if (!string.IsNullOrEmpty(entity.MPFileTwo))
  172. {
  173. entity.MPStatus = 0;//已提交
  174. entity.MPUploadTimes = DateTime.Now.ToString();
  175. entity.SUpdateTime = 1;
  176. entity.MPType = 2;
  177. }
  178. }
  179. entity.MPUploaderTwo = LoginUserInfo.Get().userId;
  180. mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity);
  181. return Success("提交成功!");
  182. }
  183. /// <summary>
  184. /// 保存实体数据(新增、修改)
  185. /// <param name="keyValue">主键</param>
  186. /// <summary>
  187. /// <returns></returns>
  188. [HttpPost]
  189. [AjaxOnly]
  190. public ActionResult AddRecord(string fileId)
  191. {
  192. var loginUser = LoginUserInfo.Get();
  193. var entity = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntityByFileTwo(fileId);
  194. var record = new MP_BrowseRecordEntity();
  195. record.MPId = entity.MPId;
  196. record.BRViewTime = DateTime.Now;
  197. record.BRViewers = loginUser.userId;
  198. record.BRViewerAddress = loginUser.iPAddress;
  199. record.Create();
  200. mpBrowseRecordIbll.SaveEntity("", record);
  201. return Success("提交成功!");
  202. }
  203. /// <summary>
  204. /// 保存文件浏览记录
  205. /// <param name="keyValue">主键</param>
  206. /// <summary>
  207. /// <returns></returns>
  208. [HttpPost]
  209. [AjaxOnly]
  210. public ActionResult AddFileRecord(string fileId)
  211. {
  212. var loginUser = LoginUserInfo.Get();
  213. var record = new MP_BrowseRecordEntity();
  214. record.FileId = fileId;
  215. record.Department = loginUser.departmentId;
  216. record.BRViewTime = DateTime.Now;
  217. record.BRViewers = loginUser.userId;
  218. record.BRViewerAddress = loginUser.iPAddress;
  219. record.Create();
  220. mpBrowseRecordIbll.SaveEntity("", record);
  221. return Success("提交成功!");
  222. }
  223. #endregion
  224. }
  225. }