все?...

This commit is contained in:
sardq 2024-05-30 02:29:51 +04:00
parent b2cdac8391
commit a1e7ac3211
6 changed files with 24 additions and 22 deletions

View File

@ -23,4 +23,8 @@
<ProjectReference Include="..\FactoryContracts\FactoryContracts.csproj" /> <ProjectReference Include="..\FactoryContracts\FactoryContracts.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project> </Project>

View File

@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace FactoryDatabaseImplement.Migrations namespace FactoryDatabaseImplement.Migrations
{ {
[DbContext(typeof(FactoryDatabase))] [DbContext(typeof(FactoryDatabase))]
[Migration("20240528144223_InitCreate")] [Migration("20240529212521_Init")]
partial class InitCreate partial class Init
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
@ -71,7 +71,8 @@ namespace FactoryDatabaseImplement.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("PlanProductionId") b.Property<int?>("PlanProductionId")
.IsRequired()
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Status") b.Property<int>("Status")
@ -81,8 +82,7 @@ namespace FactoryDatabaseImplement.Migrations
b.HasIndex("ClientId"); b.HasIndex("ClientId");
b.HasIndex("PlanProductionId") b.HasIndex("PlanProductionId");
.IsUnique();
b.ToTable("ExecutionPhases"); b.ToTable("ExecutionPhases");
}); });
@ -345,8 +345,8 @@ namespace FactoryDatabaseImplement.Migrations
.IsRequired(); .IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.PlanProduction", "PlanProduction") b.HasOne("FactoryDatabaseImplement.Models.PlanProduction", "PlanProduction")
.WithOne("ExecutionPhase") .WithMany()
.HasForeignKey("FactoryDatabaseImplement.Models.ExecutionPhase", "PlanProductionId") .HasForeignKey("PlanProductionId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@ -518,9 +518,6 @@ namespace FactoryDatabaseImplement.Migrations
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b => modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b =>
{ {
b.Navigation("ExecutionPhase")
.IsRequired();
b.Navigation("Machines"); b.Navigation("Machines");
b.Navigation("Workpieces"); b.Navigation("Workpieces");

View File

@ -6,7 +6,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace FactoryDatabaseImplement.Migrations namespace FactoryDatabaseImplement.Migrations
{ {
public partial class InitCreate : Migration public partial class Init : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -287,8 +287,7 @@ namespace FactoryDatabaseImplement.Migrations
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ExecutionPhases_PlanProductionId", name: "IX_ExecutionPhases_PlanProductionId",
table: "ExecutionPhases", table: "ExecutionPhases",
column: "PlanProductionId", column: "PlanProductionId");
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MachinePlanProductions_MachineId", name: "IX_MachinePlanProductions_MachineId",

View File

@ -69,7 +69,8 @@ namespace FactoryDatabaseImplement.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("PlanProductionId") b.Property<int?>("PlanProductionId")
.IsRequired()
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Status") b.Property<int>("Status")
@ -79,8 +80,7 @@ namespace FactoryDatabaseImplement.Migrations
b.HasIndex("ClientId"); b.HasIndex("ClientId");
b.HasIndex("PlanProductionId") b.HasIndex("PlanProductionId");
.IsUnique();
b.ToTable("ExecutionPhases"); b.ToTable("ExecutionPhases");
}); });
@ -343,8 +343,8 @@ namespace FactoryDatabaseImplement.Migrations
.IsRequired(); .IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.PlanProduction", "PlanProduction") b.HasOne("FactoryDatabaseImplement.Models.PlanProduction", "PlanProduction")
.WithOne("ExecutionPhase") .WithMany()
.HasForeignKey("FactoryDatabaseImplement.Models.ExecutionPhase", "PlanProductionId") .HasForeignKey("PlanProductionId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@ -516,9 +516,6 @@ namespace FactoryDatabaseImplement.Migrations
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b => modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b =>
{ {
b.Navigation("ExecutionPhase")
.IsRequired();
b.Navigation("Machines"); b.Navigation("Machines");
b.Navigation("Workpieces"); b.Navigation("Workpieces");

View File

@ -302,6 +302,11 @@ namespace FactoryWorkerApp.Controllers
DateFrom = startDate, DateFrom = startDate,
DateTo = endDate, DateTo = endDate,
}); });
foreach( var report in reports)
{
if (report.Machines == null)
report.Machines = new();
}
return View(reports); return View(reports);

View File

@ -14,7 +14,7 @@
<p> <p>
<a asp-action="PlanProduction">Создать план</a> <a asp-action="PlanProduction">Создать план</a>
<a asp-action="ConnectionPlanProductionWorkpiece">Привязка планов производства к заготовкам</a> <a asp-action="ConnectionPlanProductionWorkpiece">Привязка заготовок к планам производства</a>
</p> </p>
<table class="table"> <table class="table">