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,45 @@
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 StockJournalService : UnitOfWorkBase
{
public StockJournalService() { }
internal StockJournalService(IUnitOfWork unitOfWork) : base(unitOfWork) { }
public void StockJournalDelete(int stockJournalId)
{
WithUnitOfWork(uow =>
{
if (stockJournalId <= 0)
{
throw new ArgumentException("Stock journal ID must be greater than zero", nameof(stockJournalId));
}
bool result = uow.StockJournalRepository.DeleteStockJournal(stockJournalId);
CommitIfOwned(uow);
if (!result)
{
throw new InvalidOperationException($"Failed to delete stock journal with ID {stockJournalId}");
}
});
}
public bool WIP_StockJournalConsistencyCheck(int stockId, List<int> statusIdEffected = null)
{
return WithUnitOfWork(uow =>
{
if (stockId <= 0)
{
throw new ArgumentException("Stock ID must be greater than zero", nameof(stockId));
}
return uow.StockJournalRepository.WIP_StockJournalConsistencyCheck(stockId, statusIdEffected);
});
}
}
}