@@ -20,6 +20,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
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(); | private Exam_ExamPlanRoomIBLL exam_ExamPlanRoomIBLL = new Exam_ExamPlanRoomBLL(); | ||||
private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); | |||||
private StuInfoBasicIBLL StuInfoBasicIBLL = new StuInfoBasicBLL(); | |||||
#region 视图功能 | #region 视图功能 | ||||
@@ -69,7 +71,32 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
#endregion | #endregion | ||||
#region 获取数据 | #region 获取数据 | ||||
/// <summary> | |||||
/// 获取班级分页列表 | |||||
/// </summary> | |||||
/// <param name="pagination"></param> | |||||
/// <param name="queryJson"></param> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
[AjaxOnly] | |||||
public ActionResult GetClassInfoPageList(string pagination, string queryJson) | |||||
{ | |||||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||||
var data = classInfoIBLL.GetPageList(paginationobj, queryJson); | |||||
var stuList = StuInfoBasicIBLL.GetAllList(); | |||||
foreach (var item in data) | |||||
{ | |||||
item.StuNum = stuList.Count(x => x.ClassNo == item.ClassNo); | |||||
} | |||||
var jsonData = new | |||||
{ | |||||
rows = data, | |||||
total = paginationobj.total, | |||||
page = paginationobj.page, | |||||
records = paginationobj.records | |||||
}; | |||||
return Success(jsonData); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取页面显示列表数据 | /// 获取页面显示列表数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -27,14 +27,14 @@ | |||||
<div class="lr-form-item-title">排考总人数<font face="宋体">*</font></div> | <div class="lr-form-item-title">排考总人数<font face="宋体">*</font></div> | ||||
<input id="EPStuCount" type="text" class="form-control" isvalid="yes" checkexpession="Num" /> | <input id="EPStuCount" type="text" class="form-control" isvalid="yes" checkexpession="Num" /> | ||||
</div> | </div> | ||||
<div class="col-xs-6 lr-form-item" data-table="Exam_ExamPlan" > | |||||
<div class="lr-form-item-title">生成座位<font face="宋体">*</font></div> | |||||
<div class="col-xs-12 lr-form-item" data-table="Exam_ExamPlan" > | |||||
<div class="lr-form-item-title">是否随机座位<font face="宋体">*</font></div> | |||||
<div id="EPRandom" isvalid="yes" checkexpession="NotNull" ></div> | <div id="EPRandom" isvalid="yes" checkexpession="NotNull" ></div> | ||||
</div> | </div> | ||||
<div class="col-xs-6 lr-form-item" data-table="Exam_ExamPlan" > | |||||
@*<div class="col-xs-6 lr-form-item" data-table="Exam_ExamPlan" > | |||||
<div class="lr-form-item-title">是否生成<font face="宋体">*</font></div> | <div class="lr-form-item-title">是否生成<font face="宋体">*</font></div> | ||||
<div id="EPGenarate" isvalid="yes" checkexpession="NotNull" ></div> | <div id="EPGenarate" isvalid="yes" checkexpession="NotNull" ></div> | ||||
</div> | |||||
</div>*@ | |||||
<div class="col-xs-12 lr-form-item" data-table="Exam_ExamPlan" > | <div class="col-xs-12 lr-form-item" data-table="Exam_ExamPlan" > | ||||
<div class="lr-form-item-title">排序号<font face="宋体">*</font></div> | <div class="lr-form-item-title">排序号<font face="宋体">*</font></div> | ||||
<input id="EPOrder" type="text" class="form-control" isvalid="yes" checkexpession="Num" /> | <input id="EPOrder" type="text" class="form-control" isvalid="yes" checkexpession="Num" /> | ||||
@@ -55,6 +55,11 @@ var bootstrap = function ($, learun) { | |||||
$('#lr_edit').on('click', function () { | $('#lr_edit').on('click', function () { | ||||
var keyValue = $('#gridtable').jfGridValue('EPId'); | var keyValue = $('#gridtable').jfGridValue('EPId'); | ||||
if (learun.checkrow(keyValue)) { | if (learun.checkrow(keyValue)) { | ||||
//是否生成 | |||||
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate'); | |||||
if (EPGenarate == true) { | |||||
return learun.alert.warning("已生成排考名单,不可编辑!"); | |||||
} | |||||
learun.layerForm({ | learun.layerForm({ | ||||
id: 'form', | id: 'form', | ||||
title: '编辑', | title: '编辑', | ||||
@@ -71,6 +76,11 @@ var bootstrap = function ($, learun) { | |||||
$('#lr_delete').on('click', function () { | $('#lr_delete').on('click', function () { | ||||
var keyValue = $('#gridtable').jfGridValue('EPId'); | var keyValue = $('#gridtable').jfGridValue('EPId'); | ||||
if (learun.checkrow(keyValue)) { | if (learun.checkrow(keyValue)) { | ||||
//是否生成 | |||||
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate'); | |||||
if (EPGenarate == true) { | |||||
return learun.alert.warning("已生成排考名单,不可删除!"); | |||||
} | |||||
learun.layerConfirm('是否确认删除该项!', function (res) { | learun.layerConfirm('是否确认删除该项!', function (res) { | ||||
if (res) { | if (res) { | ||||
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/DeleteForm', { keyValue: keyValue }, function () { | learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/DeleteForm', { keyValue: keyValue }, function () { | ||||
@@ -114,7 +124,7 @@ var bootstrap = function ($, learun) { | |||||
$('#lr_cleardata').on('click', function () { | $('#lr_cleardata').on('click', function () { | ||||
var keyValue = $('#gridtable').jfGridValue('EPId'); | var keyValue = $('#gridtable').jfGridValue('EPId'); | ||||
if (learun.checkrow(keyValue)) { | if (learun.checkrow(keyValue)) { | ||||
learun.layerConfirm('是否确认清除排考所有记录!', function (res) { | |||||
learun.layerConfirm('是否确认清除所有排考记录!', function (res) { | |||||
if (res) { | if (res) { | ||||
learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/ClearGenerate', { keyValue: keyValue, type: 2 }, function () { | learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/ClearGenerate', { keyValue: keyValue, type: 2 }, function () { | ||||
refreshGirdData(); | refreshGirdData(); | ||||
@@ -159,7 +169,7 @@ var bootstrap = function ($, learun) { | |||||
{ label: "排考编号", name: "PlanCode", width: 100, align: "left" }, | { label: "排考编号", name: "PlanCode", width: 100, align: "left" }, | ||||
{ label: "排考总人数", name: "EPStuCount", width: 100, align: "left" }, | { label: "排考总人数", name: "EPStuCount", width: 100, align: "left" }, | ||||
{ | { | ||||
label: "生成座位", name: "EPRandom", width: 100, align: "left", | |||||
label: "是否随机座位", name: "EPRandom", width: 100, align: "left", | |||||
formatter: function (cellvalue) { | formatter: function (cellvalue) { | ||||
return cellvalue == true ? "是" : "否"; | return cellvalue == true ? "是" : "否"; | ||||
} | } | ||||
@@ -26,7 +26,7 @@ var bootstrap = function ($, learun) { | |||||
// 初始化列表 | // 初始化列表 | ||||
initGird: function () { | initGird: function () { | ||||
$('#gridtable').jfGrid({ | $('#gridtable').jfGrid({ | ||||
url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GetPageList', | |||||
url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/GetClassInfoPageList', | |||||
headData: [ | headData: [ | ||||
{ label: "班级名称", name: "ClassName", width: 200, align: "left" }, | { label: "班级名称", name: "ClassName", width: 200, align: "left" }, | ||||
{ label: "班级代码", name: "ClassNo", width: 100, align: "left" }, | { label: "班级代码", name: "ClassNo", width: 100, align: "left" }, | ||||
@@ -121,6 +121,9 @@ var bootstrap = function ($, learun) { | |||||
// 保存数据 | // 保存数据 | ||||
acceptClick = function (callBack) { | acceptClick = function (callBack) { | ||||
var selectedRow = $('#gridtable').jfGridGet('rowdata'); | var selectedRow = $('#gridtable').jfGridGet('rowdata'); | ||||
if (selectedRow.length == 0) { | |||||
return learun.alert.warning("请选择班级!"); | |||||
} | |||||
var list = []; | var list = []; | ||||
$.each(selectedRow, | $.each(selectedRow, | ||||
function (i, item) { | function (i, item) { | ||||
@@ -75,32 +75,13 @@ var bootstrap = function ($, learun) { | |||||
// 保存数据 | // 保存数据 | ||||
acceptClick = function (callBack) { | acceptClick = function (callBack) { | ||||
var selectedRow = $('#gridtable').jfGridGet('rowdata'); | var selectedRow = $('#gridtable').jfGridGet('rowdata'); | ||||
learun.layerClose(window.name); | |||||
callBack(selectedRow); | |||||
//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(); | |||||
//} | |||||
if (!!selectedRow) { | |||||
learun.layerClose(window.name); | |||||
callBack(selectedRow); | |||||
} else { | |||||
return learun.alert.warning("请选择考场!"); | |||||
} | |||||
}; | }; | ||||
page.init(); | page.init(); | ||||
} | } |
@@ -106,18 +106,20 @@ var bootstrap = function ($, learun) { | |||||
}; | }; | ||||
refreshGirdData = function (temprow) { | refreshGirdData = function (temprow) { | ||||
//console.log('temprow', temprow); | //console.log('temprow', temprow); | ||||
//求数组并集 | |||||
//两数组连接(包括重复值) | |||||
var arr3 = tempdatra.concat(temprow); | |||||
//var result = []; | |||||
var obj = []; | |||||
//去重 | |||||
tempdatra = arr3.reduce(function (prev, cur, index, arr) { | |||||
//console.log(prev, cur); | |||||
obj[cur.EmpNo] ? '' : obj[cur.EmpNo] = true && prev.push(cur); | |||||
return prev; | |||||
}, []); | |||||
$('#Exam_ExamPlanTeacher').jfGridSet('refreshdata', tempdatra); | |||||
if (!!temprow) { | |||||
//求数组并集 | |||||
//两数组连接(包括重复值) | |||||
var arr3 = tempdatra.concat(temprow); | |||||
//var result = []; | |||||
var obj = []; | |||||
//去重 | |||||
tempdatra = arr3.reduce(function (prev, cur, index, arr) { | |||||
//console.log(prev, cur); | |||||
obj[cur.EmpNo] ? '' : obj[cur.EmpNo] = true && prev.push(cur); | |||||
return prev; | |||||
}, []); | |||||
$('#Exam_ExamPlanTeacher').jfGridSet('refreshdata', tempdatra); | |||||
} | |||||
}; | }; | ||||
refreshRoomData = function (temprow) { | refreshRoomData = function (temprow) { | ||||
// console.log('teacherRow', temprow); | // console.log('teacherRow', temprow); | ||||
@@ -146,18 +148,25 @@ var bootstrap = function ($, learun) { | |||||
}; | }; | ||||
// 保存数据 | // 保存数据 | ||||
acceptClick = function (callBack, i) { | acceptClick = function (callBack, i) { | ||||
var postData = {}; | |||||
var formData = $('[data-table="Exam_ExamPlanRoom"]').lrGetFormData(); | |||||
formData.EPLId = EPLId; | |||||
postData.strEntity = JSON.stringify(formData); | |||||
postData.Exam_ExamPlanTeacherList = JSON.stringify($('#Exam_ExamPlanTeacher').jfGridGet('rowdatas')); | |||||
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/SaveRoomAndTeacher?keyValue=' + keyValue, postData, function (res) { | |||||
// 保存成功后才回调 | |||||
if (!!callBack) { | |||||
callBack(res, formData, i); | |||||
var bool = validForm(); | |||||
if (bool) { | |||||
var postData = {}; | |||||
var formData = $('[data-table="Exam_ExamPlanRoom"]').lrGetFormData(); | |||||
if (!formData.ClassroomName) { | |||||
return learun.alert.warning("请选择考场!"); | |||||
} | } | ||||
}); | |||||
formData.EPLId = EPLId; | |||||
postData.strEntity = JSON.stringify(formData); | |||||
postData.Exam_ExamPlanTeacherList = JSON.stringify($('#Exam_ExamPlanTeacher').jfGridGet('rowdatas')); | |||||
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlanLesson/SaveRoomAndTeacher?keyValue=' + keyValue, postData, function (res) { | |||||
// 保存成功后才回调 | |||||
if (!!callBack) { | |||||
callBack(res, formData, i); | |||||
} | |||||
}); | |||||
} | |||||
}; | }; | ||||
page.init(); | page.init(); | ||||
} | } |
@@ -189,6 +189,8 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); | |||||
} | } | ||||
} | } | ||||
//修改排考记录表是否生成字段 | |||||
db.ExecuteBySql($"update Exam_ExamPlan set EPGenarate=0 where EPId='{keyValue}'"); | |||||
db.Commit(); | db.Commit(); | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -215,6 +217,8 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); | |||||
try | try | ||||
{ | { | ||||
db.BeginTrans(); | db.BeginTrans(); | ||||
//排考记录表 | |||||
var examPlan = db.FindEntity<Exam_ExamPlanEntity>(keyValue); | |||||
//排考安排课程已审核的数据 | //排考安排课程已审核的数据 | ||||
var planLessonData = db.FindList<Exam_ExamPlanLessonEntity>(x => x.EPId == keyValue && x.ELCheckMark == true); | var planLessonData = db.FindList<Exam_ExamPlanLessonEntity>(x => x.EPId == keyValue && x.ELCheckMark == true); | ||||
@@ -263,6 +267,8 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); | |||||
//生成考场随机数 | //生成考场随机数 | ||||
var sealNumArr = getRanNum(planRoom.SeatCount.Value); | var sealNumArr = getRanNum(planRoom.SeatCount.Value); | ||||
//删除考场明细 | |||||
db.ExecuteBySql($"delete Exam_ArrangeExamTermItemNew where EPId='{keyValue}'"); | |||||
for (int n = 0; n < sealNumArr.Count; n++) | for (int n = 0; n < sealNumArr.Count; n++) | ||||
{ | { | ||||
//考场安排明细 | //考场安排明细 | ||||
@@ -286,23 +292,43 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');"); | |||||
//排考安排班级 | //排考安排班级 | ||||
var planClassData = db.FindList<Exam_ExamPlanClassEntity>(x => x.EPLId == planLesson.EPLId); | var planClassData = db.FindList<Exam_ExamPlanClassEntity>(x => x.EPLId == planLesson.EPLId); | ||||
var classnos = string.Join("','", planClassData.Select(x => x.ClassNo).ToList()); | var classnos = string.Join("','", planClassData.Select(x => x.ClassNo).ToList()); | ||||
string stuSql = $"select * from StuInfoBasic where classno in ('{classnos}') and stuno not in (select StuNo from Exam_ArrangeExamTermItemNew where EPId='{keyValue}')"; | |||||
string stuSql = $"select * from StuInfoBasic where checkMark='1' and classno in ('{classnos}') and stuno not in (select StuNo from Exam_ArrangeExamTermItemNew where EPId='{keyValue}')"; | |||||
//所有考生 | //所有考生 | ||||
var stuInfoList = db.FindList<StuInfoBasicEntity>(stuSql).ToList(); | var stuInfoList = db.FindList<StuInfoBasicEntity>(stuSql).ToList(); | ||||
if (itemList.Count >= stuInfoList.Count()) | if (itemList.Count >= stuInfoList.Count()) | ||||
{ | { | ||||
//为考生安排座位 | |||||
for (int i = 0; i < stuInfoList.Count; i++) | |||||
//随机安排座位 | |||||
if (examPlan.EPRandom == true) | |||||
{ | { | ||||
itemList[i].StuNo = stuInfoList[i].StuNo; | |||||
itemList[i].StuName = stuInfoList[i].StuName; | |||||
stuInfoList = stuInfoList.OrderBy(x => Guid.NewGuid()).ToList(); | |||||
//为考生安排座位 | |||||
for (int i = 0; i < stuInfoList.Count; i++) | |||||
{ | |||||
itemList[i].StuNo = stuInfoList[i].StuNo; | |||||
itemList[i].StuName = stuInfoList[i].StuName; | |||||
} | |||||
db.Insert(itemList); | |||||
} | } | ||||
else | |||||
{ | |||||
//不随机安排座位 | |||||
itemList = itemList.OrderBy(x => x.SitNumber).OrderBy(x => x.ClassroomNo).ToList(); | |||||
stuInfoList = stuInfoList.OrderBy(x =>x.StuNo).OrderBy(x=>x.ClassNo).ToList(); | |||||
//为考生安排座位 | |||||
for (int i = 0; i < stuInfoList.Count; i++) | |||||
{ | |||||
itemList[i].StuNo = stuInfoList[i].StuNo; | |||||
itemList[i].StuName = stuInfoList[i].StuName; | |||||
} | |||||
db.Insert(itemList); | |||||
db.Insert(itemList); | |||||
} | |||||
} | } | ||||
} | } | ||||
//修改排考记录表是否生成字段 | |||||
db.ExecuteBySql($"update Exam_ExamPlan set EPGenarate=1 where EPId='{keyValue}'"); | |||||
db.Commit(); | db.Commit(); | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -207,6 +207,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
var stuinfo = this.BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(); | |||||
//计算班级人数 | |||||
foreach (var entity in list) | |||||
{ | |||||
entity.ClassStuNum = stuinfo.Count(x => x.ClassNo == entity.ClassNo); | |||||
} | |||||
this.BaseRepository("CollegeMIS").Insert(list); | this.BaseRepository("CollegeMIS").Insert(list); | ||||
//更新排考安排课程表实排班级数、实排人数 | //更新排考安排课程表实排班级数、实排人数 | ||||
//排考安排课程表Id | //排考安排课程表Id | ||||
@@ -67,7 +67,7 @@ select EPId from Exam_ExamPlanLesson where EPLId='{queryParam["EPLId"].ToString( | |||||
strSql.Append($" AND t.AcademicYearNo = '{ELEntity.AcademicYearNo}' "); | strSql.Append($" AND t.AcademicYearNo = '{ELEntity.AcademicYearNo}' "); | ||||
strSql.Append($" AND t.Semester = '{ELEntity.Semester}' "); | strSql.Append($" AND t.Semester = '{ELEntity.Semester}' "); | ||||
} | } | ||||
strSql.Append($" AND t.ClassroomNo not in (select ClassroomNo from Exam_ExamPlanRoom where EPLId='{queryParam["EPLId"].ToString()}') "); | |||||
} | } | ||||
if (!queryParam["SqlParameter"].IsEmpty()) | if (!queryParam["SqlParameter"].IsEmpty()) | ||||