教学任务按 授课周数 × 周学时 = 课程总学时 双端校验,不匹配会显示具体差额并阻止保存;公共课批量生成同样校验。

排课约束增加课程、教师、学院、授课方式、场地要求、约束状态筛选,并支持批量修改当前筛选结果。
新增“非排时课程”授课方式:不进入自动排课
不占星期、节次和教室
不阻塞课表发布
允许正常选课
在班级课表和学生个人课表中单独展示
This commit is contained in:
2026-07-25 08:18:25 +08:00 Unverified
parent 30c15f89e5
commit fe508054d0
20 changed files with 3785 additions and 136 deletions
@@ -23,8 +23,10 @@ public sealed class DevelopmentSqliteMigrator(
"20260724_14_scheduling_optimization";
private const string TeacherCourseApplicationsMigration =
"20260724_15_teacher_course_applications";
private const string AutomaticScheduleJobsMigration =
"20260724_16_automatic_schedule_jobs";
private const string AutomaticScheduleJobsMigration =
"20260724_16_automatic_schedule_jobs";
private const string TeachingTaskSchedulingModesMigration =
"20260725_17_teaching_task_scheduling_modes";
public async Task MigrateAsync(CancellationToken cancellationToken = default)
{
@@ -145,9 +147,21 @@ public sealed class DevelopmentSqliteMigrator(
WHERE type = 'table' AND name = 'AutomaticScheduleJobs'
""")
.AnyAsync(value => value > 0, cancellationToken);
await ApplyMigrationAsync(
AutomaticScheduleJobsMigration,
automaticScheduleJobsExist ? [] : AutomaticScheduleJobStatements,
cancellationToken);
var teachingTaskSchedulingModeExists = await db.Database
.SqlQueryRaw<int>(
"""
SELECT COUNT(*) AS "Value"
FROM pragma_table_info('TeachingTasks')
WHERE name = 'SchedulingMode'
""")
.AnyAsync(value => value > 0, cancellationToken);
await ApplyMigrationAsync(
AutomaticScheduleJobsMigration,
automaticScheduleJobsExist ? [] : AutomaticScheduleJobStatements,
TeachingTaskSchedulingModesMigration,
teachingTaskSchedulingModeExists ? [] : TeachingTaskSchedulingModeStatements,
cancellationToken);
}
@@ -384,8 +398,9 @@ public sealed class DevelopmentSqliteMigrator(
"Capacity" INTEGER NOT NULL,
"StartWeek" INTEGER NOT NULL,
"EndWeek" INTEGER NOT NULL,
"WeeklyHours" INTEGER NOT NULL,
"Status" INTEGER NOT NULL,
"WeeklyHours" INTEGER NOT NULL,
"SchedulingMode" INTEGER NOT NULL DEFAULT 1,
"Status" INTEGER NOT NULL,
"Notes" TEXT NULL,
"PublishedAt" TEXT NULL,
"CreatedAt" TEXT NOT NULL,
@@ -1081,4 +1096,12 @@ public sealed class DevelopmentSqliteMigrator(
ON "AutomaticScheduleJobs" ("RequestedByUserId");
"""
];
private static readonly string[] TeachingTaskSchedulingModeStatements =
[
"""
ALTER TABLE "TeachingTasks"
ADD COLUMN "SchedulingMode" INTEGER NOT NULL DEFAULT 1;
"""
];
}
@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
{
/// <inheritdoc />
public partial class TeachingTaskSchedulingModes : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "SchedulingMode",
table: "TeachingTasks",
type: "int",
nullable: false,
defaultValue: 1);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SchedulingMode",
table: "TeachingTasks");
}
}
}
@@ -1771,6 +1771,9 @@ namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
b.Property<DateTime?>("PublishedAt")
.HasColumnType("datetime(6)");
b.Property<int>("SchedulingMode")
.HasColumnType("int");
b.Property<int>("StartWeek")
.HasColumnType("int");