From 6585da977c821e5fea5e7d6111adbd710a0081b6 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Mon, 25 Apr 2022 18:49:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E8=80=83=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Exam_ExamPlanLessonController.cs | 29 +++++++++- .../Views/Exam_ExamPlan/Form.cshtml | 8 +-- .../Views/Exam_ExamPlan/Index.js | 14 ++++- .../Views/Exam_ExamPlanLesson/FormClass.js | 5 +- .../Views/Exam_ExamPlanLesson/FormRoom.js | 33 +++-------- .../Exam_ExamPlanLesson/FormRoomTeacher.js | 55 +++++++++++-------- .../Exam_ExamPlan/Exam_ExamPlanService.cs | 40 +++++++++++--- .../Exam_ExamPlanClassService.cs | 6 ++ .../Exam_ExamRoom/Exam_ExamRoomService.cs | 2 +- 9 files changed, 127 insertions(+), 65 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 84a640d37..2dbb1fe89 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 @@ -20,6 +20,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers private Exam_ExamPlanLessonIBLL exam_ExamPlanLessonIBLL = new Exam_ExamPlanLessonBLL(); private Exam_ExamPlanClassIBLL exam_ExamPlanClassIBLL = new Exam_ExamPlanClassBLL(); private Exam_ExamPlanRoomIBLL exam_ExamPlanRoomIBLL = new Exam_ExamPlanRoomBLL(); + private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); + private StuInfoBasicIBLL StuInfoBasicIBLL = new StuInfoBasicBLL(); #region 视图功能 @@ -69,7 +71,32 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers #endregion #region 获取数据 - + /// + /// 获取班级分页列表 + /// + /// + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetClassInfoPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = classInfoIBLL.GetPageList(paginationobj, queryJson); + var stuList = StuInfoBasicIBLL.GetAllList(); + foreach (var item in data) + { + item.StuNum = stuList.Count(x => x.ClassNo == item.ClassNo); + } + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } /// /// 获取页面显示列表数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Form.cshtml index f8810fce8..45b9e734b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Form.cshtml @@ -27,14 +27,14 @@
排考总人数*
-
-
生成座位*
+
+
是否随机座位*
-
+ @*
是否生成*
-
+
*@
排序号*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js index 9d045a9ec..df7a6bf32 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js @@ -55,6 +55,11 @@ var bootstrap = function ($, learun) { $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('EPId'); if (learun.checkrow(keyValue)) { + //是否生成 + var EPGenarate = $('#gridtable').jfGridValue('EPGenarate'); + if (EPGenarate == true) { + return learun.alert.warning("已生成排考名单,不可编辑!"); + } learun.layerForm({ id: 'form', title: '编辑', @@ -71,6 +76,11 @@ var bootstrap = function ($, learun) { $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('EPId'); if (learun.checkrow(keyValue)) { + //是否生成 + var EPGenarate = $('#gridtable').jfGridValue('EPGenarate'); + if (EPGenarate == true) { + return learun.alert.warning("已生成排考名单,不可删除!"); + } learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/DeleteForm', { keyValue: keyValue }, function () { @@ -114,7 +124,7 @@ var bootstrap = function ($, learun) { $('#lr_cleardata').on('click', function () { var keyValue = $('#gridtable').jfGridValue('EPId'); if (learun.checkrow(keyValue)) { - learun.layerConfirm('是否确认清除排考所有记录!', function (res) { + learun.layerConfirm('是否确认清除所有排考记录!', function (res) { if (res) { learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/ClearGenerate', { keyValue: keyValue, type: 2 }, function () { refreshGirdData(); @@ -159,7 +169,7 @@ var bootstrap = function ($, learun) { { label: "排考编号", name: "PlanCode", width: 100, align: "left" }, { label: "排考总人数", name: "EPStuCount", width: 100, align: "left" }, { - label: "生成座位", name: "EPRandom", width: 100, align: "left", + label: "是否随机座位", name: "EPRandom", width: 100, align: "left", formatter: function (cellvalue) { return cellvalue == true ? "是" : "否"; } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormClass.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormClass.js index 7b7d46cd6..b86d85b55 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormClass.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormClass.js @@ -26,7 +26,7 @@ var bootstrap = function ($, learun) { // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ - url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GetPageList', + url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/GetClassInfoPageList', headData: [ { label: "班级名称", name: "ClassName", width: 200, align: "left" }, { label: "班级代码", name: "ClassNo", width: 100, align: "left" }, @@ -121,6 +121,9 @@ var bootstrap = function ($, learun) { // 保存数据 acceptClick = function (callBack) { var selectedRow = $('#gridtable').jfGridGet('rowdata'); + if (selectedRow.length == 0) { + return learun.alert.warning("请选择班级!"); + } var list = []; $.each(selectedRow, function (i, item) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.js index 9b4ec8238..6c2b15e78 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.js @@ -75,32 +75,13 @@ var bootstrap = function ($, learun) { // 保存数据 acceptClick = function (callBack) { var selectedRow = $('#gridtable').jfGridGet('rowdata'); - learun.layerClose(window.name); - callBack(selectedRow); - //var list = []; - //$.each(selectedRow, - // function (i, item) { - // var entity = { - // ClassroomName: item.ClassroomName, - // ClassroomNo: item.ClassroomNo, - // SeatCount: item.SeatCount, - // EPRId: learun.newGuid(), - // EPLId: EPLId - // } - // list.push(entity); - - // }); - //$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/SaveRoom?EPLId=' + EPLId, - // { list: list }), function (res) { - // // 保存成功后才回调 - // if (!!callBack) { - // callBack(); - // } - // }; - - //if (!!callBack) { - // callBack(); - //} + if (!!selectedRow) { + learun.layerClose(window.name); + callBack(selectedRow); + } else { + return learun.alert.warning("请选择考场!"); + } + }; page.init(); } 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 302f0a453..44863aeec 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 @@ -106,18 +106,20 @@ var bootstrap = function ($, learun) { }; refreshGirdData = function (temprow) { //console.log('temprow', temprow); - //求数组并集 - //两数组连接(包括重复值) - var arr3 = tempdatra.concat(temprow); - //var result = []; - var obj = []; - //去重 - tempdatra = arr3.reduce(function (prev, cur, index, arr) { - //console.log(prev, cur); - obj[cur.EmpNo] ? '' : obj[cur.EmpNo] = true && prev.push(cur); - return prev; - }, []); - $('#Exam_ExamPlanTeacher').jfGridSet('refreshdata', tempdatra); + if (!!temprow) { + //求数组并集 + //两数组连接(包括重复值) + var arr3 = tempdatra.concat(temprow); + //var result = []; + var obj = []; + //去重 + tempdatra = arr3.reduce(function (prev, cur, index, arr) { + //console.log(prev, cur); + obj[cur.EmpNo] ? '' : obj[cur.EmpNo] = true && prev.push(cur); + return prev; + }, []); + $('#Exam_ExamPlanTeacher').jfGridSet('refreshdata', tempdatra); + } }; refreshRoomData = function (temprow) { // console.log('teacherRow', temprow); @@ -146,18 +148,25 @@ var bootstrap = function ($, learun) { }; // 保存数据 acceptClick = function (callBack, i) { - var postData = {}; - var formData = $('[data-table="Exam_ExamPlanRoom"]').lrGetFormData(); - formData.EPLId = EPLId; - postData.strEntity = JSON.stringify(formData); - postData.Exam_ExamPlanTeacherList = JSON.stringify($('#Exam_ExamPlanTeacher').jfGridGet('rowdatas')); - - $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/SaveRoomAndTeacher?keyValue=' + keyValue, postData, function (res) { - // 保存成功后才回调 - if (!!callBack) { - callBack(res, formData, i); + var bool = validForm(); + if (bool) { + var postData = {}; + var formData = $('[data-table="Exam_ExamPlanRoom"]').lrGetFormData(); + if (!formData.ClassroomName) { + return learun.alert.warning("请选择考场!"); } - }); + formData.EPLId = EPLId; + postData.strEntity = JSON.stringify(formData); + postData.Exam_ExamPlanTeacherList = JSON.stringify($('#Exam_ExamPlanTeacher').jfGridGet('rowdatas')); + + $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/SaveRoomAndTeacher?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(res, formData, i); + } + }); + } + }; page.init(); } 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 ba209c059..290b07b5c 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 @@ -189,6 +189,8 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); } } + //修改排考记录表是否生成字段 + db.ExecuteBySql($"update Exam_ExamPlan set EPGenarate=0 where EPId='{keyValue}'"); db.Commit(); } catch (Exception ex) @@ -215,6 +217,8 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); try { db.BeginTrans(); + //排考记录表 + var examPlan = db.FindEntity(keyValue); //排考安排课程已审核的数据 var planLessonData = db.FindList(x => x.EPId == keyValue && x.ELCheckMark == true); @@ -263,6 +267,8 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); //生成考场随机数 var sealNumArr = getRanNum(planRoom.SeatCount.Value); + //删除考场明细 + db.ExecuteBySql($"delete Exam_ArrangeExamTermItemNew where EPId='{keyValue}'"); for (int n = 0; n < sealNumArr.Count; n++) { //考场安排明细 @@ -286,23 +292,43 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); //排考安排班级 var planClassData = db.FindList(x => x.EPLId == planLesson.EPLId); var classnos = string.Join("','", planClassData.Select(x => x.ClassNo).ToList()); - string stuSql = $"select * from StuInfoBasic where classno in ('{classnos}') and stuno not in (select StuNo from Exam_ArrangeExamTermItemNew where EPId='{keyValue}')"; + string stuSql = $"select * from StuInfoBasic where checkMark='1' and classno in ('{classnos}') and stuno not in (select StuNo from Exam_ArrangeExamTermItemNew where EPId='{keyValue}')"; //所有考生 var stuInfoList = db.FindList(stuSql).ToList(); if (itemList.Count >= stuInfoList.Count()) { - //为考生安排座位 - for (int i = 0; i < stuInfoList.Count; i++) + //随机安排座位 + if (examPlan.EPRandom == true) { - itemList[i].StuNo = stuInfoList[i].StuNo; - itemList[i].StuName = stuInfoList[i].StuName; + stuInfoList = stuInfoList.OrderBy(x => Guid.NewGuid()).ToList(); + //为考生安排座位 + for (int i = 0; i < stuInfoList.Count; i++) + { + itemList[i].StuNo = stuInfoList[i].StuNo; + itemList[i].StuName = stuInfoList[i].StuName; + } + + db.Insert(itemList); } + else + { + //不随机安排座位 + itemList = itemList.OrderBy(x => x.SitNumber).OrderBy(x => x.ClassroomNo).ToList(); + stuInfoList = stuInfoList.OrderBy(x =>x.StuNo).OrderBy(x=>x.ClassNo).ToList(); + //为考生安排座位 + for (int i = 0; i < stuInfoList.Count; i++) + { + itemList[i].StuNo = stuInfoList[i].StuNo; + itemList[i].StuName = stuInfoList[i].StuName; + } - db.Insert(itemList); + db.Insert(itemList); + } } } - + //修改排考记录表是否生成字段 + db.ExecuteBySql($"update Exam_ExamPlan set EPGenarate=1 where EPId='{keyValue}'"); db.Commit(); } catch (Exception ex) 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 f8ddd5618..0d192394e 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 @@ -207,6 +207,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { try { + var stuinfo = this.BaseRepository("CollegeMIS").FindList(); + //计算班级人数 + foreach (var entity in list) + { + entity.ClassStuNum = stuinfo.Count(x => x.ClassNo == entity.ClassNo); + } this.BaseRepository("CollegeMIS").Insert(list); //更新排考安排课程表实排班级数、实排人数 //排考安排课程表Id 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 956c32387..3c830ea23 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 @@ -67,7 +67,7 @@ select EPId from Exam_ExamPlanLesson where EPLId='{queryParam["EPLId"].ToString( strSql.Append($" AND t.AcademicYearNo = '{ELEntity.AcademicYearNo}' "); strSql.Append($" AND t.Semester = '{ELEntity.Semester}' "); } - + strSql.Append($" AND t.ClassroomNo not in (select ClassroomNo from Exam_ExamPlanRoom where EPLId='{queryParam["EPLId"].ToString()}') "); } if (!queryParam["SqlParameter"].IsEmpty())