From 891fbac815c44a3a310575a2f4a0db2885a71ab4 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Thu, 5 May 2022 10:46:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E6=8E=92=E8=80=83=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E5=AE=89=E6=8E=92=E8=80=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Exam_ExamPlanController.cs | 5 +++ .../Exam_ExamPlan/Exam_ExamPlanBLL.cs | 19 ++++++++ .../Exam_ExamPlan/Exam_ExamPlanIBLL.cs | 1 + .../Exam_ExamPlan/Exam_ExamPlanService.cs | 44 +++++++++++++++++++ 4 files changed, 69 insertions(+) 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 f4dce10ad..0e00216e4 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 @@ -121,6 +121,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers [AjaxOnly] public ActionResult Generate(string keyValue) { + if (!exam_ExamPlanIBLL.IsGenerate(keyValue)) + { + return Fail("请先安排考试!"); + } + exam_ExamPlanIBLL.Generate(keyValue); return Success("生成成功!"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanBLL.cs index cf4c8e992..da10ee0ec 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanBLL.cs @@ -131,6 +131,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public bool IsGenerate(string keyValue) + { + try + { + return exam_ExamPlanService.IsGenerate(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 保存实体数据(新增、修改) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanIBLL.cs index fad617a88..5766e5ca7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanIBLL.cs @@ -39,6 +39,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration void ClearGenerate(string keyValue, int type); void Generate(string keyValue); + bool IsGenerate(string keyValue); /// /// 保存实体数据(新增、修改) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanService.cs index 11869c4bf..3ca32a8b9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanService.cs @@ -206,7 +206,50 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); } } } + /// + /// 是否可以生成排考名单 + /// + /// 排考记录主表Id + public bool IsGenerate(string keyValue) + { + var db = this.BaseRepository("CollegeMIS"); + try + { + db.BeginTrans(); + //排考记录表 + var examPlan = db.FindEntity(keyValue); + //排考安排课程已审核的数据 + var planLessonData = this.BaseRepository("CollegeMIS").FindList(x => x.EPId == keyValue && x.ELCheckMark == true); + if (planLessonData.Count() <= 0) + { + return false; + } + + foreach (var planLesson in planLessonData) + { + var planClassData = this.BaseRepository("CollegeMIS").FindList(x => x.EPLId == planLesson.EPLId); + var planRoomData = this.BaseRepository("CollegeMIS").FindList(x => x.EPLId == planLesson.EPLId); + if (planClassData.Count() <= 0 || planRoomData.Count() <= 0) + { + return false; + } + } + return true; + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } /// /// 生成排考名单 /// @@ -337,6 +380,7 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); } } } + /// /// 生成随机数组 ///