From 57b1e379e72c43b18576974532db4d2af3c70ea0 Mon Sep 17 00:00:00 2001
From: zhangli <1109134334@qq.com>
Date: Tue, 17 May 2022 10:44:18 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E6=8E=92=E8=80=83=E8=AF=95=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E8=80=83=E8=AF=95=E6=97=B6=E9=97=B4=E6=97=B6=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E5=88=A4=E6=96=AD=E8=80=83=E8=AF=95=E6=97=B6=E9=97=B4?=
=?UTF-8?q?=E6=98=AF=E5=90=A6=E5=86=B2=E7=AA=81=E7=9A=84=E9=99=90=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Exam_ExamPlanLessonController.cs | 9 +++++-
.../Exam_ExamPlanLessonBLL.cs | 4 +--
.../Exam_ExamPlanLessonIBLL.cs | 2 +-
.../Exam_ExamPlanLessonService.cs | 30 ++++++++++++++++---
4 files changed, 37 insertions(+), 8 deletions(-)
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)
{