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.
 
 
 
 
 
 

217 lines
7.3 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.EducationalAdministration;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System;
  7. using System.Linq;
  8. using DocumentFormat.OpenXml.Office.CustomUI;
  9. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2019-08-21 17:28
  16. /// 描 述:成绩比例设置
  17. /// </summary>
  18. public class ClassPlanController : MvcControllerBase
  19. {
  20. private ClassPlanIBLL classPlanIBLL = new ClassPlanBLL();
  21. private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
  22. private TeachClassIBLL teachClassIBLL = new TeachClassBLL();
  23. #region 视图功能
  24. /// <summary>
  25. /// 主页面
  26. /// <summary>
  27. /// <returns></returns>
  28. [HttpGet]
  29. public ActionResult Index()
  30. {
  31. return View();
  32. }
  33. /// <summary>
  34. /// 表单页
  35. /// <summary>
  36. /// <returns></returns>
  37. [HttpGet]
  38. public ActionResult Form()
  39. {
  40. return View();
  41. }
  42. /// <summary>
  43. /// 全校开课计划
  44. /// <summary>
  45. /// <returns></returns>
  46. [HttpGet]
  47. public ActionResult IndexSchool()
  48. {
  49. return View();
  50. }
  51. #endregion
  52. #region 获取数据
  53. /// <summary>
  54. /// 获取页面显示列表数据
  55. /// </summary>
  56. /// <param name="pagination">分页参数</param>
  57. /// <param name="queryJson">查询参数</param>
  58. /// <returns></returns>
  59. [HttpGet]
  60. [AjaxOnly]
  61. public ActionResult GetPageList(string pagination, string queryJson)
  62. {
  63. Pagination paginationobj = pagination.ToObject<Pagination>();
  64. var data = classPlanIBLL.GetPageList(paginationobj, queryJson);
  65. var jsonData = new
  66. {
  67. rows = data,
  68. total = paginationobj.total,
  69. page = paginationobj.page,
  70. records = paginationobj.records
  71. };
  72. return Success(jsonData);
  73. }
  74. /// <summary>
  75. /// 全校开课计划
  76. /// </summary>
  77. /// <param name="pagination"></param>
  78. /// <param name="queryJson"></param>
  79. /// <returns></returns>
  80. [HttpGet]
  81. [AjaxOnly]
  82. public ActionResult GetPageListForSchool(string pagination, string queryJson)
  83. {
  84. Pagination paginationobj = pagination.ToObject<Pagination>();
  85. var data = classPlanIBLL.GetPageListForSchool(paginationobj, queryJson);
  86. var jsonData = new
  87. {
  88. rows = data,
  89. total = paginationobj.total,
  90. page = paginationobj.page,
  91. records = paginationobj.records
  92. };
  93. return Success(jsonData);
  94. }
  95. /// <summary>
  96. /// 获取表单数据
  97. /// </summary>
  98. /// <param name="keyValue">主键</param>
  99. /// <returns></returns>
  100. [HttpGet]
  101. [AjaxOnly]
  102. public ActionResult GetFormData(string keyValue)
  103. {
  104. var ClassPlanData = classPlanIBLL.GetClassPlanEntity(keyValue);
  105. var jsonData = new
  106. {
  107. ClassPlan = ClassPlanData,
  108. };
  109. return Success(jsonData);
  110. }
  111. #endregion
  112. #region 提交数据
  113. /// <summary>
  114. /// 删除实体数据
  115. /// </summary>
  116. /// <param name="keyValue">主键</param>
  117. /// <returns></returns>
  118. [HttpPost]
  119. [AjaxOnly]
  120. public ActionResult DeleteForm(string keyValue)
  121. {
  122. classPlanIBLL.DeleteEntity(keyValue);
  123. return Success("删除成功!");
  124. }
  125. /// <summary>
  126. /// 保存实体数据(新增、修改)
  127. /// </summary>
  128. /// <param name="keyValue">主键</param>
  129. /// <param name="strEntity">实体</param>
  130. /// <returns></returns>
  131. [HttpPost]
  132. [ValidateAntiForgeryToken]
  133. [AjaxOnly]
  134. public ActionResult SaveForm(string keyValue, string strEntity)
  135. {
  136. OpenLessonPlanEntity entity = strEntity.ToObject<OpenLessonPlanEntity>();
  137. if (!string.IsNullOrEmpty(keyValue))
  138. {
  139. entity.AmendDate = DateTime.Now;
  140. }
  141. entity.State = 0;
  142. entity.IsAllowEdit = true;
  143. entity.MakeDate = DateTime.Now;
  144. var model = classPlanIBLL.GetRepetitions(entity.F_SchoolId, entity.AcademicYearNo, entity.Semester, entity.DeptNo, entity.MajorNo, entity.Grade, entity.LessonNo);
  145. if (model != null)
  146. {
  147. if (keyValue != model.ID.ToString())
  148. {
  149. return Fail("此课程已重复!不可再次添加此课程");
  150. }
  151. }
  152. classPlanIBLL.SaveEntity(keyValue, entity);
  153. return Success("保存成功!");
  154. }
  155. #endregion
  156. #region 扩展数据
  157. /// <summary>
  158. /// 排课
  159. /// </summary>
  160. /// <param name="keyValue">主键</param>
  161. /// <returns></returns>
  162. [HttpPost]
  163. [AjaxOnly]
  164. public ActionResult CourseArranging(string keyValue)
  165. {
  166. var entity = classPlanIBLL.GetListById(keyValue);
  167. List<TeachClassEntity> TeachList = new List<TeachClassEntity>();
  168. for (int i = 0; i < entity.Count; i++)
  169. {
  170. var lessonList = classInfoIBLL.GetAllClass().
  171. Where(x => x.DeptNo == entity[i].DeptNo && x.MajorNo == entity[i].MajorNo && x.Grade == entity[i].Grade)
  172. .OrderBy(x => x.ClassNo).Select(field1 => new { field1.ClassNo, field1.ClassName }).ToList();
  173. if (lessonList.Count > 0)
  174. {
  175. for (int j = 0; j < lessonList.Count; j++)
  176. {
  177. TeachClassEntity TeachEntity = new TeachClassEntity();
  178. TeachEntity.TeachClassNo = lessonList[j].ClassNo;
  179. TeachEntity.TeachClassName = lessonList[j].ClassName;
  180. TeachEntity.AcademicYearNo = entity[i].AcademicYearNo;
  181. TeachEntity.DeptNo = entity[i].DeptNo;
  182. TeachEntity.MajorNo = entity[i].MajorNo;
  183. TeachEntity.Grade = entity[i].Grade;
  184. TeachEntity.Semester = entity[i].Semester;
  185. TeachEntity.LessonNo = entity[i].LessonNo;
  186. TeachEntity.StuNum = entity[i].StuNum;
  187. TeachEntity.LessonSortNo = entity[i].LessonSortNo;
  188. TeachEntity.F_SchoolId = entity[i].F_SchoolId;
  189. TeachList.Add(TeachEntity);
  190. }
  191. }
  192. else
  193. {
  194. return Fail("排课失败!暂无排课班级");
  195. }
  196. }
  197. teachClassIBLL.SaveEntityList(TeachList);
  198. classPlanIBLL.SaveEntityList(keyValue, entity);
  199. return Success("排课成功");
  200. }
  201. #endregion
  202. }
  203. }