From c2e21cdcae62cda630fed284ee38e2535443005f Mon Sep 17 00:00:00 2001 From: syc_zhaoqianyan Date: Tue, 24 Jun 2025 18:56:25 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=9B=B4=E6=96=B0=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ProduceService.cs | 9 +++++++-- .../BasicDbContextModelCreatingExtensions.cs | 6 ++++++ .../EntityFrameworkCore/WMSDbContext.cs | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/services/Syc.Basic.Web.WMS.Application/Service/ProduceService.cs b/services/Syc.Basic.Web.WMS.Application/Service/ProduceService.cs index 1189514..cb06f46 100644 --- a/services/Syc.Basic.Web.WMS.Application/Service/ProduceService.cs +++ b/services/Syc.Basic.Web.WMS.Application/Service/ProduceService.cs @@ -58,10 +58,15 @@ namespace Syc.Basic.Web.WMS.Service [HttpPost] public async Task InsertProduce(ProduceDto input) { - foreach (var item in await produceRepository.GetListAsync()) + var produces = await produceRepository.GetListAsync(); + if (produces.Count > 0) { - item.IfUse = 0; + foreach (var item in produces) + { + item.IfUse = 0; + } } + var produce = new Produce() { diff --git a/services/Syc.Basic.Web.WMS.EntityFrameworkCore/EntityFrameworkCore/BasicDbContextModelCreatingExtensions.cs b/services/Syc.Basic.Web.WMS.EntityFrameworkCore/EntityFrameworkCore/BasicDbContextModelCreatingExtensions.cs index f049820..e25d35f 100644 --- a/services/Syc.Basic.Web.WMS.EntityFrameworkCore/EntityFrameworkCore/BasicDbContextModelCreatingExtensions.cs +++ b/services/Syc.Basic.Web.WMS.EntityFrameworkCore/EntityFrameworkCore/BasicDbContextModelCreatingExtensions.cs @@ -174,6 +174,12 @@ namespace Syc.Basic.Web.EntityFrameworkCore b.ConfigureByConvention(); }); + modelBuilder.Entity(b => + { + b.ToTable(nameof(Produce)); + b.ConfigureByConvention(); + }); + return modelBuilder; } } diff --git a/services/Syc.Basic.Web.WMS.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs b/services/Syc.Basic.Web.WMS.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs index 4afd86e..10d5039 100644 --- a/services/Syc.Basic.Web.WMS.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs +++ b/services/Syc.Basic.Web.WMS.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs @@ -76,7 +76,12 @@ public class WMSDbContext : /// 料箱 /// public virtual DbSet Boxs { get; set; } + /// + /// 丝锭 + /// public virtual DbSet Silk { get; set; } + //生产 + public virtual DbSet Produce { get; set; } protected override void OnModelCreating(ModelBuilder builder)