CS2-43: Added save and get 'LastData' for Fluid

This commit is contained in:
KharchenkoVV 2021-08-03 17:55:28 +05:00
parent 543272ce7b
commit 17c07f8c8e
8 changed files with 44 additions and 38 deletions

View File

@ -2,32 +2,34 @@
{ {
public class FluidDataDto public class FluidDataDto
{ {
public string Temperature { get; set; } public int Key { get; set; }
public string Density { get; set; } public string Name { get; set; }
public string ConditionalViscosity { get; set; } public double Temperature { get; set; }
public string R300 { get; set; } public double Density { get; set; }
public string R600 { get; set; } public double ConditionalViscosity { get; set; }
public string R3r6 { get; set; } public double R300 { get; set; }
public string DnsDpa { get; set; } public double R600 { get; set; }
public string PlasticViscocity { get; set; } public double R3r6 { get; set; }
public string SnsDpa { get; set; } public double DnsDpa { get; set; }
public string R3r649С { get; set; } public double PlasticViscocity { get; set; }
public string Dns49Cdpa { get; set; } public double SnsDpa { get; set; }
public string PlasticViscocity49c { get; set; } public double R3r649С { get; set; }
public string Sns49Cdpa { get; set; } public double Dns49Cdpa { get; set; }
public string Mbt { get; set; } public double PlasticViscocity49c { get; set; }
public string Sand { get; set; } public double Sns49Cdpa { get; set; }
public string Filtering { get; set; } public double Mbt { get; set; }
public string Crust { get; set; } public double Sand { get; set; }
public string Ktk { get; set; } public double Filtering { get; set; }
public string Ph { get; set; } public double Crust { get; set; }
public string Hardness { get; set; } public double Ktk { get; set; }
public string Chlorides { get; set; } public double Ph { get; set; }
public string Pf { get; set; } public double Hardness { get; set; }
public string Mf { get; set; } public double Chlorides { get; set; }
public string Pm { get; set; } public double Pf { get; set; }
public string FluidSolidPhase { get; set; } public double Mf { get; set; }
public string Grease { get; set; } public double Pm { get; set; }
public string CalciumCarbonate { get; set; } public double FluidSolidPhase { get; set; }
public double Grease { get; set; }
public double CalciumCarbonate { get; set; }
} }
} }

View File

@ -2,6 +2,7 @@
{ {
public class MudDiagramDataDto public class MudDiagramDataDto
{ {
public int Key { get; set; }
public double ProbeNumber { get; set; } public double ProbeNumber { get; set; }
public double ProbeExtractionDepth { get; set; } public double ProbeExtractionDepth { get; set; }
public double Sandstone { get; set; } public double Sandstone { get; set; }
@ -13,7 +14,7 @@
public double Clay { get; set; } public double Clay { get; set; }
public double Camstone { get; set; } public double Camstone { get; set; }
public double Cement { get; set; } public double Cement { get; set; }
public string Summary { get; set; } public double Summary { get; set; }
public double DrillingMud { get; set; } public double DrillingMud { get; set; }
public double Sludge { get; set; } public double Sludge { get; set; }
public double MaxSum { get; set; } public double MaxSum { get; set; }
@ -23,6 +24,6 @@
public double Butane { get; set; } public double Butane { get; set; }
public double Pentane { get; set; } public double Pentane { get; set; }
public double MechanicalSpeed { get; set; } public double MechanicalSpeed { get; set; }
public string PreliminaryConclusion { get; set; } public double PreliminaryConclusion { get; set; }
} }
} }

View File

@ -2,6 +2,7 @@
{ {
public class NnbDataDto public class NnbDataDto
{ {
public int Key { get; set; }
public double Depth { get; set; } public double Depth { get; set; }
public double ZenithAngle { get; set; } public double ZenithAngle { get; set; }
public double TrueAzimuth { get; set; } public double TrueAzimuth { get; set; }

View File

@ -1,10 +1,9 @@
using System.ComponentModel.DataAnnotations; namespace AsbCloudDb.Model
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model
{ {
public class FluidData public class FluidData
{ {
public int Key { get; set; }
public string Name { get; set; }
public double Temperature { get; set; } public double Temperature { get; set; }
public double Density { get; set; } public double Density { get; set; }
public double ConditionalViscosity { get; set; } public double ConditionalViscosity { get; set; }

View File

@ -2,6 +2,7 @@
{ {
public class MudDiagramData public class MudDiagramData
{ {
public int Key { get; set; }
public double ProbeNumber { get; set; } public double ProbeNumber { get; set; }
public double ProbeExtractionDepth { get; set; } public double ProbeExtractionDepth { get; set; }
public double Sandstone { get; set; } public double Sandstone { get; set; }

View File

@ -2,6 +2,7 @@
{ {
public class NnbData public class NnbData
{ {
public int Key { get; set; }
public double Depth { get; set; } public double Depth { get; set; }
public double ZenithAngle { get; set; } public double ZenithAngle { get; set; }
public double TrueAzimuth { get; set; } public double TrueAzimuth { get; set; }

View File

@ -3,10 +3,11 @@ using System.Linq;
using AsbCloudDb.Model; using AsbCloudDb.Model;
using AsbCloudApp.Services; using AsbCloudApp.Services;
using Mapster; using Mapster;
using System.Text.Json;
namespace AsbCloudInfrastructure.Services namespace AsbCloudInfrastructure.Services
{ {
public class LastDataService<Tdto, TModel> : ILastDataService<Tdto> public class LastDataService<Tdto, TModel> : ILastDataService<Tdto> where Tdto : new()
{ {
private readonly IAsbCloudDbContext db; private readonly IAsbCloudDbContext db;
@ -21,9 +22,9 @@ namespace AsbCloudInfrastructure.Services
e.IdWell == idWell && e.IdCategory == idCategory); e.IdWell == idWell && e.IdCategory == idCategory);
if (entity is null) if (entity is null)
return default; return new Tdto();
var dto = entity.Adapt<Tdto>(); var dto = JsonSerializer.Deserialize<Tdto>(entity.Data.ToString());
return dto; return dto;
} }

View File

@ -25,8 +25,8 @@ namespace AsbCloudWebApi.Controllers
if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell))
return Forbid(); return Forbid();
lastDataService.Get(idWell, idCategory); var result = lastDataService.Get(idWell, idCategory);
return Ok(); return Ok(result);
} }
[HttpPost] [HttpPost]