mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 06:27:15 +00:00
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:
@@ -8,7 +8,7 @@ namespace bnhtrade.Core.Test.Account
|
||||
{
|
||||
public class Account
|
||||
{
|
||||
public Account(string sqlConnectionString)
|
||||
public Account()
|
||||
{
|
||||
//var inst = new Data.Database.Account.GetTaxCode(sqlConnectionString);
|
||||
//inst.
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Test.Amazon.MWS
|
||||
{
|
||||
public class Report
|
||||
{
|
||||
private string sqlConnectionString;
|
||||
public Report(string sqlConnectionString)
|
||||
{
|
||||
this.sqlConnectionString = sqlConnectionString;
|
||||
|
||||
// method you want to start here
|
||||
GetRport();
|
||||
|
||||
}
|
||||
public void GetRport()
|
||||
{
|
||||
string mwsReportEnum = "_GET_FBA_FULFILLMENT_INVENTORY_RECEIPTS_DATA_";
|
||||
DateTime start = new DateTime(2020, 10, 01);
|
||||
DateTime finish = new DateTime(2020, 11, 03);
|
||||
}
|
||||
}
|
||||
}
|
||||
61
src/bnhtrade.Core/Test/Amazon/SP-API/Reports.cs
Normal file
61
src/bnhtrade.Core/Test/Amazon/SP-API/Reports.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using CsvHelper;
|
||||
using CsvHelper.Configuration;
|
||||
using FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Test.Amazon.SP_API
|
||||
{
|
||||
public class Reports
|
||||
{
|
||||
public Reports()
|
||||
{
|
||||
sync_GET_LEDGER_DETAIL_VIEW_DATA();
|
||||
}
|
||||
|
||||
public void download_GET_LEDGER_DETAIL_VIEW_DATA()
|
||||
{
|
||||
var report = new Data.Amazon.Report.FbaInventoryLedgerDetailed();
|
||||
report.GetReport(DateTime.UtcNow.AddMonths(-17), DateTime.UtcNow);
|
||||
if (report.IsSetResultList)
|
||||
{
|
||||
List<Model.Import.AmazonFbaInventoryLedgerDetail> lsdkfjl = report.ResultList;
|
||||
int a = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void sync_GET_LEDGER_DETAIL_VIEW_DATA()
|
||||
{
|
||||
var logic = new bnhtrade.Core.Logic.Import.AmazonFbaInventoryLedgerDetail();
|
||||
logic.SyncDatabaseWithAmazon();
|
||||
}
|
||||
|
||||
public void CsvHelper()
|
||||
{
|
||||
using (var reader = new StreamReader("C:\\Users\\Bobbie\\AppData\\Local\\Temp\\_bnhtrade.Core\\File\\SP-API-Report GET_LEDGER_DETAIL_VIEW_DATA reportId_902635019835.txt"))
|
||||
{
|
||||
var config = new CsvConfiguration(CultureInfo.InvariantCulture)
|
||||
{
|
||||
Delimiter = "\t",
|
||||
};
|
||||
|
||||
using (var csvreader = new CsvReader(reader, config))
|
||||
{
|
||||
csvreader.Read();
|
||||
csvreader.ReadHeader();
|
||||
int columns = csvreader.HeaderRecord.Count();
|
||||
if (columns != 15)
|
||||
throw new Exception("New column detected in GET_LEDGER_DETAIL_VIEW_DATA");
|
||||
|
||||
var resultList = csvreader.GetRecords<Model.Import.AmazonFbaInventoryLedgerDetail>().ToList();
|
||||
int d = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Test.AmazonMWS
|
||||
{
|
||||
public class Report
|
||||
{
|
||||
private string sqlConnectionString;
|
||||
public Report(string sqlConnectionString)
|
||||
{
|
||||
this.sqlConnectionString = sqlConnectionString;
|
||||
|
||||
// method you want to start here
|
||||
GetRport();
|
||||
|
||||
}
|
||||
public void GetRport()
|
||||
{
|
||||
string mwsReportEnum = "_GET_FBA_FULFILLMENT_INVENTORY_RECEIPTS_DATA_";
|
||||
DateTime start = new DateTime(2020, 10, 01);
|
||||
DateTime finish = new DateTime(2020, 11, 03);
|
||||
var result = new bnhtrade.Core.AmazonReport().GetMwsReportByPeriod(mwsReportEnum, start, finish, 12, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,18 +8,14 @@ namespace bnhtrade.Core.Test
|
||||
{
|
||||
public class AutoExec
|
||||
{
|
||||
private string sqlConnectionString;
|
||||
|
||||
public AutoExec(string sqlConnectionString)
|
||||
public AutoExec()
|
||||
{
|
||||
this.sqlConnectionString = sqlConnectionString;
|
||||
|
||||
// --------------- start this ------------------- //
|
||||
AmazonSettlement();
|
||||
}
|
||||
private void AmazonSettlement()
|
||||
{
|
||||
var instance = new Core.Logic.Export.AmazonSettlement(sqlConnectionString);
|
||||
var instance = new Core.Logic.Export.AmazonSettlement();
|
||||
instance.ToInvoice();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,8 @@ namespace bnhtrade.Core.Test.Import
|
||||
{
|
||||
public class Report
|
||||
{
|
||||
private Model.Credentials.bnhtradeDB dbCredentials;
|
||||
private string sqlConnectionString;
|
||||
private Model.Credentials.AmazonSPAPI spapiCredentials;
|
||||
|
||||
public Report(Model.Credentials.bnhtradeDB dbCredentials, Model.Credentials.AmazonSPAPI spapiCredentials)
|
||||
public Report()
|
||||
{
|
||||
this.dbCredentials = dbCredentials;
|
||||
this.sqlConnectionString = dbCredentials.ConnectionString;
|
||||
this.spapiCredentials = spapiCredentials;
|
||||
FBAInventoryAge();
|
||||
}
|
||||
|
||||
@@ -29,8 +22,8 @@ namespace bnhtrade.Core.Test.Import
|
||||
|
||||
public void GetFromSPAPI()
|
||||
{
|
||||
var hhhhhjjjjj = new Core.Logic.Import.AmazonSettlement(spapiCredentials);
|
||||
hhhhhjjjjj.SyncDatabase(sqlConnectionString);
|
||||
var hhhhhjjjjj = new Core.Logic.Import.AmazonSettlement();
|
||||
hhhhhjjjjj.SyncDatabase();
|
||||
}
|
||||
|
||||
public void GetReportDocumentByReportId()
|
||||
|
||||
@@ -8,18 +8,15 @@ namespace bnhtrade.Core.Test.Logic
|
||||
{
|
||||
public class Logic
|
||||
{
|
||||
private string sqlConnectionString;
|
||||
public Logic(string sqlConnectionString)
|
||||
public Logic()
|
||||
{
|
||||
this.sqlConnectionString = sqlConnectionString;
|
||||
|
||||
// method you want to start here
|
||||
UpdateXeroWithAmzonSettlementData();
|
||||
|
||||
}
|
||||
public void UpdateXeroWithAmzonSettlementData()
|
||||
{
|
||||
var instance = new bnhtrade.Core.Logic.Export.AmazonSettlement(sqlConnectionString);
|
||||
var instance = new bnhtrade.Core.Logic.Export.AmazonSettlement();
|
||||
instance.ToInvoice();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace bnhtrade.Core.Test.Sku
|
||||
|
||||
public void UpdateFbaPricing()
|
||||
{
|
||||
var instance = new bnhtrade.Core.Logic.Sku.Price.FbaPricing(sqlConnectionString);
|
||||
var instance = new bnhtrade.Core.Logic.Sku.Price.FbaPricing();
|
||||
instance.Update();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,9 @@ namespace bnhtrade.Core.Test.Stock
|
||||
{
|
||||
public class Stock
|
||||
{
|
||||
private string sqlConnectionString;
|
||||
public Stock(string sqlConnectionString)
|
||||
public Stock()
|
||||
{
|
||||
this.sqlConnectionString = sqlConnectionString;
|
||||
|
||||
// method you want to start here
|
||||
UnreconcileSkuTrnasction(79808);
|
||||
|
||||
}
|
||||
public void ReadStatusBalance()
|
||||
@@ -30,7 +26,7 @@ namespace bnhtrade.Core.Test.Stock
|
||||
var atDate = new DateTime(2017, 02, 01, 21, 54, 30);
|
||||
DateTime.TryParse("22/12/2017 16:35:58", out atDate);
|
||||
|
||||
var result = new Core.Logic.Stock.StatusBalance(sqlConnectionString).GetBySku(sku, statusId);
|
||||
var result = new Core.Logic.Stock.StatusBalance().GetBySku(sku, statusId);
|
||||
}
|
||||
|
||||
public void ReadStockId()
|
||||
@@ -44,21 +40,12 @@ namespace bnhtrade.Core.Test.Stock
|
||||
|
||||
public void SkuTransactionAdd()
|
||||
{
|
||||
var trans = new bnhtrade.Core.Model.Stock.SkuTransaction();
|
||||
trans.IsProcessed = false;
|
||||
trans.Quantity = 1;
|
||||
//trans.Reference
|
||||
trans.SkuNumber = "005642-41";
|
||||
trans.SkuTransactionTypeCode = "ManualAdjustment005";
|
||||
//trans.StockJournalId;
|
||||
trans.TransactionDate = new DateTime(2020, 01, 29, 17, 00, 00);
|
||||
|
||||
new bnhtrade.Core.Logic.Stock.SkuTransactionPersistance(sqlConnectionString).Create(trans);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void UnreconcileSkuTrnasction(int transactoinId)
|
||||
{
|
||||
new bnhtrade.Core.Logic.Stock.SkuTransactionReconcile(sqlConnectionString).UnReconcileTransaction(transactoinId);
|
||||
new bnhtrade.Core.Logic.Stock.SkuTransactionReconcile().UnReconcileTransaction(transactoinId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user