Changed WellOperation fileds names

This commit is contained in:
KharchenkoVV 2021-08-18 17:09:57 +05:00
parent 582629c8d7
commit 154426a5fb
3 changed files with 29 additions and 30 deletions

View File

@ -413,43 +413,43 @@ namespace AsbCloudDb.Model
{
entity.HasData(new List<WellOperation> {
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}
});

View File

@ -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<IGrouping<int, WellOperation>> 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,

View File

@ -30,7 +30,6 @@ namespace AsbCloudWebApi.Controllers
/// </summary>
/// <param name="idWell">id скважины</param>
/// <param name="idCategory">id категории файла</param>
/// <param name="idUser">id отправившего файл пользователя</param>
/// <param name="files">Коллекция файлов</param>
/// <param name="token"> Токен отмены задачи </param>
/// <returns></returns>