Browse Source

排课调整

临城职教中职
zhangli 2 years ago
parent
commit
33c61e654f
7 changed files with 249 additions and 75 deletions
  1. +14
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs
  2. +11
    -4
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTerm.cshtml
  3. +27
    -16
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTerm.js
  4. +13
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArgLessonTermUpdRecord/ArgLessonTermUpdRecordEntity.cs
  5. +4
    -4
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs
  6. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs
  7. +178
    -46
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs

+ 14
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs View File

@@ -245,6 +245,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
var semesterAndYear = Common.GetSemesterAndYear(startDate);
var strAcademicYear = semesterAndYear.AcademicYearLong;
var strSemester = semesterAndYear.Semester;
if (string.IsNullOrEmpty(classNo))
{
var res = new
{ schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = "" };
return JsonResult(res);
}

//校历
var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(semesterAndYear.AcademicYearShort, semesterAndYear.Semester);
@@ -344,9 +350,9 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult DeleteLessonTerm(string keyValue)
public ActionResult DeleteLessonTerm(string keyValue,string WeekTime)
{
arrangeLessonTermIBLL.DeleteLessonTerm(keyValue);
arrangeLessonTermIBLL.DeleteLessonTerm(keyValue, WeekTime);
return Success("删除成功!");
}
@@ -360,7 +366,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
public ActionResult UpdateLessonTerm(string keyValue,string postdata)
{
UpdateLessonTermEntity model = postdata.ToObject<UpdateLessonTermEntity>();
arrangeLessonTermIBLL.UpdateLessonTerm(keyValue, model);
var res=arrangeLessonTermIBLL.UpdateLessonTerm(keyValue, model);
if (!string.IsNullOrEmpty(res))
{
return Fail(res);
}

return Success("操作成功!");
}



+ 11
- 4
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTerm.cshtml View File

@@ -105,6 +105,12 @@
.radio {
margin-bottom: 0px;
}
.radio input[type=radio] {
margin-top: 8px;
}
.WeekTimes label {
padding-right: 5px;
}
.perWeek1 li {
width: 9%;
float: left;
@@ -130,6 +136,7 @@
}
.rightDiv .ebtn {
margin-top: 10px;
margin-left: 20px;
}
.perFestivalsBox td {
padding: 1px;
@@ -138,8 +145,8 @@
.WeekTimes {
text-align: left;
border: 1px solid #dfdfdf;
line-height: 25px;
height: 30px;
line-height: 30px;
/*height: 30px;*/
}

</style>
@@ -162,7 +169,7 @@
<div class="leftDiv">
@*<div class="perSemester"></div>*@
<div class="WeekTimes" id="WeekTimes">周次:</div>
<ul class="perWeek perWeek1">
@*<ul class="perWeek perWeek1">
<li>节次/星期</li>
<li>星期一</li>
<li>星期二</li>
@@ -174,7 +181,7 @@
<li>星期八</li>
<li>星期九</li>
<li>星期十</li>
</ul>
</ul>*@
<div class="perFestivalsBox">
<table id="lessonTermTable" cellspacing="0" border="0" style="width: 100%"></table>
</div>


+ 27
- 16
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTerm.js View File

@@ -13,7 +13,7 @@ var bootstrap = function ($, learun) {
function (data) {
//console.log('res', data);
// 数据处理
var html = '';
var html = '<tr style="height: 30px;"><td>节次/星期</td><td>星期一</td><td>星期二</td><td>星期三</td><td>星期四</td><td>星期五</td><td>星期六</td><td>星期日</td><td>星期八</td><td>星期九</td><td>星期十</td></tr>';
var weekLists = data.weekList;
//十节课
for (var i = 1; i < 11; i++) {
@@ -146,10 +146,14 @@ var bootstrap = function ($, learun) {
maxHeight: 300,
allowSearch: true,
type: 'multiple',
data: res.data.weekList,
//data: res.data.weekList,
value: 'value',
text: 'text'
});
$('#WeekTimeSelect').lrselectRefresh({
data: res.data.weekList
}
);
}

});
@@ -171,17 +175,23 @@ var bootstrap = function ($, learun) {
$('#LessonInfo').lrselectSet(res.data.LessonNo);
$('#EmpInfo').lrselectSet(res.data.EmpNo);
$('#ClassroomInfo').lrselectSet(res.data.ClassroomNo);
$('#edit').text('修改');
} else {
$('#LessonInfo').lrselectSet('');
$('#EmpInfo').lrselectSet('');
$('#ClassroomInfo').lrselectSet('');
$('#edit').text('新增');
}
});
} else {
$('#LessonInfo').lrselectSet('');
$('#EmpInfo').lrselectSet('');
$('#ClassroomInfo').lrselectSet('');
$('#edit').text('新增');
}
$('#WeekTimeSelect').lrselectRefresh({
data: weekList
});
$('#WeekTimeSelect').lrselectSet(curWeek);
$('#WeekSelect').lrselectSet($(this).attr('num'));
$('#NodeSelect').lrselectSet(($(this).closest("tr").find("td:eq(0)").text()).replace('节', ''));
@@ -196,13 +206,7 @@ var bootstrap = function ($, learun) {
if ($('#ALTId').val()) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/DeleteLessonTerm', { keyValue: $('#ALTId').val() }, function () {
$('#LessonInfo').lrselectSet('');
$('#EmpInfo').lrselectSet('');
$('#ClassroomInfo').lrselectSet('');
$('#WeekTimeSelect').lrselectSet('');
$('#WeekSelect').lrselectSet('');
$('#NodeSelect').lrselectSet('');
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/DeleteLessonTerm', { keyValue: $('#ALTId').val(), WeekTime: $('#WeekTimeSelect').lrselectGet() }, function () {
refreshGirdData();
});
}
@@ -211,6 +215,9 @@ var bootstrap = function ($, learun) {
});
//修改
$('#edit').on('click', function () {
if (classNo.length === 0 || classNo === 'undefined') {
return learun.alert.warning('请选择班级!');
}
learun.layerConfirm('是否确认修改该项!', function (res) {
if (res) {
var keyValue = $('#ALTId').val();
@@ -227,12 +234,6 @@ var bootstrap = function ($, learun) {
NodeSelect: $('#NodeSelect').lrselectGet()
};
learun.postForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/UpdateLessonTerm?keyValue=' + keyValue, { postdata: JSON.stringify(postdata) }, function () {
$('#LessonInfo').lrselectSet('');
$('#EmpInfo').lrselectSet('');
$('#ClassroomInfo').lrselectSet('');
$('#WeekTimeSelect').lrselectSet('');
$('#WeekSelect').lrselectSet('');
$('#NodeSelect').lrselectSet('');
refreshGirdData();
})};
});
@@ -339,8 +340,18 @@ search: function (param) {
//当前第几周
param.curWeek = curWeek;
//班级
param.classNo = '202010';//classNo;
param.classNo = classNo;//'202010';//
page.loadData(param);

$('#WeekTimeSelect').lrselectRefresh({
data: weekList
});
$('#LessonInfo').lrselectSet('');
$('#EmpInfo').lrselectSet('');
$('#ClassroomInfo').lrselectSet('');
$('#WeekTimeSelect').lrselectSet('');
$('#WeekSelect').lrselectSet('');
$('#NodeSelect').lrselectSet('');
}
};
refreshGirdData = function () {


+ 13
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArgLessonTermUpdRecord/ArgLessonTermUpdRecordEntity.cs View File

@@ -26,6 +26,19 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <returns></returns>
[Column("ALTID")]
public string ALTId { get; set; }
/// <summary>
/// 开课时间
/// </summary>
/// <returns></returns>
[Column("LESSONDATEOLD")]
public DateTime? LessonDateOld { get; set; }
/// <summary>
/// 开课时间
/// </summary>
/// <returns></returns>
[Column("LESSONDATENEW")]
public DateTime? LessonDateNew { get; set; }

/// <summary>
/// 原课程
/// </summary>


+ 4
- 4
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs View File

@@ -213,11 +213,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}

public void DeleteLessonTerm(string keyValue)
public void DeleteLessonTerm(string keyValue, string WeekTime)
{
try
{
arrangeLessonTermService.DeleteLessonTerm(keyValue);
arrangeLessonTermService.DeleteLessonTerm(keyValue,WeekTime);
}
catch (Exception ex)
{
@@ -256,11 +256,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}

public void UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model)
public string UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model)
{
try
{
arrangeLessonTermService.UpdateLessonTerm(keyValue, model);
return arrangeLessonTermService.UpdateLessonTerm(keyValue, model);
}
catch (Exception ex)
{


+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs View File

@@ -86,8 +86,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <summary>
/// <returns></returns>
void DeleteEntity(string keyValue);
void DeleteLessonTerm(string keyValue);
void UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model);
void DeleteLessonTerm(string keyValue,string WeekTime);
string UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model);
/// <summary>
/// 保存实体数据(新增、修改)
/// <param name="keyValue">主键</param>


+ 178
- 46
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs View File

@@ -201,30 +201,49 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// 删除课程
/// </summary>
/// <param name="keyValue"></param>
public void DeleteLessonTerm(string keyValue)
public void DeleteLessonTerm(string keyValue, string WeekTime)
{
var db = this.BaseRepository("CollegeMIS");
try
{
db.BeginTrans();
var entity = db.FindEntity<ArrangeLessonTermEntity>(keyValue);
//更改课程表标记
entity.CheckMark = "0";
entity.Modify(keyValue);
db.Update(entity);

//新增修改记录表
ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity();
record.Create();
record.ALTId = entity.ALTId;
record.LessonNoOld = entity.LessonNo;
record.LessonNoNew = "";
record.EmpNoOld = entity.EmpNo;
record.EmpNoNew = "";
record.ClassroomNoOld = entity.ClassroomNo;
record.ClassroomNoNew = "";
record.Remark = "删除";
db.Insert(record);

//周次

var weekTimeAry = WeekTime.Split(',');
foreach (var weekTime in weekTimeAry)
{
var weektime = Convert.ToInt32(weekTime);
var lessonDate = GetLessonDate(weektime, Convert.ToInt32(entity.LessonTime.Split('-')[0]));

var model =
db.FindEntity<ArrangeLessonTermEntity>(x =>
x.LessonDate == lessonDate && x.LessonTime == entity.LessonTime);

if (model != null)
{

//更改课程表标记
model.CheckMark = "0";
model.Modify(keyValue);
db.Update(model);

//新增修改记录表
ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity();
record.Create();
record.ALTId = model.ALTId;
record.LessonNoOld = model.LessonNo;
record.LessonNoNew = "";
record.EmpNoOld = model.EmpNo;
record.EmpNoNew = "";
record.ClassroomNoOld = model.ClassroomNo;
record.ClassroomNoNew = "";
record.Remark = "删除";
db.Insert(record);
}
}

db.Commit();
}
catch (Exception ex)
@@ -245,51 +264,115 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// 修改课程
/// </summary>
/// <param name="keyValue"></param>
public void UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model)
public string UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model)
{
var db = this.BaseRepository("CollegeMIS");
try
{
db.BeginTrans();
//开始时间
var startdate = DateTime.Today;
var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd");

var semesterAndYear = Common.GetSemesterAndYear(startDate);
//学校日历
var schoolCalendar = this.BaseRepository().FindEntity<SchoolCalendarEntity>(x =>
x.AcademicYearNo == semesterAndYear.AcademicYearShort && x.Semester == semesterAndYear.Semester);
//当前修改的课程数据
var ArrangeLessonTerm = db.FindEntity<ArrangeLessonTermEntity>(keyValue);
var LessonTimeOld = ArrangeLessonTerm?.LessonTime;
//周次
var weekTimeAry = model.WeekTimeSelect.Split(',');
foreach (var weekTime in weekTimeAry)
{
var weektime = Convert.ToInt32(weekTime);
//开课时间
DateTime lessonDate = DateTime.Now;
if (weektime == 1)
{
//第一周
lessonDate = Common.CalculateFirstDateOfWeek(schoolCalendar.StartTime.Value)
.AddDays(model.WeekSelect - 1);
}
else
{
var start= Common.CalculateFirstDateOfWeek(schoolCalendar.StartTime.Value).AddDays((Convert.ToInt32(weekTime) - 1) * 14);
lessonDate = start.AddDays(model.WeekSelect - 1);
}
var lessiontime = model.WeekSelect + "-" + model.NodeSelect;
//需要修改周次的开课时间
var lessonDate = GetLessonDate(weektime, Convert.ToInt32(LessonTimeOld?.Split('-')[0]));

//最后调整到
var lessonDateNew = GetLessonDate(weektime, model.WeekSelect);

#region old
//var lessonDate = GetLessonDate(weektime, model.WeekSelect);

//var lessiontime = model.WeekSelect + "-" + model.NodeSelect;
//var entity =
// db.FindEntity<ArrangeLessonTermEntity>(x =>
// x.LessonDate == lessonDate && x.LessonTime == lessiontime);
//if (entity == null)
//{
// //不存在 新增
// var classInfo = db.FindEntity<ClassInfoEntity>(x => x.ClassNo == model.TeachClassNo);

// entity = new ArrangeLessonTermEntity();
// entity.Create();
// entity.LessonDate = lessonDate;
// entity.AcademicYearNo = semesterAndYear.AcademicYearShort;
// entity.Semester = semesterAndYear.Semester;
// entity.LessonDate = lessonDate;

// entity.DeptNo = classInfo?.DeptNo;
// entity.MajorNo = classInfo?.MajorNo;

// entity.LessonNo = model.LessonNo;
// entity.LessonName = model.LessonName;
// entity.EmpNo = model.EmpNo;
// entity.EmpName = model.EmpName;
// entity.TeachClassNo = model.TeachClassNo;
// entity.ClassroomNo = model.ClassroomNo;
// entity.LessonTime = lessiontime;
// entity.CheckMark = "1";
// entity.F_SchoolId = LoginUserInfo.Get().companyId;
// db.Insert(entity);

// //新增修改记录表
// ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity();
// record.Create();
// record.ALTId = entity.ALTId;
// record.LessonNoOld = "";
// record.LessonNoNew = model.LessonNo;
// record.EmpNoOld = "";
// record.EmpNoNew = model.EmpNo;
// record.ClassroomNoOld = "";
// record.ClassroomNoNew = model.ClassroomNo;
// record.Remark = "新增";
// db.Insert(record);
//}
//else
//{
// //新增修改记录表
// ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity();
// record.Create();
// record.ALTId = entity.ALTId;
// record.LessonNoOld = entity.LessonNo;
// record.LessonNoNew = model.LessonNo;
// record.EmpNoOld = entity.EmpNo;
// record.EmpNoNew = model.EmpNo;
// record.ClassroomNoOld = entity.ClassroomNo;
// record.ClassroomNoNew = model.ClassroomNo;
// record.Remark = "修改";
// db.Insert(record);

// //存在 修改
// entity.TeachClassNo = model.TeachClassNo;
// entity.LessonNo = model.LessonNo;
// entity.LessonName = model.LessonName;
// entity.EmpNo = model.EmpNo;
// entity.EmpName = model.EmpName;
// entity.ClassroomNo = model.ClassroomNo;
// db.Update(entity);
//}
#endregion

var entity =
db.FindEntity<ArrangeLessonTermEntity>(x =>
x.LessonDate == lessonDate && x.LessonTime == lessiontime);
x.LessonDate == lessonDate && x.LessonTime == LessonTimeOld);
//当前星期-节次
var lessiontimeNow = model.WeekSelect + "-" + model.NodeSelect;
if (entity == null)
{
//不存在 新增
var startdate = DateTime.Today;
var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd");

var semesterAndYear = Common.GetSemesterAndYear(startDate);
var classInfo = db.FindEntity<ClassInfoEntity>(x => x.ClassNo == model.TeachClassNo);

entity = new ArrangeLessonTermEntity();
entity.Create();
entity.LessonDate = lessonDate;
entity.LessonDate = lessonDateNew;
entity.AcademicYearNo = semesterAndYear.AcademicYearShort;
entity.Semester = semesterAndYear.Semester;
entity.LessonDate = lessonDate;
@@ -303,7 +386,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
entity.EmpName = model.EmpName;
entity.TeachClassNo = model.TeachClassNo;
entity.ClassroomNo = model.ClassroomNo;
entity.LessonTime = lessiontime;
entity.LessonTime = lessiontimeNow;
entity.CheckMark = "1";
entity.F_SchoolId = LoginUserInfo.Get().companyId;
db.Insert(entity);
@@ -312,42 +395,59 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity();
record.Create();
record.ALTId = entity.ALTId;
record.LessonDateNew = lessonDateNew;
record.LessonNoOld = "";
record.LessonNoNew = model.LessonNo;
record.EmpNoOld = "";
record.EmpNoNew = model.EmpNo;
record.ClassroomNoOld = "";
record.ClassroomNoNew = model.ClassroomNo;
record.LessonTimeNew = lessiontimeNow;
record.Remark = "新增";
db.Insert(record);
}
else
{
//直接修改
//判断是否冲突(新时间是否存在课程)
if (db.FindList<ArrangeLessonTermEntity>(x =>
x.LessonDate == lessonDateNew && x.LessonTime == lessiontimeNow&&x.CheckMark=="1" && x.ALTId != keyValue).Count() > 0)
{
return "第" + weektime + "周当前课程冲突!";
}

//新增修改记录表
ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity();
record.Create();
record.ALTId = entity.ALTId;
record.LessonDateOld = entity.LessonDate;
record.LessonDateNew = lessonDateNew;
record.LessonNoOld = entity.LessonNo;
record.LessonNoNew = model.LessonNo;
record.EmpNoOld = entity.EmpNo;
record.EmpNoNew = model.EmpNo;
record.ClassroomNoOld = entity.ClassroomNo;
record.ClassroomNoNew = model.ClassroomNo;
record.LessonTimeOld = entity.LessonTime;
record.LessonTimeNew = lessiontimeNow;
record.Remark = "修改";
db.Insert(record);

//存在 修改
entity.LessonDate = lessonDateNew;
entity.TeachClassNo = model.TeachClassNo;
entity.LessonNo = model.LessonNo;
entity.LessonName = model.LessonName;
entity.EmpNo = model.EmpNo;
entity.EmpName = model.EmpName;
entity.ClassroomNo = model.ClassroomNo;
entity.LessonTime = lessiontimeNow;
db.Update(entity);
}
}
db.Commit();
return "";
}
catch (Exception ex)
{
@@ -362,6 +462,38 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}
/// <summary>
/// 获取开课时间
/// </summary>
/// <param name="weektime"></param>
/// <param name="WeekSelect"></param>
/// <returns></returns>
private DateTime GetLessonDate(int weektime, int WeekSelect)
{
//开课时间
DateTime lessonDate = DateTime.Now;
//开始时间
var startdate = DateTime.Today;
var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd");

var semesterAndYear = Common.GetSemesterAndYear(startDate);
//学校日历
var schoolCalendar = this.BaseRepository().FindEntity<SchoolCalendarEntity>(x =>
x.AcademicYearNo == semesterAndYear.AcademicYearShort && x.Semester == semesterAndYear.Semester);
if (weektime == 1)
{
//第一周
lessonDate = Common.CalculateFirstDateOfWeek(schoolCalendar.StartTime.Value)
.AddDays(WeekSelect - 1);
}
else
{
var start = Common.CalculateFirstDateOfWeek(schoolCalendar.StartTime.Value).AddDays((weektime - 1) * 14);
lessonDate = start.AddDays(WeekSelect - 1);
}

return lessonDate;
}

/// <summary>
/// 保存实体数据(新增、修改)


Loading…
Cancel
Save