数据库映射

This commit is contained in:
18942506660
2023-10-26 13:54:40 +08:00
parent 9c890c219d
commit 8946d2d3af

View File

@@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging.Debug;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using WMS.Web.Domain.Entitys;
using WMS.Web.Repositories.Configuration.Log; using WMS.Web.Repositories.Configuration.Log;
namespace WMS.Web.Repositories.Configuration namespace WMS.Web.Repositories.Configuration
@@ -29,6 +30,79 @@ namespace WMS.Web.Repositories.Configuration
protected override void OnModelCreating(ModelBuilder builder) protected override void OnModelCreating(ModelBuilder builder)
{ {
base.OnModelCreating(builder); base.OnModelCreating(builder);
}
//改箱
builder.Entity<ChangeBoxRecord>(ent =>
{
ent.ToTable("t_wms_changebox_record");
ent.HasKey(x => x.Id);
});
//移箱
builder.Entity<MoveBoxRecord>(ent =>
{
ent.ToTable("t_wms_movebox_record");
ent.HasKey(x => x.Id);
});
#region
builder.Entity<OutStock>(ent =>
{
ent.ToTable("t_wms_outstock");
ent.HasKey(x => x.Id);
ent.HasMany(p => p.Details)
.WithOne()
.HasForeignKey(p => p.OutStockId)
.OnDelete(DeleteBehavior.Cascade);
});
builder.Entity<OutStockDetails>(ent =>
{
ent.ToTable("t_wms_outstock_details");
ent.HasKey(x => x.Id);
});
#endregion
#region
builder.Entity<OutStockTask>(ent =>
{
ent.ToTable("t_erp_outstock_task");
ent.HasKey(x => x.Id);
ent.HasMany(p => p.Details)
.WithOne()
.HasForeignKey(p => p.OutStockTaskId)
.OnDelete(DeleteBehavior.Cascade);
});
builder.Entity<OutStockTaskDetails>(ent =>
{
ent.ToTable("t_erp_outstock_task_details");
ent.HasKey(x => x.Id);
});
#endregion
#region
builder.Entity<TakeStock>(ent =>
{
ent.ToTable("t_wms_takestock");
ent.HasKey(x => x.Id);
ent.HasMany(p => p.Details)
.WithOne()
.HasForeignKey(p => p.TakeStockId)
.OnDelete(DeleteBehavior.Cascade);
});
builder.Entity<TakeStockDetails>(ent =>
{
ent.ToTable("t_wms_takestock_details");
ent.HasKey(x => x.Id);
});
#endregion
}
public DbSet<ChangeBoxRecord> ChangeBoxRecord { get; set; }
public DbSet<MoveBoxRecord> MoveBoxRecord { get; set; }
public DbSet<OutStock> OutStock { get; set; }
public DbSet<OutStockTask> OutStockTask { get; set; }
public DbSet<TakeStock> TakeStock { get; set; }
} }
} }