@@ -5,6 +5,7 @@ using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System; | |||
using Learun.Application.Organization; | |||
namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
{ | |||
@@ -19,6 +20,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
{ | |||
private Exam_ArrangeExamTermNewIBLL exam_ArrangeExamTermNewIBLL = new Exam_ArrangeExamTermNewBLL(); | |||
private Exam_ExamRoomIBLL exam_ExamRoomIBLL = new Exam_ExamRoomBLL(); | |||
private EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); | |||
private RoleIBLL roleIbll = new RoleBLL(); | |||
#region 视图功能 | |||
@@ -47,11 +50,29 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult IndexForClass() | |||
{ | |||
if (LoginUserInfo.Get().roleIds.Contains(roleIbll.GetEntityByRoleCode("paikaoerji").F_RoleId)) | |||
{ | |||
ViewBag.IsTwoDept = true; | |||
var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(LoginUserInfo.Get().account); | |||
if (empinfo != null) | |||
{ | |||
ViewBag.DeptNo = empinfo.DeptNo; | |||
} | |||
} | |||
return View(); | |||
} | |||
[HttpGet] | |||
public ActionResult IndexItem() | |||
{ | |||
if (LoginUserInfo.Get().roleIds.Contains(roleIbll.GetEntityByRoleCode("paikaoerji").F_RoleId)) | |||
{ | |||
ViewBag.IsTwoDept = true; | |||
var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(LoginUserInfo.Get().account); | |||
if (empinfo != null) | |||
{ | |||
ViewBag.DeptNo = empinfo.DeptNo; | |||
} | |||
} | |||
return View(); | |||
} | |||
/// <summary> | |||
@@ -71,6 +92,15 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult IndexClassRoom() | |||
{ | |||
if (LoginUserInfo.Get().roleIds.Contains(roleIbll.GetEntityByRoleCode("paikaoerji").F_RoleId)) | |||
{ | |||
ViewBag.IsTwoDept = true; | |||
var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(LoginUserInfo.Get().account); | |||
if (empinfo != null) | |||
{ | |||
ViewBag.DeptNo = empinfo.DeptNo; | |||
} | |||
} | |||
return View(); | |||
} | |||
#endregion | |||
@@ -95,7 +125,18 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult GetClassTree() | |||
{ | |||
return Success(exam_ArrangeExamTermNewIBLL.GetClassTree()); | |||
if (LoginUserInfo.Get().roleIds.Contains(roleIbll.GetEntityByRoleCode("paikaoerji").F_RoleId)) | |||
{ | |||
var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(LoginUserInfo.Get().account); | |||
if (empinfo != null) | |||
{ | |||
return Success(exam_ArrangeExamTermNewIBLL.GetClassTree(empinfo.DeptNo)); | |||
} | |||
else | |||
return Success(exam_ArrangeExamTermNewIBLL.GetClassTree("")); | |||
} | |||
else | |||
return Success(exam_ArrangeExamTermNewIBLL.GetClassTree("")); | |||
} | |||
/// <summary> | |||
@@ -14,7 +14,6 @@ var bootstrap = function ($, learun) { | |||
var ClassNo = ''; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
@@ -69,6 +68,13 @@ var bootstrap = function ($, learun) { | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
$.get('/Home/GetYearAndSemesteResult', function (ref) { | |||
if (ref.code == "200") { | |||
$('#AcademicYearNo').lrselectSet(ref.data.Item1); | |||
$('#Semester').lrselectSet(ref.data.Item3); | |||
page.initGird(); | |||
} | |||
}.bind(this), "json"); | |||
$('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname', placeholder: '请选择课程' }); | |||
$('#ClassRoomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname', placeholder: '请选择教室' }); | |||
$('#EmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname', placeholder: '请选择教师' }); | |||
@@ -105,6 +111,8 @@ var bootstrap = function ($, learun) { | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.AcademicYearNo = $('#AcademicYearNo').lrselectGet(); | |||
param.Semester = $('#Semester').lrselectGet(); | |||
param.StartTime = datebegin; | |||
param.EndTime = dateend; | |||
var loginInfo = learun.clientdata.get(['userinfo']); | |||
@@ -13,7 +13,6 @@ var bootstrap = function ($, learun) { | |||
var dateend = ''; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
@@ -68,6 +67,13 @@ var bootstrap = function ($, learun) { | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
$.get('/Home/GetYearAndSemesteResult', function (ref) { | |||
if (ref.code == "200") { | |||
$('#AcademicYearNo').lrselectSet(ref.data.Item1); | |||
$('#Semester').lrselectSet(ref.data.Item3); | |||
page.initGird(); | |||
} | |||
}.bind(this), "json"); | |||
//课程 | |||
$('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname', placeholder:'请选择课程' }); | |||
}, | |||
@@ -98,6 +104,8 @@ var bootstrap = function ($, learun) { | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.AcademicYearNo = $('#AcademicYearNo').lrselectGet(); | |||
param.Semester = $('#Semester').lrselectGet(); | |||
param.StartTime = datebegin; | |||
param.EndTime = dateend; | |||
var loginInfo = learun.clientdata.get(['userinfo']); | |||
@@ -48,4 +48,8 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<script> | |||
var CurrentDeptNo = "@ViewBag.DeptNo"; | |||
var IsTwoDept = "@ViewBag.IsTwoDept"; | |||
</script> | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/Exam_ArrangeExamTermNew/IndexClassRoom.js") |
@@ -11,7 +11,6 @@ var bootstrap = function ($, learun) { | |||
var logend = ''; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
@@ -40,7 +39,6 @@ var bootstrap = function ($, learun) { | |||
selectfn: function (begin, end) { | |||
logbegin = begin; | |||
logend = end; | |||
page.search(); | |||
} | |||
}); | |||
@@ -67,6 +65,14 @@ var bootstrap = function ($, learun) { | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
$.get('/Home/GetYearAndSemesteResult', function (ref) { | |||
if (ref.code == "200") { | |||
$('#AcademicYearNo').lrselectSet(ref.data.Item1); | |||
$('#Semester').lrselectSet(ref.data.Item3); | |||
page.initGird(); | |||
} | |||
}.bind(this), "json"); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
@@ -138,8 +144,14 @@ var bootstrap = function ($, learun) { | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.AcademicYearNo = $('#AcademicYearNo').lrselectGet(); | |||
param.Semester = $('#Semester').lrselectGet(); | |||
param.StartTime = logbegin; | |||
param.EndTime = logend; | |||
if (IsTwoDept) | |||
param.ImportDeptNo = CurrentDeptNo; | |||
else | |||
param.ImportDeptNo = "0"; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
@@ -48,4 +48,8 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<script> | |||
var CurrentDeptNo = "@ViewBag.DeptNo"; | |||
var IsTwoDept = "@ViewBag.IsTwoDept"; | |||
</script> | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/Exam_ArrangeExamTermNew/IndexForClass.js") |
@@ -14,7 +14,6 @@ var bootstrap = function ($, learun) { | |||
var ClassNo = ''; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
@@ -78,6 +77,13 @@ var bootstrap = function ($, learun) { | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
$.get('/Home/GetYearAndSemesteResult', function (ref) { | |||
if (ref.code == "200") { | |||
$('#AcademicYearNo').lrselectSet(ref.data.Item1); | |||
$('#Semester').lrselectSet(ref.data.Item3); | |||
page.initGird(); | |||
} | |||
}.bind(this), "json"); | |||
//课程 | |||
//$('#LessonNo').lrselect({ | |||
// placeholder: "请选择课程", | |||
@@ -119,9 +125,14 @@ var bootstrap = function ($, learun) { | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.AcademicYearNo = $('#AcademicYearNo').lrselectGet(); | |||
param.Semester = $('#Semester').lrselectGet(); | |||
param.StartTime = datebegin; | |||
param.EndTime = dateend; | |||
//console.log(param); | |||
if (IsTwoDept) | |||
param.ImportDeptNo = CurrentDeptNo; | |||
else | |||
param.ImportDeptNo = "0"; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
@@ -48,4 +48,8 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<script> | |||
var CurrentDeptNo = "@ViewBag.DeptNo"; | |||
var IsTwoDept = "@ViewBag.IsTwoDept"; | |||
</script> | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/Exam_ArrangeExamTermNew/IndexItem.js") |
@@ -14,7 +14,6 @@ var bootstrap = function ($, learun) { | |||
var ClassNo = ''; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
@@ -78,6 +77,13 @@ var bootstrap = function ($, learun) { | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
$.get('/Home/GetYearAndSemesteResult', function (ref) { | |||
if (ref.code == "200") { | |||
$('#AcademicYearNo').lrselectSet(ref.data.Item1); | |||
$('#Semester').lrselectSet(ref.data.Item3); | |||
page.initGird(); | |||
} | |||
}.bind(this), "json"); | |||
//课程 | |||
//$('#LessonNo').lrselect({ | |||
// placeholder: "请选择课程", | |||
@@ -121,9 +127,14 @@ var bootstrap = function ($, learun) { | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.AcademicYearNo = $('#AcademicYearNo').lrselectGet(); | |||
param.Semester = $('#Semester').lrselectGet(); | |||
param.StartTime = datebegin; | |||
param.EndTime = dateend; | |||
console.log(param); | |||
if (IsTwoDept) | |||
param.ImportDeptNo = CurrentDeptNo; | |||
else | |||
param.ImportDeptNo = "0"; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
@@ -22,12 +22,71 @@ namespace Learun.Application.WebApi.Modules | |||
Get["/StuList"] = GetStuInfo; | |||
Get["/StuLessonInfo"] = GetStuLessonInfo; | |||
Get["/timeTableData"] = GetTimeTableData; | |||
Get["/weeklist"] = GetWeeksData; | |||
Get["/currentweek"] = GetCurrentWeek; | |||
} | |||
private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); | |||
private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL(); | |||
private StuAttendanceLeaveIBLL stuAttendanceLeaveIBLL = new StuAttendanceLeaveBLL(); | |||
private StuAttendanceIBLL stuAttendanceIBLL = new StuAttendanceBLL(); | |||
public class WeekDate | |||
{ | |||
public int week { get; set; } | |||
public string startdate { get; set; } | |||
public string enddate { get; set; } | |||
public string textweek { get; set; } | |||
} | |||
public Response GetWeeksData(dynamic _) | |||
{ | |||
var weekdatelist = new List<WeekDate>(); | |||
var yearsemester = Common.GetSemesterAndYear(); | |||
var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate); | |||
if (arrangelessonlist.Any()) | |||
{ | |||
var firstday = arrangelessonlist.First(); | |||
var lastday = arrangelessonlist.Last(); | |||
var monday = firstday.LessonDate.Value.AddDays(-Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) + 1); | |||
var sunday = lastday.LessonDate.Value.AddDays(7 - Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek)); | |||
//总周数 | |||
var weekCount = Math.Ceiling(Convert.ToDouble((sunday - monday).Days + 1) / 7); | |||
for (var i = 0; i < weekCount; i++) | |||
{ | |||
var wentity = new WeekDate(); | |||
wentity.week = i + 1; | |||
wentity.startdate = monday.AddDays(i * 7).ToString("yyyy-MM-dd"); | |||
wentity.enddate = monday.AddDays(i * 7 + 6).ToString("yyyy-MM-dd"); | |||
wentity.textweek = "第" + wentity.week + "周 (" + wentity.startdate + "~" + wentity.enddate + ")"; | |||
weekdatelist.Add(wentity); | |||
} | |||
return Success(weekdatelist); | |||
} | |||
else | |||
return Success(new { }); | |||
} | |||
/// <summary> | |||
/// 获取当前日期是第几周 | |||
/// </summary> | |||
/// <returns></returns> | |||
public Response GetCurrentWeek(dynamic _) | |||
{ | |||
var yearsemester = Common.GetSemesterAndYear(); | |||
var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate); | |||
if (arrangelessonlist.Any()) | |||
{ | |||
var firstday = arrangelessonlist.First(); | |||
var lastday = arrangelessonlist.Last(); | |||
var monday = firstday.LessonDate.Value.AddDays(-(Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek)) + 1); | |||
var sunday = lastday.LessonDate.Value.AddDays(7 - (Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek))); | |||
var currentweek = Util.Time.GetWeekOfDay(monday, sunday); | |||
return Success(new {currentweek}); | |||
} | |||
return Success(new {currentweek=1}); | |||
} | |||
/// <summary> | |||
/// 课程表【教师功能、学生功能】 | |||
/// </summary> | |||
@@ -18,11 +18,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
#region 获取数据 | |||
public List<TreeModel> GetClassTree() | |||
public List<TreeModel> GetClassTree(string DeptNo) | |||
{ | |||
try | |||
{ | |||
var list = exam_ArrangeExamTermNewService.GetClassTree(); | |||
var list = exam_ArrangeExamTermNewService.GetClassTree(DeptNo); | |||
List<TreeModel> treeList = new List<TreeModel>(); | |||
foreach (var item in list) | |||
{ | |||
@@ -15,7 +15,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
#region 获取数据 | |||
List<TreeModel> GetClassTree(); | |||
List<TreeModel> GetClassTree(string DeptNo); | |||
List<TreeModel> GetClassRoomTree(string AcademicYearNo, string Semester); | |||
IEnumerable<Exam_ArrangeExamTermItemNewEntity> GetPageListForClass(Pagination pagination, string queryJson); | |||
IEnumerable<Exam_ArrangeExamTermItemNewEntity> GetItemPageList(Pagination pagination, string queryJson); | |||
@@ -19,11 +19,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
public class Exam_ArrangeExamTermNewService : RepositoryFactory | |||
{ | |||
#region 获取数据 | |||
public IEnumerable<ClassInfoEntity> GetClassTree() | |||
public IEnumerable<ClassInfoEntity> GetClassTree(string DeptNo) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>("select ClassNo,ClassName from Exam_ArrangeExamTermItemNew where ClassNo is not null group by ClassNo,ClassName order by ClassNo"); | |||
return this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>($@"select ClassNo,ClassName from Exam_ArrangeExamTermItemNew t | |||
left join Exam_ExamPlan e on t.EPId = e.EPId where ClassNo is not null and e.importdeptno='{DeptNo}' group by ClassNo,ClassName order by ClassNo"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -109,6 +110,17 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
strSql.Append(" AND ( ExamDate >= '" + queryParam["StartTime"].ToString() + "' AND ExamDate <= '" + queryParam["EndTime"].ToString() + "' ) "); | |||
} | |||
if (!queryParam["ImportDeptNo"].IsEmpty()) | |||
{ | |||
if (queryParam["ImportDeptNo"].ToString() == "0") | |||
{ | |||
strSql.Append(" AND e.ImportDeptNo='' "); | |||
} | |||
else | |||
{ | |||
strSql.Append(" AND e.ImportDeptNo ='"+ queryParam["ImportDeptNo"].ToString() + "'"); | |||
} | |||
} | |||
strSql.Append(@" group by AcademicYearNo, Semester, ExamDate, ExamTime,LessonNo, LessonName,ClassRoomNo,ClassRoomName,EmpNo, EmpName, ClassNo,ClassName,t.EPId | |||
having count(StuNo)>0"); | |||
@@ -180,6 +192,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
strSql.Append(" AND ( t.ExamDate >= '" + queryParam["StartTime"].ToString() + "' AND t.ExamDate <= '" + queryParam["EndTime"].ToString() + "' ) "); | |||
} | |||
if (!queryParam["ImportDeptNo"].IsEmpty()) | |||
{ | |||
if (queryParam["ImportDeptNo"].ToString() == "0") | |||
{ | |||
strSql.Append(" AND e.ImportDeptNo='' "); | |||
} | |||
else | |||
{ | |||
strSql.Append(" AND e.ImportDeptNo ='"+ queryParam["ImportDeptNo"].ToString() + "' "); | |||
} | |||
} | |||
strSql.Append(@"group by t.lessonName,t.lessonno,t.Examdate,t.examtime,t.EmpName,t.EmpNo,t.ClassroomNo,t.ClassroomName ,l.TeachMajorNo,e.AcademicYearNo ,e.Semester "); | |||
return this.BaseRepository("CollegeMIS").FindList<Exam_ArrangeExamTermItemNewEntity>(strSql.ToString(), pagination); | |||
} | |||
@@ -256,7 +280,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
strSql.Append(" AND ( ExamDate >= '" + queryParam["StartTime"].ToString() + "' AND ExamDate <= '" + queryParam["EndTime"].ToString() + "' ) "); | |||
} | |||
if (!queryParam["ImportDeptNo"].IsEmpty()) | |||
{ | |||
if (queryParam["ImportDeptNo"].ToString() == "0") | |||
{ | |||
strSql.Append(" AND e.ImportDeptNo='' "); | |||
} | |||
else | |||
{ | |||
strSql.Append(" AND e.ImportDeptNo ='" + queryParam["ImportDeptNo"].ToString() + "' "); | |||
} | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<Exam_ArrangeExamTermItemNewEntity>(strSql.ToString(), null, pagination); | |||
} | |||
catch (Exception ex) | |||
@@ -329,6 +364,14 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
strSql.Append(" AND ( ExamDate >= '" + queryParam["StartTime"].ToString() + "' AND ExamDate <= '" + queryParam["EndTime"].ToString() + "' ) "); | |||
} | |||
if (!queryParam["AcademicYearNo"].IsEmpty()) | |||
{ | |||
strSql.Append(" and e.AcademicYearNo='" + queryParam["AcademicYearNo"].ToString() + "' "); | |||
} | |||
if (!queryParam["Semester"].IsEmpty()) | |||
{ | |||
strSql.Append(" and e.Semester='" + queryParam["Semester"].ToString() + "' "); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<Exam_ArrangeExamTermNewEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
@@ -546,7 +546,7 @@ left join CdLessonType ltype on info.LessonTypeId=ltype.LTId | |||
where t.EPId='{ExamPlanLesson.EPId}' and info.CheckMark=1 "); | |||
} | |||
var EPLesson = EPLessonList.Where(x => x.EPLId == ExamPlanLesson.EPLId).FirstOrDefault(); | |||
if (EPLessonList.ToList().Exists(x => x.EPLId != entity.EPLId && x.TeachMajorNo == EPLesson.TeachMajorNo && x.ExamLength == EPLesson.ExamLength && x.ExamDate != null && x.ExamDate == entity.ExamDate && x.ExamTime == entity.ExamTime)) | |||
if (EPLessonList.ToList().Exists(x => x.EPLId != entity.EPLId && x.TeachMajorNo == EPLesson.TeachMajorNo&&x.Grade== ExamPlanLesson.Grade && x.ExamLength == EPLesson.ExamLength && x.ExamDate != null && x.ExamDate == entity.ExamDate && x.ExamTime == entity.ExamTime)) | |||
{ | |||
return (false, "同专业同时段只能安排一门课程!"); | |||
} | |||