From 154426a5fb07b313cfa9efdf85706695f25f7bf0 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Wed, 18 Aug 2021 17:09:57 +0500 Subject: [PATCH] Changed WellOperation fileds names --- AsbCloudDb/Model/AsbCloudDbContext.cs | 20 +++++----- .../Services/WellSectionService.cs | 38 +++++++++---------- AsbCloudWebApi/Controllers/FileController.cs | 1 - 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index 29b9c164..95d468da 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -413,43 +413,43 @@ namespace AsbCloudDb.Model { entity.HasData(new List { new WellOperation{ Id = 1, IdWell = 1, IdWellSectionType = 1, - IdOperationCategory = 18, Type = 0, + IdCategory = 18, IdType = 0, WellDepth = 200, StartDate = DateTime.Now.AddHours(1), DurationHours = 1.2}, new WellOperation{ Id = 2, IdWell = 1, IdWellSectionType = 1, - IdOperationCategory = 18, Type = 1, + IdCategory = 18, IdType = 1, WellDepth = 300, StartDate = DateTime.Now.AddHours(1), DurationHours = 1}, new WellOperation{ Id = 3, IdWell = 1, IdWellSectionType = 1, - IdOperationCategory = 71, Type = 0, + IdCategory = 71, IdType = 0, WellDepth = 400, StartDate = DateTime.Now.AddHours(2.5), DurationHours = 15.2}, new WellOperation{ Id = 4, IdWell = 1, IdWellSectionType = 1, - IdOperationCategory = 71, Type = 1, + IdCategory = 71, IdType = 1, WellDepth = 500, StartDate = DateTime.Now.AddHours(3), DurationHours = 17.2}, new WellOperation{ Id = 5, IdWell = 1, IdWellSectionType = 2, - IdOperationCategory = 72, Type = 0, + IdCategory = 72, IdType = 0, WellDepth = 600, StartDate = DateTime.Now.AddHours(4), DurationHours = 5}, new WellOperation{ Id = 6, IdWell = 1, IdWellSectionType = 2, - IdOperationCategory = 72, Type = 1, + IdCategory = 72, IdType = 1, WellDepth = 700, StartDate = DateTime.Now.AddHours(4.3), DurationHours = 7}, new WellOperation{ Id = 7, IdWell = 1, IdWellSectionType = 2, - IdOperationCategory = 74, Type = 0, + IdCategory = 74, IdType = 0, WellDepth = 800, StartDate = DateTime.Now.AddHours(5), DurationHours = 12}, new WellOperation{ Id = 8, IdWell = 1, IdWellSectionType = 2, - IdOperationCategory = 74, Type = 1, + IdCategory = 74, IdType = 1, WellDepth = 900, StartDate = DateTime.Now.AddHours(4.5), DurationHours = 12}, new WellOperation{ Id = 9, IdWell = 1, IdWellSectionType = 3, - IdOperationCategory = 72, Type = 0, + IdCategory = 72, IdType = 0, WellDepth = 950, StartDate = DateTime.Now.AddHours(5), DurationHours = 2}, new WellOperation{ Id = 10, IdWell = 1, IdWellSectionType = 3, - IdOperationCategory = 72, Type = 1, + IdCategory = 72, IdType = 1, WellDepth = 900, StartDate = DateTime.Now.AddHours(5), DurationHours = 2.5} }); diff --git a/AsbCloudInfrastructure/Services/WellSectionService.cs b/AsbCloudInfrastructure/Services/WellSectionService.cs index a0579126..8b949739 100644 --- a/AsbCloudInfrastructure/Services/WellSectionService.cs +++ b/AsbCloudInfrastructure/Services/WellSectionService.cs @@ -184,8 +184,8 @@ namespace AsbCloudInfrastructure.Services return groupedOperations .Select(group => ( - DepthPlan: group.Where(o => o.Type == 0).Max(w => w.WellDepth), - DepthFact: group.Where(o => o.Type == 1).Max(w => w.WellDepth) + DepthPlan: group.Where(o => o.IdType == 0).Max(w => w.WellDepth), + DepthFact: group.Where(o => o.IdType == 1).Max(w => w.WellDepth) )); } @@ -194,15 +194,15 @@ namespace AsbCloudInfrastructure.Services { var durationsPlanFactsBase = groupedOperations.Select(group => new { - DurationMaxPlan = group.Where(o => o.Type == 0).Select(op => op.StartDate + + DurationMaxPlan = group.Where(o => o.IdType == 0).Select(op => op.StartDate + TimeSpan.FromHours(op.DurationHours)).Max(), - DurationMinPlan = group.Where(o => o.Type == 0).Min(i => i.StartDate), + DurationMinPlan = group.Where(o => o.IdType == 0).Min(i => i.StartDate), - DurationMaxFact = group.Where(o => o.Type == 1).Select(op => op.StartDate + + DurationMaxFact = group.Where(o => o.IdType == 1).Select(op => op.StartDate + TimeSpan.FromHours(op.DurationHours)).Max(), - DurationMinFact = group.Where(o => o.Type == 1).Min(i => i.StartDate) + DurationMinFact = group.Where(o => o.IdType == 1).Min(i => i.StartDate) }); return durationsPlanFactsBase.Select(o => @@ -263,17 +263,17 @@ namespace AsbCloudInfrastructure.Services private static IEnumerable<(double DepthDifferencePlanSum, double DurationDifferencePlanSum, double DepthDifferenceFactSum, double DurationDifferenceFactSum)> GetParams(IEnumerable> items, - int idOperationCategory) + int IdCategory) { return items.Select(g => ( - DepthDifferencePlanSum: g.Where(o => o.Type == 0 && o.IdOperationCategory == idOperationCategory) + DepthDifferencePlanSum: g.Where(o => o.IdType == 0 && o.IdCategory == IdCategory) .Select((el, i) => i > 0 ? el.WellDepth - g.ElementAt(i - 1).WellDepth : 0).Sum(), - DurationDifferencePlanSum: g.Where(o => o.Type == 0 && o.IdOperationCategory == idOperationCategory) + DurationDifferencePlanSum: g.Where(o => o.IdType == 0 && o.IdCategory == IdCategory) .Select(el => el.DurationHours).Sum(), - DepthDifferenceFactSum: g.Where(o => o.Type == 1 && o.IdOperationCategory == idOperationCategory) + DepthDifferenceFactSum: g.Where(o => o.IdType == 1 && o.IdCategory == IdCategory) .Select((el, i) => i > 0 ? el.WellDepth - g.ElementAt(i - 1).WellDepth : 0).Sum(), - DurationDifferenceFactSum: g.Where(o => o.Type == 1 && o.IdOperationCategory == idOperationCategory) + DurationDifferenceFactSum: g.Where(o => o.IdType == 1 && o.IdCategory == IdCategory) .Select(el => el.DurationHours).Sum() )); } @@ -288,20 +288,20 @@ namespace AsbCloudInfrastructure.Services foreach (var group in groupedOperations) { - var firstBhaPositionDecreasePlan = group.Any(o => o.IdOperationCategory == 71 && o.Type == 0) - ? group.First(o => o.IdOperationCategory == 71 && o.Type == 0) + var firstBhaPositionDecreasePlan = group.Any(o => o.IdCategory == 71 && o.IdType == 0) + ? group.First(o => o.IdCategory == 71 && o.IdType == 0) : null; - var lastBhaPositionIncreasePlan = group.Any(o => o.IdOperationCategory == 72 && o.Type == 0) - ? group.First(o => o.IdOperationCategory == 72 && o.Type == 0) + var lastBhaPositionIncreasePlan = group.Any(o => o.IdCategory == 72 && o.IdType == 0) + ? group.First(o => o.IdCategory == 72 && o.IdType == 0) : null; - var firstBhaPositionDecreaseFact = group.Any(o => o.IdOperationCategory == 71 && o.Type == 1) - ? group.First(o => o.IdOperationCategory == 71 && o.Type == 1) + var firstBhaPositionDecreaseFact = group.Any(o => o.IdCategory == 71 && o.IdType == 1) + ? group.First(o => o.IdCategory == 71 && o.IdType == 1) : null; - var lastBhaPositionIncreaseFact = group.Any(o => o.IdOperationCategory == 71 && o.Type == 1) - ? group.First(o => o.IdOperationCategory == 71 && o.Type == 1) + var lastBhaPositionIncreaseFact = group.Any(o => o.IdCategory == 71 && o.IdType == 1) + ? group.First(o => o.IdCategory == 71 && o.IdType == 1) : null; bhaRaiseDecreaseCollection.Add((firstBhaPositionDecreasePlan, diff --git a/AsbCloudWebApi/Controllers/FileController.cs b/AsbCloudWebApi/Controllers/FileController.cs index 8ca5d949..b8f55f40 100644 --- a/AsbCloudWebApi/Controllers/FileController.cs +++ b/AsbCloudWebApi/Controllers/FileController.cs @@ -30,7 +30,6 @@ namespace AsbCloudWebApi.Controllers /// /// id скважины /// id категории файла - /// id отправившего файл пользователя /// Коллекция файлов /// Токен отмены задачи ///