From 87c8c84660f1322c4a0901b66dc9ab35fc391968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 9 Nov 2023 15:01:29 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Фикс неймингов свойств + удаление не используемых свойств 2. Правки запросов 3. Добавлена дата последнего редактирования в базовый класс редактируемых блоков 4. Добавлены проверки в тесты --- .../Data/DailyReport/Blocks/EditableBlock.cs | 7 + .../Blocks/Subsystems/SubsystemBlockDto.cs | 8 +- .../Blocks/TimeBalance/TimeBalanceBlockDto.cs | 2 +- .../WellOperation/WellOperationBlockDto.cs | 2 +- .../Report/ProcessMapReportWellDrillingDto.cs | 153 ++++++++---------- AsbCloudApp/Requests/TrajectoryFactRequest.cs | 2 +- .../Repository/DailyReportRepository.cs | 10 +- .../Repository/ScheduleRepository.cs | 6 +- .../Repository/TrajectoryFactRepository.cs | 4 +- .../DailyReport/DailyReportExportService.cs | 20 +-- .../DailyReport/DailyReportService.cs | 24 +-- ...ocessMapReportWellDrillingExportService.cs | 2 +- .../ProcessMapReportWellDrillingService.cs | 11 +- .../Services/DailyReportServiceTest.cs | 9 +- .../Controllers/DailyReportController.cs | 6 +- 15 files changed, 136 insertions(+), 130 deletions(-) diff --git a/AsbCloudApp/Data/DailyReport/Blocks/EditableBlock.cs b/AsbCloudApp/Data/DailyReport/Blocks/EditableBlock.cs index cafe5d33..98dd67c0 100644 --- a/AsbCloudApp/Data/DailyReport/Blocks/EditableBlock.cs +++ b/AsbCloudApp/Data/DailyReport/Blocks/EditableBlock.cs @@ -1,3 +1,5 @@ +using System; + namespace AsbCloudApp.Data.DailyReport.Blocks; /// @@ -9,4 +11,9 @@ public abstract class EditableBlock /// Id пользователя внесшего изменения в блок /// public int IdUser { get; set; } + + /// + /// Дата обновления блока + /// + public DateTime? DateLastUpdate { get; set; } } \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemBlockDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemBlockDto.cs index 1c7bf21f..21b5ea71 100644 --- a/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemBlockDto.cs +++ b/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemBlockDto.cs @@ -11,12 +11,12 @@ public class SubsystemBlockDto : EditableBlock /// /// Длина ствола скважины /// - public double? WellBoreDepth { get; set; } + public double? WellBore { get; set; } /// /// Кол-во замеров за сутки /// - public double? MeasurementsPerDaily { get; set; } + public double? MeasurementsPerDay { get; set; } /// /// Общая плановая мех. скорость @@ -29,7 +29,7 @@ public class SubsystemBlockDto : EditableBlock public string? Comment { get; set; } /// - /// Модули + /// Подсистемы /// - public IEnumerable Modules { get; set; } = Enumerable.Empty(); + public IEnumerable Subsystems { get; set; } = Enumerable.Empty(); } \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceBlockDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceBlockDto.cs index 79694283..74773f1c 100644 --- a/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceBlockDto.cs +++ b/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceBlockDto.cs @@ -33,7 +33,7 @@ public class TimeBalanceBlockDto : EditableBlock /// /// Кол-во наращиваний за сутки /// - public double? CountWellOperationSlipsTime { get; set; } + public double? WellOperationSlipsTimeCount { get; set; } /// /// Операции на скважине diff --git a/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationBlockDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationBlockDto.cs index 9e24997e..f12fd6f3 100644 --- a/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationBlockDto.cs +++ b/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationBlockDto.cs @@ -11,7 +11,7 @@ public class WellOperationBlockDto /// /// Продолжительность бурения за секцию /// - public double DurationHoursDrillingPerSection { get; set; } + public double SectionDrillingHours { get; set; } /// /// Операции проводимые на скважине diff --git a/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs b/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs index 59757c16..aba5593f 100644 --- a/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs @@ -7,105 +7,92 @@ namespace AsbCloudApp.Data.ProcessMaps.Report; /// public class ProcessMapReportWellDrillingDto { - /// - /// Идентификатор скважины - /// - public int IdWell { get; set; } - /// - /// Режим работы - /// 0 - ручной - /// 1 - ротор - /// 2 - слайд + /// Идентификатор скважины /// - public int? IdMode { get; set; } + public int IdWell { get; set; } /// - /// Id секции скважины - /// - public int IdWellSectionType { get; set; } + /// Id секции скважины + /// + public int IdWellSectionType { get; set; } - /// - /// Название секции скважины - /// - public string WellSectionTypeName { get; set; } = null!; + /// + /// Название секции скважины + /// + public string WellSectionTypeName { get; set; } = null!; - /// - /// Глубина по стволу от, м - /// - /// на начало интервала - /// - /// - public double DepthStart { get; set; } + /// + /// Глубина по стволу от, м + /// + /// на начало интервала + /// + /// + public double DepthStart { get; set; } - /// - /// Глубина по стволу до, м - /// - /// на конец интервала - /// - /// - public double DepthEnd { get; set; } + /// + /// Глубина по стволу до, м + /// + /// на конец интервала + /// + /// + public double DepthEnd { get; set; } - /// - /// Дата/ время - /// - /// на начало интервала - /// - /// - public DateTime DateStart { get; set; } + /// + /// Дата/ время + /// + /// на начало интервала + /// + /// + public DateTime DateStart { get; set; } - /// - /// Время мех бурения, ч - /// - public double MechDrillingHours { get; set; } + /// + /// Время мех бурения, ч + /// + public double MechDrillingHours { get; set; } - /// - /// Режим бурения (Ротор/слайд/ручной) - /// - public string DrillingMode { get; set; } = null!; + /// + /// Режим бурения (Ротор/слайд/ручной) + /// + public string DrillingMode { get; set; } = null!; - /// - /// Проходка, м - /// - public double? DeltaDepth { get; set; } + /// + /// Проходка, м + /// + public double? DeltaDepth { get; set; } - /// - /// Перепад давления, атм - /// - public ProcessMapReportWellDrillingParamsDto PressureDiff { get; set; } = new(); + /// + /// Перепад давления, атм + /// + public ProcessMapReportWellDrillingParamsDto PressureDiff { get; set; } = new(); - /// - /// Нагрузка, т - /// - public ProcessMapReportWellDrillingParamsDto AxialLoad { get; set; } = new(); + /// + /// Нагрузка, т + /// + public ProcessMapReportWellDrillingParamsDto AxialLoad { get; set; } = new(); - /// - /// Момент на ВСП, кНхМ - /// - public ProcessMapReportWellDrillingParamsDto TopDriveTorque { get; set; } = new(); + /// + /// Момент на ВСП, кНхМ + /// + public ProcessMapReportWellDrillingParamsDto TopDriveTorque { get; set; } = new(); - /// - /// Ограничение скорости, м/ч - /// - public ProcessMapReportWellDrillingParamsDto SpeedLimit { get; set; } = new(); + /// + /// Ограничение скорости, м/ч + /// + public ProcessMapReportWellDrillingParamsDto SpeedLimit { get; set; } = new(); - /// - /// Процент использования системы АПД план, % - /// - public double UsagePlan { get; set; } + /// + /// Процент использования системы АПД план, % + /// + public double UsagePlan { get; set; } - /// - /// Процент использования системы АПД факт, % - /// - public double UsageFact { get; set; } + /// + /// Процент использования системы АПД факт, % + /// + public double UsageFact { get; set; } - /// - /// Плановая механическая скорость, м/ч - /// - public double? RopPlan { get; set; } - - /// - /// Фактическая механическая скорость, м/ч - /// - public double? RopFact { get; set; } + /// + /// Механическая скорость, м/ч + /// + public PlanFactDto Rop { get; set; } } \ No newline at end of file diff --git a/AsbCloudApp/Requests/TrajectoryFactRequest.cs b/AsbCloudApp/Requests/TrajectoryFactRequest.cs index e1f72b72..c0169fd5 100644 --- a/AsbCloudApp/Requests/TrajectoryFactRequest.cs +++ b/AsbCloudApp/Requests/TrajectoryFactRequest.cs @@ -20,5 +20,5 @@ public class TrajectoryGeoFactRequest : RequestBase /// /// Меньше или равно дате /// - public DateTime? LtDate { get; set; } + public DateTime? LeDate { get; set; } } \ No newline at end of file diff --git a/AsbCloudInfrastructure/Repository/DailyReportRepository.cs b/AsbCloudInfrastructure/Repository/DailyReportRepository.cs index d67dd302..44e8ec41 100644 --- a/AsbCloudInfrastructure/Repository/DailyReportRepository.cs +++ b/AsbCloudInfrastructure/Repository/DailyReportRepository.cs @@ -41,10 +41,10 @@ public class DailyReportRepository : CrudRepositoryBase d.IdWell == idWell); if (request.GeDate.HasValue) - query = query.Where(d => d.DateStart <= request.GeDate.Value.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc)); + query = query.Where(d => d.DateStart >= request.GeDate.Value.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc)); if (request.LeDate.HasValue) - query = query.Where(d => d.DateStart >= request.LeDate.Value.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc)); + query = query.Where(d => d.DateStart <= request.LeDate.Value.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc)); if (request.SortFields?.Any() == true) { @@ -52,10 +52,14 @@ public class DailyReportRepository : CrudRepositoryBase GetOrDefaultAsync(int idWell, DateTime dateStart, CancellationToken cancellationToken) diff --git a/AsbCloudInfrastructure/Repository/ScheduleRepository.cs b/AsbCloudInfrastructure/Repository/ScheduleRepository.cs index 2e8bdc98..92676cd4 100644 --- a/AsbCloudInfrastructure/Repository/ScheduleRepository.cs +++ b/AsbCloudInfrastructure/Repository/ScheduleRepository.cs @@ -56,10 +56,12 @@ namespace AsbCloudInfrastructure.Repository private IQueryable BuildQuery(int idWell, DateTime workTime) { var hoursOffset = wellService.GetTimezone(idWell).Hours; + + var workTimeDateTime = workTime.ToUtcDateTimeOffset(hoursOffset); return GetQuery().Where(s => s.IdWell == idWell - && s.DrillStart <= workTime.ToUtcDateTimeOffset(hoursOffset) - && s.DrillEnd >= workTime.ToUtcDateTimeOffset(hoursOffset)); + && s.DrillStart <= workTimeDateTime + && s.DrillEnd >= workTimeDateTime); } protected override Schedule Convert(ScheduleDto dto) diff --git a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs index c7ed3202..1c29d780 100644 --- a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs +++ b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs @@ -57,8 +57,8 @@ public class TrajectoryFactRepository : ITrajectoryFactRepository if (request.GeDate.HasValue) query = query.Where(r => r.DateTime >= request.GeDate.Value); - if (request.LtDate.HasValue) - query = query.Where(r => r.DateTime <= request.LtDate.Value); + if (request.LeDate.HasValue) + query = query.Where(r => r.DateTime <= request.LeDate.Value); return query.OrderBy(e => e.Deptsvym); } diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportExportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportExportService.cs index b0397324..6fbc0c12 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportExportService.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportExportService.cs @@ -70,13 +70,13 @@ public class DailyReportExportService : IDailyReportExportService private const string cellTimeBalanceBlockSection = "C60"; private const string cellTimeBalanceBlockWellDepthPlan = "C61"; - private const string cellDurationHoursDrillingPerSection = "F77"; + private const string cellSectionDrillingHours = "F77"; private const string cellTimeBalanceBlockWellDepthFact = "F78"; - private const string cellTimeBalanceBlockCountWellOperationSlipsTime = "F79"; + private const string cellTimeBalanceBlockWellOperationSlipsTimeCount = "F79"; private const string cellSubsystemComment = "D35"; - private const string cellSubsystemMeasurementsPerDaily = "F80"; - private const string cellSubsystemWellBoreDepth = "C9"; + private const string cellSubsystemMeasurementsPerDay = "F80"; + private const string cellSubsystemWellBore = "C9"; private const string cellSubsystemTotalRopPlan = "E70"; private const string cellSignDrillingMaster = "C84"; @@ -175,17 +175,17 @@ public class DailyReportExportService : IDailyReportExportService sheet.Cell(cellTimeBalanceBlockSection).Value = timeBalanceBlock.SectionName; sheet.Cell(cellTimeBalanceBlockWellDepthPlan).Value = timeBalanceBlock.WellDepthPlan; sheet.Cell(cellTimeBalanceBlockWellDepthFact).Value = timeBalanceBlock.WellDepthFact; - sheet.Cell(cellTimeBalanceBlockCountWellOperationSlipsTime).Value = timeBalanceBlock.CountWellOperationSlipsTime; + sheet.Cell(cellTimeBalanceBlockWellOperationSlipsTimeCount).Value = timeBalanceBlock.WellOperationSlipsTimeCount; } private static void AddSubsystemBlockToSheet(IXLWorksheet sheet, SubsystemBlockDto subsystemBlock) { - var groupedModules = subsystemBlock.Modules.OrderBy(m => m.SubsystemName) + var groupedSubsystems = subsystemBlock.Subsystems.OrderBy(m => m.SubsystemName) .GroupBy(m => m.SubsystemName); var rowСurrent = rowStartSubsystemBlock; - foreach (var groupedModule in groupedModules) + foreach (var groupedModule in groupedSubsystems) { var useSubsystemPerDay = groupedModule.FirstOrDefault(m => m.IdTimeInterval == 1); var useSubsystemPerWell = groupedModule.FirstOrDefault(m => m.IdTimeInterval == 2); @@ -204,8 +204,8 @@ public class DailyReportExportService : IDailyReportExportService } sheet.Cell(cellSubsystemComment).Value = subsystemBlock.Comment; - sheet.Cell(cellSubsystemMeasurementsPerDaily).Value = subsystemBlock.MeasurementsPerDaily; - sheet.Cell(cellSubsystemWellBoreDepth).Value = subsystemBlock.WellBoreDepth; + sheet.Cell(cellSubsystemMeasurementsPerDay).Value = subsystemBlock.MeasurementsPerDay; + sheet.Cell(cellSubsystemWellBore).Value = subsystemBlock.WellBore; sheet.Cell(cellSubsystemTotalRopPlan).Value = subsystemBlock.TotalRopPlan; } @@ -242,7 +242,7 @@ public class DailyReportExportService : IDailyReportExportService private static void AddFactWellOperationBlockToSheet(IXLWorksheet sheet, WellOperationBlockDto factWellOperationBlock) { - sheet.Cell(cellDurationHoursDrillingPerSection).Value = factWellOperationBlock.DurationHoursDrillingPerSection; + sheet.Cell(cellSectionDrillingHours).Value = factWellOperationBlock.SectionDrillingHours; foreach (var factOperation in factWellOperationBlock.WellOperations.OrderBy(w => w.CategoryName)) { diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs index ca4e2cd0..95d42411 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs @@ -74,7 +74,8 @@ public class DailyReportService : IDailyReportService ?? throw new ArgumentInvalidException(nameof(idDailyReport), $"Суточный отчёт с Id: {idDailyReport} не найден"); editableBlock.IdUser = idUser; - + + editableBlock.DateLastUpdate = DateTime.UtcNow; dailyReport.DateLastUpdate = DateTime.UtcNow; switch (editableBlock) @@ -246,7 +247,7 @@ public class DailyReportService : IDailyReportService dailyReport.TimeBalanceBlock.SectionName = wellOperationRepository.GetSectionTypes() .FirstOrDefault(s => s.Id == dailyReport.TimeBalanceBlock.IdSection)?.Caption; - dailyReport.TimeBalanceBlock.CountWellOperationSlipsTime = (await detectedOperationService.GetAsync( + dailyReport.TimeBalanceBlock.WellOperationSlipsTimeCount = (await detectedOperationService.GetAsync( new DetectedOperationRequest { IdsCategories = new[] { idWellOperationSlipsTime }, @@ -267,7 +268,7 @@ public class DailyReportService : IDailyReportService { IdWell = dailyReport.IdWell, GeDate = dailyReport.DateStart, - LtDate = dailyReport.DateEnd + LeDate = dailyReport.DateEnd }, cancellationToken)).LastOrDefault(); dailyReport.TrajectoryBlock = new TrajectoryBlockDto @@ -294,9 +295,9 @@ public class DailyReportService : IDailyReportService { dailyReport.SubsystemBlock ??= new SubsystemBlockDto(); - dailyReport.SubsystemBlock.Modules = await GetModulesAsync(); + dailyReport.SubsystemBlock.Subsystems = await GetSubsystemsAsync(); - async Task> GetModulesAsync() + async Task> GetSubsystemsAsync() { var modules = new List(); @@ -327,8 +328,8 @@ public class DailyReportService : IDailyReportService modules.AddRange(statSubsystemOperationTimePerDaily); modules.AddRange(statSubsystemOperationTimePerWell); - if (dailyReport.SubsystemBlock?.Modules != null && dailyReport.SubsystemBlock.Modules.Any()) - modules.AddRange(dailyReport.SubsystemBlock.Modules); + if (dailyReport.SubsystemBlock?.Subsystems != null && dailyReport.SubsystemBlock.Subsystems.Any()) + modules.AddRange(dailyReport.SubsystemBlock.Subsystems); return modules; } @@ -338,8 +339,7 @@ public class DailyReportService : IDailyReportService { dailyReport.ProcessMapWellDrillingBlock = (await processMapReportWellDrillingService.GetAsync(dailyReport.IdWell, cancellationToken)).Where(p => p.DateStart >= dailyReport.DateStart && - p.DateStart <= dailyReport.DateEnd && - p.IdMode.HasValue) + p.DateStart <= dailyReport.DateEnd) .GroupBy(p => p.DrillingMode) .Select(g => new ProcessMapWellDrillingRecordDto { @@ -347,8 +347,8 @@ public class DailyReportService : IDailyReportService WellBoreDepth = g.Sum(p => p.DeltaDepth), Rop = new PlanFactDto { - Plan = g.Sum(p => p.RopPlan), - Fact = g.Sum(p => p.RopFact) + Plan = g.Sum(p => p.Rop.Plan), + Fact = g.Sum(p => p.Rop.Fact) }, MechDrillingHours = g.Sum(p => p.MechDrillingHours) }); @@ -367,7 +367,7 @@ public class DailyReportService : IDailyReportService DurationHours = g.Sum(o => o.DurationHours) }), - DurationHoursDrillingPerSection = factWellOperations + SectionDrillingHours = factWellOperations .Where(o => o.IdParentCategory is idWellOperationCategoryDrilling) .Sum(o => o.DurationHours) }; diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingExportService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingExportService.cs index df179df3..e89d64ad 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingExportService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingExportService.cs @@ -149,7 +149,7 @@ public class ProcessMapReportWellDrillingExportService : IProcessMapReportWellDr .SetVal(modeData.UsageFact); sheet.Cell(row, columnRop) - .SetVal(modeData.RopFact); + .SetVal(modeData.Rop.Fact); return row + 1; } diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingService.cs index daebad97..0561e9ee 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Data; using AsbCloudApp.Data.ProcessMaps; using AsbCloudApp.Data.ProcessMaps.Report; using AsbCloudApp.Data.SAUB; @@ -171,7 +172,6 @@ public class ProcessMapReportWellDrillingService : IProcessMapReportWellDrilling var result = new ProcessMapReportWellDrillingDto { IdWell = processMapByMode?.IdWell ?? processMapFirst.IdWell, - IdMode = processMapByMode?.IdMode, IdWellSectionType = idWellSectionType, WellSectionTypeName = sectionTypes[idWellSectionType], @@ -189,9 +189,12 @@ public class ProcessMapReportWellDrillingService : IProcessMapReportWellDrilling TopDriveTorque = telemetryStat.RotorTorque.MakeParams(processMapByMode?.TopDriveTorque.Plan), SpeedLimit = telemetryStat.BlockSpeed.MakeParams(processMapByMode?.RopPlan), - RopPlan = processMapByMode?.RopPlan, - RopFact = telemetryStat.Rop, - + Rop = new PlanFactDto + { + Plan = processMapByMode?.RopPlan, + Fact = telemetryStat.Rop + }, + UsagePlan = processMapByMode?.UsageSaub ?? telemetryStat.UsagePredictPlan, UsageFact = telemetryStat.UsageSaub, }; diff --git a/AsbCloudWebApi.Tests/Services/DailyReportServiceTest.cs b/AsbCloudWebApi.Tests/Services/DailyReportServiceTest.cs index 77c5bdbc..7e7046a8 100644 --- a/AsbCloudWebApi.Tests/Services/DailyReportServiceTest.cs +++ b/AsbCloudWebApi.Tests/Services/DailyReportServiceTest.cs @@ -102,11 +102,11 @@ public class DailyReportServiceTest var fakeSubsystemBlock = new SubsystemBlockDto { IdUser = idUser, - WellBoreDepth = 999, - MeasurementsPerDaily = 999, + WellBore = 999, + MeasurementsPerDay = 999, TotalRopPlan = 999, Comment = "Увеличить обороты", - Modules = new[] + Subsystems = new[] { new SubsystemRecordDto { @@ -123,6 +123,7 @@ public class DailyReportServiceTest var result = await dailyReportService.UpdateBlockAsync(idDailyReport, idUser, fakeSubsystemBlock, CancellationToken.None); //assert + Assert.NotNull(fakeSubsystemBlock.DateLastUpdate); Assert.NotNull(fakeDailyReport.DateLastUpdate); Assert.Equal(fakeDailyReport.SubsystemBlock, fakeSubsystemBlock); Assert.Equal(idDailyReport, result); @@ -153,6 +154,7 @@ public class DailyReportServiceTest var result = await dailyReportService.UpdateBlockAsync(idDailyReport, idUser, fakeSignBlock, CancellationToken.None); //assert + Assert.NotNull(fakeSignBlock.DateLastUpdate); Assert.NotNull(fakeDailyReport.DateLastUpdate); Assert.Equal(fakeDailyReport.SignBlock, fakeSignBlock); Assert.Equal(idDailyReport, result); @@ -187,6 +189,7 @@ public class DailyReportServiceTest var result = await dailyReportService.UpdateBlockAsync(idDailyReport, idUser, fakeTimeBalanceBlock, CancellationToken.None); //assert + Assert.NotNull(fakeTimeBalanceBlock.DateLastUpdate); Assert.NotNull(fakeDailyReport.DateLastUpdate); Assert.Equal(fakeDailyReport.TimeBalanceBlock, fakeTimeBalanceBlock); Assert.Equal(idDailyReport, result); diff --git a/AsbCloudWebApi/Controllers/DailyReportController.cs b/AsbCloudWebApi/Controllers/DailyReportController.cs index a7c51ba7..222eb74c 100644 --- a/AsbCloudWebApi/Controllers/DailyReportController.cs +++ b/AsbCloudWebApi/Controllers/DailyReportController.cs @@ -117,9 +117,9 @@ public class DailyReportController : ControllerBase { var validSubsystemNames = new[] { "АвтоСПО", "Автопроработка" }; - if (subsystemBlock.Modules.Any(m => !validSubsystemNames.Contains(m.SubsystemName))) - throw new ArgumentInvalidException($"Возможно добавить модули только с именами {string.Join(", ", validSubsystemNames)}", - nameof(subsystemBlock.Modules)); + if (subsystemBlock.Subsystems.Any(m => !validSubsystemNames.Contains(m.SubsystemName))) + throw new ArgumentInvalidException($"Возможно добавить подсистемы с именами {string.Join(", ", validSubsystemNames)}", + nameof(subsystemBlock.Subsystems)); return UpdateBlockAsync(idWell, idDailyReport, subsystemBlock, cancellationToken); }