using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.BasicData.Interfaces;
using Tnb.WarehouseMgr.Entities.Enums;
namespace Tnb.BasicData
{
///
/// 库位资料服务
///
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
[Route("api/[area]/[controller]/[action]")]
public class BasLocationService : IBasLocationService, IDynamicApiController, ITransient
{
private readonly ISqlSugarClient _db;
public BasLocationService(ISqlSugarRepository repository)
{
_db = repository.AsSugarClient();
}
///
/// 获取非存储库位载具列表
///
///
[HttpGet]
public async Task GetUnStoreLocationListByCarryId([FromRoute] string carryId)
{
List items = await _db.Queryable().Where(it => !string.IsNullOrEmpty(it.is_type) && Convert.ToInt32(it.is_type) != (int)EnumLocationType.存储库位).ToListAsync();
return items;
}
public async Task> GetLocationInfobyIds(IEnumerable locIds)
{
if (locIds == null)
{
throw new ArgumentNullException(nameof(locIds));
}
if (!locIds.Any())
{
throw new ArithmeticException($"parameter locIds.Count is not be empty");
}
List items = await _db.Queryable().Where(it => locIds.Contains(it.id)).ToListAsync();
return items;
}
}
}