Amazon inventory ledger testing and implementation

Tested what I can until more data for the Amazon Ledger Detail table comes in
This commit is contained in:
Bobbie Hodgetts
2024-11-21 17:50:18 +00:00
committed by GitHub
parent 7a12b49b44
commit c8689e3bba
10 changed files with 134 additions and 184 deletions

View File

@@ -354,8 +354,8 @@ namespace bnhtrade.Core.Data.Database.Import
item.Asin = reader.GetString(8); item.Asin = reader.GetString(8);
item.Condition = reader.GetString(9); item.Condition = reader.GetString(9);
item.CurrencyUnit = reader.GetString(10); item.CurrencyUnit = reader.GetString(10);
item.AmountPerUnit = reader.GetInt32(11); item.AmountPerUnit = reader.GetDecimal(11);
item.AmountTotal = reader.GetInt32(12); item.AmountTotal = reader.GetDecimal(12);
item.QuantityReimbursedCash = reader.GetInt32(13); item.QuantityReimbursedCash = reader.GetInt32(13);
item.QuantityReimbursedInventory = reader.GetInt32(14); item.QuantityReimbursedInventory = reader.GetInt32(14);
item.QuantityReimbursedTotal = reader.GetInt32(15); item.QuantityReimbursedTotal = reader.GetInt32(15);

View File

@@ -6,23 +6,19 @@ namespace bnhtrade.Core.Data.Database.Stock
{ {
public class InsertSkuTransactionType : Connection public class InsertSkuTransactionType : Connection
{ {
/// <summary>
/// The insert command will not participate in any amibent transaction scope. Default is true.
/// </summary>
public bool SuppressTransactionScope { get; set; } = true;
/// <summary> /// <summary>
/// Creates a new SKU Transaction Type /// Creates a new SKU Transaction Type
/// </summary> /// </summary>
/// <param name="stockJournalTypeId"></param> /// <param name="stockJournalTypeId"></param>
/// <param name="skuTransactionCode"></param> /// <param name="skuTransactionCode"></param>
/// <param name="transactionScopeSuppress">The insert command will not participate in any amibent transaction scope</param>
/// <returns>ID of the created record</returns> /// <returns>ID of the created record</returns>
/// <exception cref="Exception"></exception> /// <exception cref="Exception"></exception>
public int Create(string skuTransactionCode, int stockJournalTypeId) public int Create(string skuTransactionCode, int stockJournalTypeId, bool transactionScopeSuppress = false)
{ {
int id; int id;
var scopeOption = new TransactionScopeOption(); var scopeOption = new TransactionScopeOption();
if (SuppressTransactionScope) if (transactionScopeSuppress)
{ {
scopeOption = TransactionScopeOption.Suppress; scopeOption = TransactionScopeOption.Suppress;
} }
@@ -32,6 +28,7 @@ namespace bnhtrade.Core.Data.Database.Stock
} }
using (TransactionScope scope = new TransactionScope(scopeOption)) using (TransactionScope scope = new TransactionScope(scopeOption))
{
using (SqlConnection conn = new SqlConnection(SqlConnectionString)) using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{ {
conn.Open(); conn.Open();
@@ -47,8 +44,8 @@ namespace bnhtrade.Core.Data.Database.Stock
", conn)) ", conn))
{ {
cmd.Parameters.AddWithValue("@typeName", skuTransactionCode); cmd.Parameters.AddWithValue("@typeName", skuTransactionCode);
cmd.Parameters.AddWithValue("@typeCode", skuTransactionCode);
cmd.Parameters.AddWithValue("@stockJournalTypeId", stockJournalTypeId); cmd.Parameters.AddWithValue("@stockJournalTypeId", stockJournalTypeId);
cmd.Parameters.AddWithValue("@typeCode", skuTransactionCode);
object obj = cmd.ExecuteScalar(); object obj = cmd.ExecuteScalar();
@@ -59,6 +56,7 @@ namespace bnhtrade.Core.Data.Database.Stock
} }
scope.Complete(); scope.Complete();
} }
}
return id; return id;
} }
} }

View File

@@ -4,7 +4,9 @@ using System.Data.SqlClient;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Transactions;
using Dapper; using Dapper;
using static System.Formats.Asn1.AsnWriter;
namespace bnhtrade.Core.Data.Database.Stock namespace bnhtrade.Core.Data.Database.Stock
{ {
@@ -14,81 +16,10 @@ namespace bnhtrade.Core.Data.Database.Stock
{ {
} }
/// <summary> private List<Model.Stock.SkuTransactionType> Execute(string sqlWhere, DynamicParameters param, bool transactionScopeSuppress = false)
/// Depriciated, delete when not required by other code
/// </summary>
/// <param name="sqlConnectionString"></param>
/// <param name="typeCode"></param>
/// <returns></returns>
public int GetTypeId(string typeCode)
{ {
/* GetStockTransactionTypeId return meanings var returnList = new List<Model.Stock.SkuTransactionType>();
* >0 use as the TypeId when inserting transaction
* 0 Skip transpose, type doesn't exist or is new (not reviewed yet)
* -1 Type import/transpose is disabled, IsProcessed=TRUE StockTransactionID=NULL */
// old optional parameters
// , bool onNewReturnId = false, bool onNewDisableInsert = false
if (typeCode.Length == 0)
{
throw new Exception("Empty match string passed to method");
}
using (SqlConnection sqlConn = new SqlConnection(SqlConnectionString))
{
sqlConn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT
StockSkuTransactionTypeID,
IsNewReviewRequired,
TransactionImportEnabled
FROM
tblStockSkuTransactionType
WHERE
TypeCode=@typeCode;
", sqlConn))
{
cmd.Parameters.AddWithValue("@typeCode", typeCode);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
int transactionTypeId = reader.GetInt32(0);
bool isNew = reader.GetBoolean(1);
bool importEnabled = reader.GetBoolean(2);
if (isNew == true)
{
// return 0 and 'skip' item
return 0;
}
else if (importEnabled == false)
{
// mark IsProcessed=true and leave transactionId=null
return -1;
}
else if (transactionTypeId > 0)
{
return transactionTypeId;
}
else
{
throw new Exception("Sku TransactionTypeId lookup method failed, is one of the 'enabled' boolean on table set to null?");
}
}
else
{
return 0;
}
}
}
}
}
private List<Model.Stock.SkuTransactionType> Execute(string sqlWhere, DynamicParameters param)
{
string sql = @" string sql = @"
SELECT tblStockSkuTransactionType.StockSkuTransactionTypeID AS TypeId SELECT tblStockSkuTransactionType.StockSkuTransactionTypeID AS TypeId
,tblStockSkuTransactionType.TypeName ,tblStockSkuTransactionType.TypeName
@@ -116,14 +47,26 @@ namespace bnhtrade.Core.Data.Database.Stock
sql += sqlWhere; sql += sqlWhere;
using (SqlConnection conn = new SqlConnection(SqlConnectionString)) using (SqlConnection conn = new SqlConnection(SqlConnectionString))
{
if (transactionScopeSuppress)
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Suppress))
{ {
conn.Open(); conn.Open();
returnList = conn.Query<Model.Stock.SkuTransactionType>(sql, param).ToList();
return conn.Query<Model.Stock.SkuTransactionType>(sql, param).ToList(); }
}
else
{
conn.Open();
returnList = conn.Query<Model.Stock.SkuTransactionType>(sql, param).ToList();
} }
} }
public List<Model.Stock.SkuTransactionType> ByTypeCode(List<string> typeCodeList) return returnList;
}
public List<Model.Stock.SkuTransactionType> ByTypeCode(List<string> typeCodeList, bool transactionScopeSuppress = false)
{ {
typeCodeList.RemoveAll(string.IsNullOrWhiteSpace); typeCodeList.RemoveAll(string.IsNullOrWhiteSpace);
@@ -138,7 +81,7 @@ namespace bnhtrade.Core.Data.Database.Stock
return Execute(sqlWhere, param); return Execute(sqlWhere, param);
} }
public List<Model.Stock.SkuTransactionType> ByTypeName(List<string> typeName) public List<Model.Stock.SkuTransactionType> ByTypeName(List<string> typeName, bool transactionScopeSuppress = false)
{ {
typeName.RemoveAll(string.IsNullOrWhiteSpace); typeName.RemoveAll(string.IsNullOrWhiteSpace);

View File

@@ -45,7 +45,7 @@ namespace bnhtrade.Core.Logic.Import
dateLog.SetDateTimeUtc(reportName, utcEndDate); dateLog.SetDateTimeUtc(reportName, utcEndDate);
scope.Complete(); scope.Complete();
} }
log.LogInformation("Amazon report '" + reportName + "' sync with database comlpete."); log.LogInformation("Amazon report '" + reportName + "' sync with database complete.");
} }
} }
} }

View File

@@ -126,9 +126,6 @@ namespace bnhtrade.Core.Logic.Stock
/// <exception cref="Exception"></exception> /// <exception cref="Exception"></exception>
public int Create(Model.Stock.SkuTransactionCreate skuTransaction) public int Create(Model.Stock.SkuTransactionCreate skuTransaction)
{ {
// need to add function to check if transaction type exists, if not, create a new one.
throw new NotImplementedException();
if (skuTransaction == null) if (skuTransaction == null)
{ {
throw new Exception(err + "Object was null"); throw new Exception(err + "Object was null");

View File

@@ -39,10 +39,10 @@ namespace bnhtrade.Core.Logic.Stock
private string ConstructTransactionTypeCode(Model.Import.AmazonFbaInventoryLedgerDetail record) private string ConstructTransactionTypeCode(Model.Import.AmazonFbaInventoryLedgerDetail record)
{ {
if (string.IsNullOrEmpty(record.Reason)) //if (string.IsNullOrEmpty(record.Reason))
{ //{
return null; // return null;
} //}
string transactionCode = "<AmazonReport><GET_LEDGER_DETAIL_VIEW_DATA><" + record.EventType + ">"; string transactionCode = "<AmazonReport><GET_LEDGER_DETAIL_VIEW_DATA><" + record.EventType + ">";
@@ -66,33 +66,26 @@ namespace bnhtrade.Core.Logic.Stock
} }
/// <summary> /// <summary>
/// Imports/Transaposes all data required for reconcilation, into the sku transaction table. /// Imports/Transaposes all required data into sku transaction table for reconcilation.
/// </summary> /// </summary>
public void ImportAll() public void ImportAll()
{ {
bool inventoryLedgerDetail = false; string methodName = "'Import all' data to 'Stock SKU Transactions'";
bool reimbursement = false;
log.LogInformation(methodName + " started...");
while (true)
{
try try
{ {
if (true) ImportAmazonFbaLedgerDetail();
ImportAmazonFbaReimbursement();
}
catch
{ {
if (inventoryLedgerDetail == false) { inventoryLedgerDetail = true; ImportAmazonFbaLedgerDetail(); } log.LogError(methodName + " did not complete.");
if (reimbursement == false) { reimbursement = true; ImportAmazonFbaReimbursement(); } throw;
} }
break; log.LogInformation(methodName + " complete.");
}
catch (Exception ex)
{
log.LogError(
"Exception caught running Importing amazon reports in the SKU transaction table, see for further details",
ex.ToString()
);
}
}
} }
/// <summary> /// <summary>
@@ -101,7 +94,9 @@ namespace bnhtrade.Core.Logic.Stock
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
public void ImportAmazonFbaReimbursement() public void ImportAmazonFbaReimbursement()
{ {
throw new NotImplementedException("Needs testing"); string methodName = "Import 'Amazon FBA Reimbursement' into 'Stock SKU Transactions'";
//throw new NotImplementedException("Needs testing");
/* /*
* Not to be used for stock reconciliation! A single stock item can have multiple reimburesements aginst it. * Not to be used for stock reconciliation! A single stock item can have multiple reimburesements aginst it.
@@ -112,9 +107,9 @@ namespace bnhtrade.Core.Logic.Stock
* and also the 'Cost of goods' amounts moved to the appropreate account id * and also the 'Cost of goods' amounts moved to the appropreate account id
*/ */
log.LogInformation("Starting TransposeFbaRemovalOrderReport()"); log.LogInformation(methodName + " started...");
int transposeCount = 0; int importedCount = 0;
int transposeSkip = 0; int processedCount = 0;
var dbAmznReport = new Data.Database.Import.AmazonFbaReimbursement(); var dbAmznReport = new Data.Database.Import.AmazonFbaReimbursement();
var dbTransType = new Logic.Stock.SkuTransactionTypeCrud(); var dbTransType = new Logic.Stock.SkuTransactionTypeCrud();
@@ -128,6 +123,8 @@ namespace bnhtrade.Core.Logic.Stock
var transTypeCodeList = new List<string>(); var transTypeCodeList = new List<string>();
foreach (var item in importList) foreach (var item in importList)
{ {
processedCount++;
transTypeCodeList.Add(ConstructTransactionTypeCode(item, false)); transTypeCodeList.Add(ConstructTransactionTypeCode(item, false));
// any that reimburse inventory, will have two entries // any that reimburse inventory, will have two entries
if(item.QuantityReimbursedInventory > 0) if(item.QuantityReimbursedInventory > 0)
@@ -170,7 +167,7 @@ namespace bnhtrade.Core.Logic.Stock
// don't go any further until the transaction-type has been reviewed/setup // don't go any further until the transaction-type has been reviewed/setup
if (foundNewType) if (foundNewType)
{ {
log.LogWarning("Cannot complete ImportAmazonFbaReimbursement, new 'Stock Trnasaction Type' found. Review required/"); log.LogWarning(methodName + " unable to complete. New 'Stock Trnasaction Type' found. Review required/");
return; return;
} }
@@ -189,7 +186,7 @@ namespace bnhtrade.Core.Logic.Stock
if (transType.IsNewReviewRequired) if (transType.IsNewReviewRequired)
{ {
throw new Exception("Fail safe: Buggy code, should not get here!"); throw new Exception(methodName + " fail safe: Buggy code, should not get here!");
} }
else if (transType.TransactionImportEnabled) else if (transType.TransactionImportEnabled)
{ {
@@ -214,7 +211,7 @@ namespace bnhtrade.Core.Logic.Stock
if (transType.IsNewReviewRequired) if (transType.IsNewReviewRequired)
{ {
throw new Exception("Fail safe: Buggy code, should not get here!"); throw new Exception(methodName + " fail safe: Buggy code, should not get here!");
} }
else if (transType.TransactionImportEnabled) else if (transType.TransactionImportEnabled)
{ {
@@ -233,20 +230,26 @@ namespace bnhtrade.Core.Logic.Stock
} }
// update the amazon report table // update the amazon report table
dbAmznReport.UpdateIsProcessed(item.FbaReimbursementReportID, true, transId); dbAmznReport.UpdateIsProcessed(item.FbaReimbursementReportID, true, transId);
transposeCount = transposeCount + 1; importedCount++;
} }
// drop out of loop // drop out of loop
scope.Complete(); scope.Complete();
} }
Console.Write("\r"); Console.Write("\r");
log.LogInformation("ProcessFbaReimbursementData() complete, " + transposeCount + " total records transposed, " + transposeSkip + " records skipped.");
log.LogInformation(
methodName + " complete. Records transferred/processed " + importedCount + "/" + processedCount
);
} }
catch (Exception ex) catch (Exception ex)
{ {
log.LogError("Exception catch, aborting ProcessFbaReimbursementData(), see detailed info. " log.LogError(
+ transposeCount + " total records completed, " + transposeSkip + " records skipped.", ex.ToString()); methodName + " aborted due an exception, no records where modified."
} , ex.ToString()
);
throw;
}
} }
/// <summary> /// <summary>
@@ -255,12 +258,11 @@ namespace bnhtrade.Core.Logic.Stock
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
public void ImportAmazonFbaLedgerDetail() public void ImportAmazonFbaLedgerDetail()
{ {
// Done but needs testing!! string methodName = "Import 'Amazon FBA Ledger Detail' into 'Stock SKU Transactions'";
throw new NotImplementedException("Done but needs testing!!");
log.LogInformation("Starting TransposeFbaAdustmentReport()"); log.LogInformation(methodName + " started");
int transposeCount = 0; int transferredCount = 0;
int transposeSkip = 0; int processedCount = 0;
using (var scope = new TransactionScope()) using (var scope = new TransactionScope())
{ {
@@ -275,6 +277,8 @@ namespace bnhtrade.Core.Logic.Stock
var transCodeToJournalTypeId = new Dictionary<string, int>(); var transCodeToJournalTypeId = new Dictionary<string, int>();
foreach (var item in reportDict) foreach (var item in reportDict)
{ {
processedCount++;
// test for internal Amazon stuff that we don't care about and mark as processed // test for internal Amazon stuff that we don't care about and mark as processed
if (item.Value.EventType == "WhseTransfers") if (item.Value.EventType == "WhseTransfers")
{ {
@@ -340,11 +344,14 @@ namespace bnhtrade.Core.Logic.Stock
} }
} }
// check for any new types codes, and add them if ther are // check for any new types codes, remove existing from list and add remaing to db
using (TransactionScope scope2 = new TransactionScope(TransactionScopeOption.Suppress))
{
var dbTransType = new Logic.Stock.SkuTransactionTypeCrud(); var dbTransType = new Logic.Stock.SkuTransactionTypeCrud();
var transTypeList = dbTransType.GetByTypeCode(transCodeToJournalTypeId.Keys.ToList()); var transTypeList = dbTransType.GetByTypeCode(transCodeToJournalTypeId.Keys.ToList());
foreach ( var transType in transTypeList) foreach (var transType in transTypeList)
{ {
if (transCodeToJournalTypeId.ContainsKey(transType.Key)) if (transCodeToJournalTypeId.ContainsKey(transType.Key))
{ {
@@ -356,6 +363,7 @@ namespace bnhtrade.Core.Logic.Stock
{ {
dbTransType.Create(newItem.Key, newItem.Value); dbTransType.Create(newItem.Key, newItem.Value);
} }
}
// finally, add the transction list to the table // finally, add the transction list to the table
var dbTransaction = new Logic.Stock.SkuTransactionCrud(); var dbTransaction = new Logic.Stock.SkuTransactionCrud();
@@ -363,33 +371,28 @@ namespace bnhtrade.Core.Logic.Stock
{ {
int id = dbTransaction.Create(item); int id = dbTransaction.Create(item);
dbImport.UpdateIsProcessed((int)item.ForeignKey, id); dbImport.UpdateIsProcessed((int)item.ForeignKey, id);
transferredCount++;
} }
scope.Complete(); scope.Complete();
log.LogInformation( log.LogInformation(
"TransposeFbaAdustmentReport() complete, " + transposeCount + " total records transposed, " + transposeSkip + " records skipped." methodName + " complete. Records transferred/processed " + transferredCount + "/" + processedCount
); );
if (transposeSkip > 0)
{
log.LogInformation(
transposeSkip + " number records skipped during TransposeFbaAdustmentReport() operation."
);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
scope.Dispose(); scope.Dispose();
log.LogError( log.LogError(
"Exception catch, aborting TransposeFbaAdustmentReport(), see detailed info. " methodName + " aborted, no records modified. See additional info exception details."
+ transposeCount + " total records completed, " + transposeSkip + " records skipped."
, ex.ToString() , ex.ToString()
); );
throw;
} }
} }
return;
} }
} }
} }

View File

@@ -25,15 +25,15 @@ namespace bnhtrade.Core.Logic.Stock
/// <param name="stockJournalTypeId"></param> /// <param name="stockJournalTypeId"></param>
/// <returns>Id for new record entry</returns> /// <returns>Id for new record entry</returns>
/// <exception cref="InvalidOperationException">Transaction type code already exists</exception> /// <exception cref="InvalidOperationException">Transaction type code already exists</exception>
public int Create(string skuTransactionTypeCode, int stockJournalTypeId) public int Create(string skuTransactionTypeCode, int stockJournalTypeId, bool transactionScopeSuppress = false)
{ {
//check to see if type already exists //check to see if type already exists
var result = dbRead.ByTypeCode(new List<string> { skuTransactionTypeCode }); var result = dbRead.ByTypeCode(new List<string> { skuTransactionTypeCode }, transactionScopeSuppress);
if (result.Any()) if (result.Any())
throw new InvalidOperationException("Create SKU Transaction Type failed, typecode already exists failed"); throw new InvalidOperationException("Create SKU Transaction Type failed, typecode already exists failed");
// okay to proceed // okay to proceed
int id = new Data.Database.Stock.InsertSkuTransactionType().Create(skuTransactionTypeCode, stockJournalTypeId); int id = new Data.Database.Stock.InsertSkuTransactionType().Create(skuTransactionTypeCode, stockJournalTypeId, transactionScopeSuppress);
return id; return id;
} }
@@ -42,14 +42,14 @@ namespace bnhtrade.Core.Logic.Stock
/// </summary> /// </summary>
/// <param name="typeCode"></param> /// <param name="typeCode"></param>
/// <returns>The object, or null</returns> /// <returns>The object, or null</returns>
public Model.Stock.SkuTransactionType GetByTypeCode(string typeCode) public Model.Stock.SkuTransactionType GetByTypeCode(string typeCode, bool transactionScopeSuppress = false)
{ {
if (string.IsNullOrWhiteSpace(typeCode)) if (string.IsNullOrWhiteSpace(typeCode))
{ {
return null; return null;
} }
var result = dbRead.ByTypeCode(new List<string> { typeCode }); var result = dbRead.ByTypeCode(new List<string> { typeCode }, transactionScopeSuppress);
if (result.Any()) if (result.Any())
{ {
@@ -66,7 +66,7 @@ namespace bnhtrade.Core.Logic.Stock
/// </summary> /// </summary>
/// <param name="typeCodeList">list of transaction type codes</param> /// <param name="typeCodeList">list of transaction type codes</param>
/// <returns>DIctionary key=transactionTypeCode, value=transactionType object</returns> /// <returns>DIctionary key=transactionTypeCode, value=transactionType object</returns>
public Dictionary<string, Model.Stock.SkuTransactionType> GetByTypeCode(List<string> typeCodeList) public Dictionary<string, Model.Stock.SkuTransactionType> GetByTypeCode(List<string> typeCodeList, bool transactionScopeSuppress = false)
{ {
var returnDict = new Dictionary<string, Model.Stock.SkuTransactionType>(); var returnDict = new Dictionary<string, Model.Stock.SkuTransactionType>();
if (!typeCodeList.Any()) if (!typeCodeList.Any())
@@ -74,7 +74,7 @@ namespace bnhtrade.Core.Logic.Stock
return returnDict; return returnDict;
} }
var dbResult = dbRead.ByTypeCode(typeCodeList); var dbResult = dbRead.ByTypeCode(typeCodeList, transactionScopeSuppress);
foreach(var item in dbResult) foreach(var item in dbResult)
{ {

View File

@@ -15,7 +15,10 @@ namespace bnhtrade.Core.Logic.Validate
/// <returns></returns> /// <returns></returns>
public static bool SkuNumber(string skuNumber) public static bool SkuNumber(string skuNumber)
{ {
if (string.IsNullOrEmpty(skuNumber)) { return false;} if (string.IsNullOrEmpty(skuNumber))
{
return false;
}
int count = 0; int count = 0;
foreach (char c in skuNumber) foreach (char c in skuNumber)
@@ -50,11 +53,17 @@ namespace bnhtrade.Core.Logic.Validate
public static bool DateTime(DateTime dateTime) public static bool DateTime(DateTime dateTime)
{ {
if (dateTime == default(DateTime)) if (dateTime == default(DateTime))
{ return false; } {
return false;
}
else if (dateTime.Kind != DateTimeKind.Utc) else if (dateTime.Kind != DateTimeKind.Utc)
{ return false; } {
return false;
}
else else
{ return true; } {
return true;
}
} }
} }
} }

View File

@@ -54,7 +54,7 @@ namespace bnhtrade.Core.Model.Stock
{ {
var result = new List<ValidationResult>(); var result = new List<ValidationResult>();
if (Logic.Validate.Format.DateTime(TransactionDate)) if (Logic.Validate.Format.DateTime(TransactionDate) == false)
{ {
result.Add(new ValidationResult("Invalid transaction date")); result.Add(new ValidationResult("Invalid transaction date"));
} }
@@ -62,7 +62,7 @@ namespace bnhtrade.Core.Model.Stock
{ {
result.Add(new ValidationResult("Invalid transaction type code")); result.Add(new ValidationResult("Invalid transaction type code"));
} }
if (Logic.Validate.Format.SkuNumber(SkuNumber)) if (Logic.Validate.Format.SkuNumber(SkuNumber) == false)
{ {
result.Add(new ValidationResult("Invalid SKU number")); result.Add(new ValidationResult("Invalid SKU number"));
} }

View File

@@ -50,12 +50,12 @@ namespace bnhtradeScheduledTasks
Console.WriteLine("<1> Start nightly tasks"); Console.WriteLine("<1> Start nightly tasks");
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("<2> Update FBA Inventory Data"); Console.WriteLine("<2> Update FBA Inventory Data");
Console.WriteLine("<3> Update FBA Inventory Age Data"); Console.WriteLine("<3> Update FBA Inventory Ledger Data (new)");
Console.WriteLine("<4> Update Amazon Settlement Data"); Console.WriteLine("<4> Update Amazon Settlement Data");
Console.WriteLine("<5> Update Fba Inventory Receipt Data"); Console.WriteLine("<5> (depreciated) Update Fba Inventory Receipt Data");
Console.WriteLine("<6> Update Fba Sale Shipment Data"); Console.WriteLine("<6> Update Fba Sale Shipment Data");
Console.WriteLine("<7> Update Fba Return Data"); Console.WriteLine("<7> Update Fba Return Data");
Console.WriteLine("<8> Update Fba Adustment Data"); Console.WriteLine("<8> (depreciated) Update Fba Adustment Data");
Console.WriteLine("<9> Update Fba Removal Order Data"); Console.WriteLine("<9> Update Fba Removal Order Data");
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("<0> Back"); Console.WriteLine("<0> Back");
@@ -84,7 +84,7 @@ namespace bnhtradeScheduledTasks
else if (input == "3") else if (input == "3")
{ {
Console.Clear(); Console.Clear();
new bnhtrade.Core.Logic.Import.AmazonFbaInventoryAge().SyncDatabaseWithAmazon(); new bnhtrade.Core.Logic.Import.AmazonFbaInventoryLedgerDetail().SyncDatabaseWithAmazon();
Console.WriteLine("Complete, press any key to continue..."); Console.WriteLine("Complete, press any key to continue...");
Console.ReadKey(); Console.ReadKey();
} }