diff --git a/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 b/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 index 36025320..3e87cec1 100644 Binary files a/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 and b/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 differ diff --git a/src/WMS.Web.Api/Controllers/TestController.cs b/src/WMS.Web.Api/Controllers/TestController.cs index cb35eef8..9aa805ae 100644 --- a/src/WMS.Web.Api/Controllers/TestController.cs +++ b/src/WMS.Web.Api/Controllers/TestController.cs @@ -88,6 +88,9 @@ namespace WMS.Web.Api.Controllers [Route("hj")] public async Task TestHJ() { + // List boxIds = new List(); + // boxIds.Add(5324); + //var b= await _inStockService.UnBind(boxIds, true); //var b= await _boxService.Sync(null); //var list = await _outStockTaskRepositories.GetEntityList(new List { 14321 }); diff --git a/src/WMS.Web.Domain/Infrastructure/IInStockRepositories.cs b/src/WMS.Web.Domain/Infrastructure/IInStockRepositories.cs index bc297b81..f65f15eb 100644 --- a/src/WMS.Web.Domain/Infrastructure/IInStockRepositories.cs +++ b/src/WMS.Web.Domain/Infrastructure/IInStockRepositories.cs @@ -134,6 +134,6 @@ namespace WMS.Web.Domain.Infrastructure /// /// /// - Task> GetListBy(List boxIds); + Task> GetListBy(List boxIds); } } diff --git a/src/WMS.Web.Domain/Services/InStockService.cs b/src/WMS.Web.Domain/Services/InStockService.cs index de3b4c12..ba280431 100644 --- a/src/WMS.Web.Domain/Services/InStockService.cs +++ b/src/WMS.Web.Domain/Services/InStockService.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Newtonsoft.Json; +using Npoi.Mapper; using StackExchange.Redis; using System; using System.Collections.Concurrent; @@ -1135,8 +1136,10 @@ namespace WMS.Web.Domain.Services var list = await _inStockRepositories.GetListBy(t_boxIds); //解绑 - list.ForEach(x => { x.UnBind = true; }); - + list.SelectMany(s => s.Details) + .Where(w => t_boxIds.Contains(w.BoxId)) + .ForEach(f => f.UnBind = true); + if (list.Count != 0) { var isSuccess = await _inStockRepositories.UpdateRange(list, isTransaction); diff --git a/src/WMS.Web.Repositories/InStockRepositories.cs b/src/WMS.Web.Repositories/InStockRepositories.cs index 0ab1e313..5eba7399 100644 --- a/src/WMS.Web.Repositories/InStockRepositories.cs +++ b/src/WMS.Web.Repositories/InStockRepositories.cs @@ -1,6 +1,7 @@ using AutoMapper; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; +using Org.BouncyCastle.Crypto; using System; using System.Collections.Generic; using System.Linq; @@ -113,7 +114,7 @@ namespace WMS.Web.Repositories /// public async Task<(object obj, int total)> GetListField(InStockQueryRequest dto, int companyId) { - var res= await GetPagedList(dto, companyId); + var res = await GetPagedList(dto, companyId); return (res.list, res.total); } @@ -502,12 +503,15 @@ namespace WMS.Web.Repositories .Where(x => boxIds.Contains(x.detail.BoxId) && x.order.Type != InstockType.Purchase && (x.detail.UnBind == null || x.detail.UnBind == false)).Select(s => s.detail.BoxId).ToListAsync(); } - public async Task> GetListBy(List boxIds) + public async Task> GetListBy(List boxIds) { - var entitys = await _context.InStockDetails.AsNoTracking() - .Where(x => boxIds.Contains(x.BoxId) && (x.UnBind == null || x.UnBind == false)) + var res = await _context.Instock + .Include(s => s.Details) + .Include(s => s.ErpDetails) + .Where(f => f.Details.Where(w => boxIds.Contains(w.BoxId)).Count() > 0) .ToListAsync(); - return entitys; + + return res.Clone(); } } }