SP-API stock reconciliation

Amazon had depreciated a number of reports that were used for stock reconciliation. Application now uses the new fba ledger report to reconcile. It is currently untested, as this requires data from Amazon. Methods that require testing will return a 'NotImplementedException'.

Also, removed the depreciated ILMerge and replaced with ILRepack.

Plus much more tidying up, and improvements.
This commit is contained in:
Bobbie Hodgetts
2024-05-07 08:24:00 +01:00
committed by GitHub
parent 2f919d7b5a
commit 91ef9acc78
1272 changed files with 4944 additions and 2773311 deletions

View File

@@ -8,35 +8,27 @@ namespace bnhtrade.Core.Logic.Utilities
{
public class NightlyRoutine
{
private Model.Credentials.AmazonSPAPI amznCredentials;
private Model.Credentials.bnhtradeDB dbCredentials;
private Logic.Log.LogEvent log = new Log.LogEvent();
public NightlyRoutine(Model.Credentials.AmazonSPAPI amznCredentials, Model.Credentials.bnhtradeDB dbCredentials)
public NightlyRoutine()
{
this.amznCredentials = amznCredentials;
this.dbCredentials = dbCredentials;
}
public void DownloadAll()
{
new Logic.Log.LogEvent().EventLogInsert("Nightly scheduled tasks started.");
log.LogInformation("Nightly scheduled tasks started.");
var stock = new bnhtrade.Core.Stock.StockReconciliation();
var export = new bnhtrade.Core.Logic.Export.AmazonSettlement(dbCredentials.ConnectionString);
var export = new bnhtrade.Core.Logic.Export.AmazonSettlement();
bool accountUpdate = false;
bool stockUpdate = false;
bool accountProcess = false;
bool stockProcess = false;
while (true)
{
try
{
if (accountUpdate == false) { accountUpdate = true; new Logic.Import.AmazonSettlement(amznCredentials).SyncDatabase(dbCredentials.ConnectionString); }
if (stockUpdate == false) { stockUpdate = true; new bnhtrade.Core.Logic.Import.Amazon().SyncAllWithDatabase(); ; }
if (accountProcess == false) { accountProcess = true; export.ToInvoice(); }
if (stockUpdate == false) { stockUpdate = true; stock.UpdateFbaStockImportData(dbCredentials.ConnectionString); }
// if (stockProcess == false) { stockProcess = true; stock.ProcessFbaStockImportData(); }
// ^^^^^^ best to process manually, case, fba inventory recepts, if a correction is made days later (ie -1) the already incorrect value
@@ -46,14 +38,13 @@ namespace bnhtrade.Core.Logic.Utilities
}
catch (Exception ex)
{
new Logic.Log.LogEvent().EventLogInsert(
log.LogInformation(
"Exception caught running all report get method, see for further details",
1,
ex.ToString()
);
}
}
new Logic.Log.LogEvent().EventLogInsert("Nightly scheduled tasks finished.");
log.LogInformation("Nightly scheduled tasks finished.");
}
}
}