fix(dal): из таблицы JobGroup удалено поле IsUmbrella

This commit is contained in:
Mikhail Trubnikov
2025-11-25 12:26:24 +10:00
parent 1aabd3a844
commit ce12f1b5fe
6 changed files with 4013 additions and 18 deletions

View File

@@ -78,7 +78,7 @@ namespace PARR.API.Controllers.V1
{
query = query
.Include(t => t.Tnk)
.Include(t => t.Group).ThenInclude(t=>t.GroupType);
.Include(t => t.Group).ThenInclude(t => t.GroupType);
query = query
.Include(t => t.UnitFilters)
@@ -117,7 +117,7 @@ namespace PARR.API.Controllers.V1
{
var job = await jobService.Get()
.Include(t => t.Tnk)
.Include(t => t.Group).ThenInclude(t=>t.GroupType)
.Include(t => t.Group).ThenInclude(t => t.GroupType)
.Include(t => t.UnitFilters)
.ThenInclude(t => t.FieldFilters)
.ThenInclude(t => t.UnitField)
@@ -158,12 +158,15 @@ namespace PARR.API.Controllers.V1
#region Проверка существования работы с такими же параметрами
var isExistTheSameLinks = await jobService.Get()
.Include(t => t.Group).ThenInclude(t => t.GroupType)
.CountAsync(t =>
t.Group!.IsUmbrella == true &&
//t.Group!.IsUmbrella == true &&
t.Group!.GroupType!.Code == JobGroupTypesEnum.Umbrella &&
t.GroupId == request.GroupId &&
(t.MinValueRelationships == request.MinValueRelationships ||
t.MaxValueRelationships == request.MaxValueRelationships)
);
);
if (isExistTheSameLinks > 0)
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { FieldName = nameof(request.Name), Message = $"Работа с указанным диапазоном связей пересекается с уже имеющейся в базе данных({request.MinValueRelationships}-{request.MaxValueRelationships})" } }));
#endregion
@@ -178,7 +181,7 @@ namespace PARR.API.Controllers.V1
var createdJob = await jobService.Get()
.Include(t => t.Tnk)
.Include(t => t.Group).ThenInclude(t=>t.GroupType)
.Include(t => t.Group).ThenInclude(t => t.GroupType)
.Include(t => t.UnitFilters)
.ThenInclude(t => t.FieldFilters)
.ThenInclude(t => t.UnitField)
@@ -211,7 +214,7 @@ namespace PARR.API.Controllers.V1
var orig = await jobService.Get()
.Include(t => t.Tnk)
.Include(t => t.Group).ThenInclude(t=>t.GroupType)
.Include(t => t.Group).ThenInclude(t => t.GroupType)
.Include(t => t.UnitFilters)
.ThenInclude(t => t.FieldFilters)
.Include(t => t.UnitFilters)

View File

@@ -234,7 +234,7 @@ namespace PARR.API.Controllers.V1
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = "Ошибка при изменении группы заданий на выполнение работ." } }));
logger.LogInformation($"Пользователь {User.Identity?.Name} обновил группу заданий на выполнение работ: {orig.Id}," +
$" {orig.GroupName}, {orig.IsUmbrella}, {orig.ShortDescription}, {orig.FullDescription}," +
$" {orig.GroupName}, {orig.ShortDescription}, {orig.FullDescription}," +
$" {orig.Solution}, {orig.TemplateDuration}, {orig.ReferenceDate}, {orig.IsAutoDistributionEnabled}" +
$", {orig.IsAgent}, {orig.AgentName}, {orig.AgentTimeOutSec}, {orig.AgentScript}");
@@ -299,10 +299,10 @@ namespace PARR.API.Controllers.V1
} }));
logger.LogInformation($"Пользователь {User.Identity?.Name} удалил группу заданий на выполнение работ: {jobGroup.Id},{jobGroup.GroupName}," +
$" {jobGroup.IsUmbrella}, {jobGroup.ShortDescription}, {jobGroup.FullDescription}," +
$" {jobGroup.Solution}, {jobGroup.TemplateDuration}, {jobGroup.ReferenceDate}" +
$"{jobGroup.IsAutoDistributionEnabled}, {jobGroup.IsAgent}, {jobGroup.AgentName}" +
$"{jobGroup.AgentTimeOutSec}, {jobGroup.AgentScript}");
$" {jobGroup.ShortDescription}, {jobGroup.FullDescription}," +
$" {jobGroup.Solution}, {jobGroup.TemplateDuration}, {jobGroup.ReferenceDate}," +
$" {jobGroup.IsAutoDistributionEnabled}, {jobGroup.IsAgent}, {jobGroup.AgentName}," +
$" {jobGroup.AgentTimeOutSec}, {jobGroup.AgentScript}");
return NoContent();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblGroupRemoveIsUmbrella : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsUmbrella",
schema: "job",
table: "Groups");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsUmbrella",
schema: "job",
table: "Groups",
type: "boolean",
nullable: true);
}
}
}

View File

@@ -1669,9 +1669,6 @@ namespace PARR.DAL.Migrations
b.Property<bool>("IsAutoDistributionEnabled")
.HasColumnType("boolean");
b.Property<bool?>("IsUmbrella")
.HasColumnType("boolean");
b.Property<DateTimeOffset>("ReferenceDate")
.HasColumnType("timestamp with time zone");

View File

@@ -23,10 +23,10 @@ namespace PARR.DAL.Models.Job
/// </summary>
public required string GroupName { get; set; }
/// <summary>
/// Связана ли работа с групповыми ЭК(зонтами)
/// </summary>
public bool? IsUmbrella { get; set; }
///// <summary>
///// Связана ли работа с групповыми ЭК(зонтами)
///// </summary>
//public bool? IsUmbrella { get; set; }
/// <summary>
/// Поле Короткое описания шаблона АСУ ЕСПП
@@ -89,6 +89,7 @@ namespace PARR.DAL.Models.Job
/// </summary>
public DateTimeOffset ReferenceDate { get; set; }
/// <summary>
/// Включить автораспределение
/// </summary>