ScoreAuditController.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.Web.Controls;
  8. using EMIS.CommonLogic.ScoreManage;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.Entities;
  11. using EMIS.ViewModel.ScoreManage;
  12. using EMIS.Utility;
  13. using EMIS.ViewModel.CacheManage;
  14. using System.Dynamic;
  15. using Bowin.Common.JSON;
  16. using Bowin.Common.Utility;
  17. using Bowin.Common.Data;
  18. using EMIS.CommonLogic.CalendarManage;
  19. using EMIS.ViewModel.WorkflowManage;
  20. namespace EMIS.Web.Controllers.ScoreManage
  21. {
  22. [Authorization]
  23. public class ScoreAuditController : Controller
  24. {
  25. public Lazy<IScoreServices> scoreServices { get; set; }
  26. public Lazy<IFinalExaminationServices> finalExaminationServices { get; set; }
  27. public Lazy<IScoreParameterSettingServices> scoreParameterSettingServices { get; set; }
  28. public Lazy<ICreditFormulaServices> creditFormulaServices { get; set; }
  29. public Lazy<IGradePointFormulaServices> gradePointFormulaServices { get; set; }
  30. public Lazy<IScoreFormulaServices> scoreFormulaServices { get; set; }
  31. public Lazy<ISchoolYearServices> SchoolYearServices { get; set; }
  32. /// <summary>
  33. /// 报表
  34. /// </summary>
  35. /// <param name="FinalExaminationID"></param>
  36. /// <returns></returns>
  37. public ActionResult Report(Guid? FinalExaminationID)
  38. {
  39. ViewBag.FinalExaminationID = FinalExaminationID;
  40. return View();
  41. }
  42. /// <summary>
  43. /// 成绩审核页面
  44. /// </summary>
  45. /// <returns></returns>
  46. public ActionResult List()
  47. {
  48. var schoolYear = SchoolYearServices.Value.GetSchoolYearIsCurrent(true);
  49. var ApprovalStatus = scoreServices.Value.ApprovalStatus();
  50. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  51. ViewBag.ApprovalStatus = ApprovalStatus.ToString();
  52. return View();
  53. }
  54. /// <summary>
  55. /// 列表
  56. /// </summary>
  57. /// <param name="pararms"></param>
  58. /// <returns></returns>
  59. [HttpPost]
  60. public ActionResult List(QueryParamsModel pararms)
  61. {
  62. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  63. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  64. var departmentID = pararms.getExtraGuid("DepartmentComboGrid");
  65. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  66. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  67. var examsCategoryID = pararms.getExtraInt("DictionaryExamsCategory") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExamsCategory");
  68. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  69. var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  70. var approvalStatus = pararms.getExtraInt("DictionaryScoreState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryScoreState");
  71. return Json(scoreServices.Value.GetFinalExaminationScoreAuditViewGrid(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID, gradeYearID,approvalStatus, (int)pararms.page, (int)pararms.rows));
  72. }
  73. ///<summary>
  74. ///审核状态排查
  75. /// </summary>
  76. public ActionResult ApprovalStatus(string ApprovalStatus)
  77. {
  78. try
  79. {
  80. List<int?> List = new List<int?>();
  81. for (int i = 0; i < ApprovalStatus.Split(',').Length; i++)
  82. {
  83. if (!string.IsNullOrEmpty(ApprovalStatus.Split(',')[i]))
  84. {
  85. int Status = Convert.ToInt32(ApprovalStatus.Split(',')[i]);
  86. List.Add(Status);
  87. }
  88. }
  89. scoreServices.Value.CheckApprovalStatus(List);
  90. return Json("成功");
  91. }
  92. catch (Exception ex)
  93. {
  94. return Json(ex.Message);
  95. }
  96. }
  97. /// <summary>
  98. /// 审核动作
  99. /// </summary>
  100. /// <returns></returns>
  101. public ActionResult ApprovalHandle(string finalExaminationIDs)
  102. {
  103. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  104. Guid finalExaminationID = new Guid(finalExaminationIDs.Split(',')[0]);
  105. List<ActionView> listAction = scoreServices.Value.GetAuditingActionView(finalExaminationID, user.UserID);
  106. List<DropdownListItem> list = new List<DropdownListItem>();
  107. List<DropdownListItem> firstListAction = new List<DropdownListItem>(); //默认动作
  108. if (listAction.Count == 0)
  109. {
  110. return RedirectToAction("MsgShow", "Common", new
  111. {
  112. WindowID = Request["WindowID"],
  113. msg = "对不起,您无权限进行审核操作。"
  114. });
  115. }
  116. foreach (var item in listAction)
  117. {
  118. DropdownListItem dli = new DropdownListItem { Text = item.ActionName, Value = item.ToJson() };
  119. list.Add(dli);
  120. }
  121. var firstAction = listAction.OrderBy(x => x.Sort).FirstOrDefault(); //以排序获取第一个动作为默认动作
  122. firstListAction.Add(new DropdownListItem { Text = firstAction.ActionName, Value = firstAction.ToJson() });
  123. ViewData["firstListAction"] = firstListAction;
  124. ViewData["listAction"] = list;
  125. return View();
  126. }
  127. /// <summary>
  128. /// 审核动作
  129. /// </summary>
  130. /// <returns></returns>
  131. [HttpPost]
  132. public ActionResult ApprovalHandle(string finalExaminationIDs, string opinioncomment)
  133. {
  134. try
  135. {
  136. string action = Request.Form["Action"];
  137. ActionView actionView = action.JsonToObject<ActionView>();
  138. string comment = Request.Form["txtOpinioncomment"];
  139. List<Guid> list = new List<Guid>();
  140. for (int i = 0; i < finalExaminationIDs.Split(',').Length; i++)
  141. {
  142. if (!string.IsNullOrEmpty(finalExaminationIDs.Split(',')[i]))
  143. {
  144. Guid FinalExaminationID = new Guid(finalExaminationIDs.Split(',')[i]);
  145. list.Add(FinalExaminationID);
  146. }
  147. }
  148. //scoreServices.Value.GetFinalExaminationApprovalStatus(list, action, opinioncomment);
  149. scoreServices.Value.Approve(list, EMIS.Utility.FormValidate.CustomPrincipal.Current.UserID, actionView.ActionID, opinioncomment);
  150. return Json(new ReturnMessage()
  151. {
  152. IsSuccess = true,
  153. Message = "审核成功!"
  154. });
  155. }
  156. catch (Exception ex)
  157. {
  158. return Json(new ReturnMessage()
  159. {
  160. IsSuccess = true,
  161. Message = "审核失败,原因:" + ex.Message + "!"
  162. });
  163. }
  164. }
  165. /// <summary>
  166. /// 导出
  167. /// </summary>
  168. /// <returns></returns>
  169. public ActionResult Excel()
  170. {
  171. NpoiExcelHelper neh = new NpoiExcelHelper();
  172. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  173. var collegeID = Request.Form["CollegeComboGrid"].ParseStrTo<Guid>();
  174. var departmentID = Request.Form["DepartmentComboGrid"].ParseStrTo<Guid>();
  175. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  176. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  177. var examsCategoryID = Request.Form["DictionaryExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryExamsCategory"].ParseStrTo<int>();
  178. var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  179. var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  180. var approvalStatus = Request.Form["DictionaryScoreState"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryScoreState"].ParseStrTo<int>();
  181. var dt = scoreServices.Value.GetFinalExaminationScoreAuditViewList(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID, gradeYearID, approvalStatus).Select(x => new
  182. {
  183. x.SchoolyearCode,
  184. x.GradeYearID,
  185. x.ClassName,
  186. x.CourseCode,
  187. x.CourseName,
  188. x.CourseTypeName,
  189. x.ExamsCategoryName,
  190. x.CreatorUserNo,
  191. x.CreatorUserName,
  192. x.EntryDeadlineTime,
  193. x.StudentCount,
  194. x.SAPunlogStudentCount,
  195. x.ApprovalStatusName
  196. }).ToTable();
  197. string[] liststring = { "学年学期", "年级", "录入班级名称", "课程代码", "课程名称","课程类型", "考试性质","录入人编号", "录入人姓名",
  198. "录入截止日期","学生数","未录入人数","状态" };
  199. neh.Export(dt, liststring, "成绩录入信息");
  200. return Json(new ReturnMessage()
  201. {
  202. IsSuccess = true,
  203. Message = "导出成功!"
  204. });
  205. }
  206. /// <summary>
  207. /// 学生名单
  208. /// </summary>
  209. /// <returns></returns>
  210. public ActionResult StudentList(Guid? finalExaminationID, int? recordStatus)
  211. {
  212. ViewBag.FinalExaminationID = finalExaminationID;
  213. var IsColor = 0;
  214. var status = finalExaminationServices.Value.GetRebutStatus();
  215. if (status.Count > 0)
  216. {
  217. if (status.Any(x => x.Value == recordStatus))
  218. {
  219. IsColor = 1;
  220. }
  221. }
  222. ViewBag.IsColor = IsColor;
  223. return View();
  224. }
  225. /// <summary>
  226. /// 学生名单
  227. /// </summary>
  228. /// <param name="pararms"></param>
  229. /// <returns></returns>
  230. [HttpPost]
  231. public ActionResult FinalExaminationStudentList()
  232. {
  233. var finalExaminationID = Request["finalExaminationID"].ParseStrTo<Guid>();
  234. return Json(finalExaminationServices.Value.GetFinalExaminationStudent(finalExaminationID));
  235. }
  236. }
  237. }