|  |  |  | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsStores; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsStore; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Application.Contracts.Services; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Domain.WmsStores; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Domain.Shared; | 
|---|
|  |  |  | 
|---|
|  |  |  | using Volo.Abp.Application.Dtos; | 
|---|
|  |  |  | using Volo.Abp.Data; | 
|---|
|  |  |  | using Volo.Abp.ObjectExtending; | 
|---|
|  |  |  | using CmsQueryExtensions; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | namespace CMS.Plugin.HIAWms.Application.Implements; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <inheritdoc /> | 
|---|
|  |  |  | public virtual async Task<PagedResultDto<WmsStoreDto>> GetListAsync(GetWmsStoresInput input) | 
|---|
|  |  |  | public virtual async Task<PagedResultDto<WmsStoreDto>> GetListAsync(GetWmsStoreInput input) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Check.NotNull(input, nameof(input)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var specification = new WmsStoreSpecification(input.Name); | 
|---|
|  |  |  | var count = await _wmsstoreRepository.GetCountAsync(input.Filter, specification); | 
|---|
|  |  |  | var list = await _wmsstoreRepository.GetListAsync(input.Sorting, input.MaxResultCount,  input.SkipCount, input.Filter, specification); | 
|---|
|  |  |  | var store = ObjectMapper.Map<GetWmsStoreInput, WmsStore>(input); | 
|---|
|  |  |  | var count = await _wmsstoreRepository.GetCountAsync(store,input.Filter, specification); | 
|---|
|  |  |  | var list = await _wmsstoreRepository.GetListAsync(store,input.Sorting, input.MaxResultCount,  input.SkipCount, input.Filter, specification); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new PagedResultDto<WmsStoreDto>(count, ObjectMapper.Map<List<WmsStore>, List<WmsStoreDto>>(list)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var maxSort = await _wmsstoreRepository.GetMaxSortAsync(); | 
|---|
|  |  |  | var sort = input.Sort ?? maxSort; | 
|---|
|  |  |  | var wmsstore = new WmsStore | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | var wmsstore = ObjectMapper.Map<WmsStoreCreateDto,WmsStore>(input); | 
|---|
|  |  |  | wmsstore.Sort = sort; | 
|---|
|  |  |  | input.MapExtraPropertiesTo(wmsstore, MappingPropertyDefinitionChecks.None); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | await _wmsstoreRepository.InsertAsync(wmsstore); | 
|---|
|  |  |  | 
|---|
|  |  |  | wmsstore.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); | 
|---|
|  |  |  | input.MapExtraPropertiesTo(wmsstore, MappingPropertyDefinitionChecks.None); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | wmsstore.StoreCode = input.StoreCode; | 
|---|
|  |  |  | wmsstore.StoreName = input.StoreName; | 
|---|
|  |  |  | wmsstore.Remark = input.Remark; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | await _wmsstoreRepository.UpdateAsync(wmsstore); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <inheritdoc /> | 
|---|
|  |  |  | public virtual async Task AdjustSortAsync(Guid id, int sort) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var list = await _wmsstoreRepository.GetListAsync(nameof(WmsStore.Sort)); | 
|---|
|  |  |  | var list = await _wmsstoreRepository.GetListAsync(null,nameof(WmsStore.Sort)); | 
|---|
|  |  |  | if (list != null && list.Any()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var initSort = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <inheritdoc /> | 
|---|
|  |  |  | public async Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsStoresInput input) | 
|---|
|  |  |  | public async Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsStoreInput input) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Check.NotNull(input, nameof(input)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var specification = new WmsStoreSpecification(input.Name); | 
|---|
|  |  |  | var list = await _wmsstoreRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification, includeDetails: true); | 
|---|
|  |  |  | var store = ObjectMapper.Map<GetWmsStoreInput, WmsStore>(input); | 
|---|
|  |  |  | var list = await _wmsstoreRepository.GetListAsync(store, input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification, includeDetails: true); | 
|---|
|  |  |  | var result = ObjectMapper.Map<List<WmsStore>, List<WmsStoreDto>>(list); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var sheets = new Dictionary<string, object> | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ["配置"] = result.Select(x => x.GetExportData()).ToList(), | 
|---|
|  |  |  | ["配置"] = ExportHelper.ConvertListToExportData(result), | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var fileName = result.Count > 1 ? "WmsStore列表" : result.Count == 1 ? result.First()?.StoreCode : "WmsStore模版"; | 
|---|