增加重置箱接口

This commit is contained in:
18942506660
2024-05-15 15:17:02 +08:00
parent 5d31f820e0
commit e4dea40c01
8 changed files with 174 additions and 5 deletions

View File

@@ -379,5 +379,34 @@ namespace WMS.Web.Repositories
return _mapper.Map<List<SerialNumbers>>(res.Clone());
}
/// <summary>
/// 根据箱id批量删除
/// </summary>
/// <param name="boxIds"></param>
/// <param name="isTransaction"></param>
/// <returns></returns>
public async Task<bool> DeleteEntityList(List<int> boxIds, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
var res = await _context.SerialNumbers
.Where(f => boxIds.Contains(f.BoxId)).ToListAsync();
_context.SerialNumbers.RemoveRange(res);
await _context.SaveChangesAsync();
if (_transaction != null)
_transaction.Commit();
}
catch (Exception ex)
{
if (_transaction != null)
_transaction.Rollback();
return false;
}
return true;
}
}
}