From dc291767f4725b71298db2b1d40176a780e49a0f Mon Sep 17 00:00:00 2001 From: liangkun Date: Tue, 13 Jun 2023 18:28:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=80=83=E5=9C=BA=E3=80=81=E7=8F=AD?= =?UTF-8?q?=E7=BA=A7=E5=AE=89=E6=8E=92=E5=A2=9E=E5=8A=A0=E7=B3=BB=E9=83=A8?= =?UTF-8?q?=E9=9A=94=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Exam_ExamLesson/Exam_ExamLessonService.cs | 2 +- .../Exam_ExamPlanClassService.cs | 16 ++++++----- .../Exam_ExamPlanLessonEntity.cs | 5 ++++ .../Exam_ExamPlanLessonService.cs | 17 ++++++------ .../Exam_ExamPlanTimeEntity.cs | 2 +- .../Exam_ExamRoom/Exam_ExamRoomService.cs | 1 + .../Exam_ExamStudentService.cs | 27 ++++++++++--------- 7 files changed, 41 insertions(+), 29 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonService.cs index 431f14447..1428355bd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonService.cs @@ -278,7 +278,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration string sqldept = ""; if (!string.IsNullOrEmpty(ImportDeptNo)) { - sqldept = $" and t.DeptNo='{ImportDeptNo}'"; + sqldept = $" and t.DeptNo='{ImportDeptNo}' and LessonTypeId in (select LTId from CdLessonType where LessonTypeCode like 'Professional%') "; } //导入专业开课计划中是必修的(lessonsortno=1)、考核方式是考试的(ExamType='1',2022.6.23新增) string sql = $@"insert into Exam_ExamLesson([ELId] diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassService.cs index 84ce9608a..a739deffd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassService.cs @@ -329,7 +329,7 @@ where l.EPLId='{EPLId}' //查询当前考试记录所有考试课程 var lessonList = db.FindList($@"select a.*,b.MajorNo as TeachMajorNo FROM [dbo].[Exam_ExamPlanLesson] a left join [dbo].[Exam_ExamPlan] c on c.epid=a.epid -left join [dbo].[Exam_ExamLesson] b on a.lessonno=b.lessonno and b.AcademicYearNo=c.AcademicYearNo and b.Semester=c.Semester and b.Grade=a.Grade +left join [dbo].[Exam_ExamLesson] b on a.lessonno=b.lessonno and b.AcademicYearNo=c.AcademicYearNo and b.Semester=c.Semester and b.Grade=a.Grade and b.ImportDeptNo=c.ImportDeptNo where a.EPId='{EPId}'"); foreach (var lesson in lessonList) { @@ -337,30 +337,34 @@ where a.EPId='{EPId}'"); var cdLessonType = db.FindEntity(lesson.LessonTypeId); if (cdLessonType != null) { - if (cdLessonType.LessonTypeName.Contains("专业")) + if (cdLessonType.LessonTypeName.Contains("专业") || + cdLessonType.LessonTypeCode.Contains("Professional")) { //专业课添加此专业的所有班级 var addSql = $@"insert into Exam_ExamPlanClass SELECT NEWID(),'{lesson.EPLId}',c.ClassName,t.ClassNo,count(1) as StuNum FROM Exam_ExamStudent t - left join classinfo c on t.ClassNo=c.ClassNo WHERE t.ESEnabled=1 and t.AcademicYearNo='{examPlan.AcademicYearNo}' and t.Semester='{examPlan.Semester}' and t.Grade='{lesson.Grade}' + left join classinfo c on t.ClassNo=c.ClassNo WHERE t.ESEnabled=1 and t.AcademicYearNo='{examPlan.AcademicYearNo}' and t.Semester='{examPlan.Semester}' and t.Grade='{lesson.Grade}' and t.ImportDeptNo='{examPlan.ImportDeptNo}' and t.ESType='{examPlan.PlanType}' and c.majorno='{lesson.TeachMajorNo}' and t.ClassNo not in (select ClassNo from [dbo].[Exam_ExamPlanClass] where EPLId='{lesson.EPLId}') group by t.ClassNo,t.AcademicYearNo,t.Semester,t.ESType,c.ClassName "; db.ExecuteBySql(addSql); } - else if (cdLessonType.LessonTypeName.Contains("公共") || cdLessonType.LessonTypeName.Contains("公开")) + else if (cdLessonType.LessonTypeName.Contains("公共") || + cdLessonType.LessonTypeName.Contains("公开") || + cdLessonType.LessonTypeCode.Contains("OpenLesson")) { //公共课添加所有班级 var addSql = $@"insert into Exam_ExamPlanClass SELECT NEWID(),'{lesson.EPLId}',c.ClassName,t.ClassNo,count(1) as StuNum FROM Exam_ExamStudent t - left join classinfo c on t.ClassNo=c.ClassNo WHERE t.ESEnabled=1 and t.AcademicYearNo='{examPlan.AcademicYearNo}' and t.Semester='{examPlan.Semester}' and t.ESType='{examPlan.PlanType}' and t.Grade='{lesson.Grade}' + left join classinfo c on t.ClassNo=c.ClassNo WHERE t.ESEnabled=1 and t.AcademicYearNo='{examPlan.AcademicYearNo}' and t.Semester='{examPlan.Semester}' and t.ESType='{examPlan.PlanType}' and t.Grade='{lesson.Grade}' and t.ImportDeptNo='{examPlan.ImportDeptNo}' and t.ClassNo not in (select ClassNo from [dbo].[Exam_ExamPlanClass] where EPLId='{lesson.EPLId}') group by t.ClassNo,t.AcademicYearNo,t.Semester,t.ESType,c.ClassName "; db.ExecuteBySql(addSql); } } - + else + continue; //更新排考安排课程表实排班级数、实排人数和应排班级数、应排人数(如果没有点击【一键安排班级】,应排班级数、应排人数在安排考试页面切换课程时候更新) string sql = $@"update l set l.RealStuCount=t.RealStuCount,l.RealClassNum=t.RealClassNum,ClassNum=t.RealClassNum,StuCount=t.RealStuCount 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 4baa5d04c..8bb49c03b 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 @@ -130,6 +130,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [NotMapped] public string LessonTypeName { get; set; } /// + /// 课程类型编号 + /// + [NotMapped] + public string LessonTypeCode { get; set; } + /// /// 专业 /// [NotMapped] 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 37f74e960..7813e7ee1 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 @@ -329,7 +329,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { //必修+'('+grade+')' string sql = $@"insert into Exam_ExamPlanLesson(EPLId,EPId,LessonName,LessonNo,LessonTypeId,Grade) -select NEWID(),'{EPId}',LessonName,LessonNo,LessonTypeId,grade from Exam_ExamLesson where ELEnabled=1 and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan.Semester}' +select NEWID(),'{EPId}',LessonName,LessonNo,LessonTypeId,grade from Exam_ExamLesson where ELEnabled=1 and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan.Semester}' and ImportDeptNo='{exam_ExamPlan.ImportDeptNo}' and LessonNo not in (select LessonNo from Exam_ExamPlanLesson where EPId='{EPId}') group by LessonNo,grade,LessonName,LessonTypeId,grade"; this.BaseRepository("CollegeMIS").ExecuteBySql(sql); @@ -340,7 +340,7 @@ select NEWID(),'{EPId}',LessonName,LessonNo,LessonTypeId,grade from Exam_ExamLes string sql = $@" insert into Exam_ExamPlanLesson(EPLId,EPId,LessonName,LessonNo,LessonTypeId,Grade) select NEWID(),'{EPId}',a.lessonname,a.LessonNo,t.LessonTypeId,b.Grade from StuScore a left join StuInfoBasic b on b.StuNo=a.StuNo - join (select l.lessonno,l.LessonTypeId,lt.ltorder from Exam_ExamLesson l left join CdLessonType lt on l.LessonTypeId=lt.ltid where l.elenabled=1 and l.AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and l.Semester='{exam_ExamPlan.Semester}' ) t on a.lessonno=t.lessonno + join (select l.lessonno,l.LessonTypeId,lt.ltorder from Exam_ExamLesson l left join CdLessonType lt on l.LessonTypeId=lt.ltid where l.elenabled=1 and l.AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and l.Semester='{exam_ExamPlan.Semester}' and ImportDeptNo='{exam_ExamPlan.ImportDeptNo}' ) t on a.lessonno=t.lessonno --left join (select l.lessonno,l.LessonTypeId,lt.ltorder from lessoninfo l left join CdLessonType lt on l.LessonTypeId=lt.ltid ) t on a.lessonno=t.lessonno where 1=1 and a.LessonSortNo='1' and ((a.Score>=0 and a.Score<60) or a.Score=(-5) or a.Score=(-10)) and (b.ChangeStatus<>'1' or len(b.ChangeStatus)=0 or b.ChangeStatus is null) @@ -355,7 +355,7 @@ and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan string sql = $@" insert into Exam_ExamPlanLesson(EPLId,EPId,LessonName,LessonNo,LessonTypeId,Grade) select NEWID(),'{EPId}',a.lessonname,a.LessonNo,t.LessonTypeId,b.Grade from StuScoreNotPass a left join StuInfoBasic b on b.StuNo=a.StuNo - join (select l.lessonno,l.LessonTypeId,lt.ltorder from Exam_ExamLesson l left join CdLessonType lt on l.LessonTypeId=lt.ltid where l.elenabled=1 and l.AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and l.Semester='{exam_ExamPlan.Semester}' ) t on a.lessonno=t.lessonno + join (select l.lessonno,l.LessonTypeId,lt.ltorder from Exam_ExamLesson l left join CdLessonType lt on l.LessonTypeId=lt.ltid where l.elenabled=1 and l.AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and l.Semester='{exam_ExamPlan.Semester}' and ImportDeptNo='{exam_ExamPlan.ImportDeptNo}' ) t on a.lessonno=t.lessonno --left join (select l.lessonno,l.LessonTypeId,lt.ltorder from lessoninfo l left join CdLessonType lt on l.LessonTypeId=lt.ltid ) t on a.lessonno=t.lessonno where 1=1 and a.LessonSortNo='1' and ((a.Score>=0 and a.Score<60) or a.Score=(-5) or a.Score=(-10)) and (b.ChangeStatus<>'1' or len(b.ChangeStatus)=0 or b.ChangeStatus is null) @@ -592,8 +592,8 @@ left join CdLessonType ltype on info.LessonTypeId=ltype.LTId return (false, "请先安排考试记录时间!"); } //考试课程数据 - var EPLessonList = db.FindList($@" select distinct elesson.ExamTime as ExamLength,ltype.LessonTypeName,elesson.MajorNo as TeachMajorNo,t.* from Exam_ExamPlanLesson t -join Exam_ExamLesson elesson on t.LessonNo=elesson.LessonNo and [AcademicYearNo]='{examPlan.AcademicYearNo}' and [Semester]='{examPlan.Semester}' + var EPLessonList = db.FindList($@" select distinct elesson.ExamTime as ExamLength,ltype.LessonTypeCode,ltype.LessonTypeName,elesson.MajorNo as TeachMajorNo,t.* from Exam_ExamPlanLesson t +join Exam_ExamLesson elesson on t.LessonNo=elesson.LessonNo and [AcademicYearNo]='{examPlan.AcademicYearNo}' and [Semester]='{examPlan.Semester}' and elesson.ImportDeptNo='{examPlan.ImportDeptNo}' left join CdLessonType ltype on elesson.LessonTypeId=ltype.LTId where t.EPId='{EPId}' and elesson.ELEnabled=1 "); // if (examPlan.PlanType == "1") @@ -618,8 +618,9 @@ left join CdLessonType ltype on elesson.LessonTypeId=ltype.LTId { EPLesson.ExamDate = null; EPLesson.ExamTime = null; - if (!string.IsNullOrEmpty(EPLesson.LessonTypeName) && (EPLesson.LessonTypeName.Contains("公共") || EPLesson.LessonTypeName.Contains("公开"))) + if (!string.IsNullOrEmpty(EPLesson.LessonTypeName) && (EPLesson.LessonTypeName.Contains("公共") || EPLesson.LessonTypeName.Contains("公开")||EPLesson.LessonTypeCode.Contains("OpenLesson"))) { + //获取公共课时间安排 var EPTimes = EPTimeList.Where(x => x.ExamType == "2" && x.ExamTimeLength == EPLesson.ExamLength).ToList(); foreach (var EPTime in EPTimes) { @@ -627,7 +628,7 @@ left join CdLessonType ltype on elesson.LessonTypeId=ltype.LTId //不存在同专业同时间段的考试课程,修改考试时间 if (!EPLessonList.ToList().Exists(x => x.TeachMajorNo == EPLesson.TeachMajorNo && x.ExamLength == EPTime.ExamTimeLength && x.ExamDate != null && - x.ExamDate == EPTime.ExamDate && x.ExamTime == time)) + x.ExamDate == EPTime.ExamDate && x.ExamTime == time&&x.Grade==EPLesson.Grade)) { EPLesson.ExamDate = EPTime.ExamDate; EPLesson.ExamTime = time; @@ -652,7 +653,7 @@ left join CdLessonType ltype on elesson.LessonTypeId=ltype.LTId //不存在同专业同时间段的考试课程,修改考试时间 if (!EPLessonList.ToList().Exists(x => x.TeachMajorNo == EPLesson.TeachMajorNo && x.ExamLength == EPTime.ExamTimeLength && x.ExamDate != null && - x.ExamDate == EPTime.ExamDate && x.ExamTime == time)) + x.ExamDate == EPTime.ExamDate && x.ExamTime == time && x.Grade == EPLesson.Grade)) { EPLesson.ExamDate = EPTime.ExamDate; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanTime/Exam_ExamPlanTimeEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanTime/Exam_ExamPlanTimeEntity.cs index a57c80988..01e2b90ad 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanTime/Exam_ExamPlanTimeEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanTime/Exam_ExamPlanTimeEntity.cs @@ -45,7 +45,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [Column("EXAMTIMELENGTH")] public double? ExamTimeLength { get; set; } /// - /// 排考名称 + /// 课程类型 /// [Column("EXAMTYPE")] public string ExamType { get; set; } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomService.cs index 523223b6f..5f8f0c500 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomService.cs @@ -84,6 +84,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { strSql.Append($" AND t.AcademicYearNo = '{ELEntity.AcademicYearNo}' "); strSql.Append($" AND t.Semester = '{ELEntity.Semester}' "); + strSql.Append($" AND t.ImportDeptNo = '{ELEntity.ImportDeptNo}' "); } strSql.Append($" AND t.ClassroomNo not in (select ClassroomNo from Exam_ExamPlanRoom where EPLId='{queryParam["EPLId"].ToString()}') "); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs index 2c8d2075d..2568abda4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs @@ -117,6 +117,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration strSql.Append(@" t.ClassNo,count(1) as StuNum,t.AcademicYearNo,t.Semester,t.ESType,c.ClassName "); strSql.Append(" FROM Exam_ExamStudent t "); strSql.Append(" left join classinfo c on t.ClassNo=c.ClassNo "); + strSql.Append(" left join Exam_ExamPlan d on t.ImportDeptNo=d.ImportDeptNo "); strSql.Append(" WHERE t.ESEnabled=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 @@ -151,19 +152,19 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration dp.Add("StuName", "%" + queryParam["StuName"].ToString() + "%", DbType.String); strSql.Append(" AND t.StuName Like @StuName "); } - if (!queryParam["ImportDeptNo"].IsEmpty()) - { - if (queryParam["ImportDeptNo"].ToString() == "0") - { - strSql.Append(" AND t.ImportDeptNo='' "); - } - else - { - dp.Add("ImportDeptNo", queryParam["ImportDeptNo"].ToString(), DbType.String); - strSql.Append(" AND t.ImportDeptNo = @ImportDeptNo "); - } + //if (!queryParam["ImportDeptNo"].IsEmpty()) + //{ + // if (queryParam["ImportDeptNo"].ToString() == "0") + // { + // strSql.Append(" AND t.ImportDeptNo='' "); + // } + // else + // { + // dp.Add("ImportDeptNo", queryParam["ImportDeptNo"].ToString(), DbType.String); + // strSql.Append(" AND t.ImportDeptNo = @ImportDeptNo "); + // } - } + //} if (!queryParam["ESType"].IsEmpty()) { dp.Add("ESType", queryParam["ESType"].ToString(), DbType.String); @@ -184,7 +185,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var examPlan = this.BaseRepository("CollegeMIS").FindEntity(queryParam["EPId"].ToString()); if (examPlan != null) { - strSql.Append($" AND t.AcademicYearNo = '{examPlan.AcademicYearNo}' AND t.Semester = '{examPlan.Semester}' AND t.ESType = '{examPlan.PlanType}' "); + strSql.Append($" AND t.AcademicYearNo = '{examPlan.AcademicYearNo}' AND t.Semester = '{examPlan.Semester}' AND t.ESType = '{examPlan.PlanType}' and t.ImportDeptNo='{examPlan.ImportDeptNo}' "); } } strSql.Append(" group by t.ClassNo,t.AcademicYearNo,t.Semester,t.ESType,c.ClassName "); From 75e89f3453ff530f35f9dd9ae9158ed84d378bbb Mon Sep 17 00:00:00 2001 From: liangkun Date: Wed, 14 Jun 2023 16:21:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=95=99=E5=AE=A4=E3=80=81=E7=9B=91?= =?UTF-8?q?=E8=80=83=E8=80=81=E5=B8=88=E7=B3=BB=E9=83=A8=E9=9A=94=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Exam_ExamPlanLesson/FormRoomTeacher.js | 13 +++++++---- .../Exam_ExamPlanRoomService.cs | 23 +++++++++++++------ .../Exam_InvigilateTeacherEntity.cs | 3 +++ .../Exam_InvigilateTeacherService.cs | 7 +++--- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoomTeacher.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoomTeacher.js index 4c9ea7c1c..460dcdff1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoomTeacher.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoomTeacher.js @@ -95,11 +95,14 @@ var bootstrap = function ($, learun) { if (data[id].EmpNo && (data[id].EmpNo).indexOf(',') != -1) { var empnoArr = data[id].EmpNo.split(','); var empnameArr = data[id].EmpName.split(','); - $.each(empnoArr, function (i, val) { - if (!!val) { - tempdatra.push({ EmpNo: val, EmpName: empnameArr[i] }); - } - }); + $.each(empnoArr, + function(i, val) { + if (!!val) { + tempdatra.push({ EmpNo: val, EmpName: empnameArr[i] }); + } + }); + } else { + tempdatra.push({ EmpNo: data[id].EmpNo, EmpName: data[id].EmpName }); } $('#Exam_ExamPlanTeacher').jfGridSet('refreshdata', tempdatra); } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomService.cs index 7dec2cc0d..e0df6cf63 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomService.cs @@ -343,7 +343,7 @@ where l.EPLId='{EPLId}'"; //考场座位数 int? seatCount = 0; var roomListSql = - $"select * from Exam_ExamRoom where AcademicYearNo='{examPlan.AcademicYearNo}' and Semester='{examPlan.Semester}' and EREnabled=1 "; + $"select * from Exam_ExamRoom where AcademicYearNo='{examPlan.AcademicYearNo}' and Semester='{examPlan.Semester}' and ImportDeptNo='{examPlan.ImportDeptNo}' and EREnabled=1 "; if (conflictRoom.Count() > 0) { var classroomNo = string.Join("','", conflictRoom.ToList()); @@ -461,9 +461,9 @@ where l.EPLId='{EPLId}'"; } //查询课程信息 - var lessoninfo = db.FindList($@"select top 1 t.LessonTypeName,l.* from lessoninfo l + var lessoninfo = db.FindList($@"select top 1 t.LessonTypeName,t.LessonTypeCode,l.* from lessoninfo l join [dbo].[CdLessonType] t on l.LessonTypeId = t.LTId where l.LessonNo='{LessonNo}' ").FirstOrDefault(); - if (lessoninfo != null && !lessoninfo.LessonTypeName.Contains("公共") && !lessoninfo.LessonTypeName.Contains("公开")) + if (lessoninfo != null && !lessoninfo.LessonTypeName.Contains("公共") && !lessoninfo.LessonTypeName.Contains("公开")&&!lessoninfo.LessonTypeCode.Contains("OpenLesson")) { //如果是专业课,监考老师不能添加这门课的代课老师 var teachClass = db.FindList( @@ -502,14 +502,23 @@ where l.EPLId='{EPLId}'"; empnos.Add(examRoom.EmpNo); } } - - var sql = $@"select * from Exam_InvigilateTeacher where AcademicYearNo='{examPlan.AcademicYearNo}' and Semester='{examPlan.Semester}' and ITEnabled=1 "; + //20230614增加已排监考次数算法 + //排过监考的老师顺序往后调整 + //var sql = $@"select * from Exam_InvigilateTeacher where AcademicYearNo='{examPlan.AcademicYearNo}' and Semester='{examPlan.Semester}' and ImportDeptNo='{examPlan.ImportDeptNo}' and ITEnabled=1 "; + var sql = $@"select aa.EmpName,aa.EmpNo,count(b.EmpNo) as times from Exam_InvigilateTeacher aa + left join(select EPRId, SUBSTRING(a.EmpNo, number, CHARINDEX(',',a.EmpNo + ',',number)-number) as EmpNo + from[Exam_ExamPlanRoom] a with(nolock) ,master..spt_values with(nolock) + where number>= 1 and number"'"+m.EPLId+"'"))}) + ) b on aa.empno = b.empno + where aa.AcademicYearNo = '{examPlan.AcademicYearNo}' and aa.Semester = '{examPlan.Semester}' and aa.ImportDeptNo = '{examPlan.ImportDeptNo}' and aa.ITEnabled = 1"; if (empnos.Count() > 0) { string nos = string.Join("','", empnos); - sql += $" and EmpNo not in ('{nos}')"; + sql += $" and aa.EmpNo not in ('{nos}')"; } - var Exam_InvigilateTeacher = db.FindList(sql).OrderBy(x => Guid.NewGuid()).ToList(); + sql += " group by aa.EmpName,aa.EmpNo order by times"; + var Exam_InvigilateTeacher = db.FindList(sql).OrderBy(x => Guid.NewGuid()).OrderBy(x=>x.times).ToList(); //查询考场 var examPlanRooms = db.FindList(x => x.EPLId == epLesson.EPLId).ToList(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherEntity.cs index 2db0315e2..11393b2f5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherEntity.cs @@ -72,6 +72,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } #endregion #region 扩展字段 + + [NotMapped] public int times { get; set; } + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherService.cs index 20d4f1df0..86e21b4b7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherService.cs @@ -88,6 +88,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { strSql.Append($" AND t.AcademicYearNo = '{ELEntity.AcademicYearNo}' "); strSql.Append($" AND t.Semester = '{ELEntity.Semester}' "); + strSql.Append($" AND t.ImportDeptNo = '{ELEntity.ImportDeptNo}' "); } //同一考试课程下考场的监考老师不重复 var empSql = "SELECT STUFF( (SELECT ',' + empno FROM Exam_ExamPlanRoom WHERE 1=1 "; @@ -97,7 +98,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } empSql += $@" and EPLId = T.EPLId FOR XML PATH('') ), 1, 1, '') AS empno FROM Exam_ExamPlanRoom AS T - where EPLId ='{queryParam["EPLId"].ToString()}'"; + where EPLId ='{queryParam["EPLId"].ToString()}' and empno is not null "; var obj = this.BaseRepository("CollegeMIS").FindList(empSql).Select(x => x.EmpNo).Distinct().ToList(); if (obj.Count() > 0) { @@ -113,9 +114,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration LessonNo = LessonNo.Split('(')[0]; } //查询课程信息 - var lessoninfo = this.BaseRepository("CollegeMIS").FindList($@"select top 1 t.LessonTypeName,l.* from lessoninfo l + var lessoninfo = this.BaseRepository("CollegeMIS").FindList($@"select top 1 t.LessonTypeName,t.LessonTypeCode,l.* from lessoninfo l join [dbo].[CdLessonType] t on l.LessonTypeId = t.LTId where l.LessonNo='{LessonNo}' ").FirstOrDefault(); - if (lessoninfo != null && !lessoninfo.LessonTypeName.Contains("公共") && !lessoninfo.LessonTypeName.Contains("公开")) + if (lessoninfo != null && !lessoninfo.LessonTypeName.Contains("公共") && !lessoninfo.LessonTypeName.Contains("公开")&&!lessoninfo.LessonTypeCode.Contains("OpenLesson")) { //如果是专业课,监考老师不能添加这门课的代课老师 var teachClass = this.BaseRepository("CollegeMIS").FindList(