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

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Stock
{
/// <summary>
/// Model/Data used to create an intial entry in the stock SKU transaction table
/// </summary>
public class SkuTransactionCreate : IValidatableObject
{
[Required()]
public DateTime TransactionDate { get; private set; }
[Required()]
public string SkuTransactionTypeCode { get; private set; }
public int? ForeignKey { get; private set; }
public string Reference { get; private set; }
public string Detail { get; private set; }
[Required()]
public string SkuNumber { get; private set; }
[Required(), Range(0, short.MaxValue)]
public int Quantity { get; private set; } // cannot be negative
public SkuTransactionCreate(DateTime transactionDate, string transactionTypeCode, int? foreignKey, string reference, string detail
, string skuNumber, int quantity)
{
this.TransactionDate = transactionDate;
this.SkuTransactionTypeCode = transactionTypeCode;
this.ForeignKey = foreignKey;
this.Reference = reference;
this.Detail = detail;
this.SkuNumber = skuNumber;
this.Quantity = quantity;
//var context = new ValidationContext(null);
var vaild = Validate(null);
if (new Logic.Validate.SkuTransaction().IsValidResult)
if (vaild.Any())
{
throw new Exception("Invalid parameters set");
}
}
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var result = new List<ValidationResult>();
if (Logic.Validate.Format.DateTime(TransactionDate))
{
result.Add(new ValidationResult("Invalid transaction date"));
}
if (string.IsNullOrEmpty(SkuTransactionTypeCode))
{
result.Add(new ValidationResult("Invalid transaction type code"));
}
if (Logic.Validate.Format.SkuNumber(SkuNumber))
{
result.Add(new ValidationResult("Invalid SKU number"));
}
return result;
}
}
}