修复bug

This commit is contained in:
18942506660
2023-12-09 14:51:10 +08:00
parent 8c414f7cd7
commit 5a617854d8
3 changed files with 11 additions and 5 deletions

View File

@@ -209,11 +209,13 @@ namespace WMS.Web.Repositories
var res = await _context.OutStock
.Include(s => s.Details).ThenInclude(s => s.ErpDetails)
.Include(s => s.Details).ThenInclude(s => s.BoxsDetails)
.Where(f => list.Contains(f.Id)).ToListAsync();
_mapper.ToMapList(entitys, res);
_mapper.ToMapList(entitys.SelectMany(s => s.Details).ToList(), res.SelectMany(s => s.Details).ToList());
_mapper.ToMapList(entitys.SelectMany(s => s.Details).SelectMany(s => s.ErpDetails).ToList(), res.SelectMany(s => s.Details).SelectMany(s => s.ErpDetails).ToList());
_mapper.ToMapList(entitys.SelectMany(s => s.Details).SelectMany(s => s.BoxsDetails).ToList(), res.SelectMany(s => s.Details).SelectMany(s => s.BoxsDetails).ToList());
await _context.SaveChangesAsync();
if (_transaction != null)
_transaction.Commit();
@@ -235,8 +237,8 @@ namespace WMS.Web.Repositories
public async Task<List<OutStock>> GetEntityList(List<int> ids)
{
var res = await _context.OutStock
.Include(s => s.Details)
.ThenInclude(s => s.ErpDetails)
.Include(s => s.Details).ThenInclude(s => s.ErpDetails)
.Include(s => s.Details).ThenInclude(s => s.BoxsDetails)
.Where(f => ids.Contains(f.Id))
.ToListAsync();
@@ -258,12 +260,14 @@ namespace WMS.Web.Repositories
{
var res = await _context.OutStock
.Include(s => s.Details).ThenInclude(s => s.ErpDetails)
.Include(s => s.Details).ThenInclude(s => s.BoxsDetails)
.FirstOrDefaultAsync(f => f.Id == entity.Id);
if (res == null) return null;
_mapper.Map(entity, res);
_mapper.ToMapList(entity.Details, res.Details);
_mapper.ToMapList(entity.Details.SelectMany(s => s.ErpDetails).ToList(), res.Details.SelectMany(s => s.ErpDetails).ToList());
_mapper.ToMapList(entity.Details.SelectMany(s => s.BoxsDetails).ToList(), res.Details.SelectMany(s => s.BoxsDetails).ToList());
await _context.SaveChangesAsync();
if (_transaction != null)
@@ -287,6 +291,7 @@ namespace WMS.Web.Repositories
{
var res = await _context.OutStock
.Include(s => s.Details).ThenInclude(s => s.ErpDetails)
.Include(s => s.Details).ThenInclude(s => s.BoxsDetails)
.FirstOrDefaultAsync(f => taskId == f.TaskId);
return res.Clone();