feat: initialize manufacturing progress dashboard
This commit is contained in:
Generated
+457
@@ -0,0 +1,457 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using DongfangHydro.Dashboard.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DongfangHydro.Dashboard.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DashboardDbContext))]
|
||||
[Migration("20260710025438_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.20")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.Partner", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("ContactName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("ContactPhone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("PartnerType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Partners", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionLine", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ProductionLines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("ActualEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("ActualStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<int>("CompletedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DefectQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DelayDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DelayReason")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("MaterialCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("NodeType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("OperationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<Guid?>("ParentNodeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("PlannedEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("PlannedStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Progress")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RequiredQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<byte[]>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("rowversion");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("StationName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("SupplyType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("Vendor")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("VisualKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "ParentNodeId", "SortOrder");
|
||||
|
||||
b.HasIndex("OrderId", "NodeType", "RiskLevel", "Status");
|
||||
|
||||
b.ToTable("ProductionNodes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("BatchQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<int>("CompletedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<double>("DailyDelta")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("DelayDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("LineId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("LineName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<double>("PlanAchievement")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime>("PlannedEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("PlannedStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<int>("Progress")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RequiredQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<byte[]>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("rowversion");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("ThumbnailKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LineId");
|
||||
|
||||
b.HasIndex("Status", "RiskLevel", "PlannedEnd");
|
||||
|
||||
b.ToTable("ProductionOrders", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<double>("Achievement")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ActualQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Completion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("PlannedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Risk")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("SampleTime")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "SampleTime")
|
||||
.IsDescending(false, true);
|
||||
|
||||
b.ToTable("ProductionTrendPoints", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("HandlingStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<Guid>("NodeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("NodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<DateTimeOffset>("OccurredAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "NodeId");
|
||||
|
||||
b.HasIndex("OrderId", "OccurredAt")
|
||||
.IsDescending(false, true);
|
||||
|
||||
b.ToTable("RiskEvents", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId", "ParentNodeId")
|
||||
.HasPrincipalKey("OrderId", "Id")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionLine", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("LineId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId", "NodeId")
|
||||
.HasPrincipalKey("OrderId", "Id")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DongfangHydro.Dashboard.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Partners",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Code = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false),
|
||||
PartnerType = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
ContactName = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
ContactPhone = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Partners", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProductionLines",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Code = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
Owner = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
IsActive = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProductionLines", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProductionOrders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Code = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
ProductName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
||||
BatchQty = table.Column<int>(type: "int", nullable: false),
|
||||
RequiredQty = table.Column<int>(type: "int", nullable: false),
|
||||
CompletedQty = table.Column<int>(type: "int", nullable: false),
|
||||
Progress = table.Column<int>(type: "int", nullable: false),
|
||||
Status = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
RiskLevel = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
DelayDays = table.Column<int>(type: "int", nullable: false),
|
||||
PlannedStart = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
PlannedEnd = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
LineId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LineName = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
Owner = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
PlanAchievement = table.Column<double>(type: "float", nullable: false),
|
||||
DailyDelta = table.Column<double>(type: "float", nullable: false),
|
||||
ThumbnailKey = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
||||
UpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
||||
RowVersion = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProductionOrders", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductionOrders_ProductionLines_LineId",
|
||||
column: x => x.LineId,
|
||||
principalTable: "ProductionLines",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProductionNodes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
ParentNodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
Code = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false),
|
||||
OperationCode = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false),
|
||||
MaterialCode = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(240)", maxLength: 240, nullable: false),
|
||||
Level = table.Column<int>(type: "int", nullable: false),
|
||||
NodeType = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
SupplyType = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
RequiredQty = table.Column<int>(type: "int", nullable: false),
|
||||
CompletedQty = table.Column<int>(type: "int", nullable: false),
|
||||
DefectQty = table.Column<int>(type: "int", nullable: false),
|
||||
Progress = table.Column<int>(type: "int", nullable: false),
|
||||
Status = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
RiskLevel = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
DelayDays = table.Column<int>(type: "int", nullable: false),
|
||||
DelayReason = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
||||
PlannedStart = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
PlannedEnd = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ActualStart = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
ActualEnd = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
Owner = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||
Vendor = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false),
|
||||
StationName = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false),
|
||||
VisualKey = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
SortOrder = table.Column<int>(type: "int", nullable: false),
|
||||
UpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
||||
RowVersion = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProductionNodes", x => x.Id);
|
||||
table.UniqueConstraint("AK_ProductionNodes_OrderId_Id", x => new { x.OrderId, x.Id });
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductionNodes_ProductionNodes_OrderId_ParentNodeId",
|
||||
columns: x => new { x.OrderId, x.ParentNodeId },
|
||||
principalTable: "ProductionNodes",
|
||||
principalColumns: new[] { "OrderId", "Id" },
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductionNodes_ProductionOrders_OrderId",
|
||||
column: x => x.OrderId,
|
||||
principalTable: "ProductionOrders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProductionTrendPoints",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
SampleTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
||||
Completion = table.Column<int>(type: "int", nullable: false),
|
||||
Risk = table.Column<int>(type: "int", nullable: false),
|
||||
PlannedQty = table.Column<int>(type: "int", nullable: false),
|
||||
ActualQty = table.Column<int>(type: "int", nullable: false),
|
||||
Achievement = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProductionTrendPoints", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductionTrendPoints_ProductionOrders_OrderId",
|
||||
column: x => x.OrderId,
|
||||
principalTable: "ProductionOrders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RiskEvents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
NodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
OrderCode = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
NodeName = table.Column<string>(type: "nvarchar(240)", maxLength: 240, nullable: false),
|
||||
RiskLevel = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
Message = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
||||
HandlingStatus = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
||||
OccurredAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RiskEvents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RiskEvents_ProductionNodes_OrderId_NodeId",
|
||||
columns: x => new { x.OrderId, x.NodeId },
|
||||
principalTable: "ProductionNodes",
|
||||
principalColumns: new[] { "OrderId", "Id" });
|
||||
table.ForeignKey(
|
||||
name: "FK_RiskEvents_ProductionOrders_OrderId",
|
||||
column: x => x.OrderId,
|
||||
principalTable: "ProductionOrders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Partners_Code",
|
||||
table: "Partners",
|
||||
column: "Code",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionLines_Code",
|
||||
table: "ProductionLines",
|
||||
column: "Code",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionNodes_OrderId_NodeType_RiskLevel_Status",
|
||||
table: "ProductionNodes",
|
||||
columns: new[] { "OrderId", "NodeType", "RiskLevel", "Status" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionNodes_OrderId_ParentNodeId_SortOrder",
|
||||
table: "ProductionNodes",
|
||||
columns: new[] { "OrderId", "ParentNodeId", "SortOrder" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionOrders_Code",
|
||||
table: "ProductionOrders",
|
||||
column: "Code",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionOrders_LineId",
|
||||
table: "ProductionOrders",
|
||||
column: "LineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionOrders_Status_RiskLevel_PlannedEnd",
|
||||
table: "ProductionOrders",
|
||||
columns: new[] { "Status", "RiskLevel", "PlannedEnd" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionTrendPoints_OrderId_SampleTime",
|
||||
table: "ProductionTrendPoints",
|
||||
columns: new[] { "OrderId", "SampleTime" },
|
||||
descending: new[] { false, true });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RiskEvents_OrderId_NodeId",
|
||||
table: "RiskEvents",
|
||||
columns: new[] { "OrderId", "NodeId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RiskEvents_OrderId_OccurredAt",
|
||||
table: "RiskEvents",
|
||||
columns: new[] { "OrderId", "OccurredAt" },
|
||||
descending: new[] { false, true });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Partners");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductionTrendPoints");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RiskEvents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductionLines");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+652
@@ -0,0 +1,652 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using DongfangHydro.Dashboard.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DongfangHydro.Dashboard.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DashboardDbContext))]
|
||||
[Migration("20260710095939_ImportRealBom")]
|
||||
partial class ImportRealBom
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.20")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.MaterialQuota", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Brand")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<decimal?>("ConsumptionQuota")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ConsumptionQuotaText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("MaterialCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("MaterialName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<decimal?>("NetWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("NetWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<decimal?>("Quantity")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("QuantityText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Remark")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("SourceRow")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceSequence")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("SourceSheet")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("Specification")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("Unit")
|
||||
.IsRequired()
|
||||
.HasMaxLength(24)
|
||||
.HasColumnType("nvarchar(24)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "Category", "MaterialCode");
|
||||
|
||||
b.HasIndex("OrderId", "SourceSheet", "SourceRow")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MaterialQuotas", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.Partner", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("ContactName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("ContactPhone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("PartnerType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Partners", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionLine", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ProductionLines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("ActualEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("ActualStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<decimal?>("BomQuantity")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("BomQuantityText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<int>("CompletedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DefectQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DelayDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DelayReason")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Material")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("MaterialCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("NodeType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("OperationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<Guid?>("ParentNodeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("PlannedEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("PlannedStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Progress")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Remark")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("RequiredQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<byte[]>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("rowversion");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SourceRow")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceSequence")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("SourceSheet")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("Specification")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("StationName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("SupplyType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<decimal?>("TotalWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("TotalWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<decimal?>("UnitWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnitWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("Vendor")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("VisualKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "ParentNodeId", "SortOrder");
|
||||
|
||||
b.HasIndex("OrderId", "NodeType", "RiskLevel", "Status");
|
||||
|
||||
b.ToTable("ProductionNodes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("BatchQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<int>("CompletedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<double>("DailyDelta")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("DataSource")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<int>("DelayDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DrawingProductName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ImportedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<Guid?>("LineId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("LineName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<double>("PlanAchievement")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime?>("PlannedEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("PlannedStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<int>("Progress")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ProjectName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<int>("RequiredQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<byte[]>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("rowversion");
|
||||
|
||||
b.Property<string>("SourceDocumentCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("SourceFileHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("nvarchar(64)");
|
||||
|
||||
b.Property<string>("SourceFileName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(260)
|
||||
.HasColumnType("nvarchar(260)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("ThumbnailKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LineId");
|
||||
|
||||
b.HasIndex("SourceDocumentCode")
|
||||
.IsUnique()
|
||||
.HasFilter("[SourceDocumentCode] <> ''");
|
||||
|
||||
b.HasIndex("Status", "RiskLevel", "PlannedEnd");
|
||||
|
||||
b.ToTable("ProductionOrders", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<double>("Achievement")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ActualQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Completion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("PlannedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Risk")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("SampleTime")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "SampleTime")
|
||||
.IsDescending(false, true);
|
||||
|
||||
b.ToTable("ProductionTrendPoints", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("HandlingStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<Guid>("NodeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("NodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<DateTimeOffset>("OccurredAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "NodeId");
|
||||
|
||||
b.HasIndex("OrderId", "OccurredAt")
|
||||
.IsDescending(false, true);
|
||||
|
||||
b.ToTable("RiskEvents", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.MaterialQuota", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId", "ParentNodeId")
|
||||
.HasPrincipalKey("OrderId", "Id")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionLine", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("LineId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId", "NodeId")
|
||||
.HasPrincipalKey("OrderId", "Id")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,378 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DongfangHydro.Dashboard.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ImportRealBom : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "PlannedStart",
|
||||
table: "ProductionOrders",
|
||||
type: "datetime2",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime2");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "PlannedEnd",
|
||||
table: "ProductionOrders",
|
||||
type: "datetime2",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime2");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DataSource",
|
||||
table: "ProductionOrders",
|
||||
type: "nvarchar(32)",
|
||||
maxLength: 32,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DrawingProductName",
|
||||
table: "ProductionOrders",
|
||||
type: "nvarchar(240)",
|
||||
maxLength: 240,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<DateTimeOffset>(
|
||||
name: "ImportedAt",
|
||||
table: "ProductionOrders",
|
||||
type: "datetimeoffset",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ProjectName",
|
||||
table: "ProductionOrders",
|
||||
type: "nvarchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SourceDocumentCode",
|
||||
table: "ProductionOrders",
|
||||
type: "nvarchar(80)",
|
||||
maxLength: 80,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SourceFileHash",
|
||||
table: "ProductionOrders",
|
||||
type: "nvarchar(64)",
|
||||
maxLength: 64,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SourceFileName",
|
||||
table: "ProductionOrders",
|
||||
type: "nvarchar(260)",
|
||||
maxLength: 260,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.Sql(
|
||||
"UPDATE [ProductionOrders] SET [DataSource] = 'demo' WHERE [Code] LIKE 'MO-260708-%';");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "PlannedStart",
|
||||
table: "ProductionNodes",
|
||||
type: "datetime2",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime2");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "PlannedEnd",
|
||||
table: "ProductionNodes",
|
||||
type: "datetime2",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime2");
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "BomQuantity",
|
||||
table: "ProductionNodes",
|
||||
type: "decimal(18,4)",
|
||||
precision: 18,
|
||||
scale: 4,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "BomQuantityText",
|
||||
table: "ProductionNodes",
|
||||
type: "nvarchar(80)",
|
||||
maxLength: 80,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Material",
|
||||
table: "ProductionNodes",
|
||||
type: "nvarchar(120)",
|
||||
maxLength: 120,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Remark",
|
||||
table: "ProductionNodes",
|
||||
type: "nvarchar(500)",
|
||||
maxLength: 500,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SourceRow",
|
||||
table: "ProductionNodes",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SourceSequence",
|
||||
table: "ProductionNodes",
|
||||
type: "nvarchar(40)",
|
||||
maxLength: 40,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SourceSheet",
|
||||
table: "ProductionNodes",
|
||||
type: "nvarchar(40)",
|
||||
maxLength: 40,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Specification",
|
||||
table: "ProductionNodes",
|
||||
type: "nvarchar(240)",
|
||||
maxLength: 240,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "TotalWeight",
|
||||
table: "ProductionNodes",
|
||||
type: "decimal(18,4)",
|
||||
precision: 18,
|
||||
scale: 4,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TotalWeightText",
|
||||
table: "ProductionNodes",
|
||||
type: "nvarchar(80)",
|
||||
maxLength: 80,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "UnitWeight",
|
||||
table: "ProductionNodes",
|
||||
type: "decimal(18,4)",
|
||||
precision: 18,
|
||||
scale: 4,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "UnitWeightText",
|
||||
table: "ProductionNodes",
|
||||
type: "nvarchar(80)",
|
||||
maxLength: 80,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MaterialQuotas",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Category = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
SourceSequence = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
MaterialCode = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
MaterialName = table.Column<string>(type: "nvarchar(240)", maxLength: 240, nullable: false),
|
||||
Specification = table.Column<string>(type: "nvarchar(240)", maxLength: 240, nullable: false),
|
||||
Unit = table.Column<string>(type: "nvarchar(24)", maxLength: 24, nullable: false),
|
||||
Quantity = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true),
|
||||
NetWeight = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true),
|
||||
ConsumptionQuota = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true),
|
||||
QuantityText = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
NetWeightText = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
ConsumptionQuotaText = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: false),
|
||||
Brand = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false),
|
||||
Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
||||
SourceSheet = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
SourceRow = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MaterialQuotas", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MaterialQuotas_ProductionOrders_OrderId",
|
||||
column: x => x.OrderId,
|
||||
principalTable: "ProductionOrders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionOrders_SourceDocumentCode",
|
||||
table: "ProductionOrders",
|
||||
column: "SourceDocumentCode",
|
||||
unique: true,
|
||||
filter: "[SourceDocumentCode] <> ''");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MaterialQuotas_OrderId_Category_MaterialCode",
|
||||
table: "MaterialQuotas",
|
||||
columns: new[] { "OrderId", "Category", "MaterialCode" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MaterialQuotas_OrderId_SourceSheet_SourceRow",
|
||||
table: "MaterialQuotas",
|
||||
columns: new[] { "OrderId", "SourceSheet", "SourceRow" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "MaterialQuotas");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ProductionOrders_SourceDocumentCode",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DataSource",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DrawingProductName",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ImportedAt",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProjectName",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceDocumentCode",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceFileHash",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceFileName",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BomQuantity",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BomQuantityText",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Material",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Remark",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceRow",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceSequence",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceSheet",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Specification",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TotalWeight",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TotalWeightText",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UnitWeight",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UnitWeightText",
|
||||
table: "ProductionNodes");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "PlannedStart",
|
||||
table: "ProductionOrders",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime2",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "PlannedEnd",
|
||||
table: "ProductionOrders",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime2",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "PlannedStart",
|
||||
table: "ProductionNodes",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime2",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "PlannedEnd",
|
||||
table: "ProductionNodes",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime2",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+651
@@ -0,0 +1,651 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using DongfangHydro.Dashboard.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DongfangHydro.Dashboard.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DashboardDbContext))]
|
||||
[Migration("20260710103033_AllowRepeatedWorkOrderCodes")]
|
||||
partial class AllowRepeatedWorkOrderCodes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.20")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.MaterialQuota", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Brand")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<decimal?>("ConsumptionQuota")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ConsumptionQuotaText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("MaterialCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("MaterialName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<decimal?>("NetWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("NetWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<decimal?>("Quantity")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("QuantityText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Remark")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("SourceRow")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceSequence")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("SourceSheet")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("Specification")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("Unit")
|
||||
.IsRequired()
|
||||
.HasMaxLength(24)
|
||||
.HasColumnType("nvarchar(24)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "Category", "MaterialCode");
|
||||
|
||||
b.HasIndex("OrderId", "SourceSheet", "SourceRow")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MaterialQuotas", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.Partner", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("ContactName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("ContactPhone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("PartnerType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Partners", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionLine", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ProductionLines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("ActualEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("ActualStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<decimal?>("BomQuantity")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("BomQuantityText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<int>("CompletedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DefectQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DelayDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DelayReason")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Material")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("MaterialCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("NodeType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("OperationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<Guid?>("ParentNodeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("PlannedEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("PlannedStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Progress")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Remark")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("RequiredQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<byte[]>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("rowversion");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SourceRow")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceSequence")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("SourceSheet")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("Specification")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("StationName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("SupplyType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<decimal?>("TotalWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("TotalWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<decimal?>("UnitWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnitWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("Vendor")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("VisualKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "ParentNodeId", "SortOrder");
|
||||
|
||||
b.HasIndex("OrderId", "NodeType", "RiskLevel", "Status");
|
||||
|
||||
b.ToTable("ProductionNodes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("BatchQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<int>("CompletedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<double>("DailyDelta")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("DataSource")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<int>("DelayDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DrawingProductName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ImportedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<Guid?>("LineId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("LineName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<double>("PlanAchievement")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime?>("PlannedEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("PlannedStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<int>("Progress")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ProjectName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<int>("RequiredQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<byte[]>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("rowversion");
|
||||
|
||||
b.Property<string>("SourceDocumentCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("SourceFileHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("nvarchar(64)");
|
||||
|
||||
b.Property<string>("SourceFileName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(260)
|
||||
.HasColumnType("nvarchar(260)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("ThumbnailKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code");
|
||||
|
||||
b.HasIndex("LineId");
|
||||
|
||||
b.HasIndex("SourceDocumentCode")
|
||||
.IsUnique()
|
||||
.HasFilter("[SourceDocumentCode] <> ''");
|
||||
|
||||
b.HasIndex("Status", "RiskLevel", "PlannedEnd");
|
||||
|
||||
b.ToTable("ProductionOrders", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<double>("Achievement")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ActualQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Completion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("PlannedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Risk")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("SampleTime")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "SampleTime")
|
||||
.IsDescending(false, true);
|
||||
|
||||
b.ToTable("ProductionTrendPoints", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("HandlingStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<Guid>("NodeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("NodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<DateTimeOffset>("OccurredAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "NodeId");
|
||||
|
||||
b.HasIndex("OrderId", "OccurredAt")
|
||||
.IsDescending(false, true);
|
||||
|
||||
b.ToTable("RiskEvents", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.MaterialQuota", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId", "ParentNodeId")
|
||||
.HasPrincipalKey("OrderId", "Id")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionLine", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("LineId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId", "NodeId")
|
||||
.HasPrincipalKey("OrderId", "Id")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DongfangHydro.Dashboard.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AllowRepeatedWorkOrderCodes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ProductionOrders_Code",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionOrders_Code",
|
||||
table: "ProductionOrders",
|
||||
column: "Code");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ProductionOrders_Code",
|
||||
table: "ProductionOrders");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionOrders_Code",
|
||||
table: "ProductionOrders",
|
||||
column: "Code",
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+648
@@ -0,0 +1,648 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using DongfangHydro.Dashboard.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DongfangHydro.Dashboard.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DashboardDbContext))]
|
||||
partial class DashboardDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.20")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.MaterialQuota", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Brand")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<decimal?>("ConsumptionQuota")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("ConsumptionQuotaText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("MaterialCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("MaterialName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<decimal?>("NetWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("NetWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<decimal?>("Quantity")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("QuantityText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Remark")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("SourceRow")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceSequence")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("SourceSheet")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("Specification")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("Unit")
|
||||
.IsRequired()
|
||||
.HasMaxLength(24)
|
||||
.HasColumnType("nvarchar(24)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "Category", "MaterialCode");
|
||||
|
||||
b.HasIndex("OrderId", "SourceSheet", "SourceRow")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MaterialQuotas", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.Partner", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("ContactName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("ContactPhone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("PartnerType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Partners", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionLine", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ProductionLines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("ActualEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("ActualStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<decimal?>("BomQuantity")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("BomQuantityText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<int>("CompletedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DefectQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DelayDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DelayReason")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Material")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("MaterialCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("NodeType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("OperationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<Guid?>("ParentNodeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("PlannedEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("PlannedStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Progress")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Remark")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<int>("RequiredQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<byte[]>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("rowversion");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SourceRow")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceSequence")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("SourceSheet")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<string>("Specification")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<string>("StationName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("SupplyType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<decimal?>("TotalWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("TotalWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<decimal?>("UnitWeight")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("UnitWeightText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("Vendor")
|
||||
.IsRequired()
|
||||
.HasMaxLength(120)
|
||||
.HasColumnType("nvarchar(120)");
|
||||
|
||||
b.Property<string>("VisualKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "ParentNodeId", "SortOrder");
|
||||
|
||||
b.HasIndex("OrderId", "NodeType", "RiskLevel", "Status");
|
||||
|
||||
b.ToTable("ProductionNodes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("BatchQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<int>("CompletedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<double>("DailyDelta")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("DataSource")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<int>("DelayDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DrawingProductName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ImportedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<Guid?>("LineId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("LineName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<double>("PlanAchievement")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime?>("PlannedEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("PlannedStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<int>("Progress")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ProjectName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<int>("RequiredQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<byte[]>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("rowversion");
|
||||
|
||||
b.Property<string>("SourceDocumentCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(80)
|
||||
.HasColumnType("nvarchar(80)");
|
||||
|
||||
b.Property<string>("SourceFileHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("nvarchar(64)");
|
||||
|
||||
b.Property<string>("SourceFileName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(260)
|
||||
.HasColumnType("nvarchar(260)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("ThumbnailKey")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code");
|
||||
|
||||
b.HasIndex("LineId");
|
||||
|
||||
b.HasIndex("SourceDocumentCode")
|
||||
.IsUnique()
|
||||
.HasFilter("[SourceDocumentCode] <> ''");
|
||||
|
||||
b.HasIndex("Status", "RiskLevel", "PlannedEnd");
|
||||
|
||||
b.ToTable("ProductionOrders", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<double>("Achievement")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ActualQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Completion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("PlannedQty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Risk")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTimeOffset>("SampleTime")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "SampleTime")
|
||||
.IsDescending(false, true);
|
||||
|
||||
b.ToTable("ProductionTrendPoints", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("HandlingStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<Guid>("NodeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("NodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(240)
|
||||
.HasColumnType("nvarchar(240)");
|
||||
|
||||
b.Property<DateTimeOffset>("OccurredAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("OrderCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("nvarchar(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId", "NodeId");
|
||||
|
||||
b.HasIndex("OrderId", "OccurredAt")
|
||||
.IsDescending(false, true);
|
||||
|
||||
b.ToTable("RiskEvents", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.MaterialQuota", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionNode", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId", "ParentNodeId")
|
||||
.HasPrincipalKey("OrderId", "Id")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionLine", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("LineId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.ProductionTrendPoint", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DongfangHydro.Dashboard.Api.Domain.RiskEvent", b =>
|
||||
{
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionOrder", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DongfangHydro.Dashboard.Api.Domain.ProductionNode", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId", "NodeId")
|
||||
.HasPrincipalKey("OrderId", "Id")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
IF OBJECT_ID(N'[__EFMigrationsHistory]') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [__EFMigrationsHistory] (
|
||||
[MigrationId] nvarchar(150) NOT NULL,
|
||||
[ProductVersion] nvarchar(32) NOT NULL,
|
||||
CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId])
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [Partners] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[Code] nvarchar(40) NOT NULL,
|
||||
[Name] nvarchar(120) NOT NULL,
|
||||
[PartnerType] nvarchar(32) NOT NULL,
|
||||
[ContactName] nvarchar(80) NOT NULL,
|
||||
[ContactPhone] nvarchar(32) NOT NULL,
|
||||
CONSTRAINT [PK_Partners] PRIMARY KEY ([Id])
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [ProductionLines] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[Code] nvarchar(40) NOT NULL,
|
||||
[Name] nvarchar(80) NOT NULL,
|
||||
[Owner] nvarchar(80) NOT NULL,
|
||||
[IsActive] bit NOT NULL,
|
||||
CONSTRAINT [PK_ProductionLines] PRIMARY KEY ([Id])
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [ProductionOrders] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[Code] nvarchar(40) NOT NULL,
|
||||
[ProductName] nvarchar(200) NOT NULL,
|
||||
[BatchQty] int NOT NULL,
|
||||
[RequiredQty] int NOT NULL,
|
||||
[CompletedQty] int NOT NULL,
|
||||
[Progress] int NOT NULL,
|
||||
[Status] nvarchar(32) NOT NULL,
|
||||
[RiskLevel] nvarchar(32) NOT NULL,
|
||||
[DelayDays] int NOT NULL,
|
||||
[PlannedStart] datetime2 NOT NULL,
|
||||
[PlannedEnd] datetime2 NOT NULL,
|
||||
[LineId] uniqueidentifier NULL,
|
||||
[LineName] nvarchar(80) NOT NULL,
|
||||
[Owner] nvarchar(80) NOT NULL,
|
||||
[PlanAchievement] float NOT NULL,
|
||||
[DailyDelta] float NOT NULL,
|
||||
[ThumbnailKey] nvarchar(40) NOT NULL,
|
||||
[CreatedAt] datetimeoffset NOT NULL,
|
||||
[UpdatedAt] datetimeoffset NOT NULL,
|
||||
[RowVersion] rowversion NOT NULL,
|
||||
CONSTRAINT [PK_ProductionOrders] PRIMARY KEY ([Id]),
|
||||
CONSTRAINT [FK_ProductionOrders_ProductionLines_LineId] FOREIGN KEY ([LineId]) REFERENCES [ProductionLines] ([Id]) ON DELETE SET NULL
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [ProductionNodes] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[OrderId] uniqueidentifier NOT NULL,
|
||||
[ParentNodeId] uniqueidentifier NULL,
|
||||
[Code] nvarchar(60) NOT NULL,
|
||||
[OperationCode] nvarchar(60) NOT NULL,
|
||||
[MaterialCode] nvarchar(80) NOT NULL,
|
||||
[Name] nvarchar(240) NOT NULL,
|
||||
[Level] int NOT NULL,
|
||||
[NodeType] nvarchar(32) NOT NULL,
|
||||
[SupplyType] nvarchar(32) NOT NULL,
|
||||
[RequiredQty] int NOT NULL,
|
||||
[CompletedQty] int NOT NULL,
|
||||
[DefectQty] int NOT NULL,
|
||||
[Progress] int NOT NULL,
|
||||
[Status] nvarchar(32) NOT NULL,
|
||||
[RiskLevel] nvarchar(32) NOT NULL,
|
||||
[DelayDays] int NOT NULL,
|
||||
[DelayReason] nvarchar(500) NOT NULL,
|
||||
[PlannedStart] datetime2 NOT NULL,
|
||||
[PlannedEnd] datetime2 NOT NULL,
|
||||
[ActualStart] datetime2 NULL,
|
||||
[ActualEnd] datetime2 NULL,
|
||||
[Owner] nvarchar(100) NOT NULL,
|
||||
[Vendor] nvarchar(120) NOT NULL,
|
||||
[StationName] nvarchar(120) NOT NULL,
|
||||
[VisualKey] nvarchar(40) NOT NULL,
|
||||
[SortOrder] int NOT NULL,
|
||||
[UpdatedAt] datetimeoffset NOT NULL,
|
||||
[RowVersion] rowversion NOT NULL,
|
||||
CONSTRAINT [PK_ProductionNodes] PRIMARY KEY ([Id]),
|
||||
CONSTRAINT [AK_ProductionNodes_OrderId_Id] UNIQUE ([OrderId], [Id]),
|
||||
CONSTRAINT [FK_ProductionNodes_ProductionNodes_OrderId_ParentNodeId] FOREIGN KEY ([OrderId], [ParentNodeId]) REFERENCES [ProductionNodes] ([OrderId], [Id]) ON DELETE NO ACTION,
|
||||
CONSTRAINT [FK_ProductionNodes_ProductionOrders_OrderId] FOREIGN KEY ([OrderId]) REFERENCES [ProductionOrders] ([Id]) ON DELETE CASCADE
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [ProductionTrendPoints] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[OrderId] uniqueidentifier NOT NULL,
|
||||
[SampleTime] datetimeoffset NOT NULL,
|
||||
[Completion] int NOT NULL,
|
||||
[Risk] int NOT NULL,
|
||||
[PlannedQty] int NOT NULL,
|
||||
[ActualQty] int NOT NULL,
|
||||
[Achievement] float NOT NULL,
|
||||
CONSTRAINT [PK_ProductionTrendPoints] PRIMARY KEY ([Id]),
|
||||
CONSTRAINT [FK_ProductionTrendPoints_ProductionOrders_OrderId] FOREIGN KEY ([OrderId]) REFERENCES [ProductionOrders] ([Id]) ON DELETE CASCADE
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [RiskEvents] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[OrderId] uniqueidentifier NOT NULL,
|
||||
[NodeId] uniqueidentifier NOT NULL,
|
||||
[OrderCode] nvarchar(40) NOT NULL,
|
||||
[NodeName] nvarchar(240) NOT NULL,
|
||||
[RiskLevel] nvarchar(32) NOT NULL,
|
||||
[Message] nvarchar(500) NOT NULL,
|
||||
[HandlingStatus] nvarchar(32) NOT NULL,
|
||||
[OccurredAt] datetimeoffset NOT NULL,
|
||||
CONSTRAINT [PK_RiskEvents] PRIMARY KEY ([Id]),
|
||||
CONSTRAINT [FK_RiskEvents_ProductionNodes_OrderId_NodeId] FOREIGN KEY ([OrderId], [NodeId]) REFERENCES [ProductionNodes] ([OrderId], [Id]),
|
||||
CONSTRAINT [FK_RiskEvents_ProductionOrders_OrderId] FOREIGN KEY ([OrderId]) REFERENCES [ProductionOrders] ([Id]) ON DELETE CASCADE
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE UNIQUE INDEX [IX_Partners_Code] ON [Partners] ([Code]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE UNIQUE INDEX [IX_ProductionLines_Code] ON [ProductionLines] ([Code]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_ProductionNodes_OrderId_NodeType_RiskLevel_Status] ON [ProductionNodes] ([OrderId], [NodeType], [RiskLevel], [Status]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_ProductionNodes_OrderId_ParentNodeId_SortOrder] ON [ProductionNodes] ([OrderId], [ParentNodeId], [SortOrder]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE UNIQUE INDEX [IX_ProductionOrders_Code] ON [ProductionOrders] ([Code]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_ProductionOrders_LineId] ON [ProductionOrders] ([LineId]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_ProductionOrders_Status_RiskLevel_PlannedEnd] ON [ProductionOrders] ([Status], [RiskLevel], [PlannedEnd]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_ProductionTrendPoints_OrderId_SampleTime] ON [ProductionTrendPoints] ([OrderId], [SampleTime] DESC);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_RiskEvents_OrderId_NodeId] ON [RiskEvents] ([OrderId], [NodeId]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_RiskEvents_OrderId_OccurredAt] ON [RiskEvents] ([OrderId], [OccurredAt] DESC);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260710025438_InitialCreate'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260710025438_InitialCreate', N'8.0.20');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
Reference in New Issue
Block a user