diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermAttemperController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermAttemperController.cs index bd3c7f444..3c52846bc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermAttemperController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermAttemperController.cs @@ -139,55 +139,108 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers [AjaxOnly] public ActionResult SaveForm(string keyValue, string strEntity) { + //[{"AttemperId":"3ec8df23-c045-428c-b37c-c370b73f53ef","Day":"5","LessonTime":"53","LessonDate":"2024-03-08","SchooldId":"207fa1a9-160c-4943-a89b-8fa4db0547ce","Academicyear":"23-24","Semester":"2","DeptNo":"01","Deptname":"","MajorNo":"GZ13","LessonNo":"GZ1303001","Curriculum":"爵士舞","TeachClassNo":"G2201010303","ClassName":"22高职男班(舞蹈表演)","Empno":"2224","Teacher":"魏志勇","ClassRoomNo":"3102","ClassRoom":"舞蹈楼102","LessonSortNo":"1"},{"AttemperId":"e4970ebb-1af5-4298-b03c-f8014e1adb06","Day":"5","LessonTime":"53","LessonDate":"2024-03-08","SchooldId":"207fa1a9-160c-4943-a89b-8fa4db0547ce","Academicyear":"23-24","Semester":"2","DeptNo":"01","Deptname":"","MajorNo":"GZ13","LessonNo":"GZ1302005","Curriculum":"中国古典舞身韵","TeachClassNo":"G2201010303","ClassName":"22高职男班(舞蹈表演)","Empno":"5526","Teacher":"焦晓天","ClassRoomNo":"3102","ClassRoom":"舞蹈楼102","LessonSortNo":"1"}] + //"CreateUserId":"System","CreateUserName":"超级管理员","CreateTime":"2024-06-25 13:14:35","AttemperType":"02","AttemperTimeType":"","NewAcademicYearNo":"","NewSemester":"","NewDeptNo":"","NewMajorNo":"","NewLessonNo":"","NewTeachClassNo":"","NewEmpNo":"","NewClassroomNo":"","AttemperStartTime":"","AttemperEndTime":"","AttemperRemark":"22" + JObject jo = (JObject)JsonConvert.DeserializeObject(strEntity); ArrangeLessonTermAttemperEntity entity = strEntity.ToObject(); - if (entity.AttemperType == "03") + + 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 query = new List(); - 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 query = new List(); + // 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 + + foreach (var item in jo["query"]) + { + ArrangeLessonTermAttemperEntity itementity = new ArrangeLessonTermAttemperEntity(); + itementity.CreateUserId = entity.CreateUserId; + itementity.CreateUserName = entity.CreateUserName; + itementity.CreateTime = entity.CreateTime; + itementity.AttemperRemark = entity.AttemperRemark; + itementity.AttemperType = entity.AttemperType;//调课类型 + + itementity.NewAcademicYearNo= entity.NewAcademicYearNo; + itementity.NewSemester = entity.NewSemester; + itementity.NewDeptNo = entity.NewDeptNo; + itementity.NewMajorNo = entity.NewMajorNo; + itementity.NewLessonNo = entity.NewLessonNo; + itementity.NewTeachClassNo = entity.NewTeachClassNo; + itementity.NewEmpNo = entity.NewEmpNo; + itementity.NewClassroomNo = entity.NewClassroomNo; + itementity.AcademicYearNo = item["Academicyear"].ToString(); + itementity.Semester = item["Semester"].ToString(); + itementity.DeptNo = item["DeptNo"].ToString(); + itementity.MajorNo = item["MajorNo"].ToString(); + itementity.LessonNo = item["LessonNo"].ToString(); + itementity.TeachClassNo = item["TeachClassNo"].ToString(); + itementity.EmpNo = item["Empno"].ToString(); + itementity.ClassroomNo = item["ClassRoomNo"].ToString(); - entity.Status = 0; - entity.CheckStatus = 0; - arrangeLessonTermAttemperIBLL.SaveEntity(keyValue, entity); + itementity.AttemperTimeType = entity.AttemperTimeType;//调度时限 + + itementity.AttemperStartTime = entity.AttemperStartTime; + itementity.AttemperEndTime = entity.AttemperEndTime; + + itementity.Status = 0; + itementity.CheckStatus = 0; + arrangeLessonTermAttemperIBLL.SaveEntity(keyValue, itementity); + } return Success("保存成功!"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/Form.cshtml index ae5169a3c..4e180d61a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/Form.cshtml @@ -57,7 +57,7 @@
校区*
*@ -
+
@*
学年*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/Form.js index c97154fb2..b9c35e54d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/Form.js @@ -210,10 +210,34 @@ var bootstrap = function ($, learun) { }); $('#TeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' }); $('#NewTeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' }); - $('#EmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' }); - $('#NewEmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' }); - $('#ClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' }); - $('#NewClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' }); + $('#EmpNo').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData', + value: 'value', + text: 'text' + }); + //$('#EmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' }); + //$('#NewEmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' }); + $('#NewEmpNo').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData', + value: 'value', + text: 'text' + }); + //$('#ClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' }); + $('#ClassroomNo').lrselect({ + allowSearch: true, + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo', + value: 'classroomno', + text: 'classroomname' + }); + //$('#NewClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' }); + $('#NewClassroomNo').lrselect({ + allowSearch: true, + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo', + value: 'classroomno', + text: 'classroomname' + }); //调度开始时间 $('#AttemperStartTime').lrselect({ allowSearch: true }); //调度结束时间 @@ -324,10 +348,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 +364,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 +377,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', @@ -364,9 +388,9 @@ 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 +403,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 +416,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', @@ -477,14 +501,14 @@ var bootstrap = function ($, learun) { bindDataNew = function (temprow) { if (!!temprow) { //$('#NewF_SchoolId').lrselectSet(temprow.schooldId); - $('#NewAcademicYearNo').lrselectSet(temprow.academicyear); - $('#NewSemester').lrselectSet(temprow.semester); - $('#NewDeptNo').lrselectSet(temprow.deptNo); - $('#NewMajorNo').lrselectSet(temprow.majorNo); - $('#NewLessonNo').lrselectSet(temprow.lessonNo); - $('#NewTeachClassNo').lrselectSet(temprow.teachClassNo); - $('#NewEmpNo').lrselectSet(temprow.empno); - $('#NewClassroomNo').lrselectSet(temprow.classRoomNo); + $('#NewAcademicYearNo').lrselectSet(temprow[0].Academicyear); + $('#NewSemester').lrselectSet(temprow[0].Semester); + $('#NewDeptNo').lrselectSet(temprow[0].DeptNo); + $('#NewMajorNo').lrselectSet(temprow[0].MajorNo); + $('#NewLessonNo').lrselectSet(temprow[0].LessonNo); + $('#NewTeachClassNo').lrselectSet(temprow[0].TeachClassNo); + $('#NewEmpNo').lrselectSet(temprow[0].Empno); + $('#NewClassroomNo').lrselectSet(temprow[0].ClassRoomNo); } }; // 验证数据是否填写完整 @@ -572,28 +596,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 +628,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(); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/FormView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/FormView.cshtml index b53f159d8..d25f1ff28 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/FormView.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTermAttemper/FormView.cshtml @@ -60,8 +60,10 @@
校区*
*@ -
-
+
+ +
+ @*
学年*
@@ -92,7 +94,7 @@
教室*
-
+
*@