diff --git a/ds-wms-service/DS.WMS.AdminApi/Controllers/CommonController.cs b/ds-wms-service/DS.WMS.AdminApi/Controllers/CommonController.cs index 80dcbf49..0e798baa 100644 --- a/ds-wms-service/DS.WMS.AdminApi/Controllers/CommonController.cs +++ b/ds-wms-service/DS.WMS.AdminApi/Controllers/CommonController.cs @@ -16,16 +16,30 @@ namespace DS.WMS.AdminApi.Controllers; public class CommonController : ApiController { private readonly ICommonService _invokeService; - + private readonly IServerCommonService _serverService; /// /// 构造函数 /// /// - public CommonController(ICommonService invokeService) + public CommonController(ICommonService invokeService, IServerCommonService serverService) { _invokeService = invokeService; + _serverService = serverService; } + + /// + /// 获取船公司下拉列表 + /// + /// 船公司代码或中文名称 + /// + [HttpGet] + [Route("GetCarrierSelectList")] + public async Task>> GetCarrierSelectList([FromQuery] string queryKey) + { + var res = await _serverService.GetCodeCarrierSelectList(queryKey); + return res; + } /// /// 用户登录-管理端 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/IServerCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/IServerCommonService.cs new file mode 100644 index 00000000..e434d1ba --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/IServerCommonService.cs @@ -0,0 +1,23 @@ +using DS.Module.Core; +using DS.Module.Core.Extensions; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Fee.Dtos; +using DS.WMS.Core.Info.Dtos; +using DS.WMS.Core.Op.Dtos; +using DS.WMS.Core.Sys.Dtos; +using DS.WMS.Core.Sys.Entity; +using SqlSugar; + +namespace DS.WMS.Core.Sys.Interface; +/// +/// +/// +public interface IServerCommonService +{ + /// + /// 获取船公司下拉列表-管理端 + /// + /// + public Task>> GetCodeCarrierSelectList(string queryKey = ""); + +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index 30428a72..0352f10a 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -1,6 +1,5 @@ using DS.Module.Core; using DS.Module.Core.Constants; -using DS.Module.Core.Data; using DS.Module.Core.Extensions; using DS.Module.Core.Log; using DS.Module.SqlSugar; @@ -11,21 +10,14 @@ using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Info.Dtos; using DS.WMS.Core.Info.Entity; -using DS.WMS.Core.Invoice.Dtos; using DS.WMS.Core.Op.Dtos; -using DS.WMS.Core.Op.EDI; using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Sys.Dtos; using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Interface; using Mapster; -using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.Extensions.DependencyInjection; -using NPOI.POIFS.Crypt.Dsig; using SqlSugar; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace DS.WMS.Core.Sys.Method; diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ServerCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ServerCommonService.cs new file mode 100644 index 00000000..fcbb3abb --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ServerCommonService.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DS.Module.Core; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Sys.Interface; +using Mapster; +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; +using DS.Module.Core; +using DS.Module.Core.Constants; +using DS.Module.Core.Extensions; +using DS.Module.Core.Log; +using DS.Module.SqlSugar; +using DS.Module.UserModule; +using DS.WMS.Core.Code.Entity; + +namespace DS.WMS.Core.Sys.Method +{ + public class ServerCommonService : IServerCommonService + { + private readonly IServiceProvider _serviceProvider; + private readonly ISqlSugarClient db; + private readonly IUser user; + + /// + /// + /// + /// + public ServerCommonService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + user = _serviceProvider.GetRequiredService(); + } + + /// + /// + /// + /// + /// + public async Task>> GetCodeCarrierSelectList(string queryKey = "") + { + var list = await db.Queryable() + .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.Code.Contains(queryKey) || a.CnName.Contains(queryKey)) + .Select(a => new CodeCarrierRes() + { + PinYinCode = a.CnName + "(" + a.Code + ")", + }, + true) + .Take(20) + .ToListAsync(); + return await Task.FromResult(DataResult>.Success("获取数据成功!", list)); + } + } +}