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 219fe92a8..e2942f2eb 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 @@ -48,6 +48,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers return View(); } + [HttpGet] + public ActionResult FormRoom() + { + return View(); + } #endregion #region 获取数据 @@ -60,18 +65,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// [HttpGet] [AjaxOnly] - public ActionResult GetPageListForClass(string pagination, string queryJson) + public ActionResult GetListForClass(string queryJson) { - Pagination paginationobj = pagination.ToObject(); - var data = exam_ExamPlanClassIBLL.GetPageList(paginationobj, queryJson); - var jsonData = new - { - rows = data, - total = paginationobj.total, - page = paginationobj.page, - records = paginationobj.records - }; - return Success(jsonData); + var data = exam_ExamPlanClassIBLL.GetList(queryJson); + + return Success(data); } /// /// 获取页面显示列表数据 @@ -81,18 +79,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// [HttpGet] [AjaxOnly] - public ActionResult GetPageListForRoom(string pagination, string queryJson) + public ActionResult GetListForRoom(string pagination, string queryJson) { - Pagination paginationobj = pagination.ToObject(); - var data = exam_ExamPlanRoomIBLL.GetPageList(paginationobj, queryJson); - var jsonData = new - { - rows = data, - total = paginationobj.total, - page = paginationobj.page, - records = paginationobj.records - }; - return Success(jsonData); + var data = exam_ExamPlanRoomIBLL.GetList(queryJson); + + return Success(data); } /// /// 获取页面显示列表数据 @@ -178,6 +169,21 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers exam_ExamPlanLessonIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } + [HttpPost] + [AjaxOnly] + public ActionResult DeleteClass(string keyValue) + { + exam_ExamPlanClassIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + + [HttpPost] + [AjaxOnly] + public ActionResult DeleteRoom(string keyValue) + { + exam_ExamPlanRoomIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } /// /// 审核 /// @@ -221,6 +227,26 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers exam_ExamPlanLessonIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } + + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveClass(string EPLId, List list) + { + exam_ExamPlanClassIBLL.SaveList(list); + return Success("保存成功!"); + } + + + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveRoom(List list) + { + exam_ExamPlanRoomIBLL.SaveList(list); + return Success("保存成功!"); + } + #endregion } 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 2860e1f48..7b7d46cd6 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 @@ -1,5 +1,9 @@  var refreshGirdData; +var acceptClick; +//考试安排课程表Id +var EPLId = request('EPLId'); +var EPId = request('EPId'); var bootstrap = function ($, learun) { "use strict"; var page = { @@ -17,7 +21,7 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); - + }, // 初始化列表 initGird: function () { @@ -94,18 +98,6 @@ var bootstrap = function ($, learun) { }); } }, - { - label: "是否启用", name: "CheckMark", width: 80, align: "center", - formatter: function (cellvalue) { - return cellvalue == true ? "" : ""; - } - }, - { - label: "是否拆分班", name: "IsSeparate", width: 80, align: "center", - formatter: function (cellvalue) { - return cellvalue == true ? "" : ""; - } - } ], mainId: 'ClassId', isPage: true, @@ -117,6 +109,8 @@ var bootstrap = function ($, learun) { }, search: function (param) { param = param || {}; + //考试安排课程表Id + param.EPLId = EPLId; param.SqlParameter = " and CheckMark=1"; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } @@ -124,5 +118,32 @@ var bootstrap = function ($, learun) { refreshGirdData = function () { page.search(); }; + // 保存数据 + acceptClick = function (callBack) { + var selectedRow = $('#gridtable').jfGridGet('rowdata'); + var list = []; + $.each(selectedRow, + function (i, item) { + var entity = { + ClassName: item.ClassName, + ClassNo: item.ClassNo, + ClassStuNum: item.StuNum, + EPCId: learun.newGuid(), + EPLId: EPLId + } + list.push(entity); + + }); + $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/SaveClass?EPLId=' + EPLId, + { list: list }), function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }; + if (!!callBack) { + callBack(); + } + }; page.init(); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.cshtml new file mode 100644 index 000000000..f4697b424 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.cshtml @@ -0,0 +1,44 @@ +@{ + ViewBag.Title = "添加排考考场"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
学年
+
+
+
+
学期
+
+
+
+
考场编号
+ +
+
+
考场名称
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.js") 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 new file mode 100644 index 000000000..ac8251a07 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/FormRoom.js @@ -0,0 +1,104 @@ + +var refreshGirdData; +var acceptClick; +//考试安排课程表Id +var EPLId = request('EPLId'); +var EPId = request('EPId'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + $('#AcademicYearNo').lrselect({ + placeholder: "学年", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', + value: 'value', + text: 'text' + }); + //学期 + $('#Semester').lrselect({ + placeholder: "学期", + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', + value: 'value', + text: 'text' + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamRoom/GetPageList', + headData: [ + { label: "学年", name: "AcademicYearNo", width: 100, align: "left" }, + { label: "学期", name: "Semester", width: 100, align: "left" }, + { label: "考场编号", name: "ClassroomNo", width: 100, align: "left" }, + { label: "考场名称", name: "ClassroomName", width: 200, align: "left" }, + { label: "座位行数", name: "SeatRows", width: 100, align: "left" }, + { label: "座位列数", name: "SeatColumns", width: 100, align: "left" }, + { label: "考场座位数", name: "SeatCount", width: 100, align: "left" }, + //{ + // label: "是否启用", name: "EREnabled", width: 100, align: "left", + // formatter: function (cellvalue) { + // return cellvalue == 1 ? "" : ""; + // } + //}, + ], + mainId: 'ClassId', + isPage: true, + isMultiselect: true, + + }); + page.search(); + }, + search: function (param) { + param = param || {}; + //考试安排课程表Id + param.EPLId = EPLId; + param.SqlParameter = " and t.EREnabled=1"; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + page.search(); + }; + // 保存数据 + acceptClick = function (callBack) { + var selectedRow = $('#gridtable').jfGridGet('rowdata'); + 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(); + } + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/Index.cshtml index 674e5fa2e..257c74879 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/Index.cshtml @@ -60,7 +60,6 @@
班级信息
@@ -70,7 +69,6 @@
考场信息
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/Index.js index 9bbe86d8d..e54256099 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlanLesson/Index.js @@ -7,6 +7,7 @@ var refreshGirdData; //排考记录Id var EPId = request('EPId'); +//安排课程表Id var EPLId; var bootstrap = function ($, learun) { "use strict"; @@ -49,38 +50,26 @@ var bootstrap = function ($, learun) { }); //班级 新增 $('#lr_add_Class').on('click', function () { - learun.layerForm({ - id: 'formclass', - title: '新增', - url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/FormClass', - width: 600, - height: 400, - callBack: function (id) { - return top[id].acceptClick(refreshGirdData); - } - }); - }); - // 班级编辑 - $('#lr_edit_Class').on('click', function () { - var keyValue = $('#gridtable_Class').jfGridValue('EPCId'); - if (learun.checkrow(keyValue)) { + if (!!EPLId) { learun.layerForm({ id: 'formclass', - title: '编辑', - url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/FormClass?keyValue=' + keyValue, - width: 600, - height: 400, + title: '新增班级', + url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/FormClass?EPLId=' + EPLId + '&EPId=' + EPId, + width: 850, + height: 500, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); + } else { + return learun.alert.warning("请选择考试课程!"); } }); // 班级删除 $('#lr_delete_Class').on('click', function () { var keyValue = $('#gridtable_Class').jfGridValue('EPCId'); if (learun.checkrow(keyValue)) { - learun.layerConfirm('是否确认删除该项!', function (res) { + learun.layerConfirm('是否确认删除选中记录!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/DeleteClass', { keyValue: keyValue }, function () { refreshGirdData(); @@ -89,6 +78,38 @@ var bootstrap = function ($, learun) { }); } }); + + //考场 新增 + $('#lr_add_Room').on('click', function () { + if (!!EPLId) { + learun.layerForm({ + id: 'formroom', + title: '新增考场', + url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/FormRoom?EPLId=' + EPLId + '&EPId=' + EPId, + width: 850, + height: 500, + callBack: function (id) { + console.log('新增考场back'); + return top[id].acceptClick(refreshGirdData); + } + }); + } else { + return learun.alert.warning("请选择考试课程!"); + } + }); + // 考场删除 + $('#lr_delete_Room').on('click', function () { + var keyValue = $('#gridtable_Room').jfGridValue('EPRId'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除选中记录!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/DeleteRoom', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); // 打印 $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); @@ -98,19 +119,19 @@ var bootstrap = function ($, learun) { initGird: function () { //班级 $('#gridtable_Class').jfGrid({ - url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/GetPageListForClass', + url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/GetListForClass', headData: [ { label: "班级名称", name: "ClassName", width: 100, align: "left" }, { label: "班级编号", name: "ClassNo", width: 100, align: "left" }, { label: "班级人数", name: "ClassStuNum", width: 100, align: "left" }, ], mainId: 'EPCId', - isPage: true, + //isPage: true, isMultiselect: true, }); //考场 $('#gridtable_Room').jfGrid({ - url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/GetPageListForRoom', + url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/GetListForRoom', headData: [ { label: "考场名称", name: "ClassroomName", width: 100, align: "left" }, { label: "考场编号", name: "ClassroomNo", width: 100, align: "left" }, @@ -119,15 +140,17 @@ var bootstrap = function ($, learun) { { label: "监考老师姓名", name: "EmpName", width: 100, align: "left" }, ], mainId: 'EPRId', - isPage: true, + //isPage: true, isMultiselect: true, }); page.search(); }, search: function (param) { - param = param || {}; - $('#gridtable_Class').jfGridSet('reload', { queryJson: JSON.stringify(param) }); - $('#gridtable_Room').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + if (!!EPLId) { + param = param || {}; + $('#gridtable_Class').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + $('#gridtable_Room').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } }, //显示考试时间 show: function () { @@ -141,9 +164,11 @@ var bootstrap = function ($, learun) { } }; refreshGirdData = function () { - $('#gridtable_Class').jfGridSet('reload'); - $('#gridtable_Room').jfGridSet('reload'); - page.show(); + if (!!EPLId) { + $('#gridtable_Class').jfGridSet('reload'); + $('#gridtable_Room').jfGridSet('reload'); + page.show(); + } }; page.init(); } 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 126e33348..1d93ef5e8 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 @@ -996,8 +996,8 @@ + - @@ -7642,7 +7642,6 @@ - @@ -7655,6 +7654,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs index 1075e48cd..fb44678f2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs @@ -70,6 +70,23 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String); strSql.Append(" AND t.MajorNo = @MajorNo "); } + if (!queryParam["SqlParameter"].IsEmpty()) + { + strSql.Append(queryParam["SqlParameter"].ToString()); + } + + if (!queryParam["EPLId"].IsEmpty()) + { + var elSql = + $"select * from Exam_ExamLesson where ELId=(select ELId from Exam_ExamPlanLesson where EPLId='{queryParam["EPLId"].ToString()}')"; + var entity = this.BaseRepository("CollegeMIS").FindList(elSql).FirstOrDefault(); + if (entity != null) + { + strSql.Append($" and deptno='{entity.DeptNo}' and majorno='{entity.MajorNo}' and grade='{entity.Grade}'"); + strSql.Append($" and classno not in (select ClassNo from Exam_ExamPlanClass where EPLId='{queryParam["EPLId"].ToString()}')"); + + } + } return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassBLL.cs index 970324ea5..264503ac2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassBLL.cs @@ -43,6 +43,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetList(string queryJson) + { + try + { + return exam_ExamPlanClassService.GetList( queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 获取实体数据 /// @@ -119,6 +144,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public void SaveList(List list) + { + try + { + exam_ExamPlanClassService.SaveList(list); + } + 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_ExamPlanClass/Exam_ExamPlanClassIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassIBLL.cs index e2969da81..23f3499a4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassIBLL.cs @@ -21,6 +21,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 查询参数 /// IEnumerable GetPageList(Pagination pagination, string queryJson); + IEnumerable GetList(string queryJson); /// /// 获取实体数据 /// @@ -43,6 +44,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 主键 /// 实体 void SaveEntity(string keyValue, Exam_ExamPlanClassEntity entity); + + void SaveList(List list); #endregion } 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 1160583f5..f8ddd5618 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 @@ -4,6 +4,7 @@ using Learun.Util; using System; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Text; namespace Learun.Application.TwoDevelopment.EducationalAdministration @@ -44,7 +45,47 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration dp.Add("EPLId", queryParam["EPLId"].ToString(), DbType.String); strSql.Append(" AND t.EPLId = @EPLId "); } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetList(string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.* + "); + strSql.Append(" FROM Exam_ExamPlanClass t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["EPLId"].IsEmpty()) + { + dp.Add("EPLId", queryParam["EPLId"].ToString(), DbType.String); + strSql.Append(" AND t.EPLId = @EPLId "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); } catch (Exception ex) { @@ -95,7 +136,22 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { try { - this.BaseRepository("CollegeMIS").Delete(t=>t.EPCId == keyValue); + var entity = new Exam_ExamPlanClassEntity(); + if (keyValue.Contains(",")) + { + entity = this.BaseRepository("CollegeMIS").FindEntity((keyValue.Split(','))[0]); + keyValue = string.Join("','", keyValue.Split(',')); + } + else + { + entity = this.BaseRepository("CollegeMIS").FindEntity(keyValue); + } + + string sql = $"delete from Exam_ExamPlanClass where EPCId in ('{keyValue}')"; + + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); + + UpdateExamPlanLesson(entity.EPLId); } catch (Exception ex) { @@ -109,7 +165,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - + /// /// 保存实体数据(新增、修改) /// @@ -143,6 +199,63 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 排考安排班级 + /// + /// + public void SaveList(List list) + { + try + { + this.BaseRepository("CollegeMIS").Insert(list); + //更新排考安排课程表实排班级数、实排人数 + //排考安排课程表Id + var EPLId = list.Select(x => x.EPLId).FirstOrDefault(); + UpdateExamPlanLesson(EPLId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 更新排考安排课程 + /// + /// 排考安排课程表Id + private void UpdateExamPlanLesson(string EPLId) + { + try + { + //更新排考安排课程表实排班级数、实排人数 + string sql = $@"update l +set l.RealStuCount=t.RealStuCount,l.RealClassNum=t.RealClassNum +from Exam_ExamPlanLesson l +join (select '{EPLId}' as EPLId,count(1) as RealClassNum,sum(ClassStuNum) as RealStuCount from Exam_ExamPlanClass where EPLId='{EPLId}' +)t on l.EPLId=t.EPLId +where l.EPLId='{EPLId}' +"; + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomBLL.cs index d826922e1..0b80e27a3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomBLL.cs @@ -43,6 +43,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public IEnumerable GetList(string queryJson) + { + try + { + return exam_ExamPlanRoomService.GetList(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 获取实体数据 /// @@ -121,6 +140,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public void SaveList(List list) + { + try + { + exam_ExamPlanRoomService.SaveList(list); + } + 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_ExamPlanRoom/Exam_ExamPlanRoomIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomIBLL.cs index e6906f340..ac9dac88c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanRoom/Exam_ExamPlanRoomIBLL.cs @@ -21,6 +21,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 查询参数 /// IEnumerable GetPageList(Pagination pagination, string queryJson); + + IEnumerable GetList(string queryJson); /// /// 获取实体数据 /// @@ -43,6 +45,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 主键 /// 实体 void SaveEntity(string keyValue, Exam_ExamPlanRoomEntity entity); + void SaveList (List list); #endregion } 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 55a883b8a..6994057dd 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 @@ -4,6 +4,7 @@ using Learun.Util; using System; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Text; namespace Learun.Application.TwoDevelopment.EducationalAdministration @@ -44,7 +45,47 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration dp.Add("EPLId", queryParam["EPLId"].ToString(), DbType.String); strSql.Append(" AND t.EPLId = @EPLId "); } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetList(string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.* + "); + strSql.Append(" FROM Exam_ExamPlanRoom t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["EPLId"].IsEmpty()) + { + dp.Add("EPLId", queryParam["EPLId"].ToString(), DbType.String); + strSql.Append(" AND t.EPLId = @EPLId "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); } catch (Exception ex) { @@ -82,7 +123,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - + #endregion @@ -96,7 +137,23 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { try { - this.BaseRepository("CollegeMIS").Delete(t=>t.EPRId == keyValue); + var entity = new Exam_ExamPlanRoomEntity(); + if (keyValue.Contains(",")) + { + entity = this.BaseRepository("CollegeMIS").FindEntity((keyValue.Split(','))[0]); + + keyValue = string.Join("','", keyValue.Split(',')); + } + else + { + entity = this.BaseRepository("CollegeMIS").FindEntity(keyValue); + } + + string sql = $"delete from Exam_ExamPlanRoom where EPRId in ('{keyValue}')"; + + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); + + UpdateExamPlanLesson(entity.EPLId); } catch (Exception ex) { @@ -110,7 +167,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - + /// /// 保存实体数据(新增、修改) @@ -145,6 +202,54 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public void SaveList(List list) + { + try + { + this.BaseRepository("CollegeMIS").Insert(list); + //更新排考安排课程表考场座位数 + //排考安排课程表Id + var EPLId = list.Select(x => x.EPLId).FirstOrDefault(); + UpdateExamPlanLesson(EPLId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + private void UpdateExamPlanLesson(string EPLId) + { + try + { + //更新排考安排课程表考场座位数 + string sql = $@"update l +set l.SeatCount=t.SeatCount +from Exam_ExamPlanLesson l +join (select '{EPLId}' as EPLId,sum(SeatCount) as SeatCount from Exam_ExamPlanRoom where EPLId='{EPLId}' +)t on l.EPLId=t.EPLId +where l.EPLId='{EPLId}'"; + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #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 91241b86e..956c32387 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 @@ -4,6 +4,7 @@ using Learun.Util; using System; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Text; namespace Learun.Application.TwoDevelopment.EducationalAdministration @@ -56,6 +57,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration dp.Add("ClassroomName", "%" + queryParam["ClassroomName"].ToString() + "%", DbType.String); strSql.Append(" AND t.ClassroomName Like @ClassroomName "); } + if (!queryParam["EPLId"].IsEmpty()) + { + //排考安排课程表Id + var ELEntity = this.BaseRepository("CollegeMIS").FindList($@"select * from Exam_ExamPlan where EPId=( +select EPId from Exam_ExamPlanLesson where EPLId='{queryParam["EPLId"].ToString()}')").FirstOrDefault(); + if (ELEntity != null) + { + strSql.Append($" AND t.AcademicYearNo = '{ELEntity.AcademicYearNo}' "); + strSql.Append($" AND t.Semester = '{ELEntity.Semester}' "); + } + + } + + if (!queryParam["SqlParameter"].IsEmpty()) + { + strSql.Append(queryParam["SqlParameter"].ToString()); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) @@ -222,7 +241,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 座位行数 /// 座位列数 /// - public int Import(string AcademicYearNo, string Semester,int SeatRows,int SeatColumns) + public int Import(string AcademicYearNo, string Semester, int SeatRows, int SeatColumns) { try {