diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml index bb5b16dc..08a53989 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml @@ -2657,6 +2657,16 @@ 单据ID + + + 任务单 + + + + + 物料ID + + 明细ID diff --git a/src/WMS.Web.Core/Dto/InStock/InStockQueryResponse.cs b/src/WMS.Web.Core/Dto/InStock/InStockQueryResponse.cs index f7bfac70..2f2652a2 100644 --- a/src/WMS.Web.Core/Dto/InStock/InStockQueryResponse.cs +++ b/src/WMS.Web.Core/Dto/InStock/InStockQueryResponse.cs @@ -16,6 +16,18 @@ namespace WMS.Web.Core.Dto [Ignore] public int Id { get; set; } + /// + /// 任务单 + /// + [Ignore] + public int TaskId { get; set; } + + /// + /// 物料ID + /// + [Ignore] + public int MaterialId { get; set; } + /// /// 明细ID /// diff --git a/src/WMS.Web.Repositories/InStockRepositories.cs b/src/WMS.Web.Repositories/InStockRepositories.cs index 378f6369..3d37aabf 100644 --- a/src/WMS.Web.Repositories/InStockRepositories.cs +++ b/src/WMS.Web.Repositories/InStockRepositories.cs @@ -304,8 +304,6 @@ namespace WMS.Web.Repositories var query = _context.InStockTotalDetails .GroupJoin(_context.Instock, detail => detail.InStockId, order => order.Id, (detail, orders) => new { detail, orders }) .SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order }) - .GroupJoin(_context.InStockTaskDetails, t =>t.detail.TaskId, ts => ts.Fid, (p, ts) => new { p.detail,p.order, ts }) - .SelectMany(x => x.ts.DefaultIfEmpty(), (p, instockDet) => new { p.detail, p.order, instockDet }) .Where(adv => 1 == 1); if (!string.IsNullOrEmpty(dto.SourceBillNo)) @@ -363,9 +361,11 @@ namespace WMS.Web.Repositories { Id = s.order.Id, DetailsId = s.detail.Id, + TaskId=s.detail.TaskId, BillNo = s.order.BillNo, Type = s.order.Type.GetRemark(), SourceBillNo = s.detail.SourceBillNo, + MaterialId=s.detail.MaterialId, Supplier = _erpBasicDataExtendService.GetSupplierName(suppliers, s.detail.SupplierId), Org = _erpBasicDataExtendService.GetOrgName(orgs, s.order.OrgId), MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId), @@ -375,10 +375,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.instockDet.AccruedQty==0?"--":(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(); + + if (taskList != null && taskList.Count != 0) + { + var taskDetailsList= taskList.SelectMany(x => x.Details).Where(x=>x.AccruedQty<=0).ToList(); + list.ForEach(x => + { + var isHave= taskDetailsList.Where(t => t.MaterialId == x.MaterialId && t.Fid == x.TaskId).Any(); + if (isHave) + x.SuccessSync = "--"; + }); + } + return (list, total); } }