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}');"); } } } + /// /// 生成随机数组 ///