From 8946d2d3af3f75b5355c1e4e62663bd3819de385 Mon Sep 17 00:00:00 2001 From: 18942506660 <18942506660@A18942506660> Date: Thu, 26 Oct 2023 13:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Configuration/RepositoryDbContext.cs | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs index 3a8ca3cf..e039c067 100644 --- a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs +++ b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging.Debug; using System; using System.Collections.Generic; using System.Text; +using WMS.Web.Domain.Entitys; using WMS.Web.Repositories.Configuration.Log; namespace WMS.Web.Repositories.Configuration @@ -29,6 +30,79 @@ namespace WMS.Web.Repositories.Configuration protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); + + //改箱 + builder.Entity(ent => + { + ent.ToTable("t_wms_changebox_record"); + ent.HasKey(x => x.Id); + }); + //移箱 + builder.Entity(ent => + { + ent.ToTable("t_wms_movebox_record"); + ent.HasKey(x => x.Id); + }); + + #region 出库单 + builder.Entity(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(ent => + { + ent.ToTable("t_wms_outstock_details"); + ent.HasKey(x => x.Id); + }); + #endregion + + #region 出库任务单 + builder.Entity(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(ent => + { + ent.ToTable("t_erp_outstock_task_details"); + ent.HasKey(x => x.Id); + }); + #endregion + + #region 盘点单 + builder.Entity(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(ent => + { + ent.ToTable("t_wms_takestock_details"); + ent.HasKey(x => x.Id); + }); + #endregion } + + public DbSet ChangeBoxRecord { get; set; } + public DbSet MoveBoxRecord { get; set; } + public DbSet OutStock { get; set; } + public DbSet OutStockTask { get; set; } + public DbSet TakeStock { get; set; } } }