Delete ConsoleApp1

This commit is contained in:
ngfrolov 2024-01-12 15:26:55 +05:00
parent a784ce8099
commit 8d321a0d6f
Signed by: ng.frolov
GPG Key ID: E99907A0357B29A7
11 changed files with 0 additions and 595 deletions

View File

@ -1,67 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1
{
/// <summary>
/// Split WellDepth to DepthStart and DepthEnd
/// </summary>
static class ActionWellOperationsRefactor
{
private static DbContextOptions<AsbCloudDbContext> options = new DbContextOptionsBuilder<AsbCloudDbContext>()
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
.Options;
public static void Main()
{
using var db = new AsbCloudDbContext(options);
var wellsIds = db.WellOperations
.Select(o => o.IdWell)
.Distinct()
.ToList();
var transaction = db.Database.BeginTransaction();
try
{
foreach (var idWell in wellsIds)
{
var operations = db.WellOperations
.Where(o => o.IdWell == idWell)
.OrderBy(o => o.DateStart)
.ThenBy(o => o.DepthEnd)
.ToList();
var operationsPlan = operations.Where(o => o.IdType == 0);
RefactorWellOperations(operationsPlan);
var operationsFact = operations.Where(o => o.IdType == 1);
RefactorWellOperations(operationsFact);
db.SaveChanges();
}
transaction.Commit();
}
catch
{
transaction.Rollback();
}
}
private static void RefactorWellOperations(IEnumerable<WellOperation> operations)
{
if (!operations.Any())
return;
var oi = operations.GetEnumerator();
oi.MoveNext();
var pre = oi.Current;
oi.Current.DepthStart = 0d;
while (oi.MoveNext())
{
oi.Current.DepthStart = pre.DepthEnd;
pre = oi.Current;
}
}
}
}

View File

@ -1,42 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<StartupObject>ConsoleApp1.Program</StartupObject>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Connected Services\**" />
<Compile Remove="Properties\**" />
<EmbeddedResource Remove="Connected Services\**" />
<EmbeddedResource Remove="Properties\**" />
<None Remove="Connected Services\**" />
<None Remove="Properties\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="Mapster" Version="7.3.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="DetectedOperations\Files\Operations.xlsx" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AsbCloudApp\AsbCloudApp.csproj" />
<ProjectReference Include="..\AsbCloudDb\AsbCloudDb.csproj" />
<ProjectReference Include="..\AsbCloudInfrastructure\AsbCloudInfrastructure.csproj" />
</ItemGroup>
</Project>

View File

@ -1,131 +0,0 @@
using AsbCloudApp.Data.SAUB;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp1
{
public static class ControllerLoadTester
{
static readonly Random random = new((int)DateTime.Now.Ticks);
public static void TestControllerRoute(CancellationToken token = default)
{
var tasks = new List<Task>();
for (var i = 0; i < 1; i++)
{
tasks.Add(SendRequestsAsync(i, token));
};
Task.WaitAll(tasks.ToArray(), token);
Console.WriteLine("End");
}
private static async Task SendRequestsAsync(int i, CancellationToken token)
{
var uid = $"123123_1";
using var httpClient = new HttpClient();
Console.WriteLine($"Sending telemetry info with uid: {uid}");
var tInfoUri = new Uri($"http://localhost:5000/api/telemetry/{uid}/info");
var infoResponse = await httpClient.PostAsync(tInfoUri, MakeTelemetryInfoContent(), token);
Console.WriteLine($"Передана telemetry info с: {infoResponse.StatusCode}");
for (var j = 0; j <= 100; j++)
{
await Task.Delay(random.Next(1000, 5000), token);
var dataSaubUri = new Uri($"http://localhost:5000/api/telemetryDataSaub/{uid}");
var saubResponse = await httpClient.PostAsync(dataSaubUri, MakeDataSaubContent(), token);
Console.WriteLine(saubResponse.StatusCode);
}
}
private static StringContent MakeTelemetryInfoContent()
{
var json = JsonSerializer.Serialize(new TelemetryInfoDto { Cluster = "Cluster" });
var stringContent = new StringContent(json, Encoding.UTF8,
"application/json");
return stringContent;
}
private static StringContent MakeDataSaubContent(DateTime date = default)
{
var json = JsonSerializer.Serialize(new List<TelemetryDataSaubDto>()
{
MakeTelemetryDataSaubDto(date)
});
var stringContent = new StringContent(json, Encoding.UTF8,
"application/json");
return stringContent;
}
private static TelemetryDataSaubDto MakeTelemetryDataSaubDto(DateTime date = default)
{
var dto = new TelemetryDataSaubDto
{
DateTime = date == default ? DateTime.Now : date,
User = "Вупсень",
Mode = 1, //ротор
IdFeedRegulator = 1,
MseState = 1,
WellDepth = MakeFloatRandom(100),
BitDepth = MakeFloatRandom(100),
BlockPosition = MakeFloatRandom(100),
BlockPositionMin = MakeFloatRandom(100),
BlockPositionMax = MakeFloatRandom(100),
BlockSpeed = MakeFloatRandom(100),
BlockSpeedSp = MakeFloatRandom(100),
BlockSpeedSpRotor = MakeFloatRandom(100),
BlockSpeedSpSlide = MakeFloatRandom(100),
BlockSpeedSpDevelop = MakeFloatRandom(100),
Pressure = MakeFloatRandom(100),
PressureIdle = MakeFloatRandom(100),
PressureSp = MakeFloatRandom(100),
PressureSpRotor = MakeFloatRandom(100),
PressureSpSlide = MakeFloatRandom(100),
PressureSpDevelop = MakeFloatRandom(100),
PressureDeltaLimitMax = MakeFloatRandom(100),
AxialLoad = MakeFloatRandom(100),
AxialLoadSp = MakeFloatRandom(100),
AxialLoadLimitMax = MakeFloatRandom(100),
HookWeight = MakeFloatRandom(100),
HookWeightIdle = MakeFloatRandom(100),
HookWeightLimitMin = MakeFloatRandom(100),
HookWeightLimitMax = MakeFloatRandom(100),
RotorTorque = MakeFloatRandom(100),
RotorTorqueIdle = MakeFloatRandom(100),
RotorTorqueSp = MakeFloatRandom(100),
RotorTorqueLimitMax = MakeFloatRandom(100),
RotorSpeed = MakeFloatRandom(100),
Flow = MakeFloatRandom(100),
FlowIdle = MakeFloatRandom(100),
FlowDeltaLimitMax = MakeFloatRandom(100),
};
return dto;
}
private static float MakeFloatRandom(float max, float min = 0)
{
var val = (float)(min + random.NextDouble() * (max - min));
return val;
}
private static float MakeFloatSin(float max, float min, float angle)
{
var val = (float)(min + Math.Sin(angle) * (max - min) / 2);
return val;
}
}
}

View File

@ -1,17 +0,0 @@
using System;
namespace ConsoleApp1
{
class Cron
{
public DateTimeOffset Origin { get; set; }
public TimeSpan Period { get; set; }
public DateTimeOffset Next()
{
var delta = DateTimeOffset.Now - Origin;
var n = Math.Ceiling(delta / Period);
return Origin + n * Period;
}
}
}

View File

@ -1,185 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore;
using System;
namespace ConsoleApp1
{
public static class DbDemoDataService
{
public static void AddDemoData()
{
Console.WriteLine("Заполнить БД тестовыми данными? y/n");
string result = Console.ReadLine();
if (result != "y")
{
Console.WriteLine("Хорошо, в другой раз.");
return;
}
try
{
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
.Options;
using var demoContext = new AsbCloudDbContext(options);
demoContext.Deposits.Add(new Deposit { Id = 1, Caption = "м/р 1", Latitude = 60.8705722222222, Longitude = 70.3811888888889 });
demoContext.Clusters.AddRange(
new Cluster { Id = 1, Caption = "к39.1", IdDeposit = 1, Latitude = 60.8705722222222, Longitude = 70.3811888888889 },
new Cluster { Id = 2, Caption = "к151", IdDeposit = 1, Latitude = 60.8205750000000, Longitude = 70.1343833333334 },
new Cluster { Id = 3, Caption = "к611", IdDeposit = 1, Latitude = 60.8100666666667, Longitude = 69.7778388888889 },
new Cluster { Id = 4, Caption = "к203", IdDeposit = 1, Latitude = 60.8928805555556, Longitude = 70.3272055555556 },
new Cluster { Id = 5, Caption = "к221", IdDeposit = 1, Latitude = 60.6672055555556, Longitude = 69.6603861111111 }
);
demoContext.Telemetries.Add(
new Telemetry
{
Id = 1,
RemoteUid = "123",
Info = new TelemetryInfo
{
Well = "1",
Cluster = "1",
Comment = "",
Deposit = "1",
Customer = "1",
HmiVersion = "1",
//PlcVersion = "1",
TimeZoneId = "1",
DrillingStartDate = DateTime.Parse("2021-06-29T12:01:19.000000"),
TimeZoneOffsetTotalHours = 5.0
},
}
);
demoContext.Wells.AddRange(
new Well { Id = 1, IdCluster = 1, IdWellType = 1, Caption = "скв 16314", Latitude = 60.8705722222222, Longitude = 70.3811888888889, IdTelemetry = 1, },
new Well { Id = 2, IdCluster = 1, IdWellType = 2, Caption = "скв 16311", Latitude = 60.8705722222222, Longitude = 70.3811888888889 },
new Well { Id = 3, IdCluster = 2, IdWellType = 1, Caption = "скв 16315", Latitude = 60.8205750000000, Longitude = 70.1343833333334 },
new Well { Id = 4, IdCluster = 2, IdWellType = 1, Caption = "скв 16318", Latitude = 60.8205750000000, Longitude = 70.1343833333334 },
new Well { Id = 5, IdCluster = 3, IdWellType = 1, Caption = "скв 16310", Latitude = 60.8100666666667, Longitude = 69.7778388888889 },
new Well { Id = 6, IdCluster = 4, IdWellType = 1, Caption = "скв 16316", Latitude = 60.8928805555556, Longitude = 70.3272055555556 },
new Well { Id = 7, IdCluster = 5, IdWellType = 1, Caption = "скв 16312", Latitude = 60.6672055555556, Longitude = 69.6603861111111 },
new Well { Id = 8, IdCluster = 5, IdWellType = 1, Caption = "скв 16313", Latitude = 60.6672055555556, Longitude = 69.6603861111111 },
new Well { Id = 9, IdCluster = 5, IdWellType = 1, Caption = "скв 42669", Latitude = 60.6672055555556, Longitude = 69.6603861111111 }
);
demoContext.AddRange(
new RelationCompanyWell { IdWell = 1, IdCompany = 1 },
new RelationCompanyWell { IdWell = 2, IdCompany = 1 },
new RelationCompanyWell { IdWell = 3, IdCompany = 1 },
new RelationCompanyWell { IdWell = 4, IdCompany = 1 },
new RelationCompanyWell { IdWell = 5, IdCompany = 1 },
new RelationCompanyWell { IdWell = 6, IdCompany = 1 },
new RelationCompanyWell { IdWell = 7, IdCompany = 1 },
new RelationCompanyWell { IdWell = 8, IdCompany = 1 },
new RelationCompanyWell { IdWell = 9, IdCompany = 1 }
);
demoContext.WellOperations.AddRange(
new WellOperation { Id = 64049, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5 },
new WellOperation { Id = 31502, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 1.16666666666667 },
new WellOperation { Id = 1531, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 44572, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5 },
new WellOperation { Id = 44514, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5 },
new WellOperation { Id = 53383, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 3431, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 15:40"), DurationHours = 3.5 },
new WellOperation { Id = 21460, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 01:10"), DurationHours = 3.5 },
new WellOperation { Id = 30464, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5 },
new WellOperation { Id = 73111, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5 },
new WellOperation { Id = 81351, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-25 05:10"), DurationHours = 3.5 },
new WellOperation { Id = 24480, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5 },
new WellOperation { Id = 19101, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5 },
new WellOperation { Id = 34738, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5 },
new WellOperation { Id = 37606, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 71293, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 22:40"), DurationHours = 3.5 },
new WellOperation { Id = 91696, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5 },
new WellOperation { Id = 77916, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5 },
new WellOperation { Id = 93585, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 42016, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 90466, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 09:10"), DurationHours = 3.5 },
new WellOperation { Id = 15914, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5 },
new WellOperation { Id = 63469, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 23659, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5 },
new WellOperation { Id = 93508, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5 },
new WellOperation { Id = 74346, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 3139, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-24 22:10"), DurationHours = 3.5 },
new WellOperation { Id = 11429, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 14542, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5 },
new WellOperation { Id = 70906, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 82194, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5 },
new WellOperation { Id = 13578, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5 },
new WellOperation { Id = 57798, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5 },
new WellOperation { Id = 37277, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5 },
new WellOperation { Id = 23233, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5 },
new WellOperation { Id = 26075, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 8230, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-26 12:40"), DurationHours = 3.5 },
new WellOperation { Id = 26414, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5 },
new WellOperation { Id = 92747, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5 },
new WellOperation { Id = 89559, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-25 19:10"), DurationHours = 3.5 },
new WellOperation { Id = 99336, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 08:10"), DurationHours = 3.5 },
new WellOperation { Id = 80943, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5 },
new WellOperation { Id = 11934, IdWell = 1, IdWellSectionType = 1, IdCategory = 1006, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 08:10"), DurationHours = 2.33333333333333 },
new WellOperation { Id = 88089, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 11:40"), DurationHours = 3.5 },
new WellOperation { Id = 57116, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5 },
new WellOperation { Id = 57561, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 72783, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-25 01:40"), DurationHours = 3.5 },
new WellOperation { Id = 75549, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 60717, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 21171, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 13547, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 83361, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 58676, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 46864, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5 },
new WellOperation { Id = 95276, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 18:40"), DurationHours = 3.5 },
new WellOperation { Id = 33478, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5 },
new WellOperation { Id = 85086, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5 },
new WellOperation { Id = 38808, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5 },
new WellOperation { Id = 60045, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 82773, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 38025, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 08:40"), DurationHours = 3.5 },
new WellOperation { Id = 8312, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 02:10"), DurationHours = 3.5 },
new WellOperation { Id = 84440, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5 },
new WellOperation { Id = 78963, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 05:40"), DurationHours = 3.5 },
new WellOperation { Id = 39690, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 88719, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 64890, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 15:10"), DurationHours = 3.5 },
new WellOperation { Id = 95476, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5 },
new WellOperation { Id = 78257, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 41260, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5 },
new WellOperation { Id = 41055, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 47051, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 04:40"), DurationHours = 3.5 },
new WellOperation { Id = 14068, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 12:10"), DurationHours = 3.5 },
new WellOperation { Id = 96039, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 34668, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 43146, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 15263, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 20802, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 81320, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 43902, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 62958, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 74174, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 76347, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5 },
new WellOperation { Id = 51329, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 76341, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5 }
);
int res = demoContext.SaveChanges();
if (res > 0)
Console.WriteLine("Даннные добавлены");
else
Console.WriteLine("Ошибка при добавлении данных");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
}

View File

@ -1,20 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore;
using System;
namespace ConsoleApp1
{
public static class DebugWellOperationImportService
{
private static DbContextOptions<AsbCloudDbContext> options = new DbContextOptionsBuilder<AsbCloudDbContext>()
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
.Options;
public static void Main(/*string[] args*/)
{
using var db = new AsbCloudDbContext(options);
Console.WriteLine("_");
}
}
}

View File

@ -1,24 +0,0 @@

using System.Threading;
using System.Threading.Tasks;
using AsbCloudDb.Model;
using ConsoleApp1.DetectedOperations;
using Microsoft.EntityFrameworkCore;
namespace ConsoleApp1
{
class Program
{
private static DbContextOptions<AsbCloudDbContext> options = new DbContextOptionsBuilder<AsbCloudDbContext>()
.UseNpgsql("Host=localhost;Database=postgres;Port=5433;Username=postgres;Password=root;Persist Security Info=True")
.Options;
static async Task Main(/*string[] args*/)
{
using var db = new AsbCloudDbContext(options);
await new DetectedOperationExportService(db).Export(483, CancellationToken.None);
}
}
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>C:\home\linux_test_test</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@ -1,25 +0,0 @@
ТЕСТ РАБОТЫ КЛАССА КОНВЕРТИРУЮЩЕГО ЧАСТИ ПРОГРАММЫ БУРЕНИЯ В ЕДИНЫЙ ФАЙЛ ПЕЧАТНОГО ФОРМАТА (pdf)
Тест настроен под проверку на винде
для проверки необходимо создать иерархию папок (в корне С:\)
C:\Test\InFiles и C:\Test\OutFiles
Для простоты тестирования имена файлов подлежащих конвертации
"зашиты" в код
Для теста/работы на линукс машинах
на Linux сервер необходимо установить пакеты LibreOffice
sudo apt-get install libreoffice-writer libreoffice-calc
перед компиляцией необходимо изменить пути к файлам и папкам
например :
C:\Test\InFiles => /home/{папка юзера}/Test/InFiles
путь до бинарника LibreOffice:
Linux - /usr/bin/soffice
Windows - C:\Program Files\LibreOffice\program\soffice.exe

View File

@ -1,25 +0,0 @@
using System.Net.Mail;
namespace ConsoleApp1
{
public static class SendMail
{
public static void Main()
{
MailAddress to = new MailAddress("ng.frolov@autodrilling.ru");
MailAddress from = new MailAddress("bot@autodrilling.ru");
MailMessage message = new MailMessage(from, to);
message.Subject = "Using the new SMTP client.";
message.Body = "<html><boby><H1>this is a test text</H1></boby></html>";
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient("smtp.timeweb.ru");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("bot@autodrilling.ru", "xHhgwZ4D");
client.Send(message);
}
}
}

View File

@ -1,42 +0,0 @@
using AsbCloudDb.Model;
using AsbCloudInfrastructure.Repository;
using AsbCloudInfrastructure.Services;
using AsbCloudInfrastructure.Services.SAUB;
using AsbCloudInfrastructure.Services.WellOperationService;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Primitives;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1
{
class ConfigurationService : IConfigurationSection
{
public string this[string key]
{
get => "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True";
set { }
}
public string Key => "";
public string Path => "";
public string Value { get; set; } = "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True";
public IEnumerable<IConfigurationSection> GetChildren()
{
return Enumerable.Empty<IConfigurationSection>();
}
public IChangeToken? GetReloadToken()
{
return default;
}
public IConfigurationSection GetSection(string key) => this;
}
}