@@ -38,7 +38,7 @@ | |||
<div id="ScrapRemindTime"> </div> | |||
</div>*@ | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_AssetsInfoItem"> | |||
<div class="lr-form-item-title">金隅编号</div> | |||
<div class="lr-form-item-title">资产编号</div> | |||
<input id="AICodeNumJY" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_AssetsInfoItem"> | |||
@@ -22,7 +22,7 @@ | |||
<input id="AICodeNum" readonly="readonly" type="text" class="form-control" isvalid="yes" checkexpession="PositiveFloatint" />*@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_AssetsInfoItem"> | |||
<div class="lr-form-item-title" readonly="readonly">金隅资产编号</div> | |||
<div class="lr-form-item-title" readonly="readonly">资产编号</div> | |||
<input id="AICodeNumJY" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_AssetsInfoItem"> | |||
@@ -179,7 +179,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
TeachEntity.TotalStudyHour = 2; | |||
TeachEntity.IsInEffect = "1"; | |||
TeachEntity.IsPitchOn = "1"; | |||
TeachEntity.IsPitchOn = "1"; | |||
TeachEntity.F_SchoolId = entityList[i].F_SchoolId; | |||
TeachEntity.CheckMark = "1"; | |||
TeachEntity.InsertTime = DateTime.Now; | |||
@@ -259,7 +258,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
TeachEntity.TotalStudyHour = 2; | |||
TeachEntity.IsInEffect = "1"; | |||
TeachEntity.IsPitchOn = "1"; | |||
TeachEntity.IsPitchOn = "1"; | |||
TeachEntity.F_SchoolId = entityList[i].F_SchoolId; | |||
TeachEntity.InsertTime = DateTime.Now; | |||
TeachList.Add(TeachEntity); | |||
@@ -5,6 +5,7 @@ using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
using System; | |||
using System.Linq; | |||
using Newtonsoft.Json; | |||
namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
{ | |||
@@ -18,6 +19,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
public class Exam_ExamPlanController : MvcControllerBase | |||
{ | |||
private Exam_ExamPlanIBLL exam_ExamPlanIBLL = new Exam_ExamPlanBLL(); | |||
private Exam_ExamPlanLessonIBLL exam_ExamPlanLessonIBLL = new Exam_ExamPlanLessonBLL(); | |||
private Exam_ExamPlanClassIBLL exam_ExamPlanClassIBLL = new Exam_ExamPlanClassBLL(); | |||
#region 视图功能 | |||
@@ -172,7 +175,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
{ | |||
if (list.Count <= 0) | |||
{ | |||
return Fail("请安排时间"); | |||
return Fail("请安排时间!"); | |||
} | |||
foreach (var entity in list) | |||
@@ -180,12 +183,21 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
DateTime time; | |||
if (!DateTime.TryParse(entity.ExamTimeStart, out time)) | |||
{ | |||
return Fail("结束时间格式不正确!"); | |||
return Fail("开始时间格式不正确!"); | |||
} | |||
if (!DateTime.TryParse(entity.ExamTimeEnd, out time)) | |||
{ | |||
return Fail("结束时间格式不正确!"); | |||
} | |||
var startTime = Convert.ToDateTime(entity.ExamDate.Value.ToString("yyyy-MM-dd") + " " + entity.ExamTimeStart); | |||
var endTime = Convert.ToDateTime(entity.ExamDate.Value.ToString("yyyy-MM-dd") + " " + entity.ExamTimeEnd); | |||
if (endTime <= startTime) | |||
{ | |||
return Fail("结束时间必须大于开始时间!"); | |||
} | |||
//考试时长 | |||
entity.ExamTimeLength = (endTime - startTime).TotalMinutes; | |||
} | |||
exam_ExamPlanIBLL.SavePlanTime(EPId, list); | |||
return Success("保存成功!"); | |||
@@ -253,6 +265,54 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
int res = exam_ExamPlanIBLL.GenerateForm(AcademicYearNo, Semester, PlanType); | |||
return Success("清空(" + res + ")条数据成功!"); | |||
} | |||
/// <summary> | |||
/// 一键安排课程 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult PlanLessonByEPId(string keyValue) | |||
{ | |||
exam_ExamPlanLessonIBLL.InitExamPlanLesson(keyValue); | |||
return Success("操作成功!"); | |||
} | |||
/// <summary> | |||
/// 一键安排班级 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult PlanClassByEPId(string keyValue) | |||
{ | |||
var count = exam_ExamPlanLessonIBLL.GetListByEPId(keyValue).Count(); | |||
if (count <= 0) | |||
{ | |||
return Fail("请先安排课程!"); | |||
} | |||
exam_ExamPlanClassIBLL.PlanClassByEPId(keyValue); | |||
return Success("操作成功!"); | |||
} | |||
/// <summary> | |||
/// 自动生成考试课程排考时间 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult PlanLessonTimeByEPId(string keyValue) | |||
{ | |||
var count = exam_ExamPlanLessonIBLL.GetListByEPId(keyValue).Count(); | |||
if (count <= 0) | |||
{ | |||
return Fail("请先安排课程!"); | |||
} | |||
exam_ExamPlanLessonIBLL.PlanLessonTimeByEPId(keyValue); | |||
return Success("操作成功!"); | |||
} | |||
#endregion | |||
} | |||
@@ -57,8 +57,21 @@ | |||
<a id="lr_generate" class="btn btn-default"><i class="fa fa-plus"></i> 生成排考名单</a> | |||
<a id="lr_cleargenerate" class="btn btn-default"><i class="fa fa-plus"></i> 清除排考名单</a> | |||
<a id="lr_cleardata" class="btn btn-default"><i class="fa fa-plus"></i> 清除排考记录</a> | |||
<a id="lr_planks" class="btn btn-default"><i class="fa fa-plus"></i> 安排考试</a> | |||
</div> | |||
<div class="btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_more" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> | |||
<i class="fa fa-reorder"></i> <span class="lrlt">更多</span><span class="caret"></span> | |||
</a> | |||
<ul class="dropdown-menu pull-right"> | |||
<li id="lr_planks"><a><i></i> <span class="lrlt">安排考试</span></a></li> | |||
<li id="lr_examlesson"><a><i></i> <span class="lrlt">一键安排课程</span></a></li> | |||
<li id="lr_examlessontime"><a><i></i> <span class="lrlt">自动生成课程排考时间</span></a></li> | |||
<li id="lr_examclass"><a><i></i> <span class="lrlt">一键安排班级</span></a></li> | |||
<li id="lr_examroom"><a><i></i> <span class="lrlt">一键安排考场</span></a></li> | |||
<li id="lr_examteacher"><a><i></i> <span class="lrlt">一键安排监考老师</span></a></li> | |||
</ul> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
@@ -161,6 +161,50 @@ var bootstrap = function ($, learun) { | |||
F_UrlAddress: '/EducationalAdministration/Exam_ExamPlanLesson/Index?EPId=' + keyValue | |||
}); | |||
}); | |||
//一键安排课程 | |||
$('#lr_examlesson').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/PlanLessonByEPId', { keyValue: keyValue }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
//一键安排班级 | |||
$('#lr_examclass').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/PlanClassByEPId', { keyValue: keyValue }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
//自动生成排考时间 | |||
$('#lr_examlessontime').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/PlanLessonTimeByEPId', { keyValue: keyValue }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
@@ -129,16 +129,27 @@ var bootstrap = function ($, learun) { | |||
if (ELCheckMark == 1) { | |||
return learun.alert.warning("该项已审核!"); | |||
} | |||
learun.layerForm({ | |||
id: 'formteacherRoom', | |||
title: '新增考场', | |||
url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/FormRoomTeacher?EPLId=' + EPLId + '&EPId=' + EPId, | |||
width: 850, | |||
height: 500, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
var param ={}; | |||
param.EPId = EPId; | |||
param.EPLId = EPLId; | |||
//判断是否已新增班级 | |||
var data= learun.httpGet(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/GetListForClass?queryJson='+JSON.stringify(param)); | |||
if (data.data.length > 0) { | |||
learun.layerForm({ | |||
id: 'formteacherRoom', | |||
title: '新增考场', | |||
url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/FormRoomTeacher?EPLId=' + EPLId + '&EPId=' + EPId, | |||
width: 850, | |||
height: 500, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} else { | |||
return learun.alert.warning("请先添加班级!"); | |||
} | |||
} else { | |||
return learun.alert.warning("请选择考试课程!"); | |||
} | |||
@@ -67,7 +67,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取实体数据 | |||
/// </summary> | |||
@@ -181,7 +181,26 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public void PlanClassByEPId(string keyValue) | |||
{ | |||
try | |||
{ | |||
exam_ExamPlanClassService.PlanClassByEPId(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -47,6 +47,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
void SaveList(List<Exam_ExamPlanClassEntity> list); | |||
(bool flag, string msg) IsExamConflict(List<Exam_ExamPlanClassEntity> list); | |||
void PlanClassByEPId(string keyValue); | |||
#endregion | |||
} | |||
@@ -314,6 +314,81 @@ where l.EPLId='{EPLId}' | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 一键安排班级 | |||
/// </summary> | |||
public void PlanClassByEPId(string EPId) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS"); | |||
try | |||
{ | |||
db.BeginTrans(); | |||
//排考记录表 | |||
var examPlan = db.FindEntity<Exam_ExamPlanEntity>(EPId); | |||
//查询当前考试记录所有考试课程 | |||
var lessonList = db.FindList<Exam_ExamPlanLessonEntity>(x => x.EPId == EPId); | |||
foreach (var lesson in lessonList) | |||
{ | |||
var lessonno = lesson.LessonNo; | |||
if (lesson.LessonNo.Contains("(")) | |||
{ | |||
lessonno = lesson.LessonNo.Split('(')[0]; | |||
} | |||
//查询课程信息 | |||
var lessoninfo = db.FindList<LessonInfoEntity>($@"select top 1 t.LessonTypeName,l.* from lessoninfo l | |||
join [dbo].[CdLessonType] t on l.LessonTypeId = t.LTId where l.LessonNo='{lessonno}' ").FirstOrDefault(); | |||
if (lessoninfo != null) | |||
{ | |||
if (lessoninfo.LessonTypeName.Contains("专业")) | |||
{ | |||
//专业课添加此专业的所有班级 | |||
var addSql = $@"insert into Exam_ExamPlanClass | |||
SELECT NEWID(),'{lesson.EPLId}',c.ClassName,t.ClassNo,count(1) as StuNum FROM Exam_ExamStudent t | |||
left join classinfo c on t.ClassNo=c.ClassNo WHERE t.ESEnabled=1 and t.AcademicYearNo='{examPlan.AcademicYearNo}' and t.Semester='{examPlan.Semester}' and t.ESType='{examPlan.PlanType}' and c.majorno='{lessoninfo.TeachMajorNo}' | |||
and t.ClassNo not in (select ClassNo from [dbo].[Exam_ExamPlanClass] where EPLId='{lesson.EPLId}') | |||
group by t.ClassNo,t.AcademicYearNo,t.Semester,t.ESType,c.ClassName "; | |||
db.ExecuteBySql(addSql); | |||
} | |||
else if (lessoninfo.LessonTypeName.Contains("公共") || lessoninfo.LessonTypeName.Contains("公开")) | |||
{ | |||
//公共课添加所有班级 | |||
var addSql = $@"insert into Exam_ExamPlanClass | |||
SELECT NEWID(),'{lesson.EPLId}',c.ClassName,t.ClassNo,count(1) as StuNum FROM Exam_ExamStudent t | |||
left join classinfo c on t.ClassNo=c.ClassNo WHERE t.ESEnabled=1 and t.AcademicYearNo='{examPlan.AcademicYearNo}' and t.Semester='{examPlan.Semester}' and t.ESType='{examPlan.PlanType}' | |||
and t.ClassNo not in (select ClassNo from [dbo].[Exam_ExamPlanClass] where EPLId='{lesson.EPLId}') | |||
group by t.ClassNo,t.AcademicYearNo,t.Semester,t.ESType,c.ClassName "; | |||
db.ExecuteBySql(addSql); | |||
} | |||
} | |||
//更新排考安排课程表实排班级数、实排人数 | |||
string sql = $@"update l | |||
set l.RealStuCount=t.RealStuCount,l.RealClassNum=t.RealClassNum | |||
from Exam_ExamPlanLesson l | |||
join (select '{lesson.EPLId}' as EPLId,count(1) as RealClassNum,sum(ClassStuNum) as RealStuCount from Exam_ExamPlanClass where EPLId='{lesson.EPLId}' | |||
)t on l.EPLId=t.EPLId | |||
where l.EPLId='{lesson.EPLId}' | |||
"; | |||
db.ExecuteBySql(sql); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -42,7 +42,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public IEnumerable<Exam_ExamPlanLessonEntity> GetPageListForLesson(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
@@ -61,6 +61,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public IEnumerable<Exam_ExamPlanLessonEntity> GetListByEPId(string EPId) | |||
{ | |||
try | |||
{ | |||
return exam_ExamPlanLessonService.GetListByEPId(EPId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取Exam_ExamPlanLesson表实体数据 | |||
/// </summary> | |||
@@ -89,7 +108,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// 获取左侧树形数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
public List<TreeModel> GetTree(string EPId) | |||
public List<TreeModel> GetTree(string EPId) | |||
{ | |||
try | |||
{ | |||
@@ -107,7 +126,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
isexpand = true, | |||
parentId = "" | |||
}; | |||
treeList.Add(node); } | |||
treeList.Add(node); | |||
} | |||
return treeList.ToTree(); | |||
} | |||
catch (Exception ex) | |||
@@ -150,12 +170,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
/// <summary> | |||
/// 审核 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void Check(string keyValue,int ELCheckMark) | |||
public void Check(string keyValue, int ELCheckMark) | |||
{ | |||
try | |||
{ | |||
@@ -196,7 +216,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
@@ -244,6 +263,26 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public (bool flag, string msg) PlanLessonTimeByEPId(string EPId) | |||
{ | |||
try | |||
{ | |||
return exam_ExamPlanLessonService.PlanLessonTimeByEPId(EPId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -108,6 +108,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
public string AcademicYearNo { get; set; } | |||
[NotMapped] | |||
public string Semester { get; set; } | |||
/// <summary> | |||
/// 考试时长 | |||
/// </summary> | |||
[NotMapped] | |||
public int? ExamLength { get; set; } | |||
#endregion | |||
} | |||
@@ -22,6 +22,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <returns></returns> | |||
IEnumerable<Exam_ExamPlanLessonEntity> GetPageList(Pagination pagination, string queryJson); | |||
IEnumerable<Exam_ExamPlanLessonEntity> GetPageListForLesson(Pagination pagination, string queryJson); | |||
IEnumerable<Exam_ExamPlanLessonEntity> GetListByEPId(string EPId); | |||
/// <summary> | |||
/// 获取Exam_ExamPlanLesson表实体数据 | |||
/// </summary> | |||
@@ -51,6 +52,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, Exam_ExamPlanLessonEntity entity); | |||
(bool flag, string msg) PlanLessonTimeByEPId(string keyValue); | |||
(bool flag, string lessonname) IsExamTimeClash(Exam_ExamPlanLessonEntity entity); | |||
#endregion | |||
@@ -122,6 +122,32 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
public IEnumerable<Exam_ExamPlanLessonEntity> GetListByEPId(string EPId) | |||
{ | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(@"p.AcademicYearNo,p.Semester,t.* "); | |||
strSql.Append(" FROM Exam_ExamPlanLesson t "); | |||
strSql.Append(" join [dbo].[Exam_ExamPlan] p on t.epid=p.epid "); | |||
strSql.Append($" WHERE 1=1 and t.EPId='{EPId}'"); | |||
return this.BaseRepository("CollegeMIS").FindList<Exam_ExamPlanLessonEntity>(strSql.ToString()); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取Exam_ExamPlanLesson表实体数据 | |||
/// </summary> | |||
@@ -154,10 +180,20 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindTable($@" select distinct t.EPLId,t.LessonName,a.ltorder,t.LessonNo from Exam_ExamPlanLesson t | |||
var sql = $@"select distinct t.EPLId,t.LessonName,a.ltorder,t.LessonNo from Exam_ExamPlanLesson t | |||
join (select l.lessonno,l.LessonTypeId,lt.ltorder from [dbo].[LessonInfo] l left join CdLessonType lt on l.LessonTypeId=lt.ltid where l.checkmark=1) a | |||
on t.LessonNo=a.lessonno | |||
where EPId='{EPId}' order by a.ltorder, t.LessonNo"; | |||
var examplan = this.BaseRepository("CollegeMIS").FindEntity<Exam_ExamPlanEntity>(EPId); | |||
if (examplan.PlanType == "1") | |||
{ | |||
sql = $@"select distinct t.EPLId,t.LessonName,a.ltorder,t.LessonNo from Exam_ExamPlanLesson t | |||
join (select l.lessonno,l.LessonTypeId,lt.ltorder from [dbo].[LessonInfo] l left join CdLessonType lt on l.LessonTypeId=lt.ltid where l.checkmark=1) a | |||
on SUBSTRING(t.LessonNo,0,CHARINDEX('(',t.LessonNo))=a.lessonno | |||
where EPId='{EPId}' order by a.ltorder, t.LessonNo"); | |||
where EPId='{EPId}' order by a.ltorder, t.LessonNo"; | |||
} | |||
return this.BaseRepository("CollegeMIS").FindTable(sql); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -236,7 +272,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="EPId">排考记录主表Id</param> | |||
public void InitExamPlanLesson(string EPId) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS"); | |||
try | |||
{ | |||
//排考记录主表 | |||
@@ -277,27 +312,17 @@ and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan | |||
this.BaseRepository("CollegeMIS").ExecuteBySql(sql); | |||
} | |||
db.BeginTrans(); | |||
//排考课程表 | |||
var list = db.FindList<Exam_ExamPlanLessonEntity>(x => x.EPId == EPId); | |||
var EPLIdlist = this.BaseRepository("CollegeMIS").FindList<Exam_ExamPlanLessonEntity>(x => x.EPId == EPId).Select(x => x.EPLId); | |||
var EPLIds = string.Join("','", EPLIdlist); | |||
//班级 | |||
var classInfo = db.FindList<Exam_ExamStudentEntity>($"select ClassNo,count(1) as StuNum FROM Exam_ExamStudent where ESEnabled=1 and ESType='{exam_ExamPlan.PlanType}' and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan.Semester}' group by ClassNo"); | |||
foreach (var lesson in list) | |||
{ | |||
//考试课程信息 | |||
var examLesson = db.FindEntity<Exam_ExamLessonEntity>(x => x.ELId == lesson.ELId); | |||
//应排班级数 | |||
lesson.ClassNum = classInfo.Count(); | |||
//应考人数 | |||
lesson.StuCount = classInfo.Sum(x => x.StuNum); | |||
db.Update(lesson); | |||
} | |||
db.Commit(); | |||
var classInfo = this.BaseRepository("CollegeMIS").FindList<Exam_ExamStudentEntity>($"select ClassNo,count(1) as StuNum FROM Exam_ExamStudent where ESEnabled=1 and ESType='{exam_ExamPlan.PlanType}' and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan.Semester}' group by ClassNo"); | |||
//修改应排班级数和应考人数 | |||
var UpdSql = $"update Exam_ExamPlanLesson set ClassNum='{classInfo.Count()}',StuCount='{classInfo.Sum(x => x.StuNum)}' where EPLId in ('{EPLIds}')"; | |||
this.BaseRepository("CollegeMIS").ExecuteBySql(UpdSql); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
@@ -386,6 +411,55 @@ and AcademicYearNo='{exam_ExamPlan.AcademicYearNo}' and Semester='{exam_ExamPlan | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 自动生成考试课程排考时间 | |||
/// </summary> | |||
/// <param name="EPId"></param> | |||
/// <returns></returns> | |||
public (bool flag, string msg) PlanLessonTimeByEPId(string EPId) | |||
{ | |||
try | |||
{ | |||
/* | |||
* 1.查询考试记录是否已安排时间 | |||
* 2.查询考试课程的考试时长是否大于0 | |||
* 3.同一时间段内只能一个专业安排一门课程 | |||
*/ | |||
//安排时间数据 | |||
var EPTimeList = this.BaseRepository("CollegeMIS") | |||
.FindList<Exam_ExamPlanTimeEntity>(x => x.EPId == EPId); | |||
if (EPTimeList.Count() <= 0) | |||
{ | |||
return (false, "请先安排考试记录时间!"); | |||
} | |||
//考试课程数据 | |||
var EPLessonList = this.BaseRepository("CollegeMIS") | |||
.FindList<Exam_ExamPlanLessonEntity>($@"select elesson.ExamTime as ExamLength,t.* from Exam_ExamPlanLesson t | |||
join Exam_ExamLesson elesson on t.LessonNo=elesson.LessonNo | |||
where t.EPId='{EPId}'"); | |||
if (EPLessonList.ToList().Exists(x => x.ExamLength == null || x.ExamLength == 0)) | |||
{ | |||
return (false, "请先设置考试课程时长!"); | |||
} | |||
return (true, ""); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -40,6 +40,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
[Column("EXAMTIMEEND")] | |||
public string ExamTimeEnd { get; set; } | |||
/// <summary> | |||
/// 考试时长 | |||
/// </summary> | |||
[Column("EXAMTIMELENGTH")] | |||
public double? ExamTimeLength { get; set; } | |||
/// <summary> | |||
/// 排考名称 | |||
/// </summary> | |||
[Column("EXAMTYPE")] | |||
@@ -184,6 +184,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
#endregion | |||
#region 扩展字段 | |||
[NotMapped] | |||
public string LessonTypeName { get; set; } | |||
#endregion | |||
} | |||
} | |||