From f63e95b2f13b5bb0855732684bf3dbb348b97fda Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 7 Jun 2022 16:17:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E8=AE=B0=E5=BD=95=E5=AE=89?= =?UTF-8?q?=E6=8E=92=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Exam_ExamPlanController.cs | 49 +++++- .../Views/Exam_ExamPlan/FormTime.js | 164 +++++++++--------- .../Views/Exam_ExamPlan/Index.js | 3 +- .../Exam_ExamPlanTimeMap.cs | 29 ++++ .../Learun.Application.Mapping.csproj | 1 + .../Exam_ExamPlan/Exam_ExamPlanBLL.cs | 38 ++++ .../Exam_ExamPlan/Exam_ExamPlanIBLL.cs | 2 + .../Exam_ExamPlan/Exam_ExamPlanService.cs | 56 +++++- 8 files changed, 255 insertions(+), 87 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/Exam_ExamPlanTimeMap.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs index 35fa9951f..f82395959 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs @@ -3,6 +3,7 @@ using System.Data; using Learun.Application.TwoDevelopment.EducationalAdministration; using System.Web.Mvc; using System.Collections.Generic; +using System; namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { @@ -64,7 +65,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { return View(); } - + #endregion #region 获取数据 @@ -106,6 +107,19 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers }; return Success(jsonData); } + + /// + /// 安排考试 + /// + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPlanTimeList(string EPId) + { + var data = exam_ExamPlanIBLL.GetPlanTimeList(EPId); + return Success(data); + } #endregion #region 提交数据 @@ -127,7 +141,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// /// /// - [HttpPost] + [HttpPost] [AjaxOnly] public ActionResult Generate(string keyValue) { @@ -139,6 +153,37 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers exam_ExamPlanIBLL.Generate(keyValue); return Success("生成成功!"); } + + /// + /// 安排考试 + /// + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult SavePlanTime(string EPId, List list) + { + if (list.Count <= 0) + { + return Fail("请安排时间"); + } + + foreach (var entity in list) + { + DateTime time; + if (!DateTime.TryParse(entity.ExamTimeStart, out time)) + { + return Fail("结束时间格式不正确!"); + } + if (!DateTime.TryParse(entity.ExamTimeEnd, out time)) + { + return Fail("结束时间格式不正确!"); + } + } + exam_ExamPlanIBLL.SavePlanTime(EPId, list); + return Success("保存成功!"); + } + /// /// 清除排考名单/清除所有排考记录 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/FormTime.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/FormTime.js index a8ca9354e..13c324718 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/FormTime.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/FormTime.js @@ -6,6 +6,7 @@ */ var acceptClick; var keyValue = request('keyValue'); +var arr = []; var bootstrap = function ($, learun) { "use strict"; var page = { @@ -33,31 +34,30 @@ var bootstrap = function ($, learun) { removeByValue(arr, 'iid', id); } }); - - //重新排序并显示 - arr.sort(sortBy("Sort")); - page.refreshRes(); + ////重新排序并显示 + //arr.sort(sortBy("Sort")); + //page.refreshRes(); }); - //失去焦点,重新排序并显示 - $('#form').on('blur', - '.sort', - function () { - var id = $(this)[0].id; - var parId = id.replace('Sort', ''); - arr.forEach(m => { - if (m.iid == parId) { - return m.Sort = $('#' + id).val(); - } - }); - arr.sort(sortBy("Sort")); - page.refreshRes(); - }); + ////失去焦点,重新排序并显示 + //$('#form').on('blur', + // '.sort', + // function () { + // var id = $(this)[0].id; + // var parId = id.replace('Sort', ''); + // arr.forEach(m => { + // if (m.iid == parId) { + // return m.Sort = $('#' + id).val(); + // } + // }); + // arr.sort(sortBy("Sort")); + // page.refreshRes(); + // }); }, initData: function () { if (!!keyValue) { - $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/GetFormChildList?keyValue=' + keyValue, function (data) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/GetPlanTimeList?EPId=' + keyValue, function (data) { $('#content1').html(''); var html = ''; if (data && data.length > 0) { @@ -65,44 +65,66 @@ var bootstrap = function ($, learun) { var id = learun.newGuid(); var html = ''; html += '
'; - html += '
'; - html += '
 计算项目*
'; - html += '
'; + html += '
'; + html += '
 课程类型*
'; + html += '
'; html += '
'; - html += '
'; - html += '
顺序*
'; - html += ''; + html += '
'; + html += '
考试日期*
'; + html += ''; html += '
'; + html += '
'; + html += '
开始时间*
'; + html += + ''; html += '
'; + html += '
'; + html += '
结束时间*
'; + html += + ''; + html += '
'; + html += '
'; + html += '
'; + //html += '
'; + //html += '
'; + //html += '
 计算项目*
'; + //html += '
'; + //html += '
'; + //html += '
'; + //html += '
顺序*
'; + //html += ''; + //html += '
'; + //html += '
'; + $('#content1').append(html); - $('#pro' + id).lrselect({ + + $('#ExamType' + id).lrselect({ allowSearch: true, - url: top.$.rootUrl + '/LR_Desktop/FormulaMain/GetCalProject', - param: { strWhere: "1=1 " }, - value: "id", - text: "name", + url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailList', + param: { itemCode: 'ExamLessonType' }, + value: 'F_ItemValue', + text: 'F_ItemName', select: function (item) { if (item) { var id = $(this).attr('id'); - var parId = id.replace('pro', ''); - + var parId = id.replace('ExamType', ''); arr.forEach(item => { if (item.iid == parId) { //如果存在删除 removeByValue(arr, 'iid', parId); } }); - arr.push({ iid: parId, ProjectId: item.id, ProjectName: item.name, Sort: $('#Sort' + parId).val() }); + arr.push({ iid: parId, ExamType: $('#ExamType' + parId).val(), ExamDate: $('#ExamDate' + parId).val(), ExamTimeStart: $('#ExamTimeStart' + parId).val(), ExamTimeEnd: $('#ExamTimeEnd' + parId).val() }); + + //arr.sort(sortBy("Sort")); + //page.refreshRes(); - arr.sort(sortBy("Sort")); - page.refreshRes(); } } }); - - $('#pro' + id).lrselectSet(data[i].ProjectId); + $('#ExamType' + id).lrselectSet(data[i].ExamType); } } else { @@ -156,53 +178,29 @@ var bootstrap = function ($, learun) { function (item) { if (item) { var id = $(this).attr('id'); - var parId = id.replace('pro', ''); - //arr.forEach(item => { - // if (item.iid == parId) { - // //如果存在删除 - // removeByValue(arr, 'iid', parId); - // } - //}); - //arr.push({ iid: parId, ProjectId: item.id, ProjectName: item.name, Sort: $('#Sort' + parId).val() }); + var parId = id.replace('ExamType', ''); + arr.forEach(item => { + if (item.iid == parId) { + //如果存在删除 + removeByValue(arr, 'iid', parId); + } + }); + arr.push({ iid: parId, ExamType: $('#ExamType' + parId).val(), ExamDate: $('#ExamDate' + parId).val(), ExamTimeStart: $('#ExamTimeStart' + parId).val(), ExamTimeEnd: $('#ExamTimeEnd' + parId).val() }); //arr.sort(sortBy("Sort")); //page.refreshRes(); + } } }); - //$('#pro' + id).lrselect({ - // allowSearch: true, - // url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/GetCalProject', - // param: { strWhere: "1=1 " }, - // value: "id", - // text: "name", - // select: - // function (item) { - // if (item) { - // var id = $(this).attr('id'); - // var parId = id.replace('pro', ''); - // arr.forEach(item => { - // if (item.iid == parId) { - // //如果存在删除 - // removeByValue(arr, 'iid', parId); - // } - // }); - // arr.push({ iid: parId, ProjectId: item.id, ProjectName: item.name, Sort: $('#Sort' + parId).val() }); - - // arr.sort(sortBy("Sort")); - // page.refreshRes(); - // } - // } - //}); - }, refreshRes: function () { - //页面显示公式结果 - var text = ''; - arr.forEach(m => { - text += m.ProjectName; - }); - $('#result').html(text); + ////页面显示公式结果 + //var text = ''; + //arr.forEach(m => { + // text += m.ProjectName; + //}); + //$('#result').html(text); } }; // 保存数据 @@ -210,16 +208,18 @@ var bootstrap = function ($, learun) { if (!$('body').lrValidform()) { return false; } - var strEntity = JSON.stringify($('body').lrGetFormData()); - - if (arr.length == 0) { - return learun.alert.warning('请选择计算项目!'); + var data = []; + arr.forEach(function (item, index, array) { + data.push({ ExamType: $('#ExamType' + item.iid).lrselectGet(), ExamDate: $('#ExamDate' + item.iid).val(), ExamTimeStart: $('#ExamTimeStart' + item.iid).val(), ExamTimeEnd: $('#ExamTimeEnd' + item.iid).val() }); + }); + if (data.length == 0) { + return learun.alert.warning('请安排考试时间!'); } var postData = { //mainEntity: strEntity, - strEntity: arr + list: data }; - $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/SaveList?MainId=' + keyValue, postData, function (res) { + $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/SavePlanTime?EPId=' + keyValue, postData, function (res) { // 保存成功后才回调 if (!!callBack) { callBack(); 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 f37d5207c..6d00344ee 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 @@ -136,10 +136,11 @@ var bootstrap = function ($, learun) { // 安排时间 $('#lr_examtime').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('EPId'); learun.layerForm({ id: 'formtime', title: '安排时间', - url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/FormTime', + url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/FormTime?keyValue=' + keyValue, width: 850, height: 550, callBack: function (id) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/Exam_ExamPlanTimeMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/Exam_ExamPlanTimeMap.cs new file mode 100644 index 000000000..019d4a77d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/Exam_ExamPlanTimeMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.EducationalAdministration; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-04-14 18:12 + /// 描 述:考试记录表 + /// + public class Exam_ExamPlanTimeMap : EntityTypeConfiguration + { + public Exam_ExamPlanTimeMap() + { + #region 表、主键 + //表 + this.ToTable("EXAM_EXAMPLANTIME"); + //主键 + this.HasKey(t => t.Id); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index 87566726f..8ae322117 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -86,6 +86,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanBLL.cs index da10ee0ec..f3298d883 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanBLL.cs @@ -67,6 +67,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public IEnumerable GetPlanTimeList(string EPId) + { + try + { + return exam_ExamPlanService.GetPlanTimeList(EPId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion #region 提交数据 @@ -131,6 +149,26 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + + public void SavePlanTime(string EPId, List list) + { + try + { + exam_ExamPlanService.SavePlanTime(EPId, list); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public bool IsGenerate(string keyValue) { try diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanIBLL.cs index 5766e5ca7..fcf5be98c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanIBLL.cs @@ -27,6 +27,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 主键 /// Exam_ExamPlanEntity GetExam_ExamPlanEntity(string keyValue); + IEnumerable GetPlanTimeList(string EPId); #endregion #region 提交数据 @@ -39,6 +40,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration void ClearGenerate(string keyValue, int type); void Generate(string keyValue); + void SavePlanTime(string EPId, List list); bool IsGenerate(string keyValue); /// /// 保存实体数据(新增、修改) 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 b79689df8..a826690af 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 @@ -123,6 +123,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public IEnumerable GetPlanTimeList(string EPId) + { + try + { + return this.BaseRepository("CollegeMIS").FindList(x => x.EPId == EPId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion #region 提交数据 @@ -150,6 +168,40 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 安排时间 + /// + /// + /// + public void SavePlanTime(string EPId, List list) + { + var db = this.BaseRepository("CollegeMIS"); + try + { + db.BeginTrans(); + foreach (var entity in list) + { + entity.Create(); + entity.EPId = EPId; + db.Insert(entity); + } + db.Commit(); + //this.BaseRepository("CollegeMIS").Delete(t => t.EPId == keyValue); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 清除排考名单/清除所有排考记录 /// @@ -272,7 +324,7 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); db.ExecuteBySql($"delete Exam_ArrangeExamTermNew where EPId='{keyValue}'"); //删除考场明细 db.ExecuteBySql($"delete Exam_ArrangeExamTermItemNew where EPId='{keyValue}'"); - + foreach (var planLesson in planLessonData) { //排考安排明细数据 @@ -329,7 +381,7 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); //所有考生 var stuInfoList = db.FindList(stuSql).ToList(); var classInfo = db.FindList(); - + itemList = itemList.OrderBy(x => x.SitNumber).OrderBy(x => x.ClassroomNo).ToList(); if (itemList.Count >= stuInfoList.Count()) {