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.
 
 
 
 
 
 

266 lines
7.8 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 keyValueArr = keyValue.Split(',');
  128. foreach (var item in keyValueArr)
  129. {
  130. var entity = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(item);
  131. entity.MPConclusion = status ? 1 : 0;
  132. mP_QualityObjectivesIBLL.SaveEntity(item, entity);
  133. }
  134. return Success("操作成功!");
  135. }
  136. /// <summary>
  137. /// 保存实体数据(新增、修改)
  138. /// <param name="keyValue">主键</param>
  139. /// <summary>
  140. /// <returns></returns>
  141. [HttpPost]
  142. [ValidateAntiForgeryToken]
  143. [AjaxOnly]
  144. public ActionResult SaveForm(string keyValue, string strEntity)
  145. {
  146. MP_ManageMentPlanEntity entity = strEntity.ToObject<MP_ManageMentPlanEntity>();
  147. entity.MPType = 2;
  148. mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity);
  149. return Success("保存成功!");
  150. }
  151. /// <summary>
  152. /// 保存实体数据(新增、修改)
  153. /// <param name="keyValue">主键</param>
  154. /// <summary>
  155. /// <returns></returns>
  156. [HttpPost]
  157. [ValidateAntiForgeryToken]
  158. [AjaxOnly]
  159. public ActionResult UploadForm(string keyValue, string strEntity)
  160. {
  161. MP_ManageMentPlanEntity entity = strEntity.ToObject<MP_ManageMentPlanEntity>();
  162. if (!string.IsNullOrEmpty(keyValue))
  163. {
  164. var entity2 = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(keyValue);
  165. if (!string.IsNullOrEmpty(entity.MPFileTwo))
  166. {
  167. entity.MPStatus = 0;//已提交
  168. entity.MPUploadTimes = $"{DateTime.Now.ToString()}, {entity2.MPUploadTimes}";
  169. entity.SUpdateTime = entity2.SUpdateTime + 1;
  170. }
  171. }
  172. else
  173. {
  174. entity.Create();
  175. if (!string.IsNullOrEmpty(entity.MPFileTwo))
  176. {
  177. entity.MPStatus = 0;//已提交
  178. entity.MPUploadTimes = DateTime.Now.ToString();
  179. entity.SUpdateTime = 1;
  180. entity.MPType = 2;
  181. }
  182. }
  183. entity.MPUploaderTwo = LoginUserInfo.Get().userId;
  184. mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity);
  185. return Success("提交成功!");
  186. }
  187. /// <summary>
  188. /// 保存实体数据(新增、修改)
  189. /// <param name="keyValue">主键</param>
  190. /// <summary>
  191. /// <returns></returns>
  192. [HttpPost]
  193. [AjaxOnly]
  194. public ActionResult AddRecord(string fileId)
  195. {
  196. var loginUser = LoginUserInfo.Get();
  197. var entity = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntityByFileTwo(fileId);
  198. var record = new MP_BrowseRecordEntity();
  199. record.MPId = entity.MPId;
  200. record.BRViewTime = DateTime.Now;
  201. record.BRViewers = loginUser.userId;
  202. record.BRViewerAddress = loginUser.iPAddress;
  203. record.Create();
  204. mpBrowseRecordIbll.SaveEntity("", record);
  205. return Success("提交成功!");
  206. }
  207. /// <summary>
  208. /// 保存文件浏览记录
  209. /// <param name="keyValue">主键</param>
  210. /// <summary>
  211. /// <returns></returns>
  212. [HttpPost]
  213. [AjaxOnly]
  214. public ActionResult AddFileRecord(string fileId)
  215. {
  216. var loginUser = LoginUserInfo.Get();
  217. var record = new MP_BrowseRecordEntity();
  218. record.FileId = fileId;
  219. record.Department = loginUser.departmentId;
  220. record.BRViewTime = DateTime.Now;
  221. record.BRViewers = loginUser.userId;
  222. record.BRViewerAddress = loginUser.iPAddress;
  223. record.Create();
  224. mpBrowseRecordIbll.SaveEntity("", record);
  225. return Success("提交成功!");
  226. }
  227. #endregion
  228. }
  229. }