修复bug
This commit is contained in:
@@ -127,7 +127,7 @@ namespace WMS.Web.Repositories
|
||||
|
||||
try
|
||||
{
|
||||
var res = await _context.TakeStock.Include(x=>x.Details)
|
||||
var res = await _context.TakeStock.Include(x => x.Details)
|
||||
.FirstOrDefaultAsync(f => f.Id == entity.Id);
|
||||
if (res == null) return null;
|
||||
|
||||
@@ -148,9 +148,37 @@ namespace WMS.Web.Repositories
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> EditEntityList(List<TakeStock> 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.TakeStock
|
||||
.Include(s => s.Details)
|
||||
.Where(f => list.Contains(f.Id)).ToListAsync();
|
||||
|
||||
_mapper.ToMapList(entitys, res);
|
||||
_mapper.ToMapList(entitys.SelectMany(s => s.Details).ToList(), res.SelectMany(s => s.Details).ToList());
|
||||
await _context.SaveChangesAsync();
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<List<TakeStock>> GetEntityList(List<int> ids)
|
||||
{
|
||||
var res = await _context.TakeStock.Include(x=>x.Details)
|
||||
var res = await _context.TakeStock.Include(x => x.Details)
|
||||
.Where(f => ids.Contains(f.Id))
|
||||
.ToListAsync();
|
||||
|
||||
@@ -213,7 +241,7 @@ namespace WMS.Web.Repositories
|
||||
Unit = _erpBasicDataExtendService.GetMaterialUnitName(materials, s.detail.MaterialId),
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, companyId, s.detail.StockCode + s.detail.OrgCode),
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, companyId, s.detail.SubStockId),
|
||||
Erp_SubStock= _erpBasicDataExtendService.GetSubStockName(subStocks, s.detail.Erp_SubStockCode),
|
||||
Erp_SubStock = _erpBasicDataExtendService.GetSubStockName(subStocks, s.detail.Erp_SubStockCode),
|
||||
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
|
||||
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
|
||||
@@ -222,7 +250,7 @@ namespace WMS.Web.Repositories
|
||||
FinalQty = s.detail.FinalQty,
|
||||
ResultType = s.order.ResultType.GetRemark(),
|
||||
Remark = s.detail.Remark,
|
||||
FailRemark=s.order.FailRemark,
|
||||
FailRemark = s.order.FailRemark,
|
||||
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId),
|
||||
Date = s.order.Date.DateToStringSeconds(),
|
||||
SuccessSync = s.order.SuccessSync == SyncStatus.Success ? "成功" : (s.order.SuccessSync == SyncStatus.SyncIng ? "同步中" : "失败"),
|
||||
@@ -234,7 +262,7 @@ namespace WMS.Web.Repositories
|
||||
|
||||
public async Task<(object obj, int total)> GetListField(TakeStockQueryRequest dto, int companyId)
|
||||
{
|
||||
return await GetListAsync(dto,companyId);
|
||||
return await GetListAsync(dto, companyId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user