Просмотр исходного кода

排考记录--已生成排考名单的不可安排考试

新疆影视学院高职
zhangli 2 лет назад
Родитель
Сommit
0b3307924a
3 измененных файлов: 64 добавлений и 34 удалений
  1. +0
    -6
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs
  2. +41
    -8
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js
  3. +23
    -20
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanService.cs

+ 0
- 6
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamPlanController.cs Просмотреть файл

@@ -149,12 +149,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
[AjaxOnly]
public ActionResult Generate(string keyValue)
{
//var list = exam_ExamPlanIBLL.GetPlanTimeList(keyValue);
//if (list.Count() <= 0)
//{
// return Fail("请先安排时间!");
//}

var data = exam_ExamPlanIBLL.IsGenerate(keyValue);
if (!data.flag)
{


+ 41
- 8
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamPlan/Index.js Просмотреть файл

@@ -138,6 +138,10 @@ var bootstrap = function ($, learun) {
$('#lr_examtime').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('EPId');
if (learun.checkrow(keyValue)) {
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate');
if (EPGenarate == true) {
return learun.alert.warning("选中记录已生成排考名单!");
}
learun.layerForm({
id: 'formtime',
title: '安排时间',
@@ -148,6 +152,7 @@ var bootstrap = function ($, learun) {
return top[id].acceptClick(refreshGirdData);
}
});

}
});
//  安排考试
@@ -156,18 +161,26 @@ var bootstrap = function ($, learun) {
var keyValue = $('#gridtable').jfGridValue('EPId');
var PlanName = $('#gridtable').jfGridValue('PlanName');
if (learun.checkrow(keyValue))
learun.frameTab.open({
F_ModuleId: keyValue,
F_Icon: 'fa magic',
F_FullName: PlanName + '--安排考试',
F_UrlAddress: '/EducationalAdministration/Exam_ExamPlanLesson/Index?EPId=' + keyValue
});
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate');
if (EPGenarate == true) {
return learun.alert.warning("选中记录已生成排考名单!");
}
learun.frameTab.open({
F_ModuleId: keyValue,
F_Icon: 'fa magic',
F_FullName: PlanName + '--安排考试',
F_UrlAddress: '/EducationalAdministration/Exam_ExamPlanLesson/Index?EPId=' + keyValue
});
});
//一键安排课程
$('#lr_examlesson').on('click',
function () {
var keyValue = $('#gridtable').jfGridValue('EPId');
if (learun.checkrow(keyValue)) {
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate');
if (EPGenarate == true) {
return learun.alert.warning("选中记录已生成排考名单!");
}
learun.layerConfirm('是否确认安排课程!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/PlanLessonByEPId', { keyValue: keyValue }, function () {
@@ -183,6 +196,10 @@ var bootstrap = function ($, learun) {
function () {
var keyValue = $('#gridtable').jfGridValue('EPId');
if (learun.checkrow(keyValue)) {
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate');
if (EPGenarate == true) {
return learun.alert.warning("选中记录已生成排考名单!");
}
learun.layerConfirm('是否确认安排班级!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/PlanClassByEPId', { keyValue: keyValue }, function () {
@@ -198,6 +215,10 @@ var bootstrap = function ($, learun) {
function () {
var keyValue = $('#gridtable').jfGridValue('EPId');
if (learun.checkrow(keyValue)) {
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate');
if (EPGenarate == true) {
return learun.alert.warning("选中记录已生成排考名单!");
}
learun.layerConfirm('是否确认安排考场!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/PlanRoomByEPId', { keyValue: keyValue }, function () {
@@ -213,6 +234,10 @@ var bootstrap = function ($, learun) {
function () {
var keyValue = $('#gridtable').jfGridValue('EPId');
if (learun.checkrow(keyValue)) {
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate');
if (EPGenarate == true) {
return learun.alert.warning("选中记录已生成排考名单!");
}
learun.layerConfirm('是否确认生成排考时间!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/PlanLessonTimeByEPId', { keyValue: keyValue }, function () {
@@ -222,12 +247,16 @@ var bootstrap = function ($, learun) {
});
}
});
//一键安排监考老师
$('#lr_examteacher').on('click',
function () {
var keyValue = $('#gridtable').jfGridValue('EPId');
if (learun.checkrow(keyValue)) {
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate');
if (EPGenarate == true) {
return learun.alert.warning("选中记录已生成排考名单!");
}
learun.layerConfirm('是否确认安排监考老师!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/PlanTeacherByEPId', { keyValue: keyValue }, function () {
@@ -237,12 +266,16 @@ var bootstrap = function ($, learun) {
});
}
});
//一键审核所有考试课程
$('#lr_checkAll').on('click',
function () {
var keyValue = $('#gridtable').jfGridValue('EPId');
if (learun.checkrow(keyValue)) {
var EPGenarate = $('#gridtable').jfGridValue('EPGenarate');
if (EPGenarate == true) {
return learun.alert.warning("选中记录已生成排考名单!");
}
learun.layerConfirm('是否确认审核所有考试课程!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamPlan/CheckAllPlanLesson', { keyValue: keyValue }, function () {


+ 23
- 20
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlan/Exam_ExamPlanService.cs Просмотреть файл

@@ -285,7 +285,7 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');");
var EPClass = db.FindList<Exam_ExamPlanClassEntity>($"select * from Exam_ExamPlanClass where eplid in ('{EPLIds}')");
if (EPClass.Count() <= 0)
{
return (false,"请安排班级!");
return (false, "请安排班级!");
}

//排考考场
@@ -294,16 +294,16 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');");
{
return (false, "请安排考场!");
}
if (EPRoom.Where(x => string.IsNullOrEmpty(x.EmpNo)).Count() <= 0)
if (EPRoom.Where(x => string.IsNullOrEmpty(x.EmpNo)).Count() > 0)
{
return (false, "请安排监考老师!");
}

if (planLessonData.Where(x => x.ELCheckMark == false).Count() <= 0)
if (planLessonData.Where(x => x.ELCheckMark == true).Count() <= 0)
{
return (false, "请先安排考试!");
}
return (true, "");
}
catch (Exception ex)
@@ -339,6 +339,9 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');");
//删除考场明细
db.ExecuteBySql($"delete Exam_ArrangeExamTermItemNew where EPId='{keyValue}'");

var classInfo = db.FindList<ClassInfoEntity>();
//排考班级
var planClassList = db.FindList<Exam_ExamPlanClassEntity>();
foreach (var planLesson in planLessonData)
{
//排考安排明细数据
@@ -346,8 +349,7 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');");

//排考安排考场
var planRoomData = db.FindList<Exam_ExamPlanRoomEntity>(x => x.EPLId == planLesson.EPLId).ToList();
//考场数
//int planRoomCount = planRoomData.Count();

//添加排考安排数据
foreach (var planRoom in planRoomData)
{
@@ -366,7 +368,7 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');");
ExamTermNewEntity.F_SchoolId = LoginUserInfo.Get().companyId;
db.Insert(ExamTermNewEntity);

//生成考场随机
//生成考场顺序
var sealNumArr = getRanNum(planRoom.SeatCount.Value);
for (int n = 0; n < sealNumArr.Count; n++)
{
@@ -389,12 +391,11 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');");
}

//排考安排班级
var planClassData = db.FindList<Exam_ExamPlanClassEntity>(x => x.EPLId == planLesson.EPLId);
var planClassData = planClassList.Where(x => x.EPLId == planLesson.EPLId);
var classnos = string.Join("','", planClassData.Select(x => x.ClassNo).ToList());
string stuSql = $"select * from Exam_ExamStudent where ESEnabled=1 and AcademicYearNo='{examPlan.AcademicYearNo}' and Semester='{examPlan.Semester}' and ESType='{examPlan.PlanType}' and classno in ('{classnos}') and stuno not in (select StuNo from Exam_ArrangeExamTermItemNew where EPId='{keyValue}' and LessonNo='{planLesson.LessonNo}')";
//所有考生
var stuInfoList = db.FindList<Exam_ExamStudentEntity>(stuSql).ToList();
var classInfo = db.FindList<ClassInfoEntity>();

itemList = itemList.OrderBy(x => x.SitNumber).OrderBy(x => x.ClassroomNo).ToList();
if (itemList.Count >= stuInfoList.Count())
@@ -460,18 +461,20 @@ delete from Exam_ExamPlanRoom where EPLId in ('{planLessonIds}');");
/// <returns></returns>
private List<int> getRanNum(int maxValue)
{
Random ra = new Random(unchecked((int)DateTime.Now.Ticks));
int[] arrNum = { };
var list = new List<int>();
int tmp = 0;
int minValue = 1;
for (int i = 0; i < maxValue; i++)
{
tmp = ra.Next(minValue, maxValue + 1); //随机取数
list.Add(getNum(list, tmp, minValue, maxValue + 1, ra)); //取出值赋到数组中
}
//座位号不打乱,生成顺序数组
int[] arr = Enumerable.Range(1, maxValue).ToArray();
//Random ra = new Random(unchecked((int)DateTime.Now.Ticks));
//int[] arrNum = { };
//var list = new List<int>();
//int tmp = 0;
//int minValue = 1;
//for (int i = 0; i < maxValue; i++)
//{
// tmp = ra.Next(minValue, maxValue + 1); //随机取数
// list.Add(getNum(list, tmp, minValue, maxValue + 1, ra)); //取出值赋到数组中
//}

return list;
return arr.ToList();
}

private int getNum(List<int> list, int tmp, int minValue, int maxValue, Random ra)


Загрузка…
Отмена
Сохранить