| | |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using Volo.Abp.Application.Dtos; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsAreas; |
| | |
| | | /// Gets or sets the name. |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库区编号 |
| | | /// </summary> |
| | | public string AreaNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库区名称 |
| | | /// </summary> |
| | | public string AreaName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 描述 |
| | | /// </summary> |
| | | public string? AreaDesc { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库区状态 |
| | | /// </summary> |
| | | public AreaStatusEnum AreaStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库区类型 |
| | | /// </summary> |
| | | public AreaTypeEnum AreaType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 仓库代码 |
| | | /// </summary> |
| | | public string? StoreCode { get; set; } |
| | | } |
| | |
| | | public WmsAreaCreateOrUpdateDtoBase() : base(false) |
| | | { |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 库区列表 |
| | | /// </summary> |
| | | public class AreaForListOuptut |
| | | { |
| | | /// <summary> |
| | | /// 库区编号 |
| | | /// </summary> |
| | | public string AreaNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库区名称 |
| | | /// </summary> |
| | | public string AreaName { get; set; } |
| | | } |
| | | } |
| | |
| | | public AreaStatusEnum AreaStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库区状态 |
| | | /// </summary> |
| | | public string AreaStatusDesc |
| | | { |
| | | get |
| | | { |
| | | return GetEnumDescriptionUtil.GetEnumDescription(AreaStatus); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 库区类型 |
| | | /// </summary> |
| | | public AreaTypeEnum AreaType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库区状态 |
| | | /// </summary> |
| | | public string AreaTypeDesc |
| | | { |
| | | get |
| | | { |
| | | return GetEnumDescriptionUtil.GetEnumDescription(AreaType); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 冗余字段1 - 预留扩展用途 |
| | |
| | | return exportData; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 做仓库选择使用 |
| | | /// </summary> |
| | | public class WmsStoreForAreaOutpur |
| | | { |
| | | /// <summary> |
| | | /// 仓库代码 |
| | | /// </summary> |
| | | public string? StoreCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 仓库名称 |
| | | /// </summary> |
| | | public string? StoreName { get; set; } |
| | | } |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsStores; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Util; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using static CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsAreas.WmsAreaCreateOrUpdateDtoBase; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Services |
| | | { |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | List<EnumItem> GetEnumDataList(WmsEnumInput enumInput); |
| | | |
| | | /// <summary> |
| | | /// 获取仓库列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task<List<WmsStoreForAreaOutpur>> GetStreList(); |
| | | |
| | | /// <summary> |
| | | /// 库区列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task<List<AreaForListOuptut>> GetAreaListAsync(); |
| | | } |
| | | } |
| | |
| | | using Volo.Abp.Application.Dtos; |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.ObjectExtending; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Util; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Implements; |
| | | |
| | |
| | | } |
| | | |
| | | var specification = new WmsAreaSpecification(input.Name); |
| | | var count = await _wmsareaRepository.GetCountAsync(input.Filter, specification); |
| | | var list = await _wmsareaRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification); |
| | | var area = ObjectMapper.Map<GetWmsAreasInput, WmsArea>(input); |
| | | var count = await _wmsareaRepository.GetCountAsync(area,input.Filter, specification); |
| | | var list = await _wmsareaRepository.GetListAsync(area,input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification); |
| | | |
| | | return new PagedResultDto<WmsAreaDto>(count, ObjectMapper.Map<List<WmsArea>, List<WmsAreaDto>>(list)); |
| | | } |
| | |
| | | /// <inheritdoc /> |
| | | public virtual async Task AdjustSortAsync(Guid id, int sort) |
| | | { |
| | | var list = await _wmsareaRepository.GetListAsync(nameof(WmsArea.Sort)); |
| | | var list = await _wmsareaRepository.GetListAsync(null,nameof(WmsArea.Sort)); |
| | | if (list != null && list.Any()) |
| | | { |
| | | var initSort = 1; |
| | |
| | | } |
| | | |
| | | var specification = new WmsAreaSpecification(input.Name); |
| | | var list = await _wmsareaRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification, includeDetails: true); |
| | | var area = ObjectMapper.Map<GetWmsAreasInput, WmsArea>(input); |
| | | var list = await _wmsareaRepository.GetListAsync(area,input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification, includeDetails: true); |
| | | var result = ObjectMapper.Map<List<WmsArea>, List<WmsAreaDto>>(list); |
| | | |
| | | var sheets = new Dictionary<string, object> |
| | | { |
| | | ["配置"] = result.Select(x => x.GetExportData()).ToList(), |
| | | ["配置"] = ExportHelper.ConvertListToExportData(result), |
| | | }; |
| | | |
| | | var fileName = result.Count > 1 ? "WmsArea列表" : result.Count == 1 ? result.First()?.AreaName : "WmsArea模版"; |
| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsStores; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Util; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using CMS.Plugin.HIAWms.Domain.WmsStores; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using static CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsAreas.WmsAreaCreateOrUpdateDtoBase; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Implements |
| | | { |
| | |
| | | /// </summary> |
| | | public class WmsEnumAppService : CMSPluginAppService, IWmsEnumAppService |
| | | { |
| | | private readonly IWmsStoreRepository _storeRepository; |
| | | private readonly IWmsAreaRepository _wmsAreaRepository; |
| | | |
| | | public WmsEnumAppService(IWmsStoreRepository storeRepository, IWmsAreaRepository wmsAreaRepository) |
| | | { |
| | | _storeRepository = storeRepository; |
| | | _wmsAreaRepository = wmsAreaRepository; |
| | | } |
| | | |
| | | public List<EnumItem> GetEnumDataList(WmsEnumInput enumInput) |
| | | { |
| | | return EnumHelper.GetEnumItems(enumInput.EnumName); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取仓库列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsStoreForAreaOutpur>> GetStreList() |
| | | { |
| | | var list = await _storeRepository.GetListForSelectAsync(); |
| | | if (list == null || list.Count <= 0) { return new List<WmsStoreForAreaOutpur>(); } |
| | | |
| | | var result = list.Select(x => new WmsStoreForAreaOutpur |
| | | { |
| | | StoreCode = x.StoreCode, |
| | | StoreName = x.StoreName, |
| | | }).ToList(); |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 库区列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task<List<AreaForListOuptut>> GetAreaListAsync() |
| | | { |
| | | var list = await _wmsAreaRepository.GetListForSelectAsync(); |
| | | if (list == null || list.Count <= 0) { return new List<AreaForListOuptut>(); } |
| | | var result = list.Select(x=>new AreaForListOuptut |
| | | { |
| | | AreaName = x.AreaName, |
| | | AreaNo = x.AreaNo, |
| | | }).ToList(); |
| | | |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | |
| | | * into multiple profile classes for a better organization. */ |
| | | CreateMap<WmsArea, WmsAreaDto>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | CreateMap<WmsAreaCreateDto, WmsArea>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | CreateMap<GetWmsAreasInput, WmsArea>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | } |
| | | } |
| | |
| | | * into multiple profile classes for a better organization. */ |
| | | CreateMap<WmsStore, WmsStoreDto>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | CreateMap<WmsStoreCreateDto, WmsStore>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | CreateMap<GetWmsStoresInput, WmsStore>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | } |
| | | } |
| | |
| | | /// <param name="includeDetails">if set to <c>true</c> [include details].</param> |
| | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | /// <returns></returns> |
| | | Task<List<WmsArea>> GetListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsArea> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default); |
| | | Task<List<WmsArea>> GetListAsync(WmsArea? area, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsArea> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// 获取库区列表 |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<List<WmsArea>> GetListForSelectAsync(CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// Gets the count asynchronous. |
| | |
| | | /// <param name="specification">The specification.</param> |
| | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | /// <returns></returns> |
| | | Task<long> GetCountAsync(string filter = null, Specification<WmsArea> specification = null, CancellationToken cancellationToken = default); |
| | | Task<long> GetCountAsync(WmsArea? area, string filter = null, Specification<WmsArea> specification = null, CancellationToken cancellationToken = default); |
| | | } |
| | |
| | | Task<List<WmsStore>> GetListAsync(WmsStore? store, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsStore> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// 查询仓库列表 |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | Task<List<WmsStore>> GetListForSelectAsync(CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// Gets the count asynchronous. |
| | | /// </summary> |
| | | /// <param name="filter">The filter.</param> |
| | |
| | | using System; |
| | | using System.Linq.Dynamic.Core; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; |
| | | using DatabaseSchemaReader.Filters; |
| | | using MathNet.Numerics; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
| | | using Volo.Abp.EntityFrameworkCore; |
| | |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<List<WmsArea>> GetListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsArea> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | public async Task<List<WmsArea>> GetListAsync(WmsArea? area, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsArea> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | { |
| | | specification ??= new WmsAreaSpecification(); |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails(includeDetails) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.AreaNo.Contains(filter)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.AreaNo), u => u.AreaNo.Contains(area.AreaNo)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.AreaName), u => u.AreaNo.Contains(area.AreaName)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.StoreCode), u => u.AreaNo == area.StoreCode) |
| | | .WhereIf(area.AreaStatus > 0, u => u.AreaStatus == area.AreaStatus) |
| | | .WhereIf(area.AreaType > 0, u => u.AreaType == area.AreaType) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(sorting.IsNullOrEmpty() ? nameof(WmsArea.Sort) : sorting) |
| | | .PageBy(skipCount, maxResultCount) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取库区列表 |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsArea>> GetListForSelectAsync(CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<long> GetCountAsync(string filter = null, Specification<WmsArea> specification = null, CancellationToken cancellationToken = default) |
| | | public async Task<long> GetCountAsync(WmsArea? area, string filter = null, Specification<WmsArea> specification = null, CancellationToken cancellationToken = default) |
| | | { |
| | | specification ??= new WmsAreaSpecification(); |
| | | return await (await GetQueryableAsync()) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.AreaNo.Contains(filter)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.AreaNo), u => u.AreaNo.Contains(area.AreaNo)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.AreaName), u => u.AreaNo.Contains(area.AreaName)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.StoreCode), u => u.AreaNo == area.StoreCode) |
| | | .WhereIf(area.AreaStatus > 0, u => u.AreaStatus == area.AreaStatus) |
| | | .WhereIf(area.AreaType > 0, u => u.AreaType == area.AreaType) |
| | | .Where(x => !x.IsDeleted) |
| | | .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); |
| | | } |
| | |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询仓库列表 |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsStore>> GetListForSelectAsync( CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<long> GetCountAsync(WmsStore? store, string filter = null, Specification<WmsStore> specification = null, CancellationToken cancellationToken = default) |
| | | { |
| | |
| | | using CMS.Extensions.Abp.AspNetCore.Mvc.Filters; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsStores; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Util; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System; |
| | | using System.Web; |
| | | using static CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsAreas.WmsAreaCreateOrUpdateDtoBase; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Controller |
| | | { |
| | |
| | | { |
| | | return _wmsEnumAppService.GetEnumDataList(input); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取仓库列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("StoreList")] |
| | | public async Task<List<WmsStoreForAreaOutpur>> GetStreList() |
| | | { |
| | | return await _wmsEnumAppService.GetStreList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 库区列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("AreaList")] |
| | | public async Task<List<AreaForListOuptut>> GetAreaListAsync() |
| | | { |
| | | return await _wmsEnumAppService.GetAreaListAsync(); |
| | | } |
| | | } |
| | | } |