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));
}
}
}