From 75e89f3453ff530f35f9dd9ae9158ed84d378bbb Mon Sep 17 00:00:00 2001 From: liangkun Date: Wed, 14 Jun 2023 16:21:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E5=AE=A4=E3=80=81=E7=9B=91=E8=80=83?= =?UTF-8?q?=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(