From 92cd073cf9a788b726d9907f7571dba2fd4db034 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Thu, 1 Jun 2023 14:42:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B0=E8=B4=A7=E4=BF=A1=E6=81=AF=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=98=BE=E7=A4=BA=E4=B8=83=E5=A4=A9=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PurchaseReceiptController.cs | 14 +++++------ .../InspectNotes/IInspectNoteAppService.cs | 1 + .../SupplierAsns/ISupplierAsnAppService.cs | 1 + .../InspectNotes/InspectNoteAppService.cs | 23 +++++++++++++++++++ .../SupplierAsns/SupplierAsnAppService.cs | 10 ++++++++ 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs index eba7ccf00..2f7830088 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs @@ -91,7 +91,7 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers { var dto = new PurchaseReceiptSumQtyDashboardDto(); - var items = await this.GetUnPurchaseReceiptItemDashboardAsync(); + var items = await this.GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) }; @@ -101,7 +101,7 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers [HttpGet("un-receipt-count-by-supplier")] public virtual async Task> GetUnReceiptCountBySupplierQtyAsync() { - var items = await GetUnPurchaseReceiptItemDashboardAsync(); + var items = await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); var dtos = items.GroupBy(t => t.SupplierShortName) .Select( @@ -117,12 +117,12 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers [HttpGet("un-receipt-item-list")] public virtual async Task> GetUnReceiptItemListAsync() { - return await this.GetUnPurchaseReceiptItemDashboardAsync(); + return await this.GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); } private async Task> GetPurchaseReceiptItemDashboardAsync() { - var inspectNoteDetailDto = await _inspectNoteAppService.GetInspectNoteDetailByToDayTaskAsync(); + var inspectNoteDetailDto = await _inspectNoteAppService.GetInspectNoteDetailByDayTaskAsync(7).ConfigureAwait(false);//7天数据 var packingCodeList = inspectNoteDetailDto.Where(p => p.Status == EnumInventoryStatus.OK|| p.Status == EnumInventoryStatus.INSP).Select(p => p.PackingCode).ToList(); var balances = await _balanceApp.GetListByPackingCodesAsync(packingCodeList); balances = balances.Where(p => p.LocationCode == "INSPECT").ToList(); @@ -196,9 +196,9 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers return await this._supplierApp.GetByCodesAsync(codes); } - private async Task> GetSupplierAsnsAsync() + private async Task> GetSupplierAsnsAsync(int day) { - return await this._supplierAsnApp.GetForTodayUnReceivedListAsync(); + return await this._supplierAsnApp.GeUnReceivedByDayListAsync(day); } private List ConvertToUnPurchaseReceiptItemDashboard( @@ -245,7 +245,7 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers { var dtos = new List(); - var supplierAsns = await this.GetSupplierAsnsAsync(); + var supplierAsns = await this.GetSupplierAsnsAsync(7).ConfigureAwait(false);//七天数据 var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs index ea5242e09..631447f06 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs @@ -23,4 +23,5 @@ public interface IInspectNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase Task> CreateSummaryDetailAndDetailByIdAsync(Guid id, InspectNoteEditInput input); Task> GetInspectNoteDetailByToDayTaskAsync(); + Task> GetInspectNoteDetailByDayTaskAsync(int day); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs index 440cf5973..15cb37eea 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs @@ -36,4 +36,5 @@ public interface ISupplierAsnAppService Task UpdateStatusAsync(string asnNumber, EnumSupplierAsnStatus status); Task> GetForTodayListAsync(); + Task> GeUnReceivedByDayListAsync(int day); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs index 8c4bcb8a4..4cb5c5b36 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs @@ -112,4 +112,27 @@ public class InspectNoteAppService : SfsStoreWithDetailsAppServiceBase< return detailDtos; } + + [HttpPost("detail-list/by-day")] + public virtual async Task> GetInspectNoteDetailByDayTaskAsync(int day) + { + var endtime = DateTime.Today.AddHours(24).AddSeconds(-1); + var starttime = endtime.AddDays(-day).AddSeconds(1); + var entitys = await _repository.GetListAsync( + p => p.Details.Any( + y => y.InspectDate<= endtime + && y.InspectDate>= starttime), true + ).ConfigureAwait(false); + + List list = new List(); + foreach (var entity in entitys) + { + list.AddRange(entity.Details.Where(y => y.InspectDate <= endtime + && y.InspectDate >= starttime)); + } + + var detailDtos = ObjectMapper.Map, List>(list); + + return detailDtos; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs index 75372d398..9f5635a00 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs @@ -395,7 +395,17 @@ public class SupplierAsnAppService : return ObjectMapper.Map, List>(entities); } + [HttpGet("list-un-received-by-day")] + public virtual async Task> GeUnReceivedByDayListAsync(int day) + { + var endtime = DateTime.Today.AddHours(24).AddSeconds(-1); + var starttime = endtime.AddDays(-day).AddSeconds(1); + var entities = await _repository.GetListAsync( + p => p.PlanArriveDate>= starttime && p.PlanArriveDate <= endtime + && (p.Status != EnumSupplierAsnStatus.Received && p.Status != EnumSupplierAsnStatus.Cancelled), true).ConfigureAwait(false); + return ObjectMapper.Map, List>(entities); + } [HttpGet("list-by-starttime-endtime")] public virtual async Task> GetByStartTimeEndTimeAsync(DateTime startTime, DateTime endTime) {