@@ -139,50 +139,72 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, string strEntity) | |||
{ | |||
//[{"AttemperId":"5b52c7e8-d5f5-4d54-a859-1544b7d62bf6","Day":"2","LessonTime":"23","LessonDate":"2024-03-05","SchooldId":"207fa1a9-160c-4943-a89b-8fa4db0547ce","Academicyear":"23-24","Semester":"2","DeptNo":"01","Deptname":"","MajorNo":"GZ13","LessonNo":"GZ1302006","Curriculum":"编舞技法基础","TeachClassNo":"G2201010303","ClassName":"22高职男班(舞蹈表演)","Empno":"5516","Teacher":"董东洋","ClassRoomNo":"1008","ClassRoom":"教学楼008","LessonSortNo":"1"}] | |||
//JObject jo = (JObject)JsonConvert.DeserializeObject(strEntity); | |||
ArrangeLessonTermAttemperEntity entity = strEntity.ToObject<ArrangeLessonTermAttemperEntity>(); | |||
if (entity.AttemperType == "03") | |||
entity.Details = JsonConvert.SerializeObject(entity.query); | |||
if (entity.AttemperType == "01") | |||
{ | |||
//if (entity.F_SchoolId != entity.NewF_SchoolId || entity.AcademicYearNo != entity.NewAcademicYearNo || entity.Semester != entity.NewSemester) | |||
if (entity.AcademicYearNo != entity.NewAcademicYearNo || entity.Semester != entity.NewSemester) | |||
{ | |||
return Fail("校区、学年、学期不一致!"); | |||
} | |||
//调课 | |||
} | |||
if (entity.AttemperType=="04") | |||
else if (entity.AttemperType == "02") | |||
{ | |||
JObject jo = (JObject)JsonConvert.DeserializeObject(strEntity); | |||
List<ArrangeLessonTermAttrmperChildEntity> query = new List<ArrangeLessonTermAttrmperChildEntity>(); | |||
string[] targetjieci = jo["tardata"]["targetjieci"].ToString().TrimEnd(';').Split(';'); | |||
string targettime = jo["tardata"]["targettime"].ToString(); | |||
string lastdata = ""; | |||
int i = 0; | |||
int index = 0; | |||
foreach (var item in jo["predata"]) | |||
{ | |||
//index++; | |||
if (string.IsNullOrEmpty(lastdata) || lastdata != item["LessonTime"].ToString()) | |||
{ | |||
lastdata = item["LessonTime"].ToString(); | |||
if ( index >= jo["predata"].Count()/2) | |||
{ | |||
i++; | |||
} | |||
} | |||
DateTime NewLessonDate = Convert.ToDateTime(jo["tardata"]["targettime"].ToString()); | |||
string newlessontime = Convert.ToInt32(NewLessonDate.DayOfWeek).ToString()+ targetjieci[i].Replace("节",""); | |||
ArrangeLessonTermAttrmperChildEntity term = new ArrangeLessonTermAttrmperChildEntity | |||
{ | |||
LessonId = !string.IsNullOrEmpty(keyValue) ? item["LessonId"].ToString(): item["AltId"].ToString(), | |||
LessonDate = Convert.ToDateTime(item["LessonDate"].ToString()), | |||
LessonTime = item["LessonTime"].ToString(), | |||
NewLessonDate =NewLessonDate , | |||
NewLessonTime = newlessontime | |||
}; | |||
query.Add(term); | |||
index++; | |||
} | |||
entity.query = query; | |||
//停课 | |||
} | |||
else if (entity.AttemperType == "03") | |||
{ | |||
//换课 | |||
} | |||
#region 旧逻辑 | |||
//if (entity.AttemperType == "03") | |||
//{ | |||
// //if (entity.F_SchoolId != entity.NewF_SchoolId || entity.AcademicYearNo != entity.NewAcademicYearNo || entity.Semester != entity.NewSemester) | |||
// if (entity.AcademicYearNo != entity.NewAcademicYearNo || entity.Semester != entity.NewSemester) | |||
// { | |||
// return Fail("校区、学年、学期不一致!"); | |||
// } | |||
//} | |||
//if (entity.AttemperType == "04") | |||
//{ | |||
// //JObject jo = (JObject)JsonConvert.DeserializeObject(strEntity); | |||
// List<ArrangeLessonTermAttrmperChildEntity> query = new List<ArrangeLessonTermAttrmperChildEntity>(); | |||
// string[] targetjieci = jo["tardata"]["targetjieci"].ToString().TrimEnd(';').Split(';'); | |||
// string targettime = jo["tardata"]["targettime"].ToString(); | |||
// string lastdata = ""; | |||
// int i = 0; | |||
// int index = 0; | |||
// foreach (var item in jo["predata"]) | |||
// { | |||
// //index++; | |||
// if (string.IsNullOrEmpty(lastdata) || lastdata != item["LessonTime"].ToString()) | |||
// { | |||
// lastdata = item["LessonTime"].ToString(); | |||
// if (index >= jo["predata"].Count() / 2) | |||
// { | |||
// i++; | |||
// } | |||
// } | |||
// DateTime NewLessonDate = Convert.ToDateTime(jo["tardata"]["targettime"].ToString()); | |||
// string newlessontime = Convert.ToInt32(NewLessonDate.DayOfWeek).ToString() + targetjieci[i].Replace("节", ""); | |||
// ArrangeLessonTermAttrmperChildEntity term = new ArrangeLessonTermAttrmperChildEntity | |||
// { | |||
// LessonId = !string.IsNullOrEmpty(keyValue) ? item["LessonId"].ToString() : item["AltId"].ToString(), | |||
// LessonDate = Convert.ToDateTime(item["LessonDate"].ToString()), | |||
// LessonTime = item["LessonTime"].ToString(), | |||
// NewLessonDate = NewLessonDate, | |||
// NewLessonTime = newlessontime | |||
// }; | |||
// query.Add(term); | |||
// index++; | |||
// } | |||
// entity.query = query; | |||
//} | |||
#endregion | |||
entity.Status = 0; | |||
@@ -324,10 +324,10 @@ var bootstrap = function ($, learun) { | |||
//{"AltId":"c7c2e0dc-12c5-4742-ba27-f8084fa712eb","day":"2","lessonTime":"21","lessonDate":"2024-06-11","schooldId":"207fa1a9-160c-4943-a89b-8fa4db0547ce","academicyear":"23-24","semester":"2","deptNo":"06","deptname":"","majorNo":"GZ02","lessonNo":"GZ0202999","curriculum":"音乐表演(民族乐器演奏方向)专业主课","teachClassNo":"G2306010301","className":"2301班(器乐系)","empno":"1132","teacher":"吴权喜","classRoomNo":"1012","classRoom":"音乐楼012","lessonSortNo":"1"} | |||
$('#gridtable2').jfGrid({ | |||
headData: [ | |||
{ label: "学年", name: "academicyear", width: 100, align: "left" }, | |||
{ label: "学期", name: "semester", width: 100, align: "left" }, | |||
{ label: "学年", name: "Academicyear", width: 100, align: "left" }, | |||
{ label: "学期", name: "Semester", width: 100, align: "left" }, | |||
{ | |||
label: "系部", name: "deptNo", width: 100, align: "left", | |||
label: "系部", name: "DeptNo", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', | |||
@@ -340,7 +340,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
}, | |||
{ | |||
label: "专业", name: "majorNo", width: 100, align: "left", | |||
label: "专业", name: "MajorNo", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', | |||
@@ -353,7 +353,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
}, | |||
{ | |||
label: "课程", name: "lessonNo", width: 100, align: "left", | |||
label: "课程", name: "LessonNo", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo', | |||
@@ -366,7 +366,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
}, | |||
{ | |||
label: "班级", name: "teachClassNo", width: 100, align: "left", | |||
label: "班级", name: "TeachClassNo", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', | |||
@@ -379,7 +379,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
}, | |||
{ | |||
label: "教师", name: "empno", width: 100, align: "left", | |||
label: "教师", name: "Empno", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo', | |||
@@ -392,7 +392,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
}, | |||
{ | |||
label: "教室", name: "classRoomNo", width: 100, align: "left", | |||
label: "教室", name: "ClassRoomNo", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo', | |||
@@ -572,28 +572,31 @@ var bootstrap = function ($, learun) { | |||
// 保存数据 | |||
save = function (processId, callBack, i) { | |||
var formData = $('body').lrGetFormData(); | |||
if (formData.AttemperType == "03") { //对调:校区、学年、学期需要一致 | |||
//if (formData.F_SchoolId !== formData.NewF_SchoolId || formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) { | |||
if (formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) { | |||
learun.alert.warning("校区、学年、学期不一致!"); | |||
return false; | |||
} | |||
} else if (formData.AttemperType == "01") { //换课:调度时间比较;教师或教室必填一个; | |||
if ((formData.NewEmpNo == null || formData.NewEmpNo == "") && (formData.NewClassroomNo == null || formData.NewClassroomNo == "")) { | |||
learun.alert.warning("课程新安排中教师或教室不能为空!"); | |||
return false; | |||
} | |||
if (formData.AttemperEndTime < formData.AttemperStartTime) { | |||
learun.alert.warning("调度结束时间不能小于调度开始时间!"); | |||
return false; | |||
} | |||
} else if (formData.AttemperType == "04") { //调课 | |||
if (formData) { | |||
formData.predata = JSON.parse($('#gridtable').attr("data-val")); | |||
formData.tardata = JSON.parse( $('#gridtable1').attr("data-val")); | |||
} | |||
if (false) { | |||
//if (formData.AttemperType == "03") { //对调:校区、学年、学期需要一致 | |||
// //if (formData.F_SchoolId !== formData.NewF_SchoolId || formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) { | |||
// if (formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) { | |||
// learun.alert.warning("校区、学年、学期不一致!"); | |||
// return false; | |||
// } | |||
//} else if (formData.AttemperType == "01") { //换课:调度时间比较;教师或教室必填一个; | |||
// if ((formData.NewEmpNo == null || formData.NewEmpNo == "") && (formData.NewClassroomNo == null || formData.NewClassroomNo == "")) { | |||
// learun.alert.warning("课程新安排中教师或教室不能为空!"); | |||
// return false; | |||
// } | |||
// if (formData.AttemperEndTime < formData.AttemperStartTime) { | |||
// learun.alert.warning("调度结束时间不能小于调度开始时间!"); | |||
// return false; | |||
// } | |||
//} else if (formData.AttemperType == "04") { //调课 | |||
// if (formData) { | |||
// formData.predata = JSON.parse($('#gridtable').attr("data-val")); | |||
// formData.tardata = JSON.parse( $('#gridtable1').attr("data-val")); | |||
// } | |||
//} | |||
} | |||
//获取要操作的课程列表 | |||
formData.query = $('#gridtable2').jfGridGet('rowdatas'); | |||
console.log(formData) | |||
if (!!processId) { | |||
formData.ProcessId = processId; | |||
@@ -601,12 +604,12 @@ var bootstrap = function ($, learun) { | |||
var postData = { | |||
strEntity: JSON.stringify(formData) | |||
}; | |||
//$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// // 保存成功后才回调 | |||
// if (!!callBack) { | |||
// callBack(res, i); | |||
// } | |||
//}); | |||
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(res, i); | |||
} | |||
}); | |||
}; | |||
page.init(); | |||
} |
@@ -102,7 +102,7 @@ var bootstrap = function ($, learun) { | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
selectedRow = $('#gridtable').jfGridGet('rowdata'); | |||
if (learun.checkrow(keyValue)) { | |||
if (selectedRow.Status !== 0) { | |||
if (selectedRow[0].Status !== 0) { | |||
learun.alert.warning("当前课程异动记录已提交,无法删除!"); | |||
return false; | |||
} | |||
@@ -577,6 +577,78 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
{ schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = formatData }; | |||
return JsonResult(result); | |||
} | |||
/// <summary> | |||
/// 课程表【教务】 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetDataInEducationSelect_news(string startTime, string endTime, string classNo, string empNo, string schoolId) | |||
{ | |||
var userInfo = LoginUserInfo.Get(); | |||
//开始时间 | |||
var startdate = string.IsNullOrEmpty(startTime) ? DateTime.Today : Convert.ToDateTime(startTime); | |||
var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); | |||
var endDate = Common.CalculateLastDateOfWeek(startdate).ToString("yyyy-MM-dd"); | |||
var semesterAndYear = Common.GetSemesterAndYear(startDate); | |||
var strAcademicYear = semesterAndYear.AcademicYearLong; | |||
var strSemester = semesterAndYear.Semester; | |||
var timeTableList = new List<TimeTable>(); | |||
//课程表 | |||
var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId, ""); | |||
timeTableList.AddRange(data); | |||
//选修课课程表 | |||
//var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); | |||
//timeTableList.AddRange(dataOfElective); | |||
var timeTables = timeTableList.ToList(); | |||
var noDataResult = new | |||
{ schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = "" }; | |||
if (!timeTables.Any()) | |||
{ | |||
return JsonResult(noDataResult); | |||
} | |||
var formatData = from d in timeTables | |||
let tt = d.LessonTime.Substring(1) | |||
group d by tt into g | |||
orderby g.Key | |||
select new | |||
{ | |||
time = g.Key, | |||
list = from e in timeTables | |||
let ee = e.LessonTime.Substring(1) | |||
where ee == g.Key | |||
select new | |||
{ | |||
AttemperId = e.AltId, | |||
Day = e.LessonTime.ToCharArray()[0], | |||
LessonTime = e.LessonTime, | |||
LessonDate = e.LessonDate.ToString("yyyy-MM-dd"), | |||
SchooldId = e?.F_SchoolId, | |||
Academicyear = semesterAndYear.AcademicYearShort, | |||
Semester = strSemester, | |||
DeptNo = e?.DeptNo, | |||
Deptname = "", | |||
MajorNo = e?.MajorNo, | |||
LessonNo = e?.LessonNo, | |||
Curriculum = e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName, | |||
TeachClassNo = e?.TeachClassNo, | |||
ClassName = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName, | |||
Empno = e?.EmpNo, | |||
Teacher = e?.EmpName, | |||
ClassRoomNo = string.IsNullOrEmpty(e.ClassRoomNo) ? "" : e.ClassRoomNo.Trim(), | |||
ClassRoom = string.IsNullOrEmpty(e.ClassroomName) ? "" : e.ClassroomName.Trim(), | |||
LessonSortNo = e.LessonSortNo | |||
} | |||
} | |||
; | |||
var result = new | |||
{ schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = formatData }; | |||
return JsonResult(result); | |||
} | |||
/// <summary> | |||
/// 课程表【教务】--班级下拉框信息 | |||
@@ -10,7 +10,7 @@ var bootstrap = function ($, learun) { | |||
page.bindSelect(); | |||
}, | |||
loadData: function (param) { | |||
$.lrSetFormWithParam(top.$.rootUrl + '/PersonnelManagement/TimeTable/GetDataInEducationSelect', param, | |||
$.lrSetFormWithParam(top.$.rootUrl + '/PersonnelManagement/TimeTable/GetDataInEducationSelect_news', param, | |||
function (data) { | |||
// 数据处理 | |||
var html = ''; | |||
@@ -30,7 +30,7 @@ var bootstrap = function ($, learun) { | |||
})(i); //调用时参数 | |||
} | |||
$('.personT').text(data.schoolName); | |||
$('.perSemester').text(data.semester); | |||
$('.perSemester').text(data.Semester); | |||
$('.perFestivalsBox table').html(html); | |||
function flogs(num, data, obj) { | |||
@@ -70,7 +70,7 @@ var bootstrap = function ($, learun) { | |||
for (var k = 1; k < 8; k++) { | |||
(function (arg) { | |||
var args = arg - 1; | |||
var datas = flogs2(arg, lists, 'day'); | |||
var datas = flogs2(arg, lists, 'Day'); | |||
if (datas.length > 0) { | |||
html += '<td class="active">'; | |||
$.each(datas, function (i, item) { | |||
@@ -78,16 +78,16 @@ var bootstrap = function ($, learun) { | |||
html += '<hr>'; | |||
} | |||
html += "<div class='box' data-val='" + JSON.stringify(item) + "'><div>课程:" + | |||
item.curriculum + | |||
item.Curriculum + | |||
"</div>" + | |||
"<div>教师:" + | |||
item.teacher + | |||
item.Teacher + | |||
"</div>" + | |||
"<div>班级:" + | |||
item.className + | |||
item.ClassName + | |||
"</div>" + | |||
"<div>教室:" + | |||
item.classRoom + | |||
item.ClassRoom + | |||
"</div></div>"; | |||
}); | |||
html += '</td>'; | |||
@@ -160,11 +160,32 @@ var bootstrap = function ($, learun) { | |||
//点击课程表内容 | |||
$('.perFestivalsBox').on('click', 'td.active div.box', function () { | |||
var box = $(this); | |||
//$('.perFestivalsBox').find('div.box.active').removeClass('active'); | |||
if (box[0].className.indexOf('active') >= 0) { | |||
box.removeClass('active'); | |||
var choosedata = JSON.parse(box[0].getAttribute('data-val')); | |||
$('.perFestivalsBox').find('div.box.active').removeClass('active'); | |||
if ($('#ClassNo').lrselectGet() == '' && $('#EmpNo').lrselectGet() == '') { | |||
learun.alert.warning("请选择班级或者教师!"); | |||
} else { | |||
box.addClass('active'); | |||
//{"AltId":"5b52c7e8-d5f5-4d54-a859-1544b7d62bf6","day":"2","lessonTime":"23","lessonDate":"2024-03-05","schooldId":"207fa1a9-160c-4943-a89b-8fa4db0547ce","academicyear":"23-24","semester":"2","deptNo":"01","deptname":"","majorNo":"GZ13","lessonNo":"GZ1302006","curriculum":"编舞技法基础","teachClassNo":"G2201010303","className":"22高职男班(舞蹈表演)","empno":"5516","teacher":"董东洋","classRoomNo":"1008","classRoom":"教学楼008","lessonSortNo":"1"} | |||
//(1)合班课判断逻辑:同一时间、同一教室、相同教师(1个或多个)、多个班级学生 即为合班课 | |||
//(2)选择课程安排可以将所属合班课程同时勾选,教学调度系统流程只需发起一次即可 | |||
for (var i = 0; i < box.parent()[0].children.length; i++) { | |||
if (box.parent()[0].children[i].getAttribute('class')) { | |||
if (box.parent()[0].children[i].getAttribute('class').indexOf('box') >= 0) { | |||
console.log(box.parent()[0].children[i].getAttribute('data-val')) | |||
var item = box.parent()[0].children[i]; | |||
var itemdata = JSON.parse(item.getAttribute('data-val')); | |||
if (choosedata.ClassRoomNo == itemdata.ClassRoomNo) { | |||
item.setAttribute('class', 'box active') | |||
} | |||
} | |||
} | |||
} | |||
//if (box[0].className.indexOf('active') >= 0) { | |||
// box.removeClass('active'); | |||
//} else { | |||
// box.addClass('active'); | |||
//} | |||
} | |||
}); | |||
}, | |||
@@ -170,6 +170,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// </summary> | |||
[Column("PROCESSID")] | |||
public string ProcessId { get; set; } | |||
/// <summary> | |||
/// Details | |||
/// </summary> | |||
[Column("DETAILS")] | |||
public string Details { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||