物料搜索
This commit is contained in:
@@ -260,12 +260,12 @@ namespace WMS.Web.Repositories
|
||||
/// </summary>
|
||||
/// <param name="taskId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ReceiveBoxResponse>> GetInstockBox(int taskId)
|
||||
public async Task<List<ReceiveBoxResponse>> GetInstockBox(int taskId)
|
||||
{
|
||||
return await _context.InStockDetails.Where(x => x.TaskId == taskId).Select(x => new ReceiveBoxResponse()
|
||||
return await _context.InStockDetails.Where(x => x.TaskId == taskId).Select(x => new ReceiveBoxResponse()
|
||||
{
|
||||
TaskId=x.TaskId,
|
||||
BoxId=x.BoxId
|
||||
TaskId = x.TaskId,
|
||||
BoxId = x.BoxId
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
@@ -295,16 +295,17 @@ namespace WMS.Web.Repositories
|
||||
if (suppliers_result.IsSuccess)
|
||||
suppliers = suppliers_result.Data.ToList();
|
||||
|
||||
List<string> materialNumbs = new List<string>();
|
||||
|
||||
//物料集合;模糊查询后的物料集合
|
||||
if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
{
|
||||
if (materials.Count != 0)
|
||||
{
|
||||
materials = materials.Where(w => w.MaterialNumber.Contains(dto.MaterialNumber)
|
||||
materialNumbs = materials.Where(w => w.MaterialNumber.Contains(dto.MaterialNumber)
|
||||
|| w.MaterialName.Contains(dto.MaterialNumber)
|
||||
|| w.Specifications.Contains(dto.MaterialNumber)
|
||||
).ToList();
|
||||
).Select(x => x.MaterialNumber).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,11 +330,7 @@ namespace WMS.Web.Repositories
|
||||
//物料ID在模糊后的物料
|
||||
if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
{
|
||||
if (materials != null && materials.Count != 0)
|
||||
{
|
||||
var mids = materials.Select(x => x.MaterialNumber).ToList();
|
||||
query = query.Where(w => mids.Contains(w.detail.MaterialNumber));
|
||||
}
|
||||
query = query.Where(w => materialNumbs.Contains(w.detail.MaterialNumber));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(dto.Creator))
|
||||
@@ -376,7 +373,7 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
Id = s.order.Id,
|
||||
DetailsId = s.detail.Id,
|
||||
TaskId=s.detail.TaskId,
|
||||
TaskId = s.detail.TaskId,
|
||||
BillNo = s.order.BillNo,
|
||||
Type = s.order.Type.GetRemark(),
|
||||
SourceBillNo = s.detail.SourceBillNo,
|
||||
@@ -389,24 +386,24 @@ namespace WMS.Web.Repositories
|
||||
Qty = s.detail.Qty,
|
||||
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.CreatorId),
|
||||
CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
SuccessSync =(s.order.Type != InstockType.Purchase ? "--" : (s.order.SuccessSync == SyncStatus.Success ? "成功" : (s.order.SuccessSync == SyncStatus.SyncIng ? "同步中" : "失败"))),
|
||||
SuccessSync = (s.order.Type != InstockType.Purchase ? "--" : (s.order.SuccessSync == SyncStatus.Success ? "成功" : (s.order.SuccessSync == SyncStatus.SyncIng ? "同步中" : "失败"))),
|
||||
Remark = s.order.Remark
|
||||
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
|
||||
var taskIds= list.GroupBy(x => x.TaskId).Select(x => x.Key).ToList();
|
||||
var taskList = await _context.InStockTask.Include(x=>x.Details).Where(x => taskIds.Contains(x.Id)).ToListAsync();
|
||||
var taskIds = list.GroupBy(x => x.TaskId).Select(x => x.Key).ToList();
|
||||
var taskList = await _context.InStockTask.Include(x => x.Details).Where(x => taskIds.Contains(x.Id)).ToListAsync();
|
||||
|
||||
if (taskList != null && taskList.Count != 0)
|
||||
if (taskList != null && taskList.Count != 0)
|
||||
{
|
||||
var taskDetailsList= taskList.SelectMany(x => x.Details).Where(x=>x.AccruedQty<=0).ToList();
|
||||
list.ForEach(x =>
|
||||
var taskDetailsList = taskList.SelectMany(x => x.Details).Where(x => x.AccruedQty <= 0).ToList();
|
||||
list.ForEach(x =>
|
||||
{
|
||||
var isHave= taskDetailsList.Where(t => t.MaterialNumber == x.MaterialNumber && t.Fid == x.TaskId).Any();
|
||||
var isHave = taskDetailsList.Where(t => t.MaterialNumber == x.MaterialNumber && t.Fid == x.TaskId).Any();
|
||||
if (isHave)
|
||||
x.SuccessSync = "--";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return (list, total);
|
||||
}
|
||||
|
||||
@@ -426,7 +423,7 @@ namespace WMS.Web.Repositories
|
||||
/// </summary>
|
||||
/// <param name="taskIds"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<InStockTotalDetails>> GetInStockTotalDetails(List<int> taskIds)
|
||||
public async Task<List<InStockTotalDetails>> GetInStockTotalDetails(List<int> taskIds)
|
||||
{
|
||||
return await _context.InStockTotalDetails.Where(x => taskIds.Contains(x.TaskId)).ToListAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user