diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ClassPlanTeachController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ClassPlanTeachController.cs index 0b10baebb..a1c563d14 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ClassPlanTeachController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ClassPlanTeachController.cs @@ -179,7 +179,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers TeachEntity.TotalStudyHour = 2; TeachEntity.IsInEffect = "1"; TeachEntity.IsPitchOn = "1"; - TeachEntity.IsPitchOn = "1"; TeachEntity.F_SchoolId = entityList[i].F_SchoolId; TeachEntity.CheckMark = "1"; TeachEntity.InsertTime = DateTime.Now; @@ -259,7 +258,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers TeachEntity.TotalStudyHour = 2; TeachEntity.IsInEffect = "1"; TeachEntity.IsPitchOn = "1"; - TeachEntity.IsPitchOn = "1"; TeachEntity.F_SchoolId = entityList[i].F_SchoolId; TeachEntity.InsertTime = DateTime.Now; TeachList.Add(TeachEntity); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs index 6e7b8efa4..02954f117 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs @@ -269,11 +269,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers return Success("操作成功!"); } /// - /// 一键安排班级 - /// - /// - /// - [HttpPost] + /// 一键安排班级 + /// + /// + /// + [HttpPost] [AjaxOnly] public ActionResult PlanClassByEPId(string keyValue) { @@ -286,6 +286,24 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers exam_ExamPlanClassIBLL.PlanClassByEPId(keyValue); return Success("操作成功!"); } + /// + /// 自动生成考试课程排考时间 + /// + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult PlanLessonTimeByEPId(string keyValue) + { + var count = exam_ExamPlanLessonIBLL.GetListByEPId(keyValue).Count(); + if (count <= 0) + { + return Fail("请先安排课程!"); + } + exam_ExamPlanLessonIBLL.PlanLessonTimeByEPId(keyValue); + return Success("操作成功!"); + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js index 8f43e80d8..913b3239c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js @@ -190,6 +190,21 @@ var bootstrap = function ($, learun) { }); } }); + + //自动生成排考时间 + $('#lr_examlessontime').on('click', + function () { + var keyValue = $('#gridtable').jfGridValue('EPId'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认生成排考时间!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/PlanLessonTimeByEPId', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); }, // 初始化列表 initGird: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonBLL.cs index 76c291449..3dd2fe689 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonBLL.cs @@ -263,6 +263,26 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } + + public (bool flag, string msg) PlanLessonTimeByEPId(string EPId) + { + try + { + return exam_ExamPlanLessonService.PlanLessonTimeByEPId(EPId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonEntity.cs index 6cfa48f54..01ff1f76d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonEntity.cs @@ -108,6 +108,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration public string AcademicYearNo { get; set; } [NotMapped] public string Semester { get; set; } + /// + /// 考试时长 + /// + [NotMapped] + public int? ExamLength { get; set; } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonIBLL.cs index 9557074df..051781014 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonIBLL.cs @@ -52,6 +52,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 实体 void SaveEntity(string keyValue, Exam_ExamPlanLessonEntity entity); + (bool flag, string msg) PlanLessonTimeByEPId(string keyValue); + (bool flag, string lessonname) IsExamTimeClash(Exam_ExamPlanLessonEntity entity); #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonService.cs index 5c3f6a862..33ddb0c9f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanLesson/Exam_ExamPlanLessonService.cs @@ -411,6 +411,55 @@ and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan } } } + + /// + /// 自动生成考试课程排考时间 + /// + /// + /// + public (bool flag, string msg) PlanLessonTimeByEPId(string EPId) + { + try + { + /* + * 1.查询考试记录是否已安排时间 + * 2.查询考试课程的考试时长是否大于0 + * 3.同一时间段内只能一个专业安排一门课程 + */ + + //安排时间数据 + var EPTimeList = this.BaseRepository("CollegeMIS") + .FindList(x => x.EPId == EPId); + if (EPTimeList.Count() <= 0) + { + return (false, "请先安排考试记录时间!"); + } + //考试课程数据 + var EPLessonList = this.BaseRepository("CollegeMIS") + .FindList($@"select elesson.ExamTime as ExamLength,t.* from Exam_ExamPlanLesson t +join Exam_ExamLesson elesson on t.LessonNo=elesson.LessonNo + where t.EPId='{EPId}'"); + if (EPLessonList.ToList().Exists(x => x.ExamLength == null || x.ExamLength == 0)) + { + return (false, "请先设置考试课程时长!"); + } + + + return (true, ""); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion }