入库任务-仓储
This commit is contained in:
@@ -330,6 +330,12 @@
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.InStockTask.MakeBillNo(System.Int32)">
|
||||
<summary>
|
||||
创建订单号
|
||||
</summary>
|
||||
<param name="newId"></param>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Entitys.InStockTaskDetails">
|
||||
<summary>
|
||||
erp入库任务明细表
|
||||
@@ -861,6 +867,38 @@
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.AddRange(System.Collections.Generic.List{WMS.Web.Domain.Entitys.InStockTask},System.Boolean)">
|
||||
<summary>
|
||||
批量添加
|
||||
</summary>
|
||||
<param name="entitys"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.Add(WMS.Web.Domain.Entitys.InStockTask,System.Boolean)">
|
||||
<summary>
|
||||
添加
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.UpdateRange(System.Collections.Generic.List{WMS.Web.Domain.Entitys.InStockTask},System.Boolean)">
|
||||
<summary>
|
||||
批量修改
|
||||
</summary>
|
||||
<param name="entitys"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.Update(WMS.Web.Domain.Entitys.InStockTask,System.Boolean)">
|
||||
<summary>
|
||||
修改
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.ITransactionRepositories.GetTransaction">
|
||||
<summary>
|
||||
获取事务 用来处理即时库存
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
@@ -18,5 +19,37 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
Task<ResultPagedList<InStockTaskQueryResponse>> GetPagedList(InStockTaskQueryRequest dto);
|
||||
|
||||
/// <summary>
|
||||
/// 批量添加
|
||||
/// </summary>
|
||||
/// <param name="entitys"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddRange(List<InStockTask> entitys, bool isTransaction = true);
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<InStockTask> Add(InStockTask entity, bool isTransaction = true);
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改
|
||||
/// </summary>
|
||||
/// <param name="entitys"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> UpdateRange(List<InStockTask> entitys, bool isTransaction = true);
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<InStockTask> Update(InStockTask entity, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,5 +146,67 @@ namespace WMS.Web.Repositories
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改
|
||||
/// </summary>
|
||||
/// <param name="entitys"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> UpdateRange(List<InStockTask> 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.InStockTask.Include(x => x.Details).Where(f => list.Contains(f.Id)).ToListAsync();
|
||||
_mapper.Map(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="dto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<InStockTask> Update(InStockTask entity,bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var model = await _context.InStockTask
|
||||
.AsNoTracking()
|
||||
.Include(s => s.Details)
|
||||
.FirstOrDefaultAsync(f => f.Id == entity.Id);
|
||||
if (model == null)
|
||||
return null;
|
||||
_mapper.Map(entity, model);
|
||||
await _context.SaveChangesAsync();
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
return model;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user