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.
 
 
 
 
 
 

320 lines
14 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.Linq;
  7. using System;
  8. using Newtonsoft.Json.Linq;
  9. using Newtonsoft.Json;
  10. using Learun.Application.WorkFlow;
  11. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  12. {
  13. /// <summary>
  14. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  15. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  16. /// 创 建:超级管理员
  17. /// 日 期:2019-09-26 10:47
  18. /// 描 述:教学调度
  19. /// </summary>
  20. public class ArrangeLessonTermAttemperController : MvcControllerBase
  21. {
  22. private ArrangeLessonTermAttemperIBLL arrangeLessonTermAttemperIBLL = new ArrangeLessonTermAttemperBLL();
  23. private ArrangeLessonTermAttemperChildIBLL arrangeLessonTermAttemperChildIBLL = new ArrangeLessonTermAttemperChildBLL();
  24. private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL();
  25. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  26. #region 视图功能
  27. /// <summary>
  28. /// 主页面
  29. /// <summary>
  30. /// <returns></returns>
  31. [HttpGet]
  32. public ActionResult Index()
  33. {
  34. return View();
  35. }
  36. /// <summary>
  37. /// 表单页
  38. /// <summary>
  39. /// <returns></returns>
  40. [HttpGet]
  41. public ActionResult Form()
  42. {
  43. return View();
  44. }
  45. /// <summary>
  46. /// 表单查看页
  47. /// <summary>
  48. /// <returns></returns>
  49. [HttpGet]
  50. public ActionResult FormView()
  51. {
  52. return View();
  53. }
  54. #endregion
  55. #region 获取数据
  56. /// <summary>
  57. /// 获取页面显示列表数据
  58. /// <summary>
  59. /// <param name="queryJson">查询参数</param>
  60. /// <returns></returns>
  61. [HttpGet]
  62. [AjaxOnly]
  63. public ActionResult GetPageList(string pagination, string queryJson)
  64. {
  65. Pagination paginationobj = pagination.ToObject<Pagination>();
  66. var data = arrangeLessonTermAttemperIBLL.GetPageList(paginationobj, queryJson);
  67. var jsonData = new
  68. {
  69. rows = data,
  70. total = paginationobj.total,
  71. page = paginationobj.page,
  72. records = paginationobj.records
  73. };
  74. return Success(jsonData);
  75. }
  76. /// <summary>
  77. /// 获取表单数据
  78. /// <summary>
  79. /// <returns></returns>
  80. [HttpGet]
  81. [AjaxOnly]
  82. public ActionResult GetFormData(string keyValue)
  83. {
  84. var ArrangeLessonTermAttemperData = arrangeLessonTermAttemperIBLL.GetArrangeLessonTermAttemperEntity(keyValue);
  85. ArrangeLessonTermAttemperData.NewF_SchoolId = ArrangeLessonTermAttemperData.F_SchoolId;
  86. ArrangeLessonTermAttemperData.NewAcademicYearNo = ArrangeLessonTermAttemperData.AcademicYearNo;
  87. ArrangeLessonTermAttemperData.NewSemester = ArrangeLessonTermAttemperData.Semester;
  88. var jsonData = new
  89. {
  90. ArrangeLessonTermAttemper = ArrangeLessonTermAttemperData,
  91. };
  92. return Success(jsonData);
  93. }
  94. /// <summary>
  95. /// 获取表单数据
  96. /// <summary>
  97. /// <returns></returns>
  98. [HttpGet]
  99. [AjaxOnly]
  100. public ActionResult GetFormDataByProcessId(string processId)
  101. {
  102. var ArrangeLessonTermAttemperData = arrangeLessonTermAttemperIBLL.GetEntityByProcessId(processId);
  103. ArrangeLessonTermAttemperData.NewF_SchoolId = ArrangeLessonTermAttemperData.F_SchoolId;
  104. ArrangeLessonTermAttemperData.NewAcademicYearNo = ArrangeLessonTermAttemperData.AcademicYearNo;
  105. ArrangeLessonTermAttemperData.NewSemester = ArrangeLessonTermAttemperData.Semester;
  106. var jsonData = new
  107. {
  108. ArrangeLessonTermAttemper = ArrangeLessonTermAttemperData,
  109. };
  110. return Success(jsonData);
  111. }
  112. #endregion
  113. #region 提交数据
  114. /// <summary>
  115. /// 删除实体数据
  116. /// <param name="keyValue">主键</param>
  117. /// <summary>
  118. /// <returns></returns>
  119. [HttpPost]
  120. [AjaxOnly]
  121. public ActionResult DeleteForm(string keyValue)
  122. {
  123. arrangeLessonTermAttemperIBLL.DeleteEntity(keyValue);
  124. return Success("删除成功!");
  125. }
  126. /// <summary>
  127. /// 保存实体数据(新增、修改)
  128. /// <param name="keyValue">主键</param>
  129. /// <summary>
  130. /// <returns></returns>
  131. [HttpPost]
  132. [ValidateAntiForgeryToken]
  133. [AjaxOnly]
  134. public ActionResult SaveForm(string keyValue, string strEntity)
  135. {
  136. //[{"AttemperId":"3ec8df23-c045-428c-b37c-c370b73f53ef","Day":"5","LessonTime":"53","LessonDate":"2024-03-08","SchooldId":"207fa1a9-160c-4943-a89b-8fa4db0547ce","Academicyear":"23-24","Semester":"2","DeptNo":"01","Deptname":"","MajorNo":"GZ13","LessonNo":"GZ1303001","Curriculum":"爵士舞","TeachClassNo":"G2201010303","ClassName":"22高职男班(舞蹈表演)","Empno":"2224","Teacher":"魏志勇","ClassRoomNo":"3102","ClassRoom":"舞蹈楼102","LessonSortNo":"1"},{"AttemperId":"e4970ebb-1af5-4298-b03c-f8014e1adb06","Day":"5","LessonTime":"53","LessonDate":"2024-03-08","SchooldId":"207fa1a9-160c-4943-a89b-8fa4db0547ce","Academicyear":"23-24","Semester":"2","DeptNo":"01","Deptname":"","MajorNo":"GZ13","LessonNo":"GZ1302005","Curriculum":"中国古典舞身韵","TeachClassNo":"G2201010303","ClassName":"22高职男班(舞蹈表演)","Empno":"5526","Teacher":"焦晓天","ClassRoomNo":"3102","ClassRoom":"舞蹈楼102","LessonSortNo":"1"}]
  137. //"CreateUserId":"System","CreateUserName":"超级管理员","CreateTime":"2024-06-25 13:14:35","AttemperType":"02","AttemperTimeType":"","NewAcademicYearNo":"","NewSemester":"","NewDeptNo":"","NewMajorNo":"","NewLessonNo":"","NewTeachClassNo":"","NewEmpNo":"","NewClassroomNo":"","AttemperStartTime":"","AttemperEndTime":"","AttemperRemark":"22"
  138. JObject jo = (JObject)JsonConvert.DeserializeObject(strEntity);
  139. ArrangeLessonTermAttemperEntity entity = strEntity.ToObject<ArrangeLessonTermAttemperEntity>();
  140. if (entity.AttemperType == "01")
  141. {
  142. //调课
  143. }
  144. else if (entity.AttemperType == "02")
  145. {
  146. //停课
  147. }
  148. else if (entity.AttemperType == "03")
  149. {
  150. //换课
  151. }
  152. #region 旧逻辑
  153. //if (entity.AttemperType == "03")
  154. //{
  155. // //if (entity.F_SchoolId != entity.NewF_SchoolId || entity.AcademicYearNo != entity.NewAcademicYearNo || entity.Semester != entity.NewSemester)
  156. // if (entity.AcademicYearNo != entity.NewAcademicYearNo || entity.Semester != entity.NewSemester)
  157. // {
  158. // return Fail("校区、学年、学期不一致!");
  159. // }
  160. //}
  161. //if (entity.AttemperType == "04")
  162. //{
  163. // //JObject jo = (JObject)JsonConvert.DeserializeObject(strEntity);
  164. // List<ArrangeLessonTermAttrmperChildEntity> query = new List<ArrangeLessonTermAttrmperChildEntity>();
  165. // string[] targetjieci = jo["tardata"]["targetjieci"].ToString().TrimEnd(';').Split(';');
  166. // string targettime = jo["tardata"]["targettime"].ToString();
  167. // string lastdata = "";
  168. // int i = 0;
  169. // int index = 0;
  170. // foreach (var item in jo["predata"])
  171. // {
  172. // //index++;
  173. // if (string.IsNullOrEmpty(lastdata) || lastdata != item["LessonTime"].ToString())
  174. // {
  175. // lastdata = item["LessonTime"].ToString();
  176. // if (index >= jo["predata"].Count() / 2)
  177. // {
  178. // i++;
  179. // }
  180. // }
  181. // DateTime NewLessonDate = Convert.ToDateTime(jo["tardata"]["targettime"].ToString());
  182. // string newlessontime = Convert.ToInt32(NewLessonDate.DayOfWeek).ToString() + targetjieci[i].Replace("节", "");
  183. // ArrangeLessonTermAttrmperChildEntity term = new ArrangeLessonTermAttrmperChildEntity
  184. // {
  185. // LessonId = !string.IsNullOrEmpty(keyValue) ? item["LessonId"].ToString() : item["AltId"].ToString(),
  186. // LessonDate = Convert.ToDateTime(item["LessonDate"].ToString()),
  187. // LessonTime = item["LessonTime"].ToString(),
  188. // NewLessonDate = NewLessonDate,
  189. // NewLessonTime = newlessontime
  190. // };
  191. // query.Add(term);
  192. // index++;
  193. // }
  194. // entity.query = query;
  195. //}
  196. #endregion
  197. foreach (var item in jo["query"])
  198. {
  199. ArrangeLessonTermAttemperEntity itementity = new ArrangeLessonTermAttemperEntity();
  200. itementity.CreateUserId = entity.CreateUserId;
  201. itementity.CreateUserName = entity.CreateUserName;
  202. itementity.CreateTime = entity.CreateTime;
  203. itementity.AttemperRemark = entity.AttemperRemark;
  204. itementity.AttemperType = entity.AttemperType;//调课类型
  205. itementity.NewAcademicYearNo= entity.NewAcademicYearNo;
  206. itementity.NewSemester = entity.NewSemester;
  207. itementity.NewDeptNo = entity.NewDeptNo;
  208. itementity.NewMajorNo = entity.NewMajorNo;
  209. itementity.NewLessonNo = entity.NewLessonNo;
  210. itementity.NewTeachClassNo = entity.NewTeachClassNo;
  211. itementity.NewEmpNo = entity.NewEmpNo;
  212. itementity.NewClassroomNo = entity.NewClassroomNo;
  213. itementity.AcademicYearNo = item["Academicyear"].ToString();
  214. itementity.Semester = item["Semester"].ToString();
  215. itementity.DeptNo = item["DeptNo"].ToString();
  216. itementity.MajorNo = item["MajorNo"].ToString();
  217. itementity.LessonNo = item["LessonNo"].ToString();
  218. itementity.TeachClassNo = item["TeachClassNo"].ToString();
  219. itementity.EmpNo = item["Empno"].ToString();
  220. itementity.ClassroomNo = item["ClassRoomNo"].ToString();
  221. itementity.AttemperTimeType = entity.AttemperTimeType;//调度时限
  222. itementity.AttemperStartTime = entity.AttemperStartTime;
  223. itementity.AttemperEndTime = entity.AttemperEndTime;
  224. itementity.Status = 0;
  225. itementity.CheckStatus = 0;
  226. arrangeLessonTermAttemperIBLL.SaveEntity(keyValue, itementity);
  227. }
  228. return Success("保存成功!");
  229. }
  230. #endregion
  231. #region 扩展数据
  232. /// <summary>
  233. /// 课程下拉框信息【教学调度】
  234. /// </summary>
  235. /// <returns></returns>
  236. [HttpGet]
  237. [AjaxOnly]
  238. public ActionResult GetLessonDataInTerm()
  239. {
  240. var data = arrangeLessonTermIBLL.GetLessonDataInTerm("").OrderBy(x => x.value);
  241. return Success(data);
  242. }
  243. /// <summary>
  244. /// 获取调课数据
  245. /// </summary>
  246. /// <param name="code">数据源编号</param>
  247. /// <param name="strWhere">sql查询条件语句</param>
  248. /// <param name="queryJson">数据源请求条件字串</param>
  249. /// <returns></returns>
  250. [HttpGet]
  251. [AjaxOnly]
  252. public ActionResult GetchildData(string code)
  253. {
  254. var data = arrangeLessonTermAttemperChildIBLL.GetPageList(new Pagination { page=1,rows=10}, "{'AttemperId':'"+code+"'}");
  255. return JsonResult(data);
  256. }
  257. /// <summary>
  258. /// 提交课程异动记录
  259. /// </summary>
  260. /// <param name="keyValue">课程异动主键</param>
  261. /// <param name="status">审核状态</param>
  262. /// <param name="processId">流程Id</param>
  263. /// <returns></returns>
  264. public ActionResult ModifyStatus(string keyValue, int status, string processId)
  265. {
  266. arrangeLessonTermAttemperIBLL.ModifyStatus(keyValue, status, processId);
  267. return Success("提交成功!");
  268. }
  269. public ActionResult ModifyStatuss(string keyValue, int status, string processId)
  270. {
  271. var gids = arrangeLessonTermAttemperIBLL.ModifyStatuss(keyValue, status, processId);
  272. if (gids.Any())
  273. {
  274. var userInfo = LoginUserInfo.Get();
  275. var schemeCode = "ArrangeLessonTermAttemper";
  276. var level = 1;
  277. foreach (var gid in gids)
  278. {
  279. try
  280. {
  281. nWFProcessIBLL.CreateFlow(schemeCode, gid, "", level, "", userInfo);
  282. //return Success("流程创建成功");
  283. }
  284. catch (System.Exception ex)
  285. {
  286. nWFProcessIBLL.SaveDraft(gid, schemeCode, userInfo);
  287. //return Fail(ex.Message);
  288. }
  289. }
  290. }
  291. return Success("提交成功!");
  292. }
  293. #endregion
  294. }
  295. }