diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanLessonController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanLessonController.cs index 12ab302e2..898802d3e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanLessonController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanLessonController.cs @@ -305,8 +305,15 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { entity.ExamTime = entity.ExamTimeStart.Trim() + "-" + entity.ExamTimeEnd; } + + entity.EPLId = keyValue; //判断考试时间是否冲突 - //exam_ExamPlanLessonIBLL.IsExamTimeClash(entity); + var res = exam_ExamPlanLessonIBLL.IsExamTimeClash(entity); + if (res.flag && !string.IsNullOrEmpty(res.lessonname)) + { + return Fail("考试时间与课程(" + res.lessonname + ")冲突!"); + } + //保存 exam_ExamPlanLessonIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); 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 4e8106348..c7c637b78 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 @@ -208,11 +208,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 判断考试时间是否冲突 /// /// - public void IsExamTimeClash(Exam_ExamPlanLessonEntity entity) + public (bool flag, string lessonname) IsExamTimeClash(Exam_ExamPlanLessonEntity entity) { try { - exam_ExamPlanLessonService.IsExamTimeClash(entity); + return exam_ExamPlanLessonService.IsExamTimeClash(entity); } catch (Exception ex) { 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 b34662b37..fa343c8f2 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 @@ -50,7 +50,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 实体 void SaveEntity(string keyValue, Exam_ExamPlanLessonEntity entity); - void IsExamTimeClash(Exam_ExamPlanLessonEntity entity); + (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 c9b058f10..e311e7905 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 @@ -224,7 +224,7 @@ and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan { //考试课程信息 var examLesson = db.FindEntity(x => x.ELId == lesson.ELId); - + //应排班级数 lesson.ClassNum = classInfo.Count(); //应考人数 @@ -281,14 +281,36 @@ and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan } /// - /// 判断考试时间是否冲突(未完成) + /// 判断考试时间是否冲突 /// /// - public void IsExamTimeClash(Exam_ExamPlanLessonEntity entity) + public (bool flag, string lessonname) IsExamTimeClash(Exam_ExamPlanLessonEntity entity) { try { - + var epl = this.BaseRepository("CollegeMIS").FindEntity(entity.EPLId); + //查询和entity考试日期同一天的考试课程 + var daylist = this.BaseRepository("CollegeMIS").FindList($"select * from [dbo].[Exam_ExamPlanLesson] where epid='{epl.EPId}' and examtime is not null and datediff(day, examdate, '{entity.ExamDate}') = 0"); + //考试开始时间 + var examstartTime = Convert.ToDateTime(entity.ExamDate.Value.ToString("yyyy-MM-dd") + " " + entity.ExamTimeStart.Trim()); + //考试结束时间 + var examendTime = Convert.ToDateTime(entity.ExamDate.Value.ToString("yyyy-MM-dd") + " " + entity.ExamTimeEnd.Trim()); + + foreach (var examPlanLesson in daylist) + { + //开始时间 + var startTime = Convert.ToDateTime(examPlanLesson.ExamDate.Value.ToString("yyyy-MM-dd") + " " + examPlanLesson.ExamTime.Split('-')[0]); + //结束时间 + var endTime = Convert.ToDateTime(examPlanLesson.ExamDate.Value.ToString("yyyy-MM-dd") + " " + examPlanLesson.ExamTime.Split('-')[1]); + if ((examstartTime >= startTime && examstartTime <= endTime) || + (examendTime >= startTime && examendTime <= endTime)) + { + return (true, examPlanLesson.LessonName); + } + + } + + return (false, ""); } catch (Exception ex) {