feat(dal,aihitloader): Создали таблицы схемы Units и сервисы к ним.
This commit is contained in:
@@ -9,6 +9,7 @@ WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.AIHITLoaderWorker/PARR.AIHITLoaderWorker.csproj", "PARR.AIHITLoaderWorker/"]
|
||||
COPY ["PARR.AIHITLoader/PARR.AIHITLoader.csproj", "PARR.AIHITLoader/"]
|
||||
COPY ["PARR.AIHITLoader/PARR.AIHITMainLoader.csproj", "PARR.AIHITMainLoader/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
RUN dotnet restore "./PARR.AIHITLoaderWorker/./PARR.AIHITLoaderWorker.csproj"
|
||||
|
||||
@@ -19,5 +19,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.AIHITLoader\PARR.AIHITLoader.csproj" />
|
||||
<ProjectReference Include="..\PARR.AIHITMainLoader\PARR.AIHITMainLoader.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
9
PARR.AIHITMainLoader/PARR.AIHITMainLoader.csproj
Normal file
9
PARR.AIHITMainLoader/PARR.AIHITMainLoader.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -82,6 +82,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.JobAutoControl", "PARR
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.Common", "PARR.Common\PARR.Common.csproj", "{5C89E990-6E49-4897-8344-1AC3ECFBD869}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITMainLoader", "PARR.AIHITMainLoader\PARR.AIHITMainLoader.csproj", "{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -226,6 +228,10 @@ Global
|
||||
{5C89E990-6E49-4897-8344-1AC3ECFBD869}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5C89E990-6E49-4897-8344-1AC3ECFBD869}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5C89E990-6E49-4897-8344-1AC3ECFBD869}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
18
PARR.BLL/Domain/Mq/AihitMainDataMq.cs
Normal file
18
PARR.BLL/Domain/Mq/AihitMainDataMq.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace PARR.BLL.Domain.Mq
|
||||
{
|
||||
/// <summary>
|
||||
/// Модель в MQ, данные из АИХИТ для любой ХП
|
||||
/// </summary>
|
||||
public class AihitMainDataMq
|
||||
{
|
||||
/// <summary>
|
||||
/// ЭК
|
||||
/// </summary>
|
||||
public required string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Список полей ЭК, в формате - имя поля / значение
|
||||
/// </summary>
|
||||
public Dictionary<string, string> Properties { get; set; } = new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Models.Unit;
|
||||
|
||||
namespace PARR.DAL.Context
|
||||
{
|
||||
@@ -64,6 +64,22 @@ namespace PARR.DAL.Context
|
||||
|
||||
public DbSet<ParrComponent> ParrComponents { get; set; }
|
||||
|
||||
#region Units
|
||||
|
||||
public DbSet<Unit> Units { get; set; }
|
||||
|
||||
public DbSet<UnitField> UnitFields { get; set; }
|
||||
|
||||
public DbSet<UnitFieldValue> UnitFieldValues { get; set; }
|
||||
|
||||
public DbSet<UnitInField> UnitInFields { get; set; }
|
||||
|
||||
public DbSet<UnitInValue> UnitInValues { get; set; }
|
||||
|
||||
public DbSet<UnitFieldInUnitFieldValue> UnitFieldInUnitFieldValues { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
11
PARR.DAL/Context/DataContextSettings.cs
Normal file
11
PARR.DAL/Context/DataContextSettings.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace PARR.DAL.Context
|
||||
{
|
||||
internal static class DataContextSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Хранение ЭК с компонентным составом, РГ, Типы, С/н, ip, отвтетственные (не пишем шаблоны, расписания)
|
||||
/// </summary>
|
||||
public const string Unit = "unit";
|
||||
|
||||
}
|
||||
}
|
||||
3486
PARR.DAL/Migrations/20250514051030_units.Designer.cs
generated
Normal file
3486
PARR.DAL/Migrations/20250514051030_units.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
239
PARR.DAL/Migrations/20250514051030_units.cs
Normal file
239
PARR.DAL/Migrations/20250514051030_units.cs
Normal file
@@ -0,0 +1,239 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class units : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "unit");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Fields",
|
||||
schema: "unit",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
AihitName = table.Column<string>(type: "text", nullable: false),
|
||||
EsppName = table.Column<string>(type: "text", nullable: true),
|
||||
DisplayName = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Fields", x => x.Id);
|
||||
},
|
||||
comment: "Справочник полей ЭК");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "FieldValues",
|
||||
schema: "unit",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_FieldValues", x => x.Id);
|
||||
},
|
||||
comment: "Значения полей ЭК");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Units",
|
||||
schema: "unit",
|
||||
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),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Units", x => x.Id);
|
||||
},
|
||||
comment: "Таблица с ЭК");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "FieldInFieldValues",
|
||||
schema: "unit",
|
||||
columns: table => new
|
||||
{
|
||||
FieldId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FieldValueId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_FieldInFieldValues", x => new { x.FieldId, x.FieldValueId });
|
||||
table.ForeignKey(
|
||||
name: "FK_FieldInFieldValues_FieldValues_FieldValueId",
|
||||
column: x => x.FieldValueId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "FieldValues",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_FieldInFieldValues_Fields_FieldId",
|
||||
column: x => x.FieldId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "Fields",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "Значения полей ЭК");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UnitInFields",
|
||||
schema: "unit",
|
||||
columns: table => new
|
||||
{
|
||||
UnitId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FieldId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UnitInFields", x => new { x.UnitId, x.FieldId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UnitInFields_Fields_FieldId",
|
||||
column: x => x.FieldId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "Fields",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UnitInFields_Units_UnitId",
|
||||
column: x => x.UnitId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "Units",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "Справочник полей ЭК");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UnitInValues",
|
||||
schema: "unit",
|
||||
columns: table => new
|
||||
{
|
||||
UnitId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FieldId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
VlaueId = 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)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UnitInValues", x => new { x.UnitId, x.FieldId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UnitInValues_FieldValues_VlaueId",
|
||||
column: x => x.VlaueId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "FieldValues",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UnitInValues_Fields_FieldId",
|
||||
column: x => x.FieldId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "Fields",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UnitInValues_Units_UnitId",
|
||||
column: x => x.UnitId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "Units",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "Таблица связи ЭК с полями и со значениями");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FieldInFieldValues_FieldValueId",
|
||||
schema: "unit",
|
||||
table: "FieldInFieldValues",
|
||||
column: "FieldValueId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Fields_AihitName",
|
||||
schema: "unit",
|
||||
table: "Fields",
|
||||
column: "AihitName");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Fields_EsppName",
|
||||
schema: "unit",
|
||||
table: "Fields",
|
||||
column: "EsppName");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FieldValues_Value",
|
||||
schema: "unit",
|
||||
table: "FieldValues",
|
||||
column: "Value");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UnitInFields_FieldId",
|
||||
schema: "unit",
|
||||
table: "UnitInFields",
|
||||
column: "FieldId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UnitInValues_FieldId",
|
||||
schema: "unit",
|
||||
table: "UnitInValues",
|
||||
column: "FieldId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UnitInValues_VlaueId",
|
||||
schema: "unit",
|
||||
table: "UnitInValues",
|
||||
column: "VlaueId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Units_Name",
|
||||
schema: "unit",
|
||||
table: "Units",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "FieldInFieldValues",
|
||||
schema: "unit");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UnitInFields",
|
||||
schema: "unit");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UnitInValues",
|
||||
schema: "unit");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "FieldValues",
|
||||
schema: "unit");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Fields",
|
||||
schema: "unit");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Units",
|
||||
schema: "unit");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2528,6 +2528,157 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("Tnks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", 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<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Units", "unit", t =>
|
||||
{
|
||||
t.HasComment("Таблица с ЭК");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AihitName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EsppName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AihitName");
|
||||
|
||||
b.HasIndex("EsppName");
|
||||
|
||||
b.ToTable("Fields", "unit", t =>
|
||||
{
|
||||
t.HasComment("Справочник полей ЭК");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldInUnitFieldValue", b =>
|
||||
{
|
||||
b.Property<Guid>("FieldId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("FieldValueId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("FieldId", "FieldValueId");
|
||||
|
||||
b.HasIndex("FieldValueId");
|
||||
|
||||
b.ToTable("FieldInFieldValues", "unit", t =>
|
||||
{
|
||||
t.HasComment("Значения полей ЭК");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldValue", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Value");
|
||||
|
||||
b.ToTable("FieldValues", "unit", t =>
|
||||
{
|
||||
t.HasComment("Значения полей ЭК");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInField", b =>
|
||||
{
|
||||
b.Property<Guid>("UnitId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("FieldId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("UnitId", "FieldId");
|
||||
|
||||
b.HasIndex("FieldId");
|
||||
|
||||
b.ToTable("UnitInFields", "unit", t =>
|
||||
{
|
||||
t.HasComment("Справочник полей ЭК");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b =>
|
||||
{
|
||||
b.Property<Guid>("UnitId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("FieldId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("VlaueId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UnitId", "FieldId");
|
||||
|
||||
b.HasIndex("FieldId");
|
||||
|
||||
b.HasIndex("VlaueId");
|
||||
|
||||
b.ToTable("UnitInValues", "unit", t =>
|
||||
{
|
||||
t.HasComment("Таблица связи ЭК с полями и со значениями");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -3023,6 +3174,71 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("Subprocess");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldInUnitFieldValue", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field")
|
||||
.WithMany("FieldValues")
|
||||
.HasForeignKey("FieldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Unit.UnitFieldValue", "FieldValue")
|
||||
.WithMany("FieldValues")
|
||||
.HasForeignKey("FieldValueId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Field");
|
||||
|
||||
b.Navigation("FieldValue");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInField", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Unit.UnitField", "UnitField")
|
||||
.WithMany("Units")
|
||||
.HasForeignKey("FieldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit")
|
||||
.WithMany("UnitFields")
|
||||
.HasForeignKey("UnitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Unit");
|
||||
|
||||
b.Navigation("UnitField");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field")
|
||||
.WithMany("UnitInValues")
|
||||
.HasForeignKey("FieldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit")
|
||||
.WithMany("UnitInValues")
|
||||
.HasForeignKey("UnitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Unit.UnitFieldValue", "Value")
|
||||
.WithMany("UnitInValues")
|
||||
.HasForeignKey("VlaueId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Field");
|
||||
|
||||
b.Navigation("Unit");
|
||||
|
||||
b.Navigation("Value");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Role", "Role")
|
||||
@@ -3222,6 +3438,29 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("Works");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b =>
|
||||
{
|
||||
b.Navigation("UnitFields");
|
||||
|
||||
b.Navigation("UnitInValues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b =>
|
||||
{
|
||||
b.Navigation("FieldValues");
|
||||
|
||||
b.Navigation("UnitInValues");
|
||||
|
||||
b.Navigation("Units");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldValue", b =>
|
||||
{
|
||||
b.Navigation("FieldValues");
|
||||
|
||||
b.Navigation("UnitInValues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Roles");
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
namespace PARR.DAL.Models.Base
|
||||
{
|
||||
public interface IBase
|
||||
public interface IBase: IBaseDateCreated, IBaseDateModified
|
||||
{
|
||||
Guid Id { get; set; }
|
||||
|
||||
DateTimeOffset DateCreated { get; set; }
|
||||
//DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
DateTimeOffset? DateModified { get; set; }
|
||||
//DateTimeOffset? DateModified { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
7
PARR.DAL/Models/Base/IBaseDateCreated.cs
Normal file
7
PARR.DAL/Models/Base/IBaseDateCreated.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace PARR.DAL.Models.Base
|
||||
{
|
||||
public interface IBaseDateCreated
|
||||
{
|
||||
DateTimeOffset DateCreated { get; set; }
|
||||
}
|
||||
}
|
||||
7
PARR.DAL/Models/Base/IBaseDateModified.cs
Normal file
7
PARR.DAL/Models/Base/IBaseDateModified.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace PARR.DAL.Models.Base
|
||||
{
|
||||
public interface IBaseDateModified
|
||||
{
|
||||
DateTimeOffset? DateModified { get; set; }
|
||||
}
|
||||
}
|
||||
35
PARR.DAL/Models/Unit/Unit.cs
Normal file
35
PARR.DAL/Models/Unit/Unit.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
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.Unit
|
||||
{
|
||||
[Table("Units", Schema = DataContextSettings.Unit)]
|
||||
[Comment("Таблица с ЭК")]
|
||||
[Index(nameof(Name), IsUnique = true)]
|
||||
public class Unit : IBase
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ЭК
|
||||
/// </summary>
|
||||
public required string Name { get; set; }
|
||||
|
||||
//статус ЭК
|
||||
|
||||
// todo: добавить еще поля??? (которые есть у всех ЭК)
|
||||
|
||||
|
||||
public ICollection<UnitInField> UnitFields { get; set; } = new HashSet<UnitInField>();
|
||||
|
||||
public ICollection<UnitInValue> UnitInValues { get; set; } = new HashSet<UnitInValue>();
|
||||
}
|
||||
}
|
||||
53
PARR.DAL/Models/Unit/UnitField.cs
Normal file
53
PARR.DAL/Models/Unit/UnitField.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
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.Unit
|
||||
{
|
||||
/// <summary>
|
||||
/// Справочник полей ЭК (компонентный состав, ответствтвенные, любые поля)
|
||||
/// </summary>
|
||||
[Table("Fields", Schema = DataContextSettings.Unit)]
|
||||
[Comment("Справочник полей ЭК")]
|
||||
[Index(nameof(AihitName))]
|
||||
[Index(nameof(EsppName))]
|
||||
public class UnitField : IBase
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Имя поля в АИХ ИТ, заполняется при синхронизации
|
||||
/// </summary>
|
||||
public required string AihitName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Название поля в ЕСПП, возможно в дальнейшем для синхронизации
|
||||
/// </summary>
|
||||
public string? EsppName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Название поля для отображения в ГУИ
|
||||
/// </summary>
|
||||
public string? DisplayName { get; set; }
|
||||
|
||||
|
||||
|
||||
public ICollection<UnitInField> Units { get; set; } = new HashSet<UnitInField>();
|
||||
|
||||
public ICollection<UnitInValue> UnitInValues { get; set; } = new HashSet<UnitInValue>();
|
||||
|
||||
|
||||
public ICollection<UnitFieldInUnitFieldValue> FieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
|
||||
|
||||
}
|
||||
}
|
||||
28
PARR.DAL/Models/Unit/UnitFieldInUnitFieldValue.cs
Normal file
28
PARR.DAL/Models/Unit/UnitFieldInUnitFieldValue.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models.Unit
|
||||
{
|
||||
[Table("FieldInFieldValues", Schema = DataContextSettings.Unit)]
|
||||
[Comment("Значения полей ЭК")]
|
||||
[PrimaryKey(nameof(FieldId), nameof(FieldValueId))]
|
||||
public class UnitFieldInUnitFieldValue : IBaseDateCreated
|
||||
{
|
||||
public Guid FieldId { get; set; }
|
||||
|
||||
public Guid FieldValueId { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
|
||||
|
||||
[ForeignKey(nameof(FieldId))]
|
||||
public UnitField? Field { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(FieldValueId))]
|
||||
public UnitFieldValue? FieldValue { get; set; }
|
||||
}
|
||||
}
|
||||
29
PARR.DAL/Models/Unit/UnitFieldValue.cs
Normal file
29
PARR.DAL/Models/Unit/UnitFieldValue.cs
Normal 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.Unit
|
||||
{
|
||||
[Table("FieldValues", Schema = DataContextSettings.Unit)]
|
||||
[Comment("Значения полей ЭК")]
|
||||
[Index(nameof(Value))]
|
||||
public class UnitFieldValue : IBase
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
|
||||
public string? Value { get; set; }
|
||||
|
||||
|
||||
public ICollection<UnitInValue> UnitInValues { get; set; } = new HashSet<UnitInValue>();
|
||||
|
||||
public ICollection<UnitFieldInUnitFieldValue> FieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
|
||||
}
|
||||
}
|
||||
29
PARR.DAL/Models/Unit/UnitInField.cs
Normal file
29
PARR.DAL/Models/Unit/UnitInField.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Context;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models.Unit
|
||||
{
|
||||
/// <summary>
|
||||
/// Связь Unit in Field
|
||||
/// </summary>
|
||||
///
|
||||
[Table("UnitInFields", Schema = DataContextSettings.Unit)]
|
||||
[Comment("Справочник полей ЭК")]
|
||||
[PrimaryKey(nameof(UnitId), nameof(FieldId))]
|
||||
public class UnitInField
|
||||
{
|
||||
public Guid UnitId { get; set; }
|
||||
|
||||
public Guid FieldId { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(UnitId))]
|
||||
public Unit? Unit { get; set; }
|
||||
|
||||
[ForeignKey(nameof(FieldId))]
|
||||
public UnitField? UnitField { get; set; }
|
||||
}
|
||||
}
|
||||
34
PARR.DAL/Models/Unit/UnitInValue.cs
Normal file
34
PARR.DAL/Models/Unit/UnitInValue.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models.Unit
|
||||
{
|
||||
|
||||
[Table("UnitInValues", Schema = DataContextSettings.Unit)]
|
||||
[Comment("Таблица связи ЭК с полями и со значениями")]
|
||||
[PrimaryKey(nameof(UnitId), nameof(FieldId))]
|
||||
public class UnitInValue : IBaseDateModified, IBaseDateCreated
|
||||
{
|
||||
public Guid UnitId { get; set; }
|
||||
|
||||
public Guid FieldId { get; set; }
|
||||
|
||||
public Guid VlaueId { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(UnitId))]
|
||||
public Unit? Unit { get; set; }
|
||||
|
||||
[ForeignKey(nameof(FieldId))]
|
||||
public UnitField? Field { get; set; }
|
||||
|
||||
[ForeignKey(nameof(VlaueId))]
|
||||
public UnitFieldValue? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,9 @@ using PARR.DAL.Contracts;
|
||||
using PARR.DAL.InfluxDbServices;
|
||||
using PARR.DAL.Services.Implementation;
|
||||
using PARR.DAL.Services.Implementations;
|
||||
using PARR.DAL.Services.Implementations.Unit;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.DAL.Settings;
|
||||
using PARR.DAL.TransformServices;
|
||||
|
||||
@@ -89,6 +91,14 @@ namespace PARR.DAL
|
||||
services.AddTransient<ITemplateHistoryService, TemplateHistoryService>();
|
||||
services.AddTransient<IParrComponentService, ParrComponentService>();
|
||||
|
||||
#region Unit
|
||||
|
||||
services.AddTransient<IUnitService, UnitService>();
|
||||
services.AddTransient<IUnitFieldValueService, UnitFieldValueService>();
|
||||
services.AddTransient<IUnitFieldService, UnitFieldService>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
// TransformServices
|
||||
services.AddTransient<IEsppScheduleTransformService, EsppScheduleTransformService>();
|
||||
|
||||
@@ -100,8 +100,11 @@ namespace PARR.DAL.Services.Abstracts
|
||||
/// <param name="obj"></param>
|
||||
private void DateModifiedResolver(EntityEntry obj)
|
||||
{
|
||||
if (obj.Entity is IBase)
|
||||
(obj.Entity as IBase)!.DateModified = DateTimeOffset.UtcNow;
|
||||
//if (obj.Entity is IBase)
|
||||
// (obj.Entity as IBase)!.DateModified = DateTimeOffset.UtcNow;
|
||||
|
||||
if (obj.Entity is IBaseDateModified)
|
||||
(obj.Entity as IBaseDateModified)!.DateModified = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
23
PARR.DAL/Services/Implementations/Unit/UnitFieldService.cs
Normal file
23
PARR.DAL/Services/Implementations/Unit/UnitFieldService.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
internal class UnitFieldService : BaseService<UnitField>, IUnitFieldService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
|
||||
protected override DbSet<UnitField> EntitySet => dataContext.UnitFields;
|
||||
|
||||
protected override DataContext EntitiContext => dataContext;
|
||||
|
||||
public UnitFieldService(DataContext dataContext, ILogger<UnitFieldService> logger) : base(logger)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
internal class UnitFieldValueService : BaseService<UnitFieldValue>, IUnitFieldValueService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
|
||||
protected override DbSet<UnitFieldValue> EntitySet => dataContext.UnitFieldValues;
|
||||
|
||||
protected override DataContext EntitiContext => dataContext;
|
||||
|
||||
public UnitFieldValueService(DataContext dataContext, ILogger<UnitFieldValueService> logger) : base(logger)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
PARR.DAL/Services/Implementations/Unit/UnitService.cs
Normal file
22
PARR.DAL/Services/Implementations/Unit/UnitService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
internal class UnitService : BaseService<Models.Unit.Unit>, IUnitService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
|
||||
protected override DbSet<Models.Unit.Unit> EntitySet => dataContext.Units;
|
||||
|
||||
protected override DataContext EntitiContext => dataContext;
|
||||
|
||||
public UnitService(DataContext dataContext, ILogger<UnitService> logger) : base(logger)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
PARR.DAL/Services/Interfaces/Unit/IUnitFieldService.cs
Normal file
9
PARR.DAL/Services/Interfaces/Unit/IUnitFieldService.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Unit
|
||||
{
|
||||
public interface IUnitFieldService: IBaseService<UnitField>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Unit
|
||||
{
|
||||
internal interface IUnitFieldValueService: IBaseService<UnitFieldValue>
|
||||
{
|
||||
}
|
||||
}
|
||||
8
PARR.DAL/Services/Interfaces/Unit/IUnitService.cs
Normal file
8
PARR.DAL/Services/Interfaces/Unit/IUnitService.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Unit
|
||||
{
|
||||
public interface IUnitService : IBaseService<Models.Unit.Unit>
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user