修复bug
This commit is contained in:
@@ -216,6 +216,11 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Id FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{dto.SourceBillNo}%'").Select(s => s.Id).ToListAsync();
|
||||
|
||||
|
||||
#region erp基础资料
|
||||
List<int> mIds = new List<int>();
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
@@ -262,10 +267,8 @@ namespace WMS.Web.Repositories
|
||||
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
|
||||
if (dto.Ids.Count() > 0)
|
||||
query = query.Where(w => dto.Ids.Contains(w.detail.Id));
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
query = query.Where(w => w.detail.SourceBillNos.Contains(dto.SourceBillNo));
|
||||
//query = query.Where(w => EF.Functions.Like(w.detail.SourceBillNos, "%" + dto.SourceBillNo + "%"));
|
||||
//query = query.Where(w => w.detail.SourceBillNos.Where(sw => EF.Functions.Like(sw, "%" + dto.SourceBillNo + "%")).Contains(w.order.BillNo));
|
||||
if (ids.Count() != 0)
|
||||
query = query.Where(w => ids.Contains(w.detail.Id));
|
||||
if (dto.Type != null)
|
||||
query = query.Where(w => w.order.Type == (OutStockType)dto.Type);
|
||||
if (dto.Status != null)
|
||||
@@ -319,9 +322,12 @@ namespace WMS.Web.Repositories
|
||||
return new List<GetOutStockTaskByNoResponse>();
|
||||
var materials = materials_result.Data.ToList();
|
||||
|
||||
List<int> ids = new List<int>();
|
||||
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Fid FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{billNo}%'").Select(s => s.Id).ToListAsync();
|
||||
|
||||
var list = await _context.OutStockTask.Include(x => x.Details)
|
||||
.Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") ||
|
||||
f.Details.SelectMany(s=>s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) &&
|
||||
ids.Contains(f.Id)) &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||
.OrderByDescending(o => o.Id)
|
||||
.ToListAsync();
|
||||
@@ -419,9 +425,12 @@ namespace WMS.Web.Repositories
|
||||
|
||||
public async Task<List<string>> GetOutStockTaskNosByNo(string billNo)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Fid FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{billNo}%'").Select(s => s.Id).ToListAsync();
|
||||
|
||||
return await _context.OutStockTask.Include(x => x.Details)
|
||||
.Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") ||
|
||||
f.Details.SelectMany(s => s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) &&
|
||||
ids.Contains(f.Id)) &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||
.OrderByDescending(o => o.Id)
|
||||
.Select(s => s.BillNo)
|
||||
|
||||
Reference in New Issue
Block a user