From 0433a3417bf000e8cb430c1d5026d2932295a052 Mon Sep 17 00:00:00 2001 From: ndbs Date: Wed, 23 Oct 2024 15:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E5=9C=BA=E5=BA=A7=E4=BD=8D=E5=9B=BE?= =?UTF-8?q?=20=E7=BC=96=E8=BE=91=E6=98=AF=E5=90=A6=E6=9C=89=E7=A9=BA?= =?UTF-8?q?=E4=BD=8D=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Exam_ExamRoomController.cs | 56 ++++++-- .../Views/Exam_ExamRoom/FormSeat.cshtml | 124 ++++++++++++++++++ .../Views/Exam_ExamRoom/Index.cshtml | 1 + .../Views/Exam_ExamRoom/Index.js | 20 +++ .../Learun.Application.Web.csproj | 1 + .../Exam_ExamRoom/Exam_ExamRoomBLL.cs | 8 +- .../Exam_ExamRoom/Exam_ExamRoomIBLL.cs | 2 +- .../Exam_ExamRoom/Exam_ExamRoomService.cs | 48 ++++--- .../Exam_ExamRoomDetailBLL.cs | 25 +++- .../Exam_ExamRoomDetailEntity.cs | 2 +- .../Exam_ExamRoomDetailIBLL.cs | 3 +- .../Exam_ExamRoomDetailService.cs | 43 +++++- 12 files changed, 283 insertions(+), 50 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/FormSeat.cshtml diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamRoomController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamRoomController.cs index 8721f5ce0..f572594c6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamRoomController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamRoomController.cs @@ -3,6 +3,7 @@ using System.Data; using Learun.Application.TwoDevelopment.EducationalAdministration; using System.Web.Mvc; using System.Collections.Generic; +using System.Linq; namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { @@ -16,6 +17,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers public class Exam_ExamRoomController : MvcControllerBase { private Exam_ExamRoomIBLL exam_ExamRoomIBLL = new Exam_ExamRoomBLL(); + private Exam_ExamRoomDetailIBLL exam_ExamRoomDetailIBLL = new Exam_ExamRoomDetailBLL(); #region 视图功能 @@ -46,7 +48,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { return View(); } - + [HttpGet] + public ActionResult FormSeat() + { + return View(); + } #endregion #region 获取数据 @@ -88,6 +94,23 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers }; return Success(jsonData); } + + /// + /// 获取表单数据 + /// + /// 主键 + /// + public ActionResult GetClassRoomDetailData(string classroomNo, string AcademicYearNo, int? Semester) + { + var Exam_ExamRoomData = exam_ExamRoomIBLL.GetEntityByClassroomNo(classroomNo, AcademicYearNo, Semester); + var Exam_ExamRoomDetailData = exam_ExamRoomDetailIBLL.GetList("").Where(x => x.ClassRoomNo == classroomNo && x.AcademicYearNo == AcademicYearNo && x.Semester == Semester).OrderBy(x => x.ECOrder); + var jsonData = new + { + Exam_ExamRoomDetailData = Exam_ExamRoomDetailData, + Exam_ExamRoomData = Exam_ExamRoomData + }; + return Success(jsonData); + } #endregion #region 提交数据 @@ -113,7 +136,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers [AjaxOnly] public ActionResult Import(string AcademicYearNo, string Semester, int SeatRows, int SeatColumns) { - int res = exam_ExamRoomIBLL.Import(AcademicYearNo, Semester,SeatRows,SeatColumns); + int res = exam_ExamRoomIBLL.Import(AcademicYearNo, Semester, SeatRows, SeatColumns); + exam_ExamRoomIBLL.SeatEntity(AcademicYearNo, Semester); return Success("导入" + res + "条数据!"); } /// @@ -139,9 +163,9 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers public ActionResult SaveForm(string keyValue, string strEntity) { Exam_ExamRoomEntity entity = strEntity.ToObject(); - + //判断考场编号有无重复 - var model = exam_ExamRoomIBLL.GetEntityByClassroomNo(entity.ClassroomNo,entity.AcademicYearNo,entity.Semester); + var model = exam_ExamRoomIBLL.GetEntityByClassroomNo(entity.ClassroomNo, entity.AcademicYearNo, entity.Semester); if (model != null && string.IsNullOrEmpty(keyValue)) { return Fail("考场编号重复!"); @@ -159,13 +183,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers } return Success("保存成功!"); } - [HttpPost] - [AjaxOnly] - public ActionResult SeatForm(string AcademicYearNo, string Semester,string Type) - { - int res = exam_ExamRoomIBLL.SeatEntity(AcademicYearNo, Semester); - return Success("清空" + res + "条数据!"); - } /// /// 启用/停用 @@ -180,7 +197,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers exam_ExamRoomIBLL.Lock(keyValue, EREnabled); return Success("操作成功!"); } + /// + /// 座位保存允许做人 + /// + /// + /// + /// + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveDetailForm(string ClassroomNo, string AcademicYearNo, int Semester, List list) + { + exam_ExamRoomDetailIBLL.SaveSaveDetailEntity(ClassroomNo, AcademicYearNo, Semester, list); + return Success("保存成功!"); + } #endregion - } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/FormSeat.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/FormSeat.cshtml new file mode 100644 index 000000000..5c2103154 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/FormSeat.cshtml @@ -0,0 +1,124 @@ +@{ + ViewBag.Title = "考场信息-查看"; + Layout = "~/Views/Shared/_Index.cshtml"; +} + +
+
+ {{dataOne.tClassroomName}}排考座位表 +
打 印
+
+ @*
+ 监考老师:{{dataOne.teach}} + 考试时间:{{dataOne.EaxmStartTime}}{{dataOne.EaxmEndTime}} +
*@ +
    +
  • +
    +
    {{item.StuName}}
    + {{item.SitNumber}} +
    +
  • +
+
暂无数据
+
+ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.cshtml index 05a38db32..a77a3c0d6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.cshtml @@ -45,6 +45,7 @@ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.js index af68a324d..f8ea37d59 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamRoom/Index.js @@ -172,6 +172,26 @@ var bootstrap = function ($, learun) { } }); + $('#lr_seat').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ERId'); + var IsEdit = $('#gridtable').jfGridValue('IsEdit'); + if (IsEdit.indexOf('false') != -1) { + learun.alert.warning("选中记录中包含不可编辑项目!"); + return; + } + if (learun.checkrow(keyValue)) { + var AcademicYearNo = $('#gridtable').jfGridValue('AcademicYearNo'); + var Semester = $('#gridtable').jfGridValue('Semester'); + var classroomNo = $('#gridtable').jfGridValue('ClassroomNo'); + learun.layerForm({ + id: 'form_seat', + title: '座位', + width: 1200, + height: 800, + url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamRoom/FormSeat?keyValue=' + keyValue + '&AcademicYearNo=' + AcademicYearNo + '&Semester=' + Semester + '&ClassRoomNo=' + classroomNo, + }); + } + }); }, // 初始化列表 initGird: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 663faaa5a..e85603232 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -8010,6 +8010,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomBLL.cs index 97c7bb427..a8c509eae 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomBLL.cs @@ -166,7 +166,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { try { - return exam_ExamRoomService.Import(AcademicYearNo, Semester,SeatRows,SeatColumns); + return exam_ExamRoomService.Import(AcademicYearNo, Semester, SeatRows, SeatColumns); } catch (Exception ex) { @@ -200,11 +200,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - public string SeatEntity(string AcademicYearNo, string Semester, int Type) + public void SeatEntity(string AcademicYearNo, string Semester) { try { - exam_ExamRoomService.SeatEntity(AcademicYearNo, Semester, Type); + exam_ExamRoomService.SeatEntity(AcademicYearNo, Semester); } catch (Exception ex) { @@ -218,7 +218,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomIBLL.cs index 16a35c9dd..db769c9f4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoom/Exam_ExamRoomIBLL.cs @@ -52,7 +52,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration int Import(string AcademicYearNo, string Semester, int SeatRows, int SeatColumns); int DeleteWhere(string AcademicYearNo, string Semester); - string SeatEntity(string AcademicYearNo, string Semester, int Type); + void SeatEntity(string AcademicYearNo, string Semester); #endregion } 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 22e0aa4f5..56976d027 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 @@ -327,7 +327,7 @@ select NEWID(),'{AcademicYearNo}','{Semester}',ClassroomName,[ClassroomNo],{Seat { try { - string sql = $"delete Exam_ExamRoom where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and IsEdit = 'true'"; + string sql = $"delete Exam_ExamRoom where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and IsEdit = 'true';delete Exam_ExamRoomdetail where AcademicYearNo ='" + AcademicYearNo + "' and Semester='" + Semester + "' and IsEdit = 1 ;"; return this.BaseRepository("CollegeMIS").ExecuteBySql(sql); } catch (Exception ex) @@ -346,42 +346,38 @@ select NEWID(),'{AcademicYearNo}','{Semester}',ClassroomName,[ClassroomNo],{Seat /// - /// 删除实体数据 + /// 考场座位表 /// /// 主键 - public string SeatEntity(string AcademicYearNo, int Semester, int Type) + public void SeatEntity(string AcademicYearNo, string Semester) { - var db = this.BaseRepository().BeginTrans(); + var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { - if (Type == 1) + var intSemester = Convert.ToInt32(Semester); + var room = db.FindList().Where(x => x.AcademicYearNo == AcademicYearNo && x.Semester == intSemester).ToList(); + List entityList = new List(); + if (room.Count() > 0) { - var room = db.FindList().Where(x => x.AcademicYearNo == AcademicYearNo && x.Semester == Semester).ToList(); - if (room.Count() > 0) + for (int i = 0; i < room.Count(); i++) { - Exam_ExamRoomDetailEntity entity = new Exam_ExamRoomDetailEntity(); - for (int i = 0; i < room.Count(); i++) + for (int j = 0; j < room[i].SeatCount; j++) { - for (int j = 0; j < room[i].SeatCount; j++) - { - entity.AcademicYearNo = AcademicYearNo; - entity.Semester = Semester; - entity.ClassRoomNo = room[j].ClassroomNo; - entity.ClassRoomName = room[j].ClassroomName; - entity.ECOrder = i + 1; - entity.Create(); - db.Insert(entity); - } - room[i].IsEdit = false;//修改为不可编辑 + var entity = new Exam_ExamRoomDetailEntity(); + entity.AcademicYearNo = AcademicYearNo; + entity.Semester = intSemester; + entity.ClassRoomNo = room[i].ClassroomNo; + entity.ClassRoomName = room[i].ClassroomName; + entity.ECOrder = j + 1; + entity.ECEnabled = true; + entity.Create(); + entityList.Add(entity); } + room[i].IsEdit = true; } - db.Update(room);//修改为不可编辑 - } - else - { - var sql = "delete from Exam_ExamRoomDetail where AcademicYearNo ='" + AcademicYearNo + "' and Semester='"+ Semester + "'; update Exam_ExamRoom set IsEdit = 1 where AcademicYearNo ='" + AcademicYearNo + "' and Semester='; "; - this.BaseRepository("CollegeMIS").ExecuteBySql(sql); } + db.Insert(entityList); + db.Update(room); db.Commit(); } catch (Exception ex) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailBLL.cs index 65f8c52e8..344c67c05 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailBLL.cs @@ -138,7 +138,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveSaveDetailEntity(string ClassroomNo, string AcademicYearNo, int Semester, List entity) + { + try + { + exam_ExamRoomDetailService.SaveSaveDetailEntity(ClassroomNo, AcademicYearNo, Semester,entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailEntity.cs index c530d5b88..a1157cf4c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailEntity.cs @@ -51,7 +51,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [Column("ACADEMICYEARNO")] public string AcademicYearNo { get; set; } /// - /// EPRId + /// Semester /// /// [Column("Semester")] diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailIBLL.cs index 5e644a9dd..066cb01b4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailIBLL.cs @@ -45,7 +45,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 主键 /// 实体 void SaveEntity(string keyValue, Exam_ExamRoomDetailEntity entity); - + void SaveSaveDetailEntity(string ClassroomNo, string AcademicYearNo, int Semester, List entity); + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailService.cs index f499dfc3a..55433299e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamRoomDetail/Exam_ExamRoomDetailService.cs @@ -197,10 +197,45 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - - /// 自动生成班级有多少个座位 - /// 开始考试后/考试安排以后不可编辑班级座位 - /// + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveSaveDetailEntity(string ClassroomNo , string AcademicYearNo,int Semester,List entity) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + var del = db.FindList(x=>x.ClassRoomNo== ClassroomNo&& x.AcademicYearNo== AcademicYearNo&& x.Semester== Semester); + db.Delete(del); + if (entity.Count()>0) + { + entity.OrderBy(x => x.ECOrder); + for (int i = 0; i < entity.Count(); i++) + { + var insertEntity = new Exam_ExamRoomDetailEntity(); + insertEntity.ClassRoomNo = entity[i].ClassRoomNo; + insertEntity.ClassRoomName = entity[i].ClassRoomName; + insertEntity.ECEnabled = entity[i].ECEnabled; + insertEntity.ECOrder = i+1; + } + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion }