优化接口
This commit is contained in:
@@ -59,6 +59,18 @@ namespace WMS.Web.Repositories
|
||||
return entitys;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 集合:根据boxIDS
|
||||
/// </summary>
|
||||
/// <param name="boxIds"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<InStockTaskBox>> GetListBy(List<int> boxIds)
|
||||
{
|
||||
var entitys = await _context.InstockTaskBox
|
||||
.Include(s => s.Details).Where(x => boxIds.Contains(x.BoxId)).ToListAsync();
|
||||
return entitys;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 集合:根据箱号集合
|
||||
/// </summary>
|
||||
@@ -112,5 +124,34 @@ namespace WMS.Web.Repositories
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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.InstockTaskBox.Include(x => x.Details)
|
||||
.Where(f => ids.Contains(f.Id)).ToListAsync();
|
||||
_context.InstockTaskBox.RemoveRange(list);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user