实验课现在直接进入普通排课流程,不再要求先到实验排课模块逐个安排。

普通“添加排课”新增“理论课 / 实验课”类型。
自动排课会分别补足理论学时和实验学时。
实验课只能安排到实验室、实训室、机房、语音室等场地。
发布课表时分别校验理论、实验学时;任一未排足都不能发布。
普通课表及 Excel 导出会标注“实验课”。
历史排课保持不变,迁移后默认识别为理论课;后续新建或修订版本时再补充实验课。
This commit is contained in:
2026-08-02 16:54:41 +08:00 Unverified
parent 9d525826ce
commit f0f59419d5
22 changed files with 6488 additions and 266 deletions
@@ -16,10 +16,35 @@ public static class TeachingTaskHours
public static int TargetHours(
Course course,
TeachingTaskSchedulingMode schedulingMode) =>
schedulingMode == TeachingTaskSchedulingMode.Flexible
? course.TotalHours
course.TotalHours;
public static int TargetHours(Course course, ScheduleEntryKind kind) =>
kind == ScheduleEntryKind.Experiment
? Math.Max(0, course.PracticeHours)
: RegularScheduleHours(course);
public static int ScheduledHours(ScheduleEntry entry) =>
ScheduledHours(
entry.StartWeek,
entry.EndWeek,
entry.WeekPattern,
entry.PeriodCount);
public static int ScheduledHours(
int startWeek,
int endWeek,
WeekPattern weekPattern,
int periodCount)
{
if (endWeek < startWeek || periodCount <= 0) return 0;
var occurrences = Enumerable.Range(startWeek, endWeek - startWeek + 1)
.Count(week =>
weekPattern == WeekPattern.All ||
weekPattern == WeekPattern.Odd && week % 2 == 1 ||
weekPattern == WeekPattern.Even && week % 2 == 0);
return occurrences * periodCount;
}
public static bool TryResolveRegularWeeklyHours(
Course course,
int startWeek,
@@ -62,14 +87,8 @@ public static class TeachingTaskHours
if (schedulingMode == TeachingTaskSchedulingMode.Standard)
{
if (targetHours == 0)
{
return $"课程“{course.Name}”的 {course.TotalHours} 学时均为实践学时," +
"无需进入普通课表;请将授课方式设为“非排时课程”,并在实验管理中安排。";
}
return $"课程“{course.Name}”总学时为 {course.TotalHours},其中实践学时 " +
$"{course.PracticeHours},普通课表应安排 {targetHours} 学时;当前第 " +
$"{course.PracticeHours};理论课和实验课均应进入课表。当前第 " +
$"{startWeek}—{endWeek} 周、每周 {weeklyHours} 学时,共 " +
$"{plannedHours} 学时。请调整授课周次或周学时。";
}