forked from ddrilling/AsbCloudServer
Rename_DrillingProgram_FileCategories
Add entity DrillingProgram parts
This commit is contained in:
parent
def7868b9a
commit
4c68045398
16
AsbCloudApp/Data/DrillingProgramPartDto.cs
Normal file
16
AsbCloudApp/Data/DrillingProgramPartDto.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Data
|
||||||
|
{
|
||||||
|
public class DrillingProgramPartDto
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public int IdFileCategory { get; set; }
|
||||||
|
public IEnumerable<UserDto> Publishers { get; set; }
|
||||||
|
public IEnumerable<UserDto> Approvers { get; set; }
|
||||||
|
public bool PermissionToApprove { get; set; }
|
||||||
|
public bool PermissionToUpload { get; set; }
|
||||||
|
public FileInfoDto File { get; set; }
|
||||||
|
}
|
||||||
|
}
|
21
AsbCloudApp/Data/DrillingProgramStateDto.cs
Normal file
21
AsbCloudApp/Data/DrillingProgramStateDto.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Data
|
||||||
|
{
|
||||||
|
public class DrillingProgramStateDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 0 - не инициировано
|
||||||
|
/// 1 - загрузка и согласование
|
||||||
|
/// 2 - формируется (несколько минут)
|
||||||
|
/// 3 - готова
|
||||||
|
/// </summary>
|
||||||
|
public int IdState { get; set; }
|
||||||
|
public FileInfoDto Program { get; set; }
|
||||||
|
public IEnumerable<DrillingProgramPartDto> Parts { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -6,10 +6,9 @@ namespace AsbCloudApp.Services
|
|||||||
{
|
{
|
||||||
public interface IDrillingProgramService
|
public interface IDrillingProgramService
|
||||||
{
|
{
|
||||||
Task<int> CreateFileMarkAsync(FileMarkDto fileMarkDto, int idUser, CancellationToken token);
|
Task<DrillingProgramStateDto> GetStateAsync(int idWell, int fileChangerId,
|
||||||
Task<FileInfoDto> GetOrCreateAsync(int idWell, int fileChangerId,
|
|
||||||
CancellationToken token = default);
|
CancellationToken token = default);
|
||||||
Task<string> GetOrCreateSharedUrlAsync(int idWell, int idUser, IFileShareService fileShareService, CancellationToken token = default);
|
Task<int> CreateFileMarkAsync(FileMarkDto fileMarkDto, int idUser, CancellationToken token);
|
||||||
Task<int> MarkFileMarkAsDeletedAsync(int idMark, CancellationToken token);
|
Task<int> MarkFileMarkAsDeletedAsync(int idMark, CancellationToken token);
|
||||||
}
|
}
|
||||||
}
|
}
|
4882
AsbCloudDb/Migrations/20220209060041_Rename_DrillingProgram_FileCategories.Designer.cs
generated
Normal file
4882
AsbCloudDb/Migrations/20220209060041_Rename_DrillingProgram_FileCategories.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,95 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class Rename_DrillingProgram_FileCategories : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 13);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 14);
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "t_file_category",
|
||||||
|
columns: new[] { "id", "name", "short_name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ 1000, "Программа бурения", null },
|
||||||
|
{ 1001, "Задание от геологов", null },
|
||||||
|
{ 1002, "Профиль ствола скважины (ННБ)", null },
|
||||||
|
{ 1003, "Технологические расчеты (ННБ)", null },
|
||||||
|
{ 1004, "Долотная программа", null },
|
||||||
|
{ 1005, "Программа по растворам", null },
|
||||||
|
{ 1006, "Программа геофизических исследований", null },
|
||||||
|
{ 1007, "Планы спусков обсадных колонн", null },
|
||||||
|
{ 1008, "Программы цементирования обсадных колонн", null }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1000);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1001);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1002);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1003);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1004);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1005);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1006);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1007);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_file_category",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 1008);
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "t_file_category",
|
||||||
|
columns: new[] { "id", "name", "short_name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ 13, "Программа бурения, части", "ПБч" },
|
||||||
|
{ 14, "Программа бурения", "ПБ" }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -475,15 +475,48 @@ namespace AsbCloudDb.Migrations
|
|||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 13,
|
Id = 1000,
|
||||||
Name = "Программа бурения, части",
|
Name = "Программа бурения"
|
||||||
ShortName = "ПБч"
|
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 14,
|
Id = 1001,
|
||||||
Name = "Программа бурения",
|
Name = "Задание от геологов"
|
||||||
ShortName = "ПБ"
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1002,
|
||||||
|
Name = "Профиль ствола скважины (ННБ)"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1003,
|
||||||
|
Name = "Технологические расчеты (ННБ)"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1004,
|
||||||
|
Name = "Долотная программа"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1005,
|
||||||
|
Name = "Программа по растворам"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1006,
|
||||||
|
Name = "Программа геофизических исследований"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1007,
|
||||||
|
Name = "Планы спусков обсадных колонн"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1008,
|
||||||
|
Name = "Программы цементирования обсадных колонн"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ namespace AsbCloudDb.Model
|
|||||||
public virtual DbSet<Company> Companies { get; set; }
|
public virtual DbSet<Company> Companies { get; set; }
|
||||||
public virtual DbSet<CompanyType> CompaniesTypes { get; set; }
|
public virtual DbSet<CompanyType> CompaniesTypes { get; set; }
|
||||||
public virtual DbSet<Deposit> Deposits { get; set; }
|
public virtual DbSet<Deposit> Deposits { get; set; }
|
||||||
|
public virtual DbSet<DrillingProgramPart> DrillingProgramParts { get; set; }
|
||||||
public virtual DbSet<FileCategory> FileCategories { get; set; }
|
public virtual DbSet<FileCategory> FileCategories { get; set; }
|
||||||
public virtual DbSet<FileInfo> Files { get; set; }
|
public virtual DbSet<FileInfo> Files { get; set; }
|
||||||
public virtual DbSet<FileMark> FileMarks { get; set; }
|
public virtual DbSet<FileMark> FileMarks { get; set; }
|
||||||
@ -41,6 +42,7 @@ namespace AsbCloudDb.Model
|
|||||||
public virtual DbSet<RelationUserUserRole> RelationUserUserRoles { get; set; }
|
public virtual DbSet<RelationUserUserRole> RelationUserUserRoles { get; set; }
|
||||||
public virtual DbSet<RelationUserRolePermission> RelationUserRolePermissions { get; set; }
|
public virtual DbSet<RelationUserRolePermission> RelationUserRolePermissions { get; set; }
|
||||||
public virtual DbSet<RelationUserRoleUserRole> RelationUserRoleUserRoles { get; set; }
|
public virtual DbSet<RelationUserRoleUserRole> RelationUserRoleUserRoles { get; set; }
|
||||||
|
public virtual DbSet<RelationUserDrillingProgramPart> RelationDrillingProgramPartUsers { get; set; }
|
||||||
|
|
||||||
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
||||||
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
||||||
@ -213,6 +215,11 @@ namespace AsbCloudDb.Model
|
|||||||
.HasName("t_relation_user_role_user_role_pk");
|
.HasName("t_relation_user_role_user_role_pk");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<RelationUserDrillingProgramPart>(entity => {
|
||||||
|
entity.HasKey(x => new { x.IdUser, x.IdDrillingProgramPart })
|
||||||
|
.HasName("t_relation_user_drilling_program_part_pk");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<WellOperation>(entity =>
|
modelBuilder.Entity<WellOperation>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasIndex(d => d.DepthEnd);
|
entity.HasIndex(d => d.DepthEnd);
|
||||||
@ -640,8 +647,16 @@ namespace AsbCloudDb.Model
|
|||||||
//new FileCategory {Id = 11, Name = "", ShortName = ""},
|
//new FileCategory {Id = 11, Name = "", ShortName = ""},
|
||||||
|
|
||||||
new FileCategory {Id = 12, Name = "Рапорт", ShortName = "report"},
|
new FileCategory {Id = 12, Name = "Рапорт", ShortName = "report"},
|
||||||
new FileCategory {Id = 13, Name = "Программа бурения, части", ShortName = "ПБч"},
|
|
||||||
new FileCategory {Id = 14, Name = "Программа бурения", ShortName = "ПБ"},
|
new FileCategory {Id = 1000, Name = "Программа бурения"},
|
||||||
|
new FileCategory {Id = 1001, Name = "Задание от геологов"},
|
||||||
|
new FileCategory {Id = 1002, Name = "Профиль ствола скважины (ННБ)"},
|
||||||
|
new FileCategory {Id = 1003, Name = "Технологические расчеты (ННБ)"},
|
||||||
|
new FileCategory {Id = 1004, Name = "Долотная программа"},
|
||||||
|
new FileCategory {Id = 1005, Name = "Программа по растворам"},
|
||||||
|
new FileCategory {Id = 1006, Name = "Программа геофизических исследований"},
|
||||||
|
new FileCategory {Id = 1007, Name = "Планы спусков обсадных колонн"},
|
||||||
|
new FileCategory {Id = 1008, Name = "Программы цементирования обсадных колонн"},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
26
AsbCloudDb/Model/DrillingProgramPart.cs
Normal file
26
AsbCloudDb/Model/DrillingProgramPart.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Model
|
||||||
|
{
|
||||||
|
|
||||||
|
[Table("t_drilling_program_part"), Comment("части программ бурения")]
|
||||||
|
public class DrillingProgramPart
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[Column("id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[Column("id_file_category")]
|
||||||
|
[Required]
|
||||||
|
public int IdFileCategory { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(IdFileCategory))]
|
||||||
|
public FileCategory FileCategory { get; set; }
|
||||||
|
|
||||||
|
[InverseProperty(nameof(RelationUserDrillingProgramPart.DrillingProgramPart))]
|
||||||
|
public virtual ICollection<RelationUserDrillingProgramPart> RelatedUsers { get; set; }
|
||||||
|
}
|
||||||
|
}
|
26
AsbCloudDb/Model/RelationUserDrillingProgramPart.cs
Normal file
26
AsbCloudDb/Model/RelationUserDrillingProgramPart.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Model
|
||||||
|
{
|
||||||
|
[Table("t_relation_user_drilling_program_part"), Comment("Отношение пользователей и частей ПБ")]
|
||||||
|
public class RelationUserDrillingProgramPart
|
||||||
|
{
|
||||||
|
[Column("id_user")]
|
||||||
|
public int IdUser { get; set; }
|
||||||
|
|
||||||
|
[Column("id_drilling_program_part")]
|
||||||
|
public int IdDrillingProgramPart { get; set; }
|
||||||
|
|
||||||
|
[Column("id_role"), Comment("1 - publisher, 2 - approver")]
|
||||||
|
public int IdDrillingProgramPartRole { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(IdDrillingProgramPart))]
|
||||||
|
public virtual DrillingProgramPart DrillingProgramPart { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(IdUser))]
|
||||||
|
[InverseProperty(nameof(Model.User.RelationUsersUserRoles))]
|
||||||
|
public virtual User User { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user