From 012a43d0b3fa6b46d6129beef51fc1111affe500 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Fri, 12 Jan 2024 11:12:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E9=A2=84=E8=AE=A1?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=AD=98=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExpectOuts/IExpectOutAppService.cs | 15 +++++++++ .../ExpectOuts/ExpectOutAppService.cs | 33 ++++++++++++++++--- .../InventoryLabelAppService.cs | 13 +++++++- .../InventoryLabelAutoMapperProfile.cs | 10 +----- 4 files changed, 57 insertions(+), 14 deletions(-) diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs index 509c60744..6ce12eb30 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -14,4 +15,18 @@ public interface IExpectOutAppService Task> GetListByItemAsync(string itemCode); Task> GetListByLocationAsync(string locationCode); Task> GetListByPackingCodeAsync(string packingCode); + + Task> GetListByItemCodeAndStatusAndPackingCodeAsync( + string itemCode, + string locationCode, + string packingCode, + EnumInventoryStatus enumInventoryStatus, + string lot); + + Task RemoveListByItemCodeAndStatusAndPackingCodeAsync( + string itemCode, + string locationCode, + string packingCode, + EnumInventoryStatus enumInventoryStatus, + string lot); } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs index cc04a325d..5125a0034 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs @@ -5,7 +5,9 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Domain; using Win_in.Sfs.Wms.Inventory.Domain.Shared; @@ -139,12 +141,35 @@ public class ExpectOutAppService } [HttpGet("list/by-itemcode-status-packingcode")] - public virtual async Task> GetListByItemCodeAndStatusAndPackingCode() + public virtual async Task> GetListByItemCodeAndStatusAndPackingCodeAsync( + string itemCode, + string locationCode, + string packingCode, + EnumInventoryStatus enumInventoryStatus, + string lot) { - await Task.CompletedTask.ConfigureAwait(false); + var list= await _repository.GetListAsync(p => + p.ItemCode == itemCode && + p.Status == enumInventoryStatus && + p.PackingCode == packingCode && + p.Lot == lot).ConfigureAwait(false); - //TODO - throw new UserFriendlyException(""); + return ObjectMapper.Map, List>(list); + } + + [HttpDelete("remove/by-itemcode-status-packingcode")] + public virtual async Task RemoveListByItemCodeAndStatusAndPackingCodeAsync( + string itemCode, + string locationCode, + string packingCode, + EnumInventoryStatus enumInventoryStatus, + string lot) + { + await _repository.DeleteAsync(p => + p.ItemCode == itemCode && + p.Status == enumInventoryStatus && + p.PackingCode == packingCode && + p.Lot == lot).ConfigureAwait(false); } [HttpGet("list/by-packing/{packingCode}")] diff --git a/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs b/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs index e88e07199..815acff1a 100644 --- a/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs +++ b/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs @@ -15,6 +15,7 @@ using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Label.Application.Contracts; using Win_in.Sfs.Label.Domain; using Win_in.Sfs.Label.Domain.Shared; +using Win_in.Sfs.Shared.Application; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; @@ -172,7 +173,17 @@ public class InventoryLabelAppService { var createInput = ObjectMapper.Map(input); createInput.Code = numbers[i]; - var dto = await base.CreateAsync(createInput).ConfigureAwait(false); + + + await CheckCreatePolicyAsync().ConfigureAwait(continueOnCapturedContext: false); + var createEntity=ObjectMapper.Map(createInput); + SetIdForGuids(createEntity); + TryToSetTenantId(createEntity); + var result=await Repository.InsertAsync(createEntity, autoSave: true).ConfigureAwait(continueOnCapturedContext: false); + var dto = ObjectMapper.Map(result); + await Cache.SetItemAsync(dto.Id.ToString(), dto, SfsCacheConst.SeveralMinutes).ConfigureAwait(false); + + //var dto = await base.CreateAsync(createInput).ConfigureAwait(false); dto.SupplierCode = input.SupplierCode; dto.PoNumber = input.PoNumber; diff --git a/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAutoMapperProfile.cs b/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAutoMapperProfile.cs index 2cccbc882..543901747 100644 --- a/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAutoMapperProfile.cs +++ b/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAutoMapperProfile.cs @@ -30,7 +30,6 @@ public class InventoryLabelAutoMapperProfile : Profile .Ignore(x=>x.Id) .Ignore(x => x.ConcurrencyStamp) ; - CreateMap() .IgnoreAuditedObjectProperties() @@ -52,13 +51,6 @@ public class InventoryLabelAutoMapperProfile : Profile .Ignore(x => x.StdPackQty) .Ignore(x => x.Uom); - CreateMap() - .IgnoreAuditedObjectProperties() - //.MapItemBatchQtyStdPackDto() - .MapPurchaseInfoDto() - .MapProductionInfoDto() - .MapQualityInfoDto() - .Ignore(x => x.ConcurrencyStamp) - .Ignore(x => x.Id); + } }