diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs index 2c022d8d3..83fcd6ee9 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs @@ -512,7 +512,6 @@ public abstract class SfsCrudWithDetailsAppServiceBase /// 导入数据具体实现,可重写 /// - //[UnitOfWork] protected virtual async Task ImportInternalAsync(SfsImportRequestInput requestInput, byte[] inputFileBytes) { IList modelList = null; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs index 8afa8d50b..f785c718e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -39,6 +40,13 @@ public class CountNoteImportInput : SfsStoreImportInputBase [Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)] public string PackingCode { get; set; } + /// + /// 库存状态 + /// + [Display(Name = "库存状态")] + [Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)] + public EnumInventoryStatus Status { get; set; } + /// /// 托码 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs index 26971205d..a1529c8b5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs @@ -21,5 +21,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs index 501ef2e4a..278f8a52c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs @@ -7,6 +7,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Domain.Repositories; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Store.Application.Contracts; @@ -27,14 +29,18 @@ public class CountNoteAppService : { private readonly ICountNoteManager _countNoteManager; private readonly ICountPlanAppService _countPlanAppService; + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; public CountNoteAppService( ICountNoteRepository repository, - ICountNoteManager countNoteManager, ICountPlanAppService countPlanAppService) : base(repository) + ICountNoteManager countNoteManager, ICountPlanAppService countPlanAppService, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService) : base(repository) { _countNoteManager = countNoteManager; _countPlanAppService = countPlanAppService; + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; } #region 东阳 @@ -44,20 +50,25 @@ public class CountNoteAppService : /// /// /// - protected async override Task> ImportProcessingEntityAsync(Dictionary dictionary) + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) { - var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + var dataList = dictionary.Select(p => p.Key);//查询所有的导入盘点数据 + var resultDictionary = new Dictionary(); - foreach (var countNote in addList) + var allCountPlanNumbersList= dataList.GroupBy(p => p.CountPlanNumber).Select(p => p.Key).ToList(); + //特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录 + foreach (var countPlanNumber in allCountPlanNumbersList) { - var countPlanDto=await _countPlanAppService.GetByNumberAsync(countNote.CountPlanNumber).ConfigureAwait(false); + var countPlanDto = await _countPlanAppService.GetByNumberAsync(countPlanNumber).ConfigureAwait(false); if (countPlanDto.RequestType != CountPlanRequestType.Import) { throw new UserFriendlyException("非Excel盘点执行方式不能使用导入"); } - //特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录 - //_repository.DeleteAsync(p=>p.CountPlanNumber==CountPlan) + await _repository.DeleteAsync(p => p.CountPlanNumber == countPlanNumber).ConfigureAwait(false); + } + foreach (var countNote in dataList) + { countNote.Worker = CurrentUser.GetUserName(); countNote.CreatorId = CurrentUser.Id; countNote.BeginTime= DateTime.Now; @@ -65,13 +76,29 @@ public class CountNoteAppService : countNote.EndTime=DateTime.Now; countNote.Stage = EnumCountStage.Audit; - //foreach (var detail in purchaseReturnRequest.Details) - //{ - - //} + foreach (var detail in countNote.Details) + { + var locationDto= await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + var itemcBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + + detail.CountLabel =Guid.NewGuid().ToString(); + detail.LocationArea = locationDto.AreaCode; + detail.LocationGroup= locationDto.LocationGroupCode; + detail.LocationErpCode= locationDto.ErpLocationCode; + detail.WarehouseCode= locationDto.WarehouseCode; + + detail.ItemCode = itemcBasicDto.Code; + detail.ItemDesc1 = itemcBasicDto.Desc1; + detail.ItemDesc2 = itemcBasicDto.Desc2; + detail.ItemName= itemcBasicDto.Name; + detail.Uom = itemcBasicDto.BasicUom; + } + + resultDictionary.Add(countNote,EntityState.Added); } - return dictionary; + return resultDictionary; } #endregion diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs index ebeda8f63..fb83ae1ac 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs @@ -69,7 +69,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.Adjusted) .Ignore(X => X.StdPackQty) .Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) - .Ignore(x => x.Status) .Ignore(x => x.SupplierBatch) .Ignore(x => x.ArriveDate) .Ignore(x => x.ProduceDate) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs index c0a9e3222..9f4dece77 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs @@ -25,22 +25,4 @@ public abstract class CountAdjustRequestAppService : { _countAdjustRequestManager = countAdjustRequestManager; } - - /// - /// 【创建】盘点调整申请 - /// - /// - /// - [HttpPost("")] - //[Authorize(CountAdjustRequestPermissions.Create)] - public override async Task CreateAsync(CountAdjustRequestEditInput input) - { - var entity = ObjectMapper.Map(input); - - await _countAdjustRequestManager.CreateAsync(entity).ConfigureAwait(false); - - var dto = ObjectMapper.Map(entity); - return dto; - } - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs index 815ec6b6a..bfd07f21d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs @@ -52,13 +52,11 @@ public partial class StoreEventAutoMapperProfile : Profile //盘点计划映射到盘点记录 CreateMap() .ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number)) - .Ignore(x => x.Adjusted) ; CreateMap() .ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number)) - .Ignore(x => x.Adjusted) ;