箱库存-处理

This commit is contained in:
tongfei
2023-11-14 16:30:16 +08:00
parent 3f22b2b9a7
commit d3e7027adb
6 changed files with 115 additions and 14 deletions

View File

@@ -207,5 +207,34 @@ namespace WMS.Web.Repositories
return true;
}
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<bool> DeleteRange(List<int> ids, bool isTransaction = false)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
var list = await _context.BoxInventory.Include(x => x.Details)
.Where(f => ids.Contains(f.Id)).ToListAsync();
_context.BoxInventory.RemoveRange(list);
await _context.SaveChangesAsync();
if (_transaction != null)
_transaction.Commit();
}
catch (Exception ex)
{
if (_transaction != null)
_transaction.Rollback();
return false;
}
return true;
}
}
}