diff --git a/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs b/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs
index 96f6bba6..40634148 100644
--- a/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs
+++ b/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs
@@ -94,6 +94,26 @@
/// НПВ
///
public string Npv { get; set; }
+
+ ///
+ /// Проработка перед наращиванием
+ ///
+ public string ElaborationBeforeBuilding { get; set; }
+
+ ///
+ /// Шаблонировка перед наращиванием
+ ///
+ public string TemplatingBeforeBuilding { get; set; }
+
+ ///
+ /// Промывка перед наращиванием
+ ///
+ public string FlushingBeforeBuilding { get; set; }
+
+ ///
+ /// Статический замер телесистемы
+ ///
+ public string StaticSurveying { get; set; }
}
}
diff --git a/AsbCloudApp/Services/IDetectedOperationService.cs b/AsbCloudApp/Services/IDetectedOperationService.cs
index 3d077443..3fe70e1c 100644
--- a/AsbCloudApp/Services/IDetectedOperationService.cs
+++ b/AsbCloudApp/Services/IDetectedOperationService.cs
@@ -16,6 +16,7 @@ namespace AsbCloudApp.Services
Task DeleteAsync(DetectedOperationRequest request, CancellationToken token);
Task?> GetOperationsStatAsync(DetectedOperationRequest request, CancellationToken token);
Task ExportAsync(IEnumerable idsWells, CancellationToken token);
+ double GetSumValues(IEnumerable detectedOperations, int idOperation);
}
#nullable disable
}
diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
index a59cfc93..4c921371 100644
--- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
+++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
@@ -9,6 +9,8 @@ using AsbCloudApp.Services;
using AsbCloudDb.Model;
using System.Collections.Generic;
using AsbCloudApp.Data.DailyReport;
+using AsbCloudApp.Requests;
+using AsbCloudInfrastructure.Services.DetectOperations;
namespace AsbCloudInfrastructure.Services.DailyReport
{
@@ -17,12 +19,14 @@ namespace AsbCloudInfrastructure.Services.DailyReport
{
private readonly IAsbCloudDbContext db;
private readonly IWellService wellService;
+ private readonly IDetectedOperationService detectedOperationService;
private readonly DailyReportMakerExcel dailyReportMaker = new DailyReportMakerExcel();
- public DailyReportService(IAsbCloudDbContext db, IWellService wellService)
+ public DailyReportService(IAsbCloudDbContext db, IWellService wellService, IDetectedOperationService detectedOperationService)
{
this.db = db;
this.wellService = wellService;
+ this.detectedOperationService = detectedOperationService;
}
public async Task> GetListAsync(int idWell, DateTime? begin, DateTime? end, CancellationToken token)
@@ -109,16 +113,36 @@ namespace AsbCloudInfrastructure.Services.DailyReport
private async Task MakeDefaultDailyReportAsync(int idWell, DateTime date, CancellationToken token)
{
var well = await wellService.GetOrDefaultAsync(idWell, token);
+ var detectedOperations = await detectedOperationService.GetOperationsStatAsync(new DetectedOperationRequest
+ {
+ IdWell = idWell,
+ GtDate = date.Date,
+ LtDate = date.Date.AddDays(1)
+ }, token);
var dto = new DailyReportDto()
{
Head = new HeadDto()
{
ReportDate = date.Date,
WellName = well?.Caption ?? "",
- ClusterName = well?.Cluster ?? ""
+ ClusterName = well?.Cluster ?? "",
+ },
+ TimeBalance = detectedOperations is null ? new TimeBalanceDto() { } : new TimeBalanceDto()
+ {
+ Drilling = $"{detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.IdOperationRotor) + detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.IdOperationSlide)}",
+ Flushing = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationFlushing).ToString(),
+ Building = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.IdOperationSlipsTime).ToString(),
+ Elaboration = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationElaboration).ToString(),
+ ElaborationBeforeBuilding = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationElaborationBeforeBuilding).ToString(),
+ TemplatingBeforeBuilding = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationTemplatingBeforeBuilding).ToString(),
+ FlushingBeforeBuilding = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationFlushingBeforeBuilding).ToString(),
+ StaticSurveying = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationStaticSurveying).ToString(),
+ Gis = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationGis).ToString(),
+ Ozc = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationOzc).ToString(),
+ Cementing = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationCementing).ToString(),
+ Npv = detectedOperationService.GetSumValues(detectedOperations, DetectedOperationService.idOperationNpv).ToString(),
}
};
-
return dto;
}
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
index 067d7e73..1bdb4469 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs
@@ -21,6 +21,19 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
public const int IdOperationRotor = 1;
public const int IdOperationSlide = 3;
public const int IdOperationSlipsTime = 14;
+ public const int idOperationFlushing = 22;
+ public const int idOperationElaboration = 1022;
+
+ public const int idOperationRepair = 1031;
+ public const int idOperationGis = 1001;
+ public const int idOperationOzc = 1008;
+ public const int idOperationCementing = 1040;
+ public const int idOperationNpv = 1043;
+
+ public const int idOperationElaborationBeforeBuilding = 18;
+ public const int idOperationTemplatingBeforeBuilding = 19;
+ public const int idOperationFlushingBeforeBuilding = 20;
+ public const int idOperationStaticSurveying = 21;
private readonly IAsbCloudDbContext db;
private readonly IWellService wellService;
@@ -283,6 +296,15 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
return result;
}
+ public double GetSumValues(IEnumerable detectedOperations, int idOperation)
+ {
+ var result = detectedOperations
+ .Where(o => o.IdCategory == idOperation)
+ .Select(o => o.MinutesTotal)
+ .Sum() / 60;
+ return Math.Round(result, 2);
+ }
+
public Task ExportAsync(IEnumerable idsWells, CancellationToken token)
{
var exportService = new DetectedOperationExportService(db, wellService);