@@ -21,6 +21,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
private Exam_ExamPlanIBLL exam_ExamPlanIBLL = new Exam_ExamPlanBLL(); | private Exam_ExamPlanIBLL exam_ExamPlanIBLL = new Exam_ExamPlanBLL(); | ||||
private Exam_ExamPlanLessonIBLL exam_ExamPlanLessonIBLL = new Exam_ExamPlanLessonBLL(); | private Exam_ExamPlanLessonIBLL exam_ExamPlanLessonIBLL = new Exam_ExamPlanLessonBLL(); | ||||
private Exam_ExamPlanClassIBLL exam_ExamPlanClassIBLL = new Exam_ExamPlanClassBLL(); | private Exam_ExamPlanClassIBLL exam_ExamPlanClassIBLL = new Exam_ExamPlanClassBLL(); | ||||
private Exam_ExamPlanRoomIBLL exam_ExamPlanRoomIBLL = new Exam_ExamPlanRoomBLL(); | |||||
#region 视图功能 | #region 视图功能 | ||||
@@ -321,6 +322,24 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
return Success("操作成功!"); | return Success("操作成功!"); | ||||
} | } | ||||
/// <summary> | |||||
/// 一键安排考场 | |||||
/// </summary> | |||||
/// <param name="keyValue"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult PlanRoomByEPId(string keyValue) | |||||
{ | |||||
var res = exam_ExamPlanRoomIBLL.PlanRoomByEPId(keyValue); | |||||
if (!res.flag) | |||||
{ | |||||
return Fail(res.str); | |||||
} | |||||
return Success("操作成功!"); | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -193,6 +193,21 @@ var bootstrap = function ($, learun) { | |||||
} | } | ||||
}); | }); | ||||
//一键安排考场 | |||||
$('#lr_examroom').on('click', | |||||
function () { | |||||
var keyValue = $('#gridtable').jfGridValue('EPId'); | |||||
if (learun.checkrow(keyValue)) { | |||||
learun.layerConfirm('是否确认安排考场!', function (res) { | |||||
if (res) { | |||||
learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/PlanRoomByEPId', { keyValue: keyValue }, function () { | |||||
refreshGirdData(); | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
}); | |||||
//自动生成排考时间 | //自动生成排考时间 | ||||
$('#lr_examlessontime').on('click', | $('#lr_examlessontime').on('click', | ||||
function () { | function () { | ||||
@@ -130,7 +130,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 保存实体数据(新增、修改) | /// 保存实体数据(新增、修改) | ||||
@@ -175,6 +175,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
} | } | ||||
public (bool flag, string str) PlanRoomByEPId(string EPId) | |||||
{ | |||||
try | |||||
{ | |||||
return exam_ExamPlanRoomService.PlanRoomByEPId(EPId); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -47,6 +47,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <param name="entity">实体</param> | /// <param name="entity">实体</param> | ||||
void SaveEntity(string keyValue, Exam_ExamPlanRoomEntity entity); | void SaveEntity(string keyValue, Exam_ExamPlanRoomEntity entity); | ||||
void SaveList (List<Exam_ExamPlanRoomEntity> list); | void SaveList (List<Exam_ExamPlanRoomEntity> list); | ||||
(bool flag,string str) PlanRoomByEPId(string EPId); | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -128,7 +128,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
return this.BaseRepository("CollegeMIS").FindList<Exam_ExamPlanRoomEntity>(x => x.EPLId == EPLId && x.ClassroomNo == ClassroomNo).Count() > 0 ? true : false; | |||||
return this.BaseRepository("CollegeMIS").FindList<Exam_ExamPlanRoomEntity>(x => x.EPLId == EPLId && x.ClassroomNo == ClassroomNo).Count() > 0 ? true : false; | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -269,6 +269,55 @@ where l.EPLId='{EPLId}'"; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 自动安排考场 | |||||
/// </summary> | |||||
/// <param name="EPId">考试记录表Id</param> | |||||
/// <returns></returns> | |||||
public (bool flag, string str) PlanRoomByEPId(string EPId) | |||||
{ | |||||
var db = this.BaseRepository("CollegeMIS"); | |||||
try | |||||
{ | |||||
db.BeginTrans(); | |||||
/* | |||||
* 1.查询是否已添加考试课程和班级 | |||||
* 2.查询是否生成课程排考时间 | |||||
* 3.查询考试课程并循环, | |||||
* 根据考试课程的总班级人数和排考时间,随机安排考场(同一时间段考场不能重复) | |||||
*/ | |||||
//考试记录表 | |||||
var examPlan = db.FindEntity<Exam_ExamPlanEntity>(EPId); | |||||
//考试课程 | |||||
var examLessonList = db.FindList<Exam_ExamPlanLessonEntity>(x => x.EPId == EPId).ToList(); | |||||
if (examLessonList.Count() <= 0) | |||||
{ | |||||
return (false, "请先添加考试课程!"); | |||||
} | |||||
if (!examLessonList.Exists(x => x.ExamDate != null)) | |||||
{ | |||||
return (false, "请先设置排考时间!"); | |||||
} | |||||
//考试班级 | |||||
db.Commit(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
db.Rollback(); | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||