2021-10-08 11:30:57 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
using AsbCloudInfrastructure.Services;
|
|
|
|
|
using AsbCloudInfrastructure.Services.Cache;
|
2021-10-09 20:16:22 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.WellOperationService;
|
2021-10-08 11:30:57 +05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace ConsoleApp1
|
|
|
|
|
{
|
|
|
|
|
public static class DebugWellOperationsStatService
|
|
|
|
|
{
|
|
|
|
|
public static void Main(/*string[] args*/)
|
|
|
|
|
{
|
|
|
|
|
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
|
|
|
|
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
|
|
|
|
.Options;
|
|
|
|
|
using var db = new AsbCloudDbContext(options);
|
|
|
|
|
var cacheDb = new CacheDb();
|
|
|
|
|
var wellService = new WellService(db, new TelemetryTracker(), cacheDb);
|
|
|
|
|
var wellOptsStat = new WellOperationsStatService(db, cacheDb, wellService);
|
|
|
|
|
var tvd = wellOptsStat.GetTvdAsync(1, default).Result;
|
|
|
|
|
Print(tvd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void Print(IEnumerable<PlanFactPredictBase<WellOperationDto>> tvd)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("|\tplan\t|\tfact\t|\tprog\t|");
|
|
|
|
|
Console.WriteLine("|:-------------:|:-------------:|:-------------:|");
|
|
|
|
|
foreach (var item in tvd)
|
|
|
|
|
Print(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void Print(PlanFactPredictBase<WellOperationDto> item)
|
|
|
|
|
{
|
|
|
|
|
static string GetText(WellOperationDto item)
|
|
|
|
|
=> (item is null)
|
|
|
|
|
? " --------- "
|
|
|
|
|
: $"{item.IdCategory} d:{item.DepthStart} ";
|
|
|
|
|
Console.WriteLine($"|\t{GetText(item.Plan)}\t|\t{GetText(item.Fact)}\t|\t{GetText(item.Predict)}\t|");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|