Merge branch 'v1.0.5' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api into v1.0.5
This commit is contained in:
@@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
@@ -373,5 +374,41 @@ namespace WMS.Web.Repositories
|
||||
}
|
||||
return details;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据序列号搜索
|
||||
/// </summary>
|
||||
/// <param name="serialNumbers"></param>
|
||||
/// <returns></returns>
|
||||
public Task<List<OutStock>> GetEntityListBySerialNumbers(List<string> serialNumbers)
|
||||
{
|
||||
if (serialNumbers.Count() == 0) Task.FromResult(new List<OutStock>());
|
||||
string str = $"select * from t_wms_outstock where Id in (select Fid from t_wms_outstock_details where ";
|
||||
for (int i = 0; i < serialNumbers.Count(); i++)
|
||||
{
|
||||
if (i == 0)
|
||||
str += $"SerialNumbers like '%\"{serialNumbers[i]}\"%'";
|
||||
else
|
||||
str += $" or SerialNumbers like '%\"{serialNumbers[i]}\"%'";
|
||||
}
|
||||
str += ")";
|
||||
var fs = FormattableStringFactory.Create(str);
|
||||
var list = _context.Set<OutStock>().FromSqlInterpolated(fs).ToList();
|
||||
return Task.FromResult(list);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据箱号搜索
|
||||
/// </summary>
|
||||
/// <param name="boxBillNos"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<OutStock>> GetEntityListByBoxBillNos(List<string> boxBillNos)
|
||||
{
|
||||
var boxIds = await _context.Box.Where(w => boxBillNos.Contains(w.BoxBillNo)).Select(s => s.Id).ToListAsync();
|
||||
if (boxIds.Count() == 0) return new List<OutStock>();
|
||||
var res = await _context.OutStock
|
||||
.Include(s => s.Details).ThenInclude(s => s.BoxsDetails)
|
||||
.Where(f => f.Details.SelectMany(s=>s.BoxsDetails).Where(wb=> boxIds.Contains(wb.BoxId)).Any()).ToListAsync();
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,11 @@ namespace WMS.Web.Repositories
|
||||
private readonly IErpService _erpService;
|
||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||
private readonly ILogger<OutStockTaskRepositories> _logger;
|
||||
private readonly IOutStockRepositories _outStockRepositories;
|
||||
public OutStockTaskRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService,
|
||||
IErpBasicDataExtendService erpBasicDataExtendService, ILogger<OutStockTaskRepositories> logger)
|
||||
IErpBasicDataExtendService erpBasicDataExtendService, ILogger<OutStockTaskRepositories> logger,
|
||||
IOutStockRepositories outStockRepositories)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
@@ -46,6 +48,8 @@ namespace WMS.Web.Repositories
|
||||
_erpService = erpService;
|
||||
_erpBasicDataExtendService = erpBasicDataExtendService;
|
||||
_logger = logger;
|
||||
_outStockRepositories = outStockRepositories;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增
|
||||
@@ -273,6 +277,19 @@ namespace WMS.Web.Repositories
|
||||
if (customer_result.IsSuccess)
|
||||
customers = customer_result.Data.ToList();
|
||||
|
||||
List<int> taskIds = new List<int>();
|
||||
//序列码出库单
|
||||
if (dto.SerialNumbers.Count() > 0)
|
||||
{
|
||||
var res = await _outStockRepositories.GetEntityListBySerialNumbers(dto.SerialNumbers);
|
||||
taskIds.AddRange(res.Select(s => s.TaskId));
|
||||
}
|
||||
//箱号取出库单
|
||||
if (dto.BoxBillNos.Count() > 0)
|
||||
{
|
||||
var res = await _outStockRepositories.GetEntityListByBoxBillNos(dto.BoxBillNos);
|
||||
taskIds.AddRange(res.Select(s => s.TaskId));
|
||||
}
|
||||
#endregion
|
||||
|
||||
var query = _context.OutStockTaskDetails.Include(x => x.ErpDetails)
|
||||
@@ -315,6 +332,10 @@ namespace WMS.Web.Repositories
|
||||
DateTime dt_end = ((DateTime)dto.CreateEndDate).AddDays(1);
|
||||
query = query.Where(w => w.order.OperateTime <= dt_end);
|
||||
}
|
||||
if (taskIds.Count() > 0)
|
||||
{
|
||||
query = query.Where(w => taskIds.Contains(w.order.Id));
|
||||
}
|
||||
//组装
|
||||
int total = await query.CountAsync();
|
||||
var list = await query.Select(s => new OutStockTaskQueryInfoResponse()
|
||||
|
||||
Reference in New Issue
Block a user