修复bug
This commit is contained in:
@@ -47,24 +47,19 @@ namespace WMS.Web.Domain.Services
|
||||
public async Task<Result> Save(SaveOutStockRequest dto, LoginInDto loginInfo)
|
||||
{
|
||||
var outStockTask = await _outStockTaskRepositories.Get(dto.TaskId);
|
||||
OutStock entity = await _outStockRepositories.GetByTaskId(dto.TaskId);
|
||||
//OutStock entity = await _outStockRepositories.GetByTaskId(dto.TaskId);
|
||||
|
||||
if (entity == null)
|
||||
entity = new OutStock();
|
||||
OutStock entity = new OutStock();
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask.Id, outStockTask.Type);
|
||||
foreach (var d in dto.Details)
|
||||
{
|
||||
//任务单明细
|
||||
var tDetail = outStockTask.Details.FirstOrDefault(f => f.MaterialId == d.MaterialId);
|
||||
if (tDetail == null) continue;
|
||||
//出库单明细
|
||||
OutStockDetails outd = entity.Details.FirstOrDefault(f => f.MaterialId == d.MaterialId);
|
||||
if (outd == null)
|
||||
{
|
||||
outd = _mapper.Map<OutStockDetails>(tDetail);
|
||||
entity.Details.Add(outd);
|
||||
}
|
||||
var outd = _mapper.Map<OutStockDetails>(tDetail);
|
||||
|
||||
outd.Qty = outd.Qty + d.Qty;
|
||||
entity.Details.Add(outd);
|
||||
}
|
||||
|
||||
//需要填写序列号
|
||||
@@ -74,9 +69,6 @@ namespace WMS.Web.Domain.Services
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
if (entity.Id > 0)
|
||||
entity = await _outStockRepositories.Edit(entity, false);
|
||||
else
|
||||
entity = await _outStockRepositories.Add(entity, false);
|
||||
|
||||
if (entity == null) isRollback = true;
|
||||
|
||||
Reference in New Issue
Block a user