feat(dal): Создана таблица JobRelationshipFilter для хранения фильров атрибутов связей между ЭК
This commit is contained in:
@@ -95,6 +95,8 @@ namespace PARR.DAL.Context
|
||||
|
||||
public DbSet<JobGroup> JobGroups { get; set; }
|
||||
|
||||
public DbSet<JobRelationshipFilter> JobRelationshipFilters { get; set; }
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
3829
PARR.DAL/Migrations/20250801063927_tblJobRelationshipFiltersCreate.Designer.cs
generated
Normal file
3829
PARR.DAL/Migrations/20250801063927_tblJobRelationshipFiltersCreate.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblJobRelationshipFiltersCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RelationshipFilters",
|
||||
schema: "job",
|
||||
columns: table => new
|
||||
{
|
||||
UnitFilterId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FieldId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
IsParent = table.Column<bool>(type: "boolean", nullable: false),
|
||||
ValueMask = table.Column<string>(type: "text", nullable: false),
|
||||
IsFullMatch = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsInverse = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RelationshipFilters", x => new { x.UnitFilterId, x.FieldId });
|
||||
table.ForeignKey(
|
||||
name: "FK_RelationshipFilters_Fields_FieldId",
|
||||
column: x => x.FieldId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "Fields",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RelationshipFilters_UnitFilters_UnitFilterId",
|
||||
column: x => x.UnitFilterId,
|
||||
principalSchema: "job",
|
||||
principalTable: "UnitFilters",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "Таблица фильтров связей ЭК");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RelationshipFilters_FieldId",
|
||||
schema: "job",
|
||||
table: "RelationshipFilters",
|
||||
column: "FieldId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "RelationshipFilters",
|
||||
schema: "job");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1684,6 +1684,37 @@ namespace PARR.DAL.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job.JobRelationshipFilter", b =>
|
||||
{
|
||||
b.Property<Guid>("UnitFilterId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("FieldId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsFullMatch")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsInverse")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsParent")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ValueMask")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UnitFilterId", "FieldId");
|
||||
|
||||
b.HasIndex("FieldId");
|
||||
|
||||
b.ToTable("RelationshipFilters", "job", t =>
|
||||
{
|
||||
t.HasComment("Таблица фильтров связей ЭК");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -3207,7 +3238,7 @@ namespace PARR.DAL.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Job.JobUnitFilter", "UnitFilter")
|
||||
.WithMany("fieldFilters")
|
||||
.WithMany("FieldFilters")
|
||||
.HasForeignKey("UnitFilterId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@@ -3236,6 +3267,25 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("Tnk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job.JobRelationshipFilter", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Unit.UnitField", "UnitField")
|
||||
.WithMany("RelationshipFilters")
|
||||
.HasForeignKey("FieldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Job.JobUnitFilter", "UnitFilter")
|
||||
.WithMany("RelationshipFilters")
|
||||
.HasForeignKey("UnitFilterId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UnitField");
|
||||
|
||||
b.Navigation("UnitFilter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Job.Job", "Job")
|
||||
@@ -3387,7 +3437,7 @@ namespace PARR.DAL.Migrations
|
||||
modelBuilder.Entity("PARR.DAL.Models.Template", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Job.Job", "Job")
|
||||
.WithMany()
|
||||
.WithMany("Templates")
|
||||
.HasForeignKey("JobId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@@ -3620,6 +3670,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
|
||||
{
|
||||
b.Navigation("Templates");
|
||||
|
||||
b.Navigation("UnitFilters");
|
||||
});
|
||||
|
||||
@@ -3632,7 +3684,9 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b =>
|
||||
{
|
||||
b.Navigation("fieldFilters");
|
||||
b.Navigation("FieldFilters");
|
||||
|
||||
b.Navigation("RelationshipFilters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b =>
|
||||
@@ -3736,6 +3790,8 @@ namespace PARR.DAL.Migrations
|
||||
{
|
||||
b.Navigation("FieldValues");
|
||||
|
||||
b.Navigation("RelationshipFilters");
|
||||
|
||||
b.Navigation("UnitInValues");
|
||||
|
||||
b.Navigation("Units");
|
||||
|
||||
54
PARR.DAL/Models/Job/JobRelationshipFilter.cs
Normal file
54
PARR.DAL/Models/Job/JobRelationshipFilter.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models.Job
|
||||
{
|
||||
[Table("RelationshipFilters", Schema = DataContextSettings.Job)]
|
||||
[Comment("Таблица фильтров связей ЭК")]
|
||||
[PrimaryKey(nameof(UnitFilterId), nameof(FieldId))]
|
||||
public class JobRelationshipFilter //: IBase
|
||||
{
|
||||
//[Key]
|
||||
//public Guid Id { get; set; }
|
||||
|
||||
//public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
//public DateTimeOffset? DateModified { get; set; }
|
||||
|
||||
public Guid UnitFilterId { get; set; }
|
||||
/// <summary>
|
||||
/// Родительская связь - true,
|
||||
/// Дочерняя связь - false
|
||||
/// </summary>
|
||||
public bool IsParent { get; set; }
|
||||
|
||||
public Guid FieldId { get; set; }
|
||||
|
||||
public required string ValueMask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Полное совпадение или хотябы одно
|
||||
/// true - list.All()
|
||||
/// false - list.Any()
|
||||
/// </summary>
|
||||
public bool IsFullMatch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Обратный фильтр, что у связи нет таких значений
|
||||
/// </summary>
|
||||
public bool IsInverse { get; set; }
|
||||
|
||||
[ForeignKey(nameof(UnitFilterId))]
|
||||
public JobUnitFilter? UnitFilter { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(FieldId))]
|
||||
public UnitField? UnitField { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@ namespace PARR.DAL.Models.Job
|
||||
[ForeignKey(nameof(JobId))]
|
||||
public Job? Job { get; set; }
|
||||
|
||||
public ICollection<FieldFilter> fieldFilters { get; set; } = new HashSet<FieldFilter>();
|
||||
public ICollection<FieldFilter> FieldFilters { get; set; } = new HashSet<FieldFilter>();
|
||||
|
||||
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Base;
|
||||
using PARR.DAL.Models.Job;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -49,5 +50,6 @@ namespace PARR.DAL.Models.Unit
|
||||
|
||||
public ICollection<UnitFieldInUnitFieldValue> FieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
|
||||
|
||||
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace PARR.EsppScheduleSync
|
||||
/// <param name="template"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private EsppObjectSchedule ConvertDbObjToEsppObj(Template template)
|
||||
private async Task<EsppObjectSchedule> ConvertDbObjToEsppObj(Template template)
|
||||
{
|
||||
var esppObjectFromDb = new EsppObjectSchedule
|
||||
{
|
||||
@@ -102,7 +102,7 @@ namespace PARR.EsppScheduleSync
|
||||
};
|
||||
|
||||
FillScheduleFromDb(template, ref esppObjectFromDb);
|
||||
|
||||
await Task.Delay(1);//TODO Нет парни нет!!!
|
||||
return ClearOptionalFields(esppObjectFromDb);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user