|  |  |  | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsEnumDto; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto; | 
|---|
|  |  |  | 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.Shared.Enums; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Domain.WmsAreas; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Domain.WmsMaterials; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Domain.WmsPlaces; | 
|---|
|  |  |  | using CMS.Plugin.HIAWms.Domain.WmsStores; | 
|---|
|  |  |  | using CmsQueryExtensions; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | using static CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsPlaces.WmsPlaceCreateOrUpdateDtoBase; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | namespace CMS.Plugin.HIAWms.Application.Implements | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | public class WmsEnumAppService : CMSPluginAppService, IWmsEnumAppService | 
|---|
|  |  |  | { | 
|---|
|  |  |  | private readonly IWmsStoreRepository _storeRepository; | 
|---|
|  |  |  | private readonly IWmsAreaRepository _wmsAreaRepository; | 
|---|
|  |  |  | private readonly IWmsPlaceRepository _wmsPlaceRepository; | 
|---|
|  |  |  | private readonly IWmsMaterialRepository _wmsMaterialRepository; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public WmsEnumAppService(IWmsStoreRepository storeRepository, IWmsAreaRepository wmsAreaRepository, IWmsPlaceRepository wmsPlaceRepository, IWmsMaterialRepository wmsMaterialRepository) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _storeRepository = storeRepository; | 
|---|
|  |  |  | _wmsAreaRepository = wmsAreaRepository; | 
|---|
|  |  |  | _wmsPlaceRepository = wmsPlaceRepository; | 
|---|
|  |  |  | _wmsMaterialRepository = wmsMaterialRepository; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 巷道列表 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | public async Task<List<PlaceAisleForListOuptut>> GetAisleListAsync() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var list = await _wmsPlaceRepository.GetAisleListForSelectAsync(); | 
|---|
|  |  |  | if (list == null || list.Count <= 0) { return new List<PlaceAisleForListOuptut>(); } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var result = list.Select(x => new PlaceAisleForListOuptut | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Aisle = x.Aisle, | 
|---|
|  |  |  | AisleName = $"第{x.Aisle}巷道", | 
|---|
|  |  |  | }).ToList(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 获取机型 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | public async Task<List<MaterialModelOutput>> GetMaterialModeListAsync() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var materialList = await _wmsMaterialRepository.GetMaterialListAsync(new WmsMaterial()); | 
|---|
|  |  |  | if (materialList == null || materialList.Count <= 0) return new List<MaterialModelOutput>(); ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return materialList.Select(material => new MaterialModelOutput | 
|---|
|  |  |  | { | 
|---|
|  |  |  | MaterialModel = material.MaterialModel, | 
|---|
|  |  |  | MaterialModelDesc = material.MaterialModel | 
|---|
|  |  |  | }).ToList(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 获取库区列表 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="cancellationToken"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | public async Task<List<PlaceListOutput>> GetPlaceListForSelectAsync(PlaceTypeEnum placeType) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var placeList = await _wmsPlaceRepository.GetPlaceListForSelectAsync(placeType); | 
|---|
|  |  |  | if (placeList == null || placeList.Count <= 0) return new List<PlaceListOutput>(); ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return placeList.Select(place => new PlaceListOutput | 
|---|
|  |  |  | { | 
|---|
|  |  |  | PlaceNo = place.PlaceNo, | 
|---|
|  |  |  | PlaceNoDesc = place.PlaceNo | 
|---|
|  |  |  | }).ToList(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|