wip, this turned into a maaaaaahooosive job

This commit is contained in:
2025-07-09 13:28:17 +01:00
parent 8c3b00c75c
commit c0f7f1a476
25 changed files with 1888 additions and 1188 deletions

View File

@@ -0,0 +1,39 @@
using bnhtrade.Core.Data.Database.UnitOfWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Logic.Inventory
{
public class StockStatusService : UnitOfWorkBase
{
public StockStatusService() : base() { }
internal StockStatusService(IUnitOfWork unitOfWork) : base(unitOfWork) { }
/// <summary>
/// Return the avaliable balance of a status. Uses a more efficent sql/code. However, balance requests should
/// generally also involve a date/time (i.e. the system does allow a stock transaction in the future, therefore
/// this method may give an available quantity, but transfers before that date wouod not be possible).
/// </summary>
/// <param name="sku">SKU number</param>
/// <param name="statusId">Status ID</param>
/// <returns>Balance as quantity</returns>
private int GetAvailableBalanceBySku(string sku, int statusId)
{
return WithUnitOfWork(uow =>
{
if (string.IsNullOrWhiteSpace(sku))
{
throw new ArgumentException("SKU number is null, empty, or whitespace", nameof(sku));
}
return uow.StockJournalRepository.ReadStatusBalanceBySku(sku, statusId);
});
}
}
}