From 3a37437e61c87b730208b58e4ac9423cff9c72e4 Mon Sep 17 00:00:00 2001 From: mahao Date: Thu, 11 May 2023 17:28:23 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E5=BA=93=E4=BD=8D=E4=B8=8E=E7=9B=AE=E6=A0=87=E5=BA=93=E4=BD=8D?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TransferNotes/TransferNoteAppService.cs | 18 ++++++++++++++++-- .../TransferRequestAppService.cs | 8 ++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index abffc111b..f2b747fa7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -64,8 +64,15 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase { var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); - var toLocationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + CheckLocation(toLocationDto, detail); + CheckFromLocation(fromLocationDto, detail); + if (toLocationDto.Type == fromLocationDto.Type) + { + throw new UserFriendlyException($"来源库位与目标库位类型不一致"); + } detail.OnTheWayLocationCode = bool.FalseString; detail.ItemCode=balanceDto.ItemCode; @@ -91,7 +98,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase detail.FromLot = balanceDto.Lot; detail.ToLocationArea = toLocationDto.AreaCode; - detail.ToLocationErpCode = toLocationDto.LocationGroupCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; detail.ToLocationGroup = toLocationDto.LocationGroupCode; detail.ToWarehouseCode = toLocationDto.WarehouseCode; detail.ToContainerCode = balanceDto.ContainerCode; @@ -126,6 +133,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase throw new UserFriendlyException($"库位代码为【{detail.ToLocationCode}】不存在"); } } + private void CheckFromLocation(LocationDTO locationDto, TransferNoteDetail detail) + { + if (locationDto == null) + { + throw new UserFriendlyException($"库位代码为【{detail.FromLocationCode}】不存在"); + } + } #endregion /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs index 950a6768b..363f234d2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs @@ -110,7 +110,15 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) .ConfigureAwait(false); + var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) + .ConfigureAwait(false); + CheckLocation(toLocationDto, detail.ToLocationCode); + CheckLocation(fromLocationDto, detail.FromLocationCode); + if (toLocationDto.Type == fromLocationDto.Type) + { + throw new UserFriendlyException($"来源库位与目标库位类型不一致"); + } detail.ItemCode = balanceDto.ItemCode; detail.ArriveDate = balanceDto.ArriveDate; From f2f29fd8e3668545099888a13a8c53c0f931261d Mon Sep 17 00:00:00 2001 From: MaHao Date: Thu, 11 May 2023 18:05:24 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9D=A5=E6=BA=90=E5=BA=93=E4=BD=8D?= =?UTF-8?q?=E4=B8=8E=E7=9B=AE=E6=A0=87=E5=BA=93=E4=BD=8D=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Notes/TransferNotes/TransferNoteAppService.cs | 2 +- .../Requests/TransferRequests/TransferRequestAppService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index f2b747fa7..d1d5c3dd4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -69,7 +69,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase CheckLocation(toLocationDto, detail); CheckFromLocation(fromLocationDto, detail); - if (toLocationDto.Type == fromLocationDto.Type) + if (toLocationDto.Type != fromLocationDto.Type) { throw new UserFriendlyException($"来源库位与目标库位类型不一致"); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs index 363f234d2..6e8c9edc4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs @@ -115,7 +115,7 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase CheckLocation(toLocationDto, detail.ToLocationCode); CheckLocation(fromLocationDto, detail.FromLocationCode); - if (toLocationDto.Type == fromLocationDto.Type) + if (toLocationDto.Type != fromLocationDto.Type) { throw new UserFriendlyException($"来源库位与目标库位类型不一致"); } @@ -143,7 +143,7 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase detail.FromLot = balanceDto.Lot; detail.ToLocationArea = toLocationDto.AreaCode; - detail.ToLocationErpCode = toLocationDto.LocationGroupCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; detail.ToLocationGroup = toLocationDto.LocationGroupCode; detail.ToWarehouseCode = toLocationDto.WarehouseCode; detail.ToContainerCode = balanceDto.ContainerCode; From f3f20d8b99f5be5e99ddcb59fb1499d9253007cb Mon Sep 17 00:00:00 2001 From: mahao Date: Tue, 16 May 2023 13:08:19 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E7=BA=B3=E5=85=A5=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E4=B8=8E=E5=AE=9E=E9=99=85=E7=9C=8B=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PlanAndActualController.cs | 23 +++++++++++++----- .../Models/PlanAndActualDashboardDto.cs | 24 ++++++++++++++++--- .../PurchaseOrders/PurchaseOrderAppService.cs | 4 ++-- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs index d54bb4b54..3c91b8ddf 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs @@ -36,7 +36,10 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers _purchaseReceiptJobApp = purchaseReceiptJobApp; } - + /// + /// 纳入计划与实际 + /// + /// [HttpGet("plan-actual-list")] public virtual async Task> GetPlanAndActualListAsync() { @@ -76,23 +79,28 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers var purchaseReceipts = purchaseReceiptNotes.FindAll(t => t.AsnNumber == supplierAsn.Number); var putaways = putawayNotes.FindAll(t => t.AsnNumber == supplierAsn.Number); + var supplierName = string.Empty; var supplierShortName = string.Empty; var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode); if (supplier == null) + { continue; + } + supplierName = supplier.Name; supplierShortName = supplier.ShortName; foreach (var detail in supplierAsn.Details) { - var dto = dtos.FirstOrDefault(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode); + var dto = dtos.FirstOrDefault(t => t.SupplierName == supplierName && t.ItemCode == detail.ItemCode); if (dto == null) { dto = new PlanAndActualDashboardDto(); + dto.SupplierName = supplier.Name; dto.SupplierShortName = supplierShortName; dto.ItemCode = detail.ItemCode; dto.ItemDesc1 = detail.ItemDesc1; @@ -112,21 +120,24 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers purchaseOrderDtos = purchaseOrderDtos.Where(p => poNumberList.Contains(p.Number)).ToList(); - decimal allPutawayQty = 0; decimal allReceiptQty = 0; decimal allPlanArriveQty = 0; + decimal allArriveQty = 0; foreach (var purchaseOrderDTO in purchaseOrderDtos) { allPutawayQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.PutAwayQty); - allReceiptQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.ReceivedQty); - allPlanArriveQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.ShippedQty); + allReceiptQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.PutAwayQty); + allPlanArriveQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.Qty); + allArriveQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.ShippedQty); } dto.PutawayQty = allPutawayQty; dto.PlanArriveQty = allPlanArriveQty; dto.ReceiptQty = allReceiptQty; + dto.ArriveQty = allArriveQty; + dto.DifferQty = dto.PlanArriveQty - dto.ReceiptQty; dtos.Add(dto); } @@ -139,7 +150,7 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers } } - return dtos.OrderBy(t => t.SupplierShortName).ToList(); + return dtos.OrderBy(t => t.SupplierName).ToList(); } private decimal CountReceiptQty(List purchaseReceipts, string itemCode) diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Models/PlanAndActualDashboardDto.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Models/PlanAndActualDashboardDto.cs index 9af8b2d40..26fba190d 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Models/PlanAndActualDashboardDto.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Models/PlanAndActualDashboardDto.cs @@ -4,6 +4,12 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Models; public class PlanAndActualDashboardDto { + /// + /// 供应商名称 + /// + [Display(Name = "供应商名称")] + public string SupplierName { get; set; } + /// /// 供应商简称 /// @@ -17,9 +23,9 @@ public class PlanAndActualDashboardDto public string ItemCode { get; set; } /// - /// 零件号 + /// 物料名称 /// - [Display(Name = "零件号")] + [Display(Name = "物料名称")] public string ItemName { get; set; } /// @@ -41,17 +47,29 @@ public class PlanAndActualDashboardDto public decimal SupplierAsnCount { get; set; } /// - /// 发货物料数量 + /// 计划发货物料数量 /// [Display(Name = "发货物料数量")] public decimal PlanArriveQty { get; set; } + /// + /// 发货物料数量 + /// + [Display(Name = "发货物料数量")] + public decimal ArriveQty { get; set; } + /// /// 收货物料数量 /// [Display(Name = "收货物料数量")] public decimal ReceiptQty { get; set; } + /// + /// 差异数 PlanArriveQty-ReceiptQty + /// + [Display(Name = "差异数")] + public decimal DifferQty { get; set; } + /// /// 上架物料数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs index 11e682df0..6053d58d7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs @@ -91,7 +91,7 @@ public class PurchaseOrderAppService : detail.ItemName = itemBasicDto.Name; detail.ItemDesc1 = itemBasicDto.Desc1; detail.ItemDesc2 = itemBasicDto.Desc2; - detail.StdPackQty=itemBasicDto.StdPackQty; + detail.StdPackQty = itemBasicDto.StdPackQty; } } @@ -297,7 +297,7 @@ public class PurchaseOrderAppService : public virtual async Task> GetListBySupplierCodeAsync(string supplierCode, string itemCode) { var entitys = await _repository - .GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode) + .GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode, true) .ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entitys); From ceda5ecff7ccff9d3a7a72b5123d7f32f2ce336c Mon Sep 17 00:00:00 2001 From: mahao Date: Tue, 16 May 2023 16:38:07 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=9E=E5=86=B2?= =?UTF-8?q?=E7=9A=84=E9=9B=B6=E4=BB=B6=E6=8F=8F=E8=BF=B0=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BackFlushNotes/BackFlushNoteAppService.cs | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs index 90f9f8fd1..07e300af2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs @@ -1,14 +1,15 @@ +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application; -using System.Collections.Generic; - [Authorize] [Route($"{StoreConsts.RootPath}backFlush-note")] public class BackFlushNoteAppService : @@ -17,17 +18,22 @@ public class BackFlushNoteAppService : IBackFlushNoteAppService { private readonly IBackFlushNoteManager _backFlushNoteManager; + private readonly IItemBasicAppService _itemBasicAppService; - public BackFlushNoteAppService(IBackFlushNoteRepository repository, IBackFlushNoteManager backFlushNoteManager) : + public BackFlushNoteAppService(IBackFlushNoteRepository repository, IBackFlushNoteManager backFlushNoteManager, IItemBasicAppService itemBasicAppService) : base(repository) { _backFlushNoteManager = backFlushNoteManager; + _itemBasicAppService = itemBasicAppService; } + [HttpPost("create-many")] public virtual async Task> CreateManyAsync(List inputs) { var entities = ObjectMapper.Map, List>(inputs); + entities = await ProcessingBackFlushNoteData(entities).ConfigureAwait(false); + entities = await _backFlushNoteManager.CreateManyAsync(entities).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entities); @@ -43,4 +49,33 @@ public class BackFlushNoteAppService : return ObjectMapper.Map, List>(entities); } + + /// + /// 处理数据 + /// + /// + private async Task> ProcessingBackFlushNoteData(List backFlushNotes) + { + if (backFlushNotes != null && backFlushNotes.Count > 0) + { + var itemCodes = backFlushNotes.Select(t => t.ItemCode); + List itemBasicDtos = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false); + + backFlushNotes.ForEach(t => + { + var itemBasicDto = itemBasicDtos.FirstOrDefault(w => w.Code == t.ItemCode); + if (itemBasicDto != null) + { + t.ItemDesc1 = itemBasicDto.Desc1; + t.ItemDesc2 = itemBasicDto.Desc2; + t.Details.ForEach(tDetail => + { + tDetail.ItemDesc1 = itemBasicDto.Desc1; + tDetail.ItemDesc2 = itemBasicDto.Desc2; + }); + } + }); + } + return backFlushNotes; + } }