feat(dal,aihitloader): Создали таблицы схемы Units и сервисы к ним.
This commit is contained in:
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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user