feat(dal): Добавлена таблица Groups для возможности группировки Job

This commit is contained in:
Mikhail Kuznetsov
2025-06-11 11:14:27 +10:00
parent 0d08794636
commit 230dfd6f85
13 changed files with 8226 additions and 40 deletions

View File

@@ -89,7 +89,7 @@ namespace PARR.DAL.Context
public DbSet<Job> Jobs { get; set; } public DbSet<Job> Jobs { get; set; }
public DbSet<JobDetails> JobDetails { get; set; } public DbSet<JobUnitFilter> JobDetails { get; set; }
#endregion #endregion

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,298 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class JobsUpdateAddJobGroupTbl : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_FieldFilters_JobDetails_JobDetailsId",
schema: "job",
table: "FieldFilters");
migrationBuilder.DropTable(
name: "JobDetails",
schema: "job");
migrationBuilder.DropColumn(
name: "IsUmbrella",
schema: "job",
table: "Jobs");
migrationBuilder.RenameColumn(
name: "JobDetailsId",
schema: "job",
table: "FieldFilters",
newName: "UnitFilterId");
migrationBuilder.RenameIndex(
name: "IX_FieldFilters_JobDetailsId",
schema: "job",
table: "FieldFilters",
newName: "IX_FieldFilters_UnitFilterId");
migrationBuilder.AddColumn<Guid>(
name: "JobId",
table: "Templates",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "UnitId",
table: "Templates",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "GroupId",
schema: "job",
table: "Jobs",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<string>(
name: "WorkName",
schema: "job",
table: "Jobs",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "Groups",
schema: "job",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
GroupName = table.Column<string>(type: "text", nullable: false),
IsUmbrella = table.Column<bool>(type: "boolean", nullable: true),
ShortDescription = table.Column<string>(type: "text", nullable: false),
FullDescription = table.Column<string>(type: "text", nullable: false),
Solution = table.Column<string>(type: "text", nullable: false),
Duration = table.Column<string>(type: "text", nullable: false),
ReferenceDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Groups", x => x.Id);
},
comment: "Таблица описания групп работ, для реализации зонтиков");
migrationBuilder.CreateTable(
name: "JobUnitFilters",
schema: "job",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
UnitFilter = table.Column<string>(type: "text", nullable: false),
JobId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobUnitFilters", x => x.Id);
table.ForeignKey(
name: "FK_JobUnitFilters_Jobs_JobId",
column: x => x.JobId,
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП");
migrationBuilder.CreateIndex(
name: "IX_Templates_JobId",
table: "Templates",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_Templates_UnitId",
table: "Templates",
column: "UnitId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_GroupId",
schema: "job",
table: "Jobs",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_JobUnitFilters_JobId",
schema: "job",
table: "JobUnitFilters",
column: "JobId");
migrationBuilder.AddForeignKey(
name: "FK_FieldFilters_JobUnitFilters_UnitFilterId",
schema: "job",
table: "FieldFilters",
column: "UnitFilterId",
principalSchema: "job",
principalTable: "JobUnitFilters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Jobs_Groups_GroupId",
schema: "job",
table: "Jobs",
column: "GroupId",
principalSchema: "job",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Templates_Jobs_JobId",
table: "Templates",
column: "JobId",
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Templates_Units_UnitId",
table: "Templates",
column: "UnitId",
principalSchema: "unit",
principalTable: "Units",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_FieldFilters_JobUnitFilters_UnitFilterId",
schema: "job",
table: "FieldFilters");
migrationBuilder.DropForeignKey(
name: "FK_Jobs_Groups_GroupId",
schema: "job",
table: "Jobs");
migrationBuilder.DropForeignKey(
name: "FK_Templates_Jobs_JobId",
table: "Templates");
migrationBuilder.DropForeignKey(
name: "FK_Templates_Units_UnitId",
table: "Templates");
migrationBuilder.DropTable(
name: "Groups",
schema: "job");
migrationBuilder.DropTable(
name: "JobUnitFilters",
schema: "job");
migrationBuilder.DropIndex(
name: "IX_Templates_JobId",
table: "Templates");
migrationBuilder.DropIndex(
name: "IX_Templates_UnitId",
table: "Templates");
migrationBuilder.DropIndex(
name: "IX_Jobs_GroupId",
schema: "job",
table: "Jobs");
migrationBuilder.DropColumn(
name: "JobId",
table: "Templates");
migrationBuilder.DropColumn(
name: "UnitId",
table: "Templates");
migrationBuilder.DropColumn(
name: "GroupId",
schema: "job",
table: "Jobs");
migrationBuilder.DropColumn(
name: "WorkName",
schema: "job",
table: "Jobs");
migrationBuilder.RenameColumn(
name: "UnitFilterId",
schema: "job",
table: "FieldFilters",
newName: "JobDetailsId");
migrationBuilder.RenameIndex(
name: "IX_FieldFilters_UnitFilterId",
schema: "job",
table: "FieldFilters",
newName: "IX_FieldFilters_JobDetailsId");
migrationBuilder.AddColumn<bool>(
name: "IsUmbrella",
schema: "job",
table: "Jobs",
type: "boolean",
nullable: true);
migrationBuilder.CreateTable(
name: "JobDetails",
schema: "job",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
JobId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Duration = table.Column<string>(type: "text", nullable: false),
FullDescription = table.Column<string>(type: "text", nullable: false),
ReferenceDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
ShortDescription = table.Column<string>(type: "text", nullable: false),
Solution = table.Column<string>(type: "text", nullable: false),
UnitFilter = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobDetails", x => x.Id);
table.ForeignKey(
name: "FK_JobDetails_Jobs_JobId",
column: x => x.JobId,
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП");
migrationBuilder.CreateIndex(
name: "IX_JobDetails_JobId",
schema: "job",
table: "JobDetails",
column: "JobId");
migrationBuilder.AddForeignKey(
name: "FK_FieldFilters_JobDetails_JobDetailsId",
schema: "job",
table: "FieldFilters",
column: "JobDetailsId",
principalSchema: "job",
principalTable: "JobDetails",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,211 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class JobsUpdateMOCKData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_FieldFilters_JobUnitFilters_UnitFilterId",
schema: "job",
table: "FieldFilters");
migrationBuilder.DropForeignKey(
name: "FK_JobUnitFilters_Jobs_JobId",
schema: "job",
table: "JobUnitFilters");
migrationBuilder.DropForeignKey(
name: "FK_Templates_Jobs_JobId",
table: "Templates");
migrationBuilder.DropForeignKey(
name: "FK_Templates_Units_UnitId",
table: "Templates");
migrationBuilder.DropPrimaryKey(
name: "PK_JobUnitFilters",
schema: "job",
table: "JobUnitFilters");
migrationBuilder.RenameTable(
name: "JobUnitFilters",
schema: "job",
newName: "UnitFilters",
newSchema: "job");
migrationBuilder.RenameIndex(
name: "IX_JobUnitFilters_JobId",
schema: "job",
table: "UnitFilters",
newName: "IX_UnitFilters_JobId");
migrationBuilder.AlterColumn<Guid>(
name: "UnitId",
table: "Templates",
type: "uuid",
nullable: false,
defaultValue: new Guid("b4dfd71a-2b2f-414f-8409-4b9abd9c4d2c"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "JobId",
table: "Templates",
type: "uuid",
nullable: false,
defaultValue: new Guid("ba05948b-b040-48cc-ab77-0accc9c223a0"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_UnitFilters",
schema: "job",
table: "UnitFilters",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FieldFilters_UnitFilters_UnitFilterId",
schema: "job",
table: "FieldFilters",
column: "UnitFilterId",
principalSchema: "job",
principalTable: "UnitFilters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Templates_Jobs_JobId",
table: "Templates",
column: "JobId",
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Templates_Units_UnitId",
table: "Templates",
column: "UnitId",
principalSchema: "unit",
principalTable: "Units",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UnitFilters_Jobs_JobId",
schema: "job",
table: "UnitFilters",
column: "JobId",
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_FieldFilters_UnitFilters_UnitFilterId",
schema: "job",
table: "FieldFilters");
migrationBuilder.DropForeignKey(
name: "FK_Templates_Jobs_JobId",
table: "Templates");
migrationBuilder.DropForeignKey(
name: "FK_Templates_Units_UnitId",
table: "Templates");
migrationBuilder.DropForeignKey(
name: "FK_UnitFilters_Jobs_JobId",
schema: "job",
table: "UnitFilters");
migrationBuilder.DropPrimaryKey(
name: "PK_UnitFilters",
schema: "job",
table: "UnitFilters");
migrationBuilder.RenameTable(
name: "UnitFilters",
schema: "job",
newName: "JobUnitFilters",
newSchema: "job");
migrationBuilder.RenameIndex(
name: "IX_UnitFilters_JobId",
schema: "job",
table: "JobUnitFilters",
newName: "IX_JobUnitFilters_JobId");
migrationBuilder.AlterColumn<Guid>(
name: "UnitId",
table: "Templates",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AlterColumn<Guid>(
name: "JobId",
table: "Templates",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddPrimaryKey(
name: "PK_JobUnitFilters",
schema: "job",
table: "JobUnitFilters",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FieldFilters_JobUnitFilters_UnitFilterId",
schema: "job",
table: "FieldFilters",
column: "UnitFilterId",
principalSchema: "job",
principalTable: "JobUnitFilters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_JobUnitFilters_Jobs_JobId",
schema: "job",
table: "JobUnitFilters",
column: "JobId",
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Templates_Jobs_JobId",
table: "Templates",
column: "JobId",
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Templates_Units_UnitId",
table: "Templates",
column: "UnitId",
principalSchema: "unit",
principalTable: "Units",
principalColumn: "Id");
}
}
}

View File

@@ -1557,7 +1557,7 @@ namespace PARR.DAL.Migrations
b.Property<Guid>("FieldId") b.Property<Guid>("FieldId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<Guid>("JobDetailsId") b.Property<Guid>("UnitFilterId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ValueMask") b.Property<string>("ValueMask")
@@ -1568,7 +1568,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("FieldId"); b.HasIndex("FieldId");
b.HasIndex("JobDetailsId"); b.HasIndex("UnitFilterId");
b.ToTable("FieldFilters", "job", t => b.ToTable("FieldFilters", "job", t =>
{ {
@@ -1588,8 +1588,8 @@ namespace PARR.DAL.Migrations
b.Property<DateTimeOffset?>("DateModified") b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
b.Property<bool?>("IsUmbrella") b.Property<Guid>("GroupId")
.HasColumnType("boolean"); .HasColumnType("uuid");
b.Property<int?>("MaxValueRelationships") b.Property<int?>("MaxValueRelationships")
.HasColumnType("integer"); .HasColumnType("integer");
@@ -1607,8 +1607,14 @@ namespace PARR.DAL.Migrations
b.Property<Guid>("TnkId") b.Property<Guid>("TnkId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("WorkName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("GroupId");
b.HasIndex("TnkId"); b.HasIndex("TnkId");
b.ToTable("Jobs", "job", t => b.ToTable("Jobs", "job", t =>
@@ -1617,7 +1623,7 @@ namespace PARR.DAL.Migrations
}); });
}); });
modelBuilder.Entity("PARR.DAL.Models.Job.JobDetails", b => modelBuilder.Entity("PARR.DAL.Models.Job.JobGroup", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -1637,8 +1643,12 @@ namespace PARR.DAL.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("JobId") b.Property<string>("GroupName")
.HasColumnType("uuid"); .IsRequired()
.HasColumnType("text");
b.Property<bool?>("IsUmbrella")
.HasColumnType("boolean");
b.Property<DateTimeOffset>("ReferenceDate") b.Property<DateTimeOffset>("ReferenceDate")
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
@@ -1651,6 +1661,29 @@ namespace PARR.DAL.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id");
b.ToTable("Groups", "job", t =>
{
t.HasComment("Таблица описания групп работ, для реализации зонтиков");
});
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<string>("UnitFilter") b.Property<string>("UnitFilter")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@@ -1659,7 +1692,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("JobId"); b.HasIndex("JobId");
b.ToTable("JobDetails", "job", t => b.ToTable("UnitFilters", "job", t =>
{ {
t.HasComment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП"); t.HasComment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП");
}); });
@@ -2547,6 +2580,9 @@ namespace PARR.DAL.Migrations
b.Property<bool>("IsActiveTemplate") b.Property<bool>("IsActiveTemplate")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("LastRun") b.Property<DateTimeOffset?>("LastRun")
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
@@ -2560,15 +2596,22 @@ namespace PARR.DAL.Migrations
b.Property<string>("ScheduleEsppId") b.Property<string>("ScheduleEsppId")
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("UnitId")
.HasColumnType("uuid");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApplicationInWorkId"); b.HasIndex("ApplicationInWorkId");
b.HasIndex("HostId"); b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("Name") b.HasIndex("Name")
.IsUnique(); .IsUnique();
b.HasIndex("UnitId");
b.ToTable("Templates"); b.ToTable("Templates");
}); });
@@ -3152,32 +3195,40 @@ namespace PARR.DAL.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("PARR.DAL.Models.Job.JobDetails", "JobDetails") b.HasOne("PARR.DAL.Models.Job.JobUnitFilter", "UnitFilter")
.WithMany("fieldFilters") .WithMany("fieldFilters")
.HasForeignKey("JobDetailsId") .HasForeignKey("UnitFilterId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Field"); b.Navigation("Field");
b.Navigation("JobDetails"); b.Navigation("UnitFilter");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b => modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
{ {
b.HasOne("PARR.DAL.Models.Job.JobGroup", "Group")
.WithMany("Job")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Tnk", "Tnk") b.HasOne("PARR.DAL.Models.Tnk", "Tnk")
.WithMany() .WithMany()
.HasForeignKey("TnkId") .HasForeignKey("TnkId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Group");
b.Navigation("Tnk"); b.Navigation("Tnk");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job.JobDetails", b => modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b =>
{ {
b.HasOne("PARR.DAL.Models.Job.Job", "Job") b.HasOne("PARR.DAL.Models.Job.Job", "Job")
.WithMany("JobDetails") .WithMany("UnitFilters")
.HasForeignKey("JobId") .HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@@ -3336,9 +3387,25 @@ namespace PARR.DAL.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("PARR.DAL.Models.Job.Job", "Job")
.WithMany()
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit")
.WithMany()
.HasForeignKey("UnitId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationsInWork"); b.Navigation("ApplicationsInWork");
b.Navigation("Host"); b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Unit");
}); });
modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b => modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b =>
@@ -3564,10 +3631,15 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b => modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
{ {
b.Navigation("JobDetails"); b.Navigation("UnitFilters");
}); });
modelBuilder.Entity("PARR.DAL.Models.Job.JobDetails", b => modelBuilder.Entity("PARR.DAL.Models.Job.JobGroup", b =>
{
b.Navigation("Job");
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b =>
{ {
b.Navigation("fieldFilters"); b.Navigation("fieldFilters");
}); });

View File

@@ -18,7 +18,7 @@ namespace PARR.DAL.Models.Job
public DateTimeOffset? DateModified { get; set; } public DateTimeOffset? DateModified { get; set; }
public Guid JobDetailsId { get; set; } public Guid UnitFilterId { get; set; }
public Guid FieldId { get; set; } public Guid FieldId { get; set; }
@@ -28,7 +28,7 @@ namespace PARR.DAL.Models.Job
[ForeignKey(nameof(FieldId))] [ForeignKey(nameof(FieldId))]
public UnitField? Field { get; set; } public UnitField? Field { get; set; }
[ForeignKey(nameof(JobDetailsId))] [ForeignKey(nameof(UnitFilterId))]
public JobDetails? JobDetails { get; set; } public JobUnitFilter? UnitFilter { get; set; }
} }
} }

View File

@@ -18,14 +18,15 @@ namespace PARR.DAL.Models.Job
public DateTimeOffset? DateModified { get; set; } public DateTimeOffset? DateModified { get; set; }
/// <summary> /// <summary>
/// Наименование работ /// Наименование работ для интерфеса в ПАРР
/// </summary> /// </summary>
public required string Name { get; set; } public required string Name { get; set; }
/// <summary> /// <summary>
/// Связана ли работа с групповыми ЭК(зонтами) /// Наименование работ для поля Работа в шаблоне АСУ ЕСПП, может быть динамическое
/// </summary> /// </summary>
public bool? IsUmbrella { get; set; } public required string WorkName { get; set; }
/// <summary> /// <summary>
/// Минимальное значение дочерних связей группового ЭК /// Минимальное значение дочерних связей группового ЭК
@@ -44,9 +45,16 @@ namespace PARR.DAL.Models.Job
public Guid TnkId { get; set; } public Guid TnkId { get; set; }
public Guid GroupId { get; set; }
[ForeignKey(nameof(GroupId))]
public JobGroup? Group { get; set; }
[ForeignKey(nameof(TnkId))] [ForeignKey(nameof(TnkId))]
public Tnk? Tnk { get; set; } public Tnk? Tnk { get; set; }
public ICollection<JobDetails> JobDetails { get; set; }= new HashSet<JobDetails>();
public ICollection<JobUnitFilter> UnitFilters { get; set; }= new HashSet<JobUnitFilter>();
} }
} }

View File

@@ -6,9 +6,9 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job namespace PARR.DAL.Models.Job
{ {
[Table("JobDetails", Schema = DataContextSettings.Job)] [Table("Groups", Schema = DataContextSettings.Job)]
[Comment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП")] [Comment("Таблица описания групп работ, для реализации зонтиков")]
public class JobDetails : IBase public class JobGroup : IBase
{ {
[Key] [Key]
public Guid Id { get; set; } public Guid Id { get; set; }
@@ -16,9 +16,16 @@ namespace PARR.DAL.Models.Job
public DateTimeOffset DateCreated { get; set; } public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; } public DateTimeOffset? DateModified { get; set; }
public required string UnitFilter { get; set; }
public Guid JobId { get; set; } /// <summary>
/// Наименование работ для интерфеса в ПАРР
/// </summary>
public required string GroupName { get; set; }
/// <summary>
/// Связана ли работа с групповыми ЭК(зонтами)
/// </summary>
public bool? IsUmbrella { get; set; }
/// <summary> /// <summary>
/// Поле Короткое описания шаблона АСУ ЕСПП /// Поле Короткое описания шаблона АСУ ЕСПП
@@ -46,9 +53,6 @@ namespace PARR.DAL.Models.Job
public DateTimeOffset ReferenceDate { get; set; } public DateTimeOffset ReferenceDate { get; set; }
[ForeignKey(nameof(JobId))] public ICollection<Job> Job { get; set; } = new HashSet<Job>();
public Job? Job { get; set; }
public ICollection<FieldFilter> fieldFilters { get; set; } = new HashSet<FieldFilter>();
} }
} }

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("UnitFilters", Schema = DataContextSettings.Job)]
[Comment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП")]
public class JobUnitFilter : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string UnitFilter { get; set; }
public Guid JobId { get; set; }
[ForeignKey(nameof(JobId))]
public Job? Job { get; set; }
public ICollection<FieldFilter> fieldFilters { get; set; } = new HashSet<FieldFilter>();
}
}

View File

@@ -4,6 +4,7 @@ using PARR.Constants;
using PARR.DAL.Models.Base; using PARR.DAL.Models.Base;
using PARR.DAL.Models.Base.History; using PARR.DAL.Models.Base.History;
using PARR.DAL.Models.Base.History.Base; using PARR.DAL.Models.Base.History.Base;
using PARR.DAL.Models.Job;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
@@ -49,6 +50,11 @@ namespace PARR.DAL.Models
public Guid ApplicationInWorkId { get; set; } public Guid ApplicationInWorkId { get; set; }
public Guid JobId { get; set; }//TODO Вернуть не NULL!!!
public Guid UnitId { get; set; }//TODO Вернуть не NULL!!!
public Guid HostId { get; set; }
#region Initiator #region Initiator
public string? InitiatorIp { get; set; } public string? InitiatorIp { get; set; }
@@ -61,20 +67,22 @@ namespace PARR.DAL.Models
[ForeignKey(nameof(ApplicationInWorkId))] [ForeignKey(nameof(ApplicationInWorkId))]
public ApplicationsInWork? ApplicationsInWork { get; set; } public ApplicationsInWork? ApplicationsInWork { get; set; }
public Guid HostId { get; set; }
[ForeignKey(nameof(HostId))] [ForeignKey(nameof(HostId))]
public Host? Host { get; set; } public Host? Host { get; set; }
[ForeignKey(nameof(JobId))]
public Job.Job? Job { get; set; }
[ForeignKey(nameof(UnitId))]
public Unit.Unit? Unit { get; set; }
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>(); public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
public ICollection<AgentHistory> AgentHistories { get; set; } = new HashSet<AgentHistory>(); public ICollection<AgentHistory> AgentHistories { get; set; } = new HashSet<AgentHistory>();
public ICollection<Order> Orders { get; set; } = new HashSet<Order>(); public ICollection<Order> Orders { get; set; } = new HashSet<Order>();
public ICollection<TemplateHistory> TemplateHistories { get; set; } = new HashSet<TemplateHistory>(); public ICollection<TemplateHistory> TemplateHistories { get; set; } = new HashSet<TemplateHistory>();
} }
} }

View File

@@ -7,11 +7,11 @@ using PARR.DAL.Services.Interfaces.Job;
namespace PARR.DAL.Services.Implementations.Job namespace PARR.DAL.Services.Implementations.Job
{ {
internal class JobDetailsService : BaseService<Models.Job.JobDetails>, IJobDetailsService internal class JobDetailsService : BaseService<Models.Job.JobUnitFilter>, IJobDetailsService
{ {
private readonly DataContext dataContext; private readonly DataContext dataContext;
protected override DbSet<JobDetails> EntitySet => dataContext.JobDetails; protected override DbSet<JobUnitFilter> EntitySet => dataContext.JobDetails;
protected override DataContext EntitiContext => dataContext; protected override DataContext EntitiContext => dataContext;

View File

@@ -2,7 +2,7 @@
namespace PARR.DAL.Services.Interfaces.Job namespace PARR.DAL.Services.Interfaces.Job
{ {
public interface IJobDetailsService : IBaseService<Models.Job.JobDetails> public interface IJobDetailsService : IBaseService<Models.Job.JobUnitFilter>
{ {
} }
} }