根据出库任务单获取出库任务信息
This commit is contained in:
@@ -169,6 +169,42 @@ namespace WMS.Web.Repositories
|
||||
return res.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OutStockTask> Edit(OutStockTask entity, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
var res = await _context.OutStockTask
|
||||
.Include(s => s.Details)
|
||||
.FirstOrDefaultAsync(f => f.Id == entity.Id);
|
||||
if (res == null) return null;
|
||||
|
||||
_mapper.Map(entity, res);
|
||||
_mapper.ToMapList(entity.Details, res.Details);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
@@ -224,5 +260,18 @@ namespace WMS.Web.Repositories
|
||||
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
return (list, total);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据订单号获取订单信息
|
||||
/// </summary>
|
||||
/// <param name="billNo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<GetOutStockTaskByNoResponse> GetOutStockTaskByNo(string billNo)
|
||||
{
|
||||
var entity = await _context.OutStockTask.Include(x => x.Details).FirstOrDefaultAsync(f => billNo.Equals(f.BillNo));
|
||||
var response = _mapper.Map<GetOutStockTaskByNoResponse>(entity);
|
||||
//获取物料信息 显示物料三件套
|
||||
var mIds = entity.Details.Select(s => s.MaterialId).ToList();
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user