改箱调整

This commit is contained in:
18942506660
2023-10-31 16:06:51 +08:00
parent 4e45383532
commit c1c3ec2928
12 changed files with 205 additions and 64 deletions

View File

@@ -71,6 +71,34 @@ namespace WMS.Web.Repositories
}
}
/// <summary>
/// 批量添加
/// </summary>
/// <param name="entity"></param>
/// <param name="isTransaction"></param>
/// <returns></returns>
public async Task<bool> AddRange(List<ChangeBoxRecord> list, bool isTransaction = true)
{
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _context.Database.BeginTransaction();
try
{
_context.ChangeBoxRecord.AddRange(list);
await _context.SaveChangesAsync();
if (_transaction != null)
_transaction.Commit();
return true;
}
catch (Exception ex)
{
if (_transaction != null)
_transaction.Rollback();
return false;
}
}
/// <summary>
/// 列表
/// </summary>
@@ -99,12 +127,12 @@ namespace WMS.Web.Repositories
query = query.Where(w => EF.Functions.Like(w.srcBox.BoxBillNo, "%" + dto.SrcBox + "%"));
if (!string.IsNullOrEmpty(dto.DestBox))
query = query.Where(w => EF.Functions.Like(w.destBox.BoxBillNo, "%" + dto.DestBox + "%"));
if (dto.StockId != null)
query = query.Where(w => w.changeBox.StockId == dto.StockId);
if (dto.SrcSubStockId != null)
query = query.Where(w => w.changeBox.SrcSubStockId == dto.SrcSubStockId);
if (dto.DestSubStockId != null)
query = query.Where(w => w.changeBox.DestSubStockId == dto.DestSubStockId);
//if (dto.StockId != null)
// query = query.Where(w => w.changeBox.StockId == dto.StockId);
//if (dto.SrcSubStockId != null)
// query = query.Where(w => w.changeBox.SrcSubStockId == dto.SrcSubStockId);
//if (dto.DestSubStockId != null)
// query = query.Where(w => w.changeBox.DestSubStockId == dto.DestSubStockId);
if (dto.CreateBeginDate != null)
query = query.Where(w => w.changeBox.CreateTime >= dto.CreateBeginDate);
if (dto.CreateEndDate != null)
@@ -117,12 +145,12 @@ namespace WMS.Web.Repositories
MaterialName = "",
MaterialNumber = "",
Specifications = "",
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.changeBox.StockId),
//Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.changeBox.StockId),
SerialNumbers = JsonConvert.SerializeObject(s.changeBox.SerialNumbers),
SrcBox = s.srcBox.BoxBillNo,
DestBox = s.destBox.BoxBillNo,
SrcSubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.changeBox.SrcSubStockId),
DestSubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.changeBox.DestSubStockId),
//SrcSubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.changeBox.SrcSubStockId),
//DestSubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.changeBox.DestSubStockId),
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.changeBox.CreatorId),
CreateTime = s.changeBox.CreateTime.DateToStringSeconds()
#endregion