出入库回退增加备注

This commit is contained in:
18942506660
2024-07-27 10:31:57 +08:00
parent a28c882307
commit 16d067fa94
11 changed files with 150 additions and 11 deletions

View File

@@ -15,6 +15,7 @@ using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Mappers;
using WMS.Web.Domain.Values.Single;
using WMS.Web.Repositories.Configuration;
@@ -122,6 +123,7 @@ namespace WMS.Web.Repositories
Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, companyId, s.order.StockCode + s.order.OrgCode),
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocksJoinOrgCode, companyId, s.order.SubStockCode + s.order.StockCode + s.order.OrgCode),
SerialNumbers = (string.Join(",", s.detail.SerialNumbers)).TrimEnd(','),
Remark=s.detail.Remark
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
return (list,total);
@@ -171,5 +173,42 @@ namespace WMS.Web.Repositories
{
return await GetPagedList(dto,companyId);
}
public async Task<BackRecord> Edit(BackRecord entity, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
var res = await _context.BackRecord
.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 ex)
{
if (_transaction != null)
_transaction.Rollback();
return null;
}
}
public async Task<BackRecord> GetEntity(int id)
{
return await _context.BackRecord.AsNoTracking()
.Include(s => s.Details)
.Where(f => id == f.Id).FirstOrDefaultAsync();
}
}
}