diff --git a/src/bnhtrade.Core/Data/Database/Account/ReadAccountCode.cs b/src/bnhtrade.Core/Data/Database/Account/ReadAccountCode.cs index 373e714..814d552 100644 --- a/src/bnhtrade.Core/Data/Database/Account/ReadAccountCode.cs +++ b/src/bnhtrade.Core/Data/Database/Account/ReadAccountCode.cs @@ -10,19 +10,29 @@ namespace bnhtrade.Core.Data.Database.Account public class ReadAccountCode : Connection { private Data.Database.SqlWhereBuilder sqlWhere = new SqlWhereBuilder(); - private List resultList; + private List resultList; public ReadAccountCode() { } - public List All() + /// + /// Gets the full chart of accounts + /// + /// Dictionary where the database record id is the key + public Dictionary All() { Innit(); - return Execute(null, null); + var list = Execute(null, null); + var dictionary = new Dictionary(); + foreach (var item in list) + { + dictionary.Add(item.Id, item); + } + return dictionary; } - public List ByAccountCode(List accountCodeList) + public List ByAccountCode(List accountCodeList) { Innit(); @@ -35,7 +45,7 @@ namespace bnhtrade.Core.Data.Database.Account return Execute(sqlWhere.SqlWhereString, sqlWhere.ParameterList); } - private List Execute(string sqlWhere, Dictionary parameters) + private List Execute(string sqlWhere, Dictionary parameters) { //build sql query string sqlString = @" @@ -45,6 +55,7 @@ namespace bnhtrade.Core.Data.Database.Account ,tblAccountChartOf.Description ,tblAccountChartOfType.AccountChartOfType ,tblAccountChartOfType.BasicType + ,tblAccountChartOfType.Multiplier FROM tblAccountChartOf INNER JOIN tblAccountChartOfType ON tblAccountChartOf.AccountChartOfTypeID = tblAccountChartOfType.AccountChartOfTypeID " + sqlWhere; @@ -69,19 +80,20 @@ namespace bnhtrade.Core.Data.Database.Account { while (reader.Read()) { - var result = new Model.Account.AccountCode(); - int tablePk = reader.GetInt32(0); - result.AccountCodeId = reader.GetInt32(1); - result.Title = reader.GetString(2); - if (!reader.IsDBNull(3)) { result.Description = reader.GetString(3); } - result.Type = reader.GetString(4); - result.BasicType = reader.GetString(5); + uint tablePk = (uint)reader.GetInt32(0); + uint accountCode = (uint)reader.GetInt32(1); + string title = reader.GetString(2); + string description = null; + if (!reader.IsDBNull(3)) { description = reader.GetString(3); } + string type = reader.GetString(4); + string basicType = reader.GetString(5); + int multiplier = reader.GetInt32(6); + var result = new Model.Account.Account(tablePk, accountCode, title, description, type, basicType, multiplier); resultList.Add(result); } } - return resultList; } } @@ -90,7 +102,7 @@ namespace bnhtrade.Core.Data.Database.Account private void Innit() { - resultList = new List(); + resultList = new List(); } } } diff --git a/src/bnhtrade.Core/Data/Database/Account/ReadTaxCode.cs b/src/bnhtrade.Core/Data/Database/Account/ReadTaxCode.cs index e90d529..dd285c2 100644 --- a/src/bnhtrade.Core/Data/Database/Account/ReadTaxCode.cs +++ b/src/bnhtrade.Core/Data/Database/Account/ReadTaxCode.cs @@ -94,7 +94,7 @@ namespace bnhtrade.Core.Data.Database.Account taxcodeList = taxcodeList.Distinct().ToList(); - whereBuilder.Innit(); + whereBuilder.Init(); whereBuilder.In("TaxCode", taxcodeList, "WHERE"); return Execute(whereBuilder.SqlWhereString, whereBuilder.ParameterList); @@ -111,7 +111,7 @@ namespace bnhtrade.Core.Data.Database.Account taxcodeIdList = taxcodeIdList.Distinct().ToList(); - whereBuilder.Innit(); + whereBuilder.Init(); whereBuilder.In("AccountTaxCodeID", taxcodeIdList, "WHERE"); return Execute(whereBuilder.SqlWhereString, whereBuilder.ParameterList); @@ -144,7 +144,7 @@ namespace bnhtrade.Core.Data.Database.Account FROM tblSku INNER JOIN tblAccountTaxCode ON tblSku.AccountTaxCodeID = tblAccountTaxCode.AccountTaxCodeID "; - whereBuilder.Innit(); + whereBuilder.Init(); whereBuilder.In("tblSku.skuSkuNumber", skuNumberList, "WHERE"); sql += whereBuilder.SqlWhereString; @@ -196,7 +196,7 @@ namespace bnhtrade.Core.Data.Database.Account LEFT OUTER JOIN tblAccountTaxCode ON tblAccountInvoiceLineItem.AccountTaxCodeID_Default = tblAccountTaxCode.AccountTaxCodeID "; - whereBuilder.Innit(); + whereBuilder.Init(); whereBuilder.In("tblAccountInvoiceLineItem.ItemCode", lineItemCode, "WHERE"); sql += whereBuilder.SqlWhereString; diff --git a/src/bnhtrade.Core/Data/Database/Constants.cs b/src/bnhtrade.Core/Data/Database/Constants.cs index 6842153..8fae4df 100644 --- a/src/bnhtrade.Core/Data/Database/Constants.cs +++ b/src/bnhtrade.Core/Data/Database/Constants.cs @@ -59,6 +59,17 @@ namespace bnhtrade.Core.Data.Database SkuReconciliationFbaReimbursement = 11, } + /// + /// Returns the sql table ID for a stock status + /// + public enum StockStatus + { + FbaFulfillable = 15, + FbaSold = 12, + ReservedGarageStock = 16, + Reserved = 11, + } + /// /// Returns the sql table ID for a stock status type /// diff --git a/src/bnhtrade.Core/Data/Database/Export/CreateSalesInvoice.cs b/src/bnhtrade.Core/Data/Database/Export/CreateSalesInvoice.cs index e618bc6..1714f09 100644 --- a/src/bnhtrade.Core/Data/Database/Export/CreateSalesInvoice.cs +++ b/src/bnhtrade.Core/Data/Database/Export/CreateSalesInvoice.cs @@ -104,7 +104,7 @@ namespace bnhtrade.Core.Data.Database.Export cmd.Parameters.AddWithValue("@invoiceID", invoiceId); cmd.Parameters.AddWithValue("@itemCode", invoiceList[i].InvoiceLineList[j].ItemCode); cmd.Parameters.AddWithValue("@netAmount", invoiceList[i].InvoiceLineList[j].UnitAmount); - cmd.Parameters.AddWithValue("@accountCode", invoiceList[i].InvoiceLineList[j].AccountCode.AccountCodeId); + cmd.Parameters.AddWithValue("@accountCode", invoiceList[i].InvoiceLineList[j].AccountCode.AccountCode); cmd.Parameters.AddWithValue("@taxAmount", invoiceList[i].InvoiceLineList[j].TaxAmount); cmd.Parameters.AddWithValue("@taxCode", invoiceList[i].InvoiceLineList[j].TaxCode.TaxCode); diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonSettlementRead.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonSettlementRead.cs index 75e2c97..4e46a34 100644 --- a/src/bnhtrade.Core/Data/Database/Import/AmazonSettlementRead.cs +++ b/src/bnhtrade.Core/Data/Database/Import/AmazonSettlementRead.cs @@ -43,7 +43,7 @@ namespace bnhtrade.Core.Data.Database.Import INNER JOIN tblImportAmazonSettlementReportLine ON tblImportAmazonSettlementReport.ImportAmazonSettlementReportID = tblImportAmazonSettlementReportLine.ImportAmazonSettlementReportID WHERE "; - whereBuilder.Innit(); + whereBuilder.Init(); whereBuilder.In("tblImportAmazonSettlementReport.[settlement-id]", settlementIdList); sql += whereBuilder.SqlWhereString; diff --git a/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs b/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs index 60db15a..ad436bc 100644 --- a/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs +++ b/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs @@ -120,7 +120,7 @@ namespace bnhtrade.Core.Data.Database.Product // add nullable items to model if (!reader.IsDBNull(2)) item.TitleSuffix = reader.GetString(2); - if (!reader.IsDBNull(3)) + if (!reader.IsDBNull(4)) item.ProductCategorySubID = reader.GetInt32(4); if (!reader.IsDBNull(5)) item.ReleaseDate = DateTime.SpecifyKind(reader.GetDateTime(5), DateTimeKind.Utc); @@ -187,11 +187,11 @@ namespace bnhtrade.Core.Data.Database.Product "; var sqlWhereBuilder = new Database.SqlWhereBuilder(); - sqlWhereBuilder.Innit(); + sqlWhereBuilder.Init(); sqlWhereBuilder.In("tblSku.skuSkuNumber", skuNumberList); sql += sqlWhereBuilder.SqlWhereString; - using (SqlConnection conn = new SqlConnection()) + using (SqlConnection conn = new SqlConnection(SqlConnectionString)) { conn.Open(); diff --git a/src/bnhtrade.Core/Data/Database/SKU/ReadSku.cs b/src/bnhtrade.Core/Data/Database/SKU/ReadSku.cs index b25b971..c800dab 100644 --- a/src/bnhtrade.Core/Data/Database/SKU/ReadSku.cs +++ b/src/bnhtrade.Core/Data/Database/SKU/ReadSku.cs @@ -34,7 +34,7 @@ namespace bnhtrade.Core.Data.Database.Sku FROM tblSku WHERE "; - sqlWhere.Innit(); + sqlWhere.Init(); sqlWhere.In("skuSkuNumber", skuNumberList); sqlString += sqlWhere.SqlWhereString; diff --git a/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs b/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs index 502cc8b..48009fb 100644 --- a/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs +++ b/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs @@ -7,44 +7,71 @@ using System.Threading.Tasks; namespace bnhtrade.Core.Data.Database { + /// + /// Step 1: Call the methods for each where clause you want to create. This can be done multiple times to create an sql where string. Pay attention + /// to the prefixes that you'll require between each where clause, as each time a method is called the sql statement will be appended to the previous sql + /// string. + /// Step 2: Appened the created sql string to your sql statement, NB the WHERE statemet is not included by default. + /// Step 3: Once you've created your sql command object, add the parameters to it using the method contained within this class. + /// STep 4: exceute your sql commend. + /// public class SqlWhereBuilder { - private int parameterCount; + private int parameterCount = 0; public SqlWhereBuilder() { - Innit(); + Init(); } public string SqlWhereString { get; private set; } + public bool IsSetSqlWhereString + { + get + { + if (SqlWhereString == null || string.IsNullOrEmpty(SqlWhereString)) + { + return false; + } + else + { + return true; + } + } + } + public Dictionary ParameterList { get; private set; } - public void Innit() + /// + /// Initialises the class + /// + public void Init() { - SqlWhereString = null; - ParameterList = new Dictionary(); parameterCount = 0; + SqlWhereString = ""; + ParameterList = new Dictionary(); } public void AddParametersToSqlCommand(SqlCommand cmd) { - foreach (var item in ParameterList) + if (ParameterList != null) { - cmd.Parameters.AddWithValue(item.Key, item.Value); + foreach (var item in ParameterList) + { + cmd.Parameters.AddWithValue(item.Key, item.Value); + } } } /// - /// Used to create a string for an SQL where condition 'In' statement + /// Append an 'In' statement and parameter list to the class properties /// /// Name of the column to used to for the condition statement /// List of values to test in condition statement - /// Optional string to prefix to the returned result + /// Optional prefix that gets added to the sql string result public void In(string columnReference, List orValueList, string wherePrefix = null) { - Innit(); - if (orValueList == null || !orValueList.Any()) { return; @@ -62,7 +89,6 @@ namespace bnhtrade.Core.Data.Database sqlWhere += " " + columnReference + " IN ( "; - var paramters = new Dictionary(); int listCount = distinctList.Count(); for (int i = 0; i < listCount; i++, parameterCount++) { @@ -73,20 +99,19 @@ namespace bnhtrade.Core.Data.Database string param = "@parameter" + parameterCount; sqlWhere += param; - paramters.Add(param, distinctList[i]); + ParameterList.Add(param, distinctList[i]); } - sqlWhere += " )"; + sqlWhere += " ) "; - SqlWhereString = sqlWhere; - ParameterList = paramters; + SqlWhereString = SqlWhereString + sqlWhere; } /// - /// Used to create a string for an SQL where condition 'In' statement + /// Append an 'In' statement and parameter list to the class properties /// /// Name of the column to used to for the condition statement /// List of values to test in condition statement - /// Optional string to prefix to the returned result + /// Optional prefix that gets added to the sql string result public void In(string columnReference, List orValueList, string wherePrefix = null) { var stringList = new List(); diff --git a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusBalance.cs b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusBalance.cs index 73f0306..93ae836 100644 --- a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusBalance.cs +++ b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusBalance.cs @@ -119,5 +119,54 @@ namespace bnhtrade.Core.Data.Database.Stock } return statusBalance; } + + /// + /// Get a list of SKUs avaliable against a specified statusId + /// + /// The stock status id + /// Dictionary of SKUs and the balance of each + public Dictionary ByStatusId(int statusId) + { + var returnList = new Dictionary(); + + using (SqlConnection conn = new SqlConnection(SqlConnectionString)) + { + conn.Open(); + + using (SqlCommand cmd = new SqlCommand(@" + SELECT sub.* + FROM ( + SELECT tblSku.skuSkuID + ,tblSku.skuSkuNumber + ,SUM(tblStockJournalPost.Quantity) AS Balance + FROM tblStockJournal + INNER JOIN tblStockJournalPost ON tblStockJournal.StockJournalID = tblStockJournalPost.StockJournalID + INNER JOIN tblStock ON tblStockJournal.StockID = tblStock.StockID + INNER JOIN tblSku ON tblStock.SkuID = tblSku.skuSkuID + WHERE (tblStockJournalPost.StockStatusID = @statusId) + GROUP BY tblSku.skuSkuID + ,tblSku.skuSkuNumber + ) sub + WHERE sub.Balance <> 0 + ", conn)) + { + // add parameters + cmd.Parameters.AddWithValue("@statusId", statusId); + + // execute + using (SqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + string sku = reader.GetString(1); + int qty = reader.GetInt32(2); + + returnList.Add(sku, qty); + } + } + } + } + return returnList; + } } } diff --git a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTransaction.cs b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTransaction.cs index 175a3b5..b078322 100644 --- a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTransaction.cs +++ b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTransaction.cs @@ -112,7 +112,7 @@ namespace bnhtrade.Core.Data.Database.Stock foreach (var item in dbresults) { - result.Sku = item.SkuNumber; + result.SkuNumber = item.SkuNumber; result.AddBalanceTransaction(item.EntryDate, item.StockNumber, item.Quantity); } } @@ -125,15 +125,15 @@ namespace bnhtrade.Core.Data.Database.Stock /// Gets list of stock status debits and credits. Includes stock numbers with balance greater than or less than zero. /// /// Required, filters results by stock status Id - /// Required, filters results by sku number + /// Required, filters results by sku number /// Tuple list is assending order - public Model.Stock.StatusTransaction BySku(int stockStatusId, string sku) + public Model.Stock.StatusTransaction BySku(int stockStatusId, string skuNumber) { var result = new Model.Stock.StatusTransaction(); - result.Sku = sku; + result.SkuNumber = skuNumber; result.StockStatusId = stockStatusId; - if (string.IsNullOrWhiteSpace(sku)) + if (string.IsNullOrWhiteSpace(skuNumber)) { return result; } @@ -176,7 +176,7 @@ namespace bnhtrade.Core.Data.Database.Stock { var param = new Dapper.DynamicParameters(); param.Add("@stockStatusId", stockStatusId); - param.Add("@sku", sku); + param.Add("@sku", skuNumber); var dbList = conn.Query(strSQL, param); diff --git a/src/bnhtrade.Core/Data/Database/Stock/Status.cs b/src/bnhtrade.Core/Data/Database/Stock/Status.cs new file mode 100644 index 0000000..77243ce --- /dev/null +++ b/src/bnhtrade.Core/Data/Database/Stock/Status.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static bnhtrade.Core.Data.Database.Constants; + +namespace bnhtrade.Core.Data.Database.Stock +{ + internal class Status : Connection + { + private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder; + + public List StatusIds { get; set; } + + public List StatusTypeIds { get; set; } + + public Status () + { + Init(); + } + + public void Init() + { + sqlBuilder = new SqlWhereBuilder(); + StatusIds = new List(); + StatusTypeIds = new List(); + } + + public List Read() + { + var returnList = new List(); + sqlBuilder.Init(); + + //build sql query + string sql = @" + SELECT [StockStatusID] + ,[StatusCode] + ,[StockStatus] + ,[StockStatusTypeID] + ,[Reference] + ,[ForeignKeyID] + ,[IsCreditOnly] + ,[IsClosed] + ,[RecordCreated] + FROM [e2A].[dbo].[tblStockStatus] + WHERE 1=1 "; + + // build the where statments + if (StatusIds.Any()) + { + sqlBuilder.In("StockStatusID", StatusIds, "AND"); + } + if (StatusTypeIds.Any()) + { + sqlBuilder.In("StockStatusTypeID", StatusTypeIds, "AND"); + } + + // append where string to the sql + if (sqlBuilder.IsSetSqlWhereString) + { + sql = sql + sqlBuilder.SqlWhereString; + } + + using (SqlConnection conn = new SqlConnection(SqlConnectionString)) + { + conn.Open(); + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + sqlBuilder.AddParametersToSqlCommand(cmd); + + using (SqlDataReader reader = cmd.ExecuteReader()) + { + if (reader.HasRows) + { + var typeDict = new Data.Database.Stock.StatusType().Read(); + + while (reader.Read()) + { + int statusId = reader.GetInt32(0); + int? statusCode = null; + if (!reader.IsDBNull(1)) { statusCode = reader.GetInt32(1); } + string stockStatus = reader.GetString(2); + int typeId = reader.GetInt32(3); + string reference = null; + if (!reader.IsDBNull(4)) { reference = reader.GetString(4); } + int? foreignKeyId = null; + if (!reader.IsDBNull(5)) { foreignKeyId = reader.GetInt32(5); } + bool isCreditOnly = reader.GetBoolean(6); + bool isClosed = reader.GetBoolean(7); + DateTime recordCreated = DateTime.SpecifyKind(reader.GetDateTime(8), DateTimeKind.Utc); + + var newItem = new Model.Stock.Status(statusId + , statusCode + , stockStatus + , typeDict[typeId] + , reference + , foreignKeyId + , isCreditOnly + , isClosed + , recordCreated + ); + + returnList.Add(newItem); + } + } + } + } + } + return returnList; + } + } +} diff --git a/src/bnhtrade.Core/Data/Database/Stock/StatusType.cs b/src/bnhtrade.Core/Data/Database/Stock/StatusType.cs new file mode 100644 index 0000000..1b394e1 --- /dev/null +++ b/src/bnhtrade.Core/Data/Database/Stock/StatusType.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Data.Database.Stock +{ + public class StatusType : Connection + { + public StatusType() + { + } + + /// + /// Reads all Status Types from database + /// + /// + public Dictionary Read() + { + var returnDict = new Dictionary(); + + // get all account info before we start + var accountDict = new Data.Database.Account.ReadAccountCode().All(); + + using (SqlConnection conn = new SqlConnection(SqlConnectionString)) + { + conn.Open(); + + using (SqlCommand cmd = new SqlCommand(@" + SELECT [StockStatusTypeID] + ,[StatusTypeName] + ,[ForeignKeyType] + ,[ReferenceType] + ,[AccountChartOfID] + FROM [e2A].[dbo].[tblStockStatusType] + ", conn)) + { + using (SqlDataReader reader = cmd.ExecuteReader()) + { + var accountIdDict = new Dictionary(); + + while (reader.Read()) + { + int statusTypeId = reader.GetInt32(0); + string name = reader.GetString(1); + string foreignKey = null; + if (!reader.IsDBNull(2)) { foreignKey = reader.GetString(2); } + string reference = null; + if (!reader.IsDBNull(3)) { reference = reader.GetString(3); } + uint accountId = (uint)reader.GetInt32(4); + + var statusType = new Model.Stock.StatusType(statusTypeId, name, foreignKey, reference, accountDict[accountId]); + returnDict.Add(statusTypeId, statusType); + } + } + } + } + return returnDict; + } + } +} diff --git a/src/bnhtrade.Core/Logic/Account/GetAccountCodeInfo.cs b/src/bnhtrade.Core/Logic/Account/GetAccountCodeInfo.cs index 84300bc..9e08fac 100644 --- a/src/bnhtrade.Core/Logic/Account/GetAccountCodeInfo.cs +++ b/src/bnhtrade.Core/Logic/Account/GetAccountCodeInfo.cs @@ -15,12 +15,12 @@ namespace bnhtrade.Core.Logic.Account readAccountCode = new Data.Database.Account.ReadAccountCode(); } - public List GetAll() + public Dictionary GetAll() { return readAccountCode.All(); } - public Model.Account.AccountCode ByAccountCode(int accountCode) + public Model.Account.Account ByAccountCode(int accountCode) { var list = ByAccountCode(new List { accountCode }); if (list.Any()) @@ -33,14 +33,14 @@ namespace bnhtrade.Core.Logic.Account } } - public List ByAccountCode(List accountCodeList) + public List ByAccountCode(List accountCodeList) { return readAccountCode.ByAccountCode(accountCodeList); } - public Dictionary ConvertToDictionary(List accountCodeList) + public Dictionary ConvertToDictionary(List accountCodeList) { - var returnDict = new Dictionary(); + var returnDict = new Dictionary(); if (accountCodeList == null) { @@ -49,9 +49,9 @@ namespace bnhtrade.Core.Logic.Account foreach (var accountCode in accountCodeList) { - if (!returnDict.ContainsKey(accountCode.AccountCodeId)) + if (!returnDict.ContainsKey((int)accountCode.AccountCode)) { - returnDict.Add(accountCode.AccountCodeId, accountCode); + returnDict.Add((int)accountCode.AccountCode, accountCode); } } return returnDict; diff --git a/src/bnhtrade.Core/Logic/Amazon/Fba/Stock.cs b/src/bnhtrade.Core/Logic/Amazon/Fba/Stock.cs new file mode 100644 index 0000000..1538051 --- /dev/null +++ b/src/bnhtrade.Core/Logic/Amazon/Fba/Stock.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Logic.Amazon.Fba +{ + public class Stock + { + Logic.Stock.StatusBalance read = new Logic.Stock.StatusBalance(); + + /// + /// Get a list of FBA SKUs to replenish from reversed stock. This using the local stock ledger and may not tally with Amazon + /// + /// SKU and the avaible stock in reserve + public List GetReplenishmentList() + { + int fbaFulfillableStatusId = (int)Data.Database.Constants.StockStatus.FbaFulfillable; + int reserveStatusId = (int)Data.Database.Constants.StockStatus.ReservedGarageStock; + + var fbaList = read.GetSkuQuantity(fbaFulfillableStatusId); + var myList = read.GetSkuQuantity(reserveStatusId); + + foreach (var item in fbaList) + { + if (myList.ContainsKey(item.Key)) + { + myList.Remove(item.Key); + } + } + + var readStatusBalance = new Logic.Stock.StatusBalance(); + var returnList = new List(); + foreach (var item in myList) + { + var skuStatusBalance = readStatusBalance.GetStatusBalance(item.Key, reserveStatusId, true); + returnList.Add(skuStatusBalance); + } + return returnList; + } + } +} diff --git a/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs b/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs index a96a859..18e25ec 100644 --- a/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs +++ b/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs @@ -66,7 +66,7 @@ namespace bnhtrade.Core.Logic.Sku.Price statusTypeList.Add((int)Data.Database.Constants.StockStatusType.FbaInventoryActive); statusTypeList.Add((int)Data.Database.Constants.StockStatusType.FbaShipment); - var fbaSkuStock = new Logic.Stock.GetStatusTypeBalance().BySku(statusTypeList); + var fbaSkuStock = new Logic.Stock.StatusTypeBalance().GetByStatusTypeId(statusTypeList); // retrive SKU info var getSku = new Logic.Sku.GetSkuInfo(); diff --git a/src/bnhtrade.Core/Logic/Stock/StatusBalance.cs b/src/bnhtrade.Core/Logic/Stock/StatusBalance.cs index 827ced4..efcff13 100644 --- a/src/bnhtrade.Core/Logic/Stock/StatusBalance.cs +++ b/src/bnhtrade.Core/Logic/Stock/StatusBalance.cs @@ -26,29 +26,29 @@ namespace bnhtrade.Core.Logic.Stock } /// - /// Return the avaliable balance of a status at a specified date and time. Useful for checking availability before - /// moving stock/sku retrospectivly + /// Return the avaliable balance of a status, includes datetime that each stockNumber became avaiable. + /// Useful for checking availability before moving stock/sku retrospectivly /// - /// SKU number + /// SKU number /// Status ID - /// Date and time you would like to know the balance at + /// True, inlcude SKU and StockStatus class. False, supply the SKU Number and StockStatusId instead /// - public Model.Stock.StatusBalance GetBySku(string sku, int statusId) + public Model.Stock.StatusBalance GetStatusBalance(string skuNumber, int statusId, bool includeDetails = true) { - if (string.IsNullOrWhiteSpace(sku)) + if (string.IsNullOrWhiteSpace(skuNumber)) { throw new Exception("SKU number is null, empty, or whitespace"); } // get list of transactions for availale stock - var stockTransaction = new Data.Database.Stock.ReadStatusTransaction(); - var transList = stockTransaction.BySku(statusId, sku); + var readStatusTransaction = new Data.Database.Stock.ReadStatusTransaction(); + var statusTransaction = readStatusTransaction.BySku(statusId, skuNumber); // create quantity list List qtyList = new List(); - for (int i = 0; i < transList.TransactionList.Count; i++) + for (int i = 0; i < statusTransaction.TransactionList.Count; i++) { - qtyList.Add(transList.TransactionList[i].Quantity); + qtyList.Add(statusTransaction.TransactionList[i].Quantity); } // tally list @@ -57,15 +57,15 @@ namespace bnhtrade.Core.Logic.Stock { if (qtyList[iCr] < 0) { - int crStockNumber = transList.TransactionList[iCr].StockNumber; - DateTime crDate = transList.TransactionList[iCr].EntryDate; + int crStockNumber = statusTransaction.TransactionList[iCr].StockNumber; + DateTime crDate = statusTransaction.TransactionList[iCr].EntryDate; // loop, in reverse, to find debits for (int iDr = qtyList.Count - 1; iDr > -1; iDr--) { // find debits, last in first out (filter by date) - if (transList.TransactionList[iDr].StockNumber == crStockNumber - && transList.TransactionList[iDr].EntryDate <= crDate + if (statusTransaction.TransactionList[iDr].StockNumber == crStockNumber + && statusTransaction.TransactionList[iDr].EntryDate <= crDate && qtyList[iDr] > 0) { // credit fully assigned @@ -87,22 +87,49 @@ namespace bnhtrade.Core.Logic.Stock } // build result list from tally results - var result = new Model.Stock.StatusBalance(); - result.Sku = transList.Sku; - result.StockStatusId = transList.StockStatusId; - + var entryList = new List<(DateTime EntryDate, int StockNumber, int Quantity)>(); for (int i = 0; i < qtyList.Count; i++) { if (qtyList[i] != 0) { - result.AddBalanceTransaction( - transList.TransactionList[i].EntryDate, - transList.TransactionList[i].StockNumber, + (DateTime EntryDate, int StockNumber, int Quantity) entryItem = ( + statusTransaction.TransactionList[i].EntryDate, + statusTransaction.TransactionList[i].StockNumber, qtyList[i]); + entryList.Add(entryItem); } } - return result; + if (includeDetails) + { + // get the sku obj + var readSku = new Logic.Sku.GetSkuInfo(); + readSku.IncludeConditionInfo = true; + readSku.IncludeProductInfo = true; + readSku.IncludeTaxCodeInfo = true; + var sku = readSku.BySkuNumber(statusTransaction.SkuNumber); + + // get the status obj + var readStatus = new Data.Database.Stock.Status(); + readStatus.StatusIds = new List { statusTransaction.StockStatusId }; + var status = readStatus.Read()[0]; + + return new Model.Stock.StatusBalance(status, sku, entryList); + } + else + { + return new Model.Stock.StatusBalance(statusTransaction.StockStatusId, statusTransaction.SkuNumber, entryList); + } + } + + /// + /// Get a list of SKUs avaliable against a specified statusId + /// + /// The stock status id + /// Dictionary of SKUs and the repective balance of each + public Dictionary GetSkuQuantity(int statusId) + { + return new Data.Database.Stock.ReadStatusBalance().ByStatusId(statusId); } } } diff --git a/src/bnhtrade.Core/Logic/Stock/StatusReallocate.cs b/src/bnhtrade.Core/Logic/Stock/StatusReallocate.cs index 6944416..26627b0 100644 --- a/src/bnhtrade.Core/Logic/Stock/StatusReallocate.cs +++ b/src/bnhtrade.Core/Logic/Stock/StatusReallocate.cs @@ -58,10 +58,10 @@ namespace bnhtrade.Core.Logic.Stock var returnList = new List<(int StockJournalId, int Quantity)>(); // get balance of status and check for avaliable quantity - var statusBalance = new Logic.Stock.StatusBalance().GetBySku(skuNumber, creditStatusId); + var statusBalance = new Logic.Stock.StatusBalance().GetStatusBalance(skuNumber, creditStatusId); if (statusBalance.GetAvaliableQuantity(entryDate) <= 0 - || (statusBalance.CheckAvaliableQuantity(quantity, entryDate) == false && reallocatePartialQuantity == false + || (statusBalance.IsQuantityAvaliable(quantity, entryDate) == false && reallocatePartialQuantity == false )) { return returnList; @@ -70,7 +70,7 @@ namespace bnhtrade.Core.Logic.Stock // temp code start // until use of stockId is designed out of application var stockIdDictionary = new Dictionary(); - foreach (var item in statusBalance.ByDateList) + foreach (var item in statusBalance.StockList) { if (!stockIdDictionary.ContainsKey(item.StockNumber)) { @@ -84,7 +84,7 @@ namespace bnhtrade.Core.Logic.Stock //make the changes using (TransactionScope scope = new TransactionScope()) { - foreach (var item in statusBalance.ByDateList) + foreach (var item in statusBalance.StockList) { if (quantity > item.Quantity) { diff --git a/src/bnhtrade.Core/Logic/Stock/GetStatusTypeBalance.cs b/src/bnhtrade.Core/Logic/Stock/StatusTypeBalance.cs similarity index 81% rename from src/bnhtrade.Core/Logic/Stock/GetStatusTypeBalance.cs rename to src/bnhtrade.Core/Logic/Stock/StatusTypeBalance.cs index cf8ad80..d609a67 100644 --- a/src/bnhtrade.Core/Logic/Stock/GetStatusTypeBalance.cs +++ b/src/bnhtrade.Core/Logic/Stock/StatusTypeBalance.cs @@ -6,11 +6,11 @@ using System.Threading.Tasks; namespace bnhtrade.Core.Logic.Stock { - public class GetStatusTypeBalance + public class StatusTypeBalance { private Core.Data.Database.Stock.ReadStatusTypeBalance dbRead; - public GetStatusTypeBalance() + public StatusTypeBalance() { dbRead = new Data.Database.Stock.ReadStatusTypeBalance(); } @@ -20,7 +20,7 @@ namespace bnhtrade.Core.Logic.Stock /// /// List of Status Type Ids /// Dictionary where SKU number is key and quantity is value - public Dictionary BySku(List StatusTypeIdList) + public Dictionary GetByStatusTypeId(List StatusTypeIdList) { return dbRead.ReadSku(StatusTypeIdList); } diff --git a/src/bnhtrade.Core/Model/Account/Account.cs b/src/bnhtrade.Core/Model/Account/Account.cs new file mode 100644 index 0000000..d5fccf9 --- /dev/null +++ b/src/bnhtrade.Core/Model/Account/Account.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.UI.WebControls; + +namespace bnhtrade.Core.Model.Account +{ + public class Account + { + public Account(uint id, uint accountCode, string accountName, string description, string type, string basicType, int multiplier) + { + Id = id; + AccountCode = accountCode; + AccountName = accountName; + Description = description; + Type = type; + BasicType = basicType; + Multiplier = multiplier; + } + + /// + /// Database record id + /// + public uint Id { get; private set; } + + public uint AccountCode { get; private set; } + + public string AccountName { get; private set; } + + public string Description { get; private set; } + + public string Type { get; private set; } + + public string BasicType { get; private set; } + + public int Multiplier { get; private set; } + } +} diff --git a/src/bnhtrade.Core/Model/Account/AccountCode.cs b/src/bnhtrade.Core/Model/Account/AccountCode.cs deleted file mode 100644 index 861ea3c..0000000 --- a/src/bnhtrade.Core/Model/Account/AccountCode.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace bnhtrade.Core.Model.Account -{ - public class AccountCode : IValidatableObject - { - private int? accountCodeId; - - [Required(), Range(1, int.MaxValue)] - public int AccountCodeId - { - get { return (int)accountCodeId; } - set { accountCodeId = value; } - } - - [Required(), MaxLength(150)] - public string Title - { - get; - set; - } - - [MaxLength(500)] - public string Description - { - get; - set; - } - - [Required(), MaxLength(50)] - public string Type - { - get; - set; - } - - [Required(), MaxLength(50)] - public string BasicType - { - get; - set; - } - - public bool IsSetAccountCodeId - { - get { return accountCodeId != null; } - } - - public bool IsSetTitle - { - get { return Title != null; } - } - - public bool IsSetDescription - { - get { return Description != null; } - } - - public bool IsSetType - { - get { return Type != null; } - } - - public bool IsSetBasicType - { - get { return BasicType != null; } - } - - public IEnumerable Validate(ValidationContext validationContext) - { - var resultList = new List(); - - if (!IsSetAccountCodeId) - { - resultList.Add(new ValidationResult("Account Code is not set")); - } - - return resultList; - } - } -} diff --git a/src/bnhtrade.Core/Model/Account/Invoice.cs b/src/bnhtrade.Core/Model/Account/Invoice.cs index 2667f7a..c908775 100644 --- a/src/bnhtrade.Core/Model/Account/Invoice.cs +++ b/src/bnhtrade.Core/Model/Account/Invoice.cs @@ -28,7 +28,7 @@ namespace bnhtrade.Core.Model.Account decimal? UnitAmount { get; set; } - Model.Account.AccountCode AccountCode { get; set; } + Model.Account.Account AccountCode { get; set; } Model.Account.TaxCodeInfo TaxCode { get; set; } @@ -116,7 +116,7 @@ namespace bnhtrade.Core.Model.Account public bool UnitAmountIsTaxExclusive { get; set; } [Required()] - public Model.Account.AccountCode AccountCode + public Model.Account.Account AccountCode { get; set; diff --git a/src/bnhtrade.Core/Model/Account/InvoiceLineItem.cs b/src/bnhtrade.Core/Model/Account/InvoiceLineItem.cs index ce3c9de..955ecb6 100644 --- a/src/bnhtrade.Core/Model/Account/InvoiceLineItem.cs +++ b/src/bnhtrade.Core/Model/Account/InvoiceLineItem.cs @@ -44,7 +44,7 @@ namespace bnhtrade.Core.Model.Account } [Required()] - public Model.Account.AccountCode DefaultAccountCode + public Model.Account.Account DefaultAccountCode { get; set; @@ -61,7 +61,6 @@ namespace bnhtrade.Core.Model.Account { var resultList = new List(); - resultList.AddRange(DefaultAccountCode.Validate(validationContext)); resultList.AddRange(DefaultTaxCode.Validate(validationContext)); return resultList; diff --git a/src/bnhtrade.Core/Model/Stock/Status.cs b/src/bnhtrade.Core/Model/Stock/Status.cs new file mode 100644 index 0000000..244564b --- /dev/null +++ b/src/bnhtrade.Core/Model/Stock/Status.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Model.Stock +{ + public class Status + { + public Status(int statusId, int? statusCode, string title, Model.Stock.StatusType type, string reference, int? foreignKeyId, bool isCreditOnly, bool isClosed, DateTime recordCreated) + { + StatusId = statusId; + StatusCode = statusCode; + StatusTitle = title; + StatusType = type; + Reference = reference; + ForeignKeyID = foreignKeyId; + IsCreditOnly = isCreditOnly; + IsClosed = isClosed; + RecordCreated = recordCreated; + } + + public int StatusId { get; private set; } + + public int? StatusCode { get; private set; } + + public string StatusTitle { get; private set; } + + public Model.Stock.StatusType StatusType { get; private set; } + + public string Reference { get; private set; } + + public int? ForeignKeyID { get; private set; } + + public bool IsCreditOnly { get; private set; } + + public bool IsClosed { get; private set; } + + public DateTime RecordCreated { get; private set; } + } +} diff --git a/src/bnhtrade.Core/Model/Stock/StatusBalance.cs b/src/bnhtrade.Core/Model/Stock/StatusBalance.cs index d2679e0..5ae186b 100644 --- a/src/bnhtrade.Core/Model/Stock/StatusBalance.cs +++ b/src/bnhtrade.Core/Model/Stock/StatusBalance.cs @@ -1,60 +1,150 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; +using static bnhtrade.Core.Data.Database.Constants; namespace bnhtrade.Core.Model.Stock { public class StatusBalance { - public int StockStatusId { get; set; } - - public string Sku { get; set; } - - public List ByDateList { get; private set; } = new List(); - - public class ByDate + internal StatusBalance(int stockStatusId, string skuNumber, List<(DateTime EntryDate, int StockNumber, int Quantity)> stockList) { - public DateTime EntryDate { get; set; } - - public int StockNumber { get; set; } - - public int Quantity { get; set; } + StockStatusId = stockStatusId; + SkuNumber = skuNumber; + AddStockList(stockList); } - public void AddBalanceTransaction(DateTime entryDate, int stockNumber, int quantity) + internal StatusBalance(Model.Stock.Status status, Model.Sku.Sku sku, List<(DateTime EntryDate, int StockNumber, int Quantity)> stockList) { - if (entryDate == new DateTime()) + StockStatusId = status.StatusId; + Status = status; + SkuNumber = sku.SkuNumber; + Sku = sku; + AddStockList(stockList); + } + + public int StockStatusId { get; private set; } + + public Model.Stock.Status Status { get; private set; } + + public bool IsSetStatus + { + get { - throw new Exception("Entry date set to default value"); + return Status != null; + } + } + + public string SkuNumber { get; private set; } + + public Model.Sku.Sku Sku { get; private set; } + + public bool IsSetSku + { + get + { + return Sku != null; + } + } + + /// + /// A list of when each stock item(s) became available and the quanitity (which is not a running total). + /// + public List StockList { get; private set; } = new List(); + + public class Stock + { + public Stock(DateTime entryDate, int stockNumber, int quantity) + { + EntryDate = entryDate; + StockNumber = stockNumber; + Quantity = quantity; } - var item = new ByDate(); - item.EntryDate = entryDate; - item.StockNumber = stockNumber; - item.Quantity = quantity; + public DateTime EntryDate { get; private set; } - if (ByDateList == null) { ByDateList = new List(); } + public int StockNumber { get; private set; } - if (ByDateList.Count == 0 || ByDateList.Last().EntryDate <= item.EntryDate) + public int Quantity { get; private set; } + } + + internal void AddDetail(Model.Stock.Status status, Model.Sku.Sku sku) + { + if (sku.SkuNumber != SkuNumber || status.StatusId != StockStatusId) { - ByDateList.Add(item); + throw new ArgumentException("Invalid SKU or Status applied to class"); } - else + SkuNumber = sku.SkuNumber; + Sku = sku; + } + + private void AddStockList(List<(DateTime EntryDate, int StockNumber, int Quantity)> stockList) + { + foreach (var stockItem in stockList) { - for (int i = 0; i < ByDateList.Count; i++) + if (stockItem.EntryDate == new DateTime()) { - if (entryDate <= ByDateList[i].EntryDate) + throw new Exception("Entry date set to default value"); + } + + var item = new Stock(stockItem.EntryDate, stockItem.StockNumber, stockItem.Quantity); + + if (StockList.Count == 0 || StockList.Last().EntryDate <= item.EntryDate) + { + StockList.Add(item); + } + else + { + for (int i = 0; i < StockList.Count; i++) { - i++; - ByDateList.Insert(i, item); + if (stockItem.EntryDate <= StockList[i].EntryDate) + { + i++; + StockList.Insert(i, item); + } } } } } - public bool CheckAvaliableQuantity(int quantity, DateTime onDateTime) + public int GetAvaliableQuantity() + { + if (!StockList.Any()) + { + return 0; + } + + int qty = 0; + + for (int i = 0; i < StockList.Count; i++) + { + qty += StockList[i].Quantity; + } + + return qty; + } + + public int GetAvaliableQuantity(DateTime onDateTime) + { + if (!StockList.Any()) + { + return 0; + } + + int qty = 0; + + for (int i = 0; i < StockList.Count; i++) + { + if (StockList[i].EntryDate <= onDateTime) + { + qty += StockList[i].Quantity; + } + } + + return qty; + } + + public bool IsQuantityAvaliable(int quantity, DateTime onDateTime) { if (GetAvaliableQuantity(onDateTime) < quantity) { @@ -65,42 +155,5 @@ namespace bnhtrade.Core.Model.Stock return true; } } - - public int GetAvaliableQuantity() - { - if (!ByDateList.Any()) - { - return 0; - } - - int qty = 0; - - for (int i = 0; i < ByDateList.Count; i++) - { - qty += ByDateList[i].Quantity; - } - - return qty; - } - - public int GetAvaliableQuantity(DateTime onDateTime) - { - if (!ByDateList.Any()) - { - return 0; - } - - int qty = 0; - - for (int i = 0; i < ByDateList.Count; i++) - { - if (ByDateList[i].EntryDate <= onDateTime) - { - qty += ByDateList[i].Quantity; - } - } - - return qty; - } } } diff --git a/src/bnhtrade.Core/Model/Stock/StatusTransaction.cs b/src/bnhtrade.Core/Model/Stock/StatusTransaction.cs index d5311d6..af15cac 100644 --- a/src/bnhtrade.Core/Model/Stock/StatusTransaction.cs +++ b/src/bnhtrade.Core/Model/Stock/StatusTransaction.cs @@ -10,7 +10,7 @@ namespace bnhtrade.Core.Model.Stock { public int StockStatusId { get; set; } - public string Sku { get; set; } + public string SkuNumber { get; set; } public int Balance { diff --git a/src/bnhtrade.Core/Model/Stock/StatusType.cs b/src/bnhtrade.Core/Model/Stock/StatusType.cs new file mode 100644 index 0000000..c699b4e --- /dev/null +++ b/src/bnhtrade.Core/Model/Stock/StatusType.cs @@ -0,0 +1,26 @@ +using bnhtrade.Core.Data.Database.Stock; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Model.Stock +{ + public class StatusType + { + public StatusType(int stockStatusTypeId, string name, string foreignKeyType, string referenceType, Model.Account.Account account) + { + StockStatusTypeID = stockStatusTypeId; + StatusTypeName = name; + ForeignKeyType = foreignKeyType; + ReferenceType = referenceType; + Account = account; + } + public int StockStatusTypeID { get; private set; } + public string StatusTypeName { get; private set; } + public string ForeignKeyType { get; private set; } + public string ReferenceType { get; private set; } + public Model.Account.Account Account { get; private set; } + } +} diff --git a/src/bnhtrade.Core/Test/Amazon/Amazon.cs b/src/bnhtrade.Core/Test/Amazon/Amazon.cs new file mode 100644 index 0000000..d0c819b --- /dev/null +++ b/src/bnhtrade.Core/Test/Amazon/Amazon.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Test.Amazon +{ + public class Amazon + { + public Amazon() + { + var stock = new Stock(); + stock.GetReplenishmentList(); + } + + public class Stock + { + public void GetReplenishmentList() + { + var read = new bnhtrade.Core.Logic.Amazon.Fba.Stock(); + var resut = read.GetReplenishmentList(); + } + } + } +} diff --git a/src/bnhtrade.Core/Test/Stock/Stock.cs b/src/bnhtrade.Core/Test/Stock/Stock.cs index 9f85e8d..342670b 100644 --- a/src/bnhtrade.Core/Test/Stock/Stock.cs +++ b/src/bnhtrade.Core/Test/Stock/Stock.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using bnhtrade.Core.Data.Database.Stock; namespace bnhtrade.Core.Test.Stock { @@ -11,8 +12,9 @@ namespace bnhtrade.Core.Test.Stock public Stock() { // method you want to start here - + ReadStockStatus(); } + public void ReadStatusBalance() { var result = new bnhtrade.Core.Data.Database.Stock.ReadStatusTransaction() @@ -26,7 +28,15 @@ 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().GetBySku(sku, statusId); + var result = new Core.Logic.Stock.StatusBalance().GetStatusBalance(sku, statusId); + int i = 0; + } + public void StatusBalance2() + { + int statusId = 16; // Inventory, Reserved (Garage Stock) + var result = new Core.Logic.Stock.StatusBalance().GetSkuQuantity(statusId); + int i = result.Values.ToList().Sum(); + int y = 0; } public void ReadStockId() @@ -47,5 +57,14 @@ namespace bnhtrade.Core.Test.Stock { new bnhtrade.Core.Logic.Stock.SkuTransactionReconcile().UnReconcileTransaction(transactoinId); } + + public void ReadStockStatus() + { + var db = new Status(); + db.StatusIds = new List { 3, 4, 5, 6, 7, 11, 12, 13, 15 }; + db.StatusTypeIds = new List { 12, 5 }; + var result = db.Read(); + int i = 0; + } } } diff --git a/src/bnhtrade.Core/bnhtrade.Core.csproj b/src/bnhtrade.Core/bnhtrade.Core.csproj index 7e19a1a..506a48a 100644 --- a/src/bnhtrade.Core/bnhtrade.Core.csproj +++ b/src/bnhtrade.Core/bnhtrade.Core.csproj @@ -183,7 +183,10 @@ + + + @@ -234,7 +237,7 @@ - + @@ -271,7 +274,7 @@ - + @@ -303,8 +306,10 @@ + + @@ -315,6 +320,7 @@ + diff --git a/src/bnhtrade.ScheduledTasks/Program.cs b/src/bnhtrade.ScheduledTasks/Program.cs index 5088326..3e4af66 100644 --- a/src/bnhtrade.ScheduledTasks/Program.cs +++ b/src/bnhtrade.ScheduledTasks/Program.cs @@ -264,8 +264,8 @@ namespace bnhtradeScheduledTasks Console.WriteLine("<5> Test Logic"); Console.WriteLine("<6> Test SKU"); Console.WriteLine("<7> Test Stock"); - Console.WriteLine("<8> Test Amazon SP-API Report"); - Console.WriteLine("<9> "); + Console.WriteLine("<8> Test Amazon SP-API"); + Console.WriteLine("<9> Test Amazon"); Console.WriteLine(" Test SP-API Fulfilment Inbound"); Console.WriteLine(); Console.WriteLine("<0> Back"); @@ -360,6 +360,7 @@ namespace bnhtradeScheduledTasks { Console.Clear(); + new bnhtrade.Core.Test.Amazon.Amazon(); Console.WriteLine("Nothing to do here");