phronCare/Core/Services/Stock/LSStockScanService.cs
Leandro Hernan Rojas 1c4c241266
Some checks failed
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Failing after 15m47s
Add StockItemModal v1
2025-08-18 00:47:37 -03:00

45 lines
1.6 KiB
C#

using Core.Interfaces.Stock;
using Domain.Dtos.Stock;
using Domain.Generics;
using Models.Interfaces;
namespace Core.Services.Stock
{
public class LSStockScanService : ILSStockScanDom
{
#region Declaraciones y Constructor
private readonly IPhLSMStockItemRepository _repo;
// Constructor injection for repository dependency
public LSStockScanService(IPhLSMStockItemRepository repo) => _repo = repo;
#endregion
#region Metodos
public Task<PagedResult<StockItemScanResultDto>> SearchAsync(StockItemSearchParams p)
=> _repo.SearchStockItemsAsync(
p.CodeOrText,
p.Batch,
p.LocationId,
p.ProductType,
p.TraceabilityType,
p.PlusProcess,
p.Page,
p.PageSize);
public Task<PagedResult<StockItemScanResultDto>> SearchParsedAsync(
StockItemParsedSearchParams p,
CancellationToken ct = default)
{
var page = p.Page <= 0 ? 1 : p.Page;
var take = p.PageSize <= 0 ? 20 : p.PageSize;
return _repo.SearchStockItemsParsedAsync(
gtin: string.IsNullOrWhiteSpace(p.Gtin) ? null : p.Gtin!.Trim(),
batch: string.IsNullOrWhiteSpace(p.Batch) ? null : p.Batch!.Trim(),
expiration: p.Expiration,
serial: string.IsNullOrWhiteSpace(p.Serial) ? null : p.Serial!.Trim(),
locationId: p.LocationId,
page: page,
take: take
);
}
#endregion
}
}