调整接口
This commit is contained in:
@@ -19,6 +19,8 @@ using WMS.Web.Core.Dto.OutStockTask;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Core;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using WMS.Web.Domain.Mappers;
|
||||
using WMS.Web.Core.Help;
|
||||
|
||||
namespace WMS.Web.Repositories
|
||||
{
|
||||
@@ -173,5 +175,50 @@ namespace WMS.Web.Repositories
|
||||
var (list, count, qty) = await GetListAsync(dto, companyId);
|
||||
return (list, count);
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量修改
|
||||
/// </summary>
|
||||
/// <param name="entitys"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> EditEntityList(List<ProductInventory> entitys, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
List<int> list = entitys.Select(s => s.Id).ToList();
|
||||
|
||||
var res = await _context.ProductInventory
|
||||
.Where(f => list.Contains(f.Id)).ToListAsync();
|
||||
|
||||
_mapper.ToMapList(entitys, res);
|
||||
await _context.SaveChangesAsync();
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取数据
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProductInventory>> GetEntityList(ProductInventoryType type)
|
||||
{
|
||||
var res = await _context.ProductInventory
|
||||
.Where(f => f.Type==type)
|
||||
.ToListAsync();
|
||||
|
||||
return res.Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user