diff --git a/AsbCloudApp/Data/MudDiagramDataDto.cs b/AsbCloudApp/Data/MudDiagramDataDto.cs new file mode 100644 index 00000000..bd801445 --- /dev/null +++ b/AsbCloudApp/Data/MudDiagramDataDto.cs @@ -0,0 +1,28 @@ +namespace AsbCloudApp.Data +{ + public class MudDiagramDataDto + { + public double ProbeNumber { get; set; } + public double ProbeExtractionDepth { get; set; } + public double Sandstone { get; set; } + public double Siltstone { get; set; } + public double Argillit { get; set; } + public double BrokenArgillit { get; set; } + public double Coal { get; set; } + public double Sand { get; set; } + public double Clay { get; set; } + public double Camstone { get; set; } + public double Cement { get; set; } + public string Summary { get; set; } + public double DrillingMud { get; set; } + public double Sludge { get; set; } + public double MaxSum { get; set; } + public double Methane { get; set; } + public double Ethan { get; set; } + public double Propane { get; set; } + public double Butane { get; set; } + public double Pentane { get; set; } + public double MechanicalSpeed { get; set; } + public string PreliminaryConclusion { get; set; } + } +} diff --git a/AsbCloudApp/Data/NnbDataDto.cs b/AsbCloudApp/Data/NnbDataDto.cs new file mode 100644 index 00000000..8812e6a0 --- /dev/null +++ b/AsbCloudApp/Data/NnbDataDto.cs @@ -0,0 +1,23 @@ +namespace AsbCloudApp.Data +{ + public class NnbDataDto + { + public double Depth { get; set; } + public double ZenithAngle { get; set; } + public double TrueAzimuth { get; set; } + public double ConditionalViscosity { get; set; } + public double DirectAzimuth { get; set; } + public double VerticalDepth { get; set; } + public double AbsoluteMark { get; set; } + public double LocalNorthOffset { get; set; } + public double LocalEastOffset { get; set; } + public double OutFallOffset { get; set; } + public double OffsetAzimuth { get; set; } + public double AreaIntensity { get; set; } + public double OffsetStopAngle { get; set; } + public double ZenithIntensity { get; set; } + public double Comment { get; set; } + public double DepthPlanFactDifference { get; set; } + public double DistancePlanFactDifference { get; set; } + } +} diff --git a/AsbCloudApp/Services/ILastDataService.cs b/AsbCloudApp/Services/ILastDataService.cs index 3817f4cc..47c785c3 100644 --- a/AsbCloudApp/Services/ILastDataService.cs +++ b/AsbCloudApp/Services/ILastDataService.cs @@ -3,6 +3,6 @@ public interface ILastDataService { Tdto Get(int idWell, int idCategory); - int Upsert(int idWell, int idCategory, Tdto value); + void Upsert(int idWell, int idCategory, Tdto value); } } diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index ebacb6e5..974fbac8 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -215,18 +215,18 @@ namespace AsbCloudDb.Model modelBuilder.Entity(entity => { entity.HasData(new List { - new FileCategory {Id = 1, Name = "Растворный сервис"}, - new FileCategory {Id = 2, Name = "Цементирование"}, - new FileCategory {Id = 3, Name = "ННБ"}, - new FileCategory {Id = 4, Name = "ГТИ"}, - new FileCategory {Id = 5, Name = "Документы по скважине"}, - new FileCategory {Id = 6, Name = "Супервайзер"}, - new FileCategory {Id = 7, Name = "Мастер"}, - new FileCategory {Id = 8, Name = "Последние данные"}, - new FileCategory {Id = 9, Name = "Последний замер бурового раствора"}, - new FileCategory {Id = 10, Name = "Шламограмма"}, - new FileCategory {Id = 11, Name = "Последние данные ННБ"}, - new FileCategory {Id = 12, Name = "Рапорт"} + new FileCategory {Id = 1, Name = "Растворный сервис", ShortName = "fluidService"}, + new FileCategory {Id = 2, Name = "Цементирование", ShortName = "cement"}, + new FileCategory {Id = 3, Name = "ННБ", ShortName = "nnb"}, + new FileCategory {Id = 4, Name = "ГТИ", ShortName = "gti"}, + new FileCategory {Id = 5, Name = "Документы по скважине", ShortName = "wellDocuments"}, + new FileCategory {Id = 6, Name = "Супервайзер", ShortName = "supervisor"}, + new FileCategory {Id = 7, Name = "Мастер", ShortName = "master"}, + new FileCategory {Id = 8, Name = "Последний замер бурового раствора ПЛАН", ShortName = "fluidPlanLastData"}, + new FileCategory {Id = 9, Name = "Последний замер бурового раствора ФАКТ", ShortName = "fluidFactLastData"}, + new FileCategory {Id = 10, Name = "Последние данные Шламограммы", ShortName = "mudLastData"}, + new FileCategory {Id = 11, Name = "Последние данные ННБ", ShortName = "nnbLastData"}, + new FileCategory {Id = 12, Name = "Рапорт", ShortName = "report"} }); }); } diff --git a/AsbCloudDb/Model/FileCategory.cs b/AsbCloudDb/Model/FileCategory.cs index 42079a87..1f38806e 100644 --- a/AsbCloudDb/Model/FileCategory.cs +++ b/AsbCloudDb/Model/FileCategory.cs @@ -13,5 +13,8 @@ namespace AsbCloudDb.Model [Column("name"), Comment("Название категории")] public string Name { get; set; } + + [Column("short_name"), Comment("Короткое название категории")] + public string ShortName { get; set; } } } \ No newline at end of file diff --git a/AsbCloudDb/Model/FluidData.cs b/AsbCloudDb/Model/FluidData.cs index 2a84827a..3a2e5a9c 100644 --- a/AsbCloudDb/Model/FluidData.cs +++ b/AsbCloudDb/Model/FluidData.cs @@ -3,65 +3,34 @@ using System.ComponentModel.DataAnnotations.Schema; namespace AsbCloudDb.Model { - [Table("t_fluid_data")] public class FluidData { - [Key] - [Column("id")] - public int Id { get; set; } - [Column("temperature")] public double Temperature { get; set; } - [Column("density")] public double Density { get; set; } - [Column("conditionalViscosity")] public double ConditionalViscosity { get; set; } - [Column("r300")] public double R300 { get; set; } - [Column("r600")] public double R600 { get; set; } - [Column("r3r6")] public double R3r6 { get; set; } - [Column("dnsDpa")] public double DnsDpa { get; set; } - [Column("plasticViscocity")] public double PlasticViscocity { get; set; } - [Column("snsDpa")] public double SnsDpa { get; set; } - [Column("r3r649С")] public double R3r649С { get; set; } - [Column("dns49Cdpa")] public double Dns49Cdpa { get; set; } - [Column("plasticViscocity49c")] public double PlasticViscocity49c { get; set; } - [Column("sns49Cdpa")] public double Sns49Cdpa { get; set; } - [Column("mbt")] public double Mbt { get; set; } - [Column("sand")] public double Sand { get; set; } - [Column("filtering")] public double Filtering { get; set; } - [Column("crust")] public double Crust { get; set; } - [Column("ktk")] public double Ktk { get; set; } - [Column("ph")] public double Ph { get; set; } - [Column("hardness")] public double Hardness { get; set; } - [Column("chlorides")] public double Chlorides { get; set; } - [Column("pf")] public double Pf { get; set; } - [Column("mf")] public double Mf { get; set; } - [Column("pm")] public double Pm { get; set; } - [Column("fluidSolidPhase")] public double FluidSolidPhase { get; set; } - [Column("grease")] public double Grease { get; set; } - [Column("calciumCarbonate")] public double CalciumCarbonate { get; set; } } } diff --git a/AsbCloudDb/Model/LastData.cs b/AsbCloudDb/Model/LastData.cs index 974318bf..e2bf64f6 100644 --- a/AsbCloudDb/Model/LastData.cs +++ b/AsbCloudDb/Model/LastData.cs @@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json.Serialization; namespace AsbCloudDb.Model { @@ -23,5 +24,13 @@ namespace AsbCloudDb.Model [Column("data", TypeName = "jsonb"), Comment("Данные таблицы последних данных")] public object Data { get; set; } + + [JsonIgnore] + [ForeignKey(nameof(IdWell))] + public virtual Well Well { get; set; } + + [JsonIgnore] + [ForeignKey(nameof(IdCategory))] + public virtual FileCategory FileCategory { get; set; } } } diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index bd638938..e0c2b3c0 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -39,7 +39,9 @@ namespace AsbCloudInfrastructure services.AddTransient, LastDataService>(); - + services.AddTransient, LastDataService>(); + services.AddTransient, LastDataService>(); + return services; } diff --git a/AsbCloudInfrastructure/Services/LastDataService.cs b/AsbCloudInfrastructure/Services/LastDataService.cs index 1bf707bb..f9edceec 100644 --- a/AsbCloudInfrastructure/Services/LastDataService.cs +++ b/AsbCloudInfrastructure/Services/LastDataService.cs @@ -27,7 +27,7 @@ namespace AsbCloudInfrastructure.Services return dto; } - public int Upsert(int idWell, int idCategory, Tdto value) + public void Upsert(int idWell, int idCategory, Tdto value) { var model = value.Adapt(); @@ -44,13 +44,15 @@ namespace AsbCloudInfrastructure.Services { var newLastData = new LastData { + IdWell = idWell, + IdCategory = idCategory, LastUpdateDate = DateTime.Now, Data = model }; db.LastData.Add(newLastData); } - return db.SaveChanges(); + db.SaveChanges(); } } diff --git a/AsbCloudWebApi/Controllers/FluidController.cs b/AsbCloudWebApi/Controllers/FluidController.cs index fc6ddb6a..a567517b 100644 --- a/AsbCloudWebApi/Controllers/FluidController.cs +++ b/AsbCloudWebApi/Controllers/FluidController.cs @@ -5,10 +5,10 @@ using AsbCloudApp.Services; namespace AsbCloudWebApi.Controllers { - [Route("api/lastData/{idWell}")] + [Route("api/fluidLastData/{idWell}")] [ApiController] [Authorize] - public class FluidController : CrudController + public class FluidController : LastDataController { public FluidController(ILastDataService lastDataService, IWellService wellService) : base(lastDataService, wellService) diff --git a/AsbCloudWebApi/Controllers/LastDataController.cs b/AsbCloudWebApi/Controllers/LastDataController.cs index b2a579c3..449c9166 100644 --- a/AsbCloudWebApi/Controllers/LastDataController.cs +++ b/AsbCloudWebApi/Controllers/LastDataController.cs @@ -30,7 +30,7 @@ namespace AsbCloudWebApi.Controllers } [HttpPost] - public IActionResult Put([FromRoute] int idWell, [FromQuery] int idCategory, [FromForm] T data) + public IActionResult Put([FromRoute] int idWell, [FromQuery] int idCategory, T data) { int? idCompany = User.GetCompanyId(); diff --git a/AsbCloudWebApi/Controllers/MudDiagramController.cs b/AsbCloudWebApi/Controllers/MudDiagramController.cs new file mode 100644 index 00000000..f5f70dbc --- /dev/null +++ b/AsbCloudWebApi/Controllers/MudDiagramController.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using AsbCloudApp.Data; +using AsbCloudApp.Services; + +namespace AsbCloudWebApi.Controllers +{ + [Route("api/mudLastData/{idWell}")] + [ApiController] + [Authorize] + public class MudDiagramController : LastDataController + { + public MudDiagramController(ILastDataService lastDataService, + IWellService wellService) : base(lastDataService, wellService) + { } + } +} diff --git a/AsbCloudWebApi/Controllers/NnbDataController.cs b/AsbCloudWebApi/Controllers/NnbDataController.cs new file mode 100644 index 00000000..e69f90ea --- /dev/null +++ b/AsbCloudWebApi/Controllers/NnbDataController.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using AsbCloudApp.Data; +using AsbCloudApp.Services; + +namespace AsbCloudWebApi.Controllers +{ + [Route("api/nnbLastData/{idWell}")] + [ApiController] + [Authorize] + public class NnbDataController : LastDataController + { + public NnbDataController(ILastDataService lastDataService, + IWellService wellService) : base(lastDataService, wellService) + { } + } +}