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
@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
namespace bnhtrade.ComTypeLib.Credential
{
[ComVisible(true)]
[Guid("33376d64-a9aa-41e5-b2e7-59f332f020f2")]
[Guid("dd956394-0622-49fa-8c26-1ec82e70d03d")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IConnectionCredential
{
@@ -15,7 +15,7 @@ namespace bnhtrade.ComTypeLib.Credential
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("24310731-61ad-4f77-92cf-018f5aaacf32")]
[Guid("de81b703-8d55-4dbc-a561-2317a9068a6f")]
[ProgId("bnhtrade.ConnectionCredential")]
public class ConnectionCredential : IConnectionCredential
{
-67
View File
@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- -->
<!-- ILMerge project-specific settings. Almost never need to be set explicitly. -->
<!-- for details, see http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx -->
<!-- -->
<!-- *** set this file to Type=None, CopyToOutput=Never *** -->
<!-- If True, all copy local dependencies will also be merged from referenced projects whether they are referenced in the current project explicitly or not -->
<ILMergeTransitive>true</ILMergeTransitive>
<!-- Extra ILMerge library paths (semicolon-separated). Dont put your package dependencies here, they will be added automagically -->
<ILMergeLibraryPath></ILMergeLibraryPath>
<!-- The solution NuGet package directory if not standard 'SOLUTION\packages' -->
<ILMergePackagesPath></ILMergePackagesPath>
<!-- The merge order file name if differs from standard 'ILMergeOrder.txt' -->
<ILMergeOrderFile></ILMergeOrderFile>
<!-- The strong key file name if not specified in the project -->
<ILMergeKeyFile></ILMergeKeyFile>
<!-- The assembly version if differs for the version of the main assembly -->
<ILMergeAssemblyVersion></ILMergeAssemblyVersion>
<!-- added in Version 1.0.4 -->
<ILMergeFileAlignment></ILMergeFileAlignment>
<!-- added in Version 1.0.4, default=none -->
<ILMergeAllowDuplicateType></ILMergeAllowDuplicateType>
<!-- If the <see cref="CopyAttributes"/> is also set, any assembly-level attributes names that have the same type are copied over into the target assembly -->
<ILMergeAllowMultipleAssemblyLevelAttributes></ILMergeAllowMultipleAssemblyLevelAttributes>
<!-- See ILMerge documentation -->
<ILMergeAllowZeroPeKind></ILMergeAllowZeroPeKind>
<!-- The assembly level attributes of each input assembly are copied over into the target assembly -->
<ILMergeCopyAttributes></ILMergeCopyAttributes>
<!-- Creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies, default=true -->
<ILMergeDebugInfo>false</ILMergeDebugInfo>
<!-- Target assembly will be delay signed -->
<ILMergeDelaySign></ILMergeDelaySign>
<!-- Types in assemblies other than the primary assembly have their visibility modified -->
<ILMergeInternalize></ILMergeInternalize>
<!-- The path name of the file that will be used to identify types that are not to have their visibility modified -->
<ILMergeInternalizeExcludeFile></ILMergeInternalizeExcludeFile>
<!-- XML documentation files are merged to produce an XML documentation file for the target assembly -->
<ILMergeXmlDocumentation></ILMergeXmlDocumentation>
<!-- External assembly references in the manifest of the target assembly will use full public keys (false) or public key tokens (true, default value) -->
<ILMergePublicKeyTokens></ILMergePublicKeyTokens>
<!-- Types with the same name are all merged into a single type in the target assembly -->
<ILMergeUnionMerge></ILMergeUnionMerge>
<!-- The version of the target framework, default 40 (works for 45 too) -->
<ILTargetPlatform></ILTargetPlatform>
</PropertyGroup>
</Project>
-4
View File
@@ -1,4 +0,0 @@
# this file contains the partial list of the merged assemblies in the merge order
# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build
# and finetune merge order to your satisfaction
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="ILRepacker" AfterTargets="Build">
<ItemGroup>
<InputAssemblies Include="$(OutputPath)\*.dll" />
</ItemGroup>
<ILRepack
AllowDuplicateResources="false"
DebugInfo="true"
Internalize="true"
InternalizeExclude="$(AssemblyName).dll"
InputAssemblies="@(InputAssemblies)"
OutputFile="$(TargetPath)"
Parallel="true"
TargetKind="Dll"
LibraryPath="$(OutputPath)" />
</Target>
</Project>
+9 -4
View File
@@ -1,4 +1,5 @@
using bnhtrade.ComTypeLib.Credential;
using bnhtrade.Core.Test.Account;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -38,7 +39,7 @@ namespace bnhtrade.ComTypeLib
public string ProductCompetitivePriceGet(int productId, int conditionId, ConnectionCredential sqlConnCred)
{
var compPrice = new Core.Logic.Product.GetCompetitivePrice(sqlConnCred.ConnectionString).Execute(productId, conditionId);
var compPrice = new Core.Logic.Product.GetCompetitivePrice().Execute(productId, conditionId);
if (compPrice == null)
{
@@ -54,14 +55,15 @@ namespace bnhtrade.ComTypeLib
{
priceDateLocal = DateTime.SpecifyKind(priceDateLocal, DateTimeKind.Local);
return new Core.Data.Database.Product.CreateCompetitivePrice(sqlConnCred.ConnectionString)
return new Core.Data.Database.Product.CreateCompetitivePrice()
.ProductCompetitivePriceSet(productId, conditionId, price, isBuyBoxPrice, priceDateLocal);
}
public void ProductUpdateAmazonEstimateFee(ConnectionCredential sqlConnCred, object inputList)
{
// get com object in string array
var inputTuple = new Dictionary<string, decimal>();
//var inputTuple = new Dictionary<string, decimal>();
var inputTuple = new List<(string asin, decimal listingPrice)>();
var getArray = new Utility.LoadComObjextIntoStringArray();
string[] stringArray = getArray.LoadComObjectIntoStringArray(inputList);
@@ -72,7 +74,10 @@ namespace bnhtrade.ComTypeLib
{
throw new Exception("Split function failed on line: " + item);
}
inputTuple.Add(split[0], decimal.Parse(split[1]));
var asin = split[0];
var listingPrice = decimal.Parse(split[1]);
var t = (asin, listingPrice);
inputTuple.Add(t);
}
new Core.Logic.Product.AmazonEstimateFee().UpdateDatabase(inputTuple);
@@ -17,7 +17,7 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c3405e9d-b47a-4569-b6a3-bc9e7aa71ee5")]
@@ -63,5 +63,4 @@ namespace bnhtrade.ComTypeLib.Purchase
Core.Stock.StockCreate.WIP_StockDeletePurchase(sqlConnCred.ConnectionString, stockId);
}
}
}
+13 -12
View File
@@ -65,7 +65,7 @@ namespace bnhtrade.ComTypeLib
{
entryDate = DateTime.SpecifyKind(entryDate, DateTimeKind.Utc);
return new Core.Logic.Stock.StatusReallocate(sqlConnCred.ConnectionString).ByStockId(entryDate, 4, stockId, quantity, debitStatusId, creditStatusId);
return new Core.Logic.Stock.StatusReallocate().ByStockId(entryDate, 4, stockId, quantity, debitStatusId, creditStatusId);
}
public void StockJournalDelete(ConnectionCredential sqlConnCred, int stockJournalId)
@@ -78,7 +78,7 @@ namespace bnhtrade.ComTypeLib
//var request = new Core.Stock.StockReconciliation();
//var result = new Core.Stock.StockReconciliation.ReconcileStockTransactionsResult();
var result = new Core.Logic.Stock.SkuTransactionReconcile(sqlConnCred.ConnectionString);
var result = new Core.Logic.Stock.SkuTransactionReconcile();
result.ReconcileStockTransactions(false);
//ReconcileStockTransactionsResult returnObject = new ReconcileStockTransactionsResult();
@@ -123,7 +123,7 @@ namespace bnhtrade.ComTypeLib
public void UnReconcileSkuTransaction(ConnectionCredential sqlConnCred, int skuTransactionId)
{
new Core.Logic.Stock.SkuTransactionReconcile(sqlConnCred.ConnectionString).UnReconcileTransaction(skuTransactionId);
new Core.Logic.Stock.SkuTransactionReconcile().UnReconcileTransaction(skuTransactionId);
}
public bool StockJournalConsistencyCheck(ConnectionCredential sqlConnCred, int stockId)
@@ -133,16 +133,17 @@ namespace bnhtrade.ComTypeLib
public void SkuTransactionAdd(ConnectionCredential sqlConnCred, int quantity, string skuNumber, string transactionTypeCode, DateTime transactionDate)
{
var trans = new bnhtrade.Core.Model.Stock.SkuTransaction();
trans.IsProcessed = false;
trans.Quantity = (short)quantity;
//trans.Reference
trans.SkuNumber = skuNumber;
trans.SkuTransactionTypeCode = transactionTypeCode;
//trans.StockJournalId;
trans.TransactionDate = transactionDate;
var trans = new bnhtrade.Core.Model.Stock.SkuTransactionCreate(
transactionDate
, transactionTypeCode
, null
, null
, null
, skuNumber
, quantity
);
new bnhtrade.Core.Logic.Stock.SkuTransactionPersistance(sqlConnCred.ConnectionString).Create(trans);
new bnhtrade.Core.Logic.Stock.SkuTransactionCrud().Create(trans);
}
}
}
@@ -0,0 +1,18 @@
@set batchpath=%~dp0
@set filename=bnhtradeCOM.dll
@set sourcepath="%batchpath%%filename%"
@set destpath="%LOCALAPPDATA%\bnhtrade\%filename%"
@copy /y %sourcepath% %destpath%
@cd\Windows\Microsoft.NET\Framework64\v4.*
regasm.exe /codebase /tlb %destpath%
@cd\Windows\Microsoft.NET\Framework\v4.*
regasm.exe /codebase /tlb %destpath%
@echo.
@echo Finished running regasm install script.
@echo.
@rem if no arguments passed, pause
@IF "%~1"=="" @pause
@@ -0,0 +1,7 @@
@set mypath=%~dp0
call "%mypath%RegAsmUninstall.bat" nopause
call "%mypath%RegAsmInstall.bat" nopause
@echo Completed regasm refresh
@echo.
@pause
@@ -0,0 +1,16 @@
@set filename=bnhtradeCOM.dll
@set dllpath="%LOCALAPPDATA%\bnhtrade\%filename%"
@c:
@cd\Windows\Microsoft.NET\Framework64\v4.*
regasm.exe /u %dllpath%
@cd\Windows\Microsoft.NET\Framework\v4.*
regasm.exe /u %dllpath%
@echo.
@echo Finished running regasm uninstall script.
@rem if no arguments passed, pause
@echo.
@IF "%~1"=="" @pause
+2 -2
View File
@@ -12,7 +12,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
@@ -32,7 +32,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.2" newVersion="7.0.0.2" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props" Condition="Exists('..\..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" />
<Import Project="..\..\packages\ILMerge.3.0.29\build\ILMerge.props" Condition="Exists('..\..\packages\ILMerge.3.0.29\build\ILMerge.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -22,7 +20,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\artifiacts\Debug\</OutputPath>
<OutputPath>..\..\bin\Debug\com\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -31,11 +29,12 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\artifiacts\Release\</OutputPath>
<OutputPath>..\..\bin\Release\com\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols>
<RegisterForComInterop>false</RegisterForComInterop>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>Always</RunPostBuildEvent>
@@ -62,11 +61,17 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="ILMerge.props" />
<None Include="_RegAsmInstall.bat" />
<None Include="_RegAsmRefresh.bat" />
<None Include="_RegAsmUninstall.bat" />
<None Include="ILRepack.targets" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="ILMergeOrder.txt" />
<ProjectReference Include="..\bnhtrade.Core\bnhtrade.Core.csproj">
<Project>{339d7413-3da7-46ea-a55c-255a9a6b95eb}</Project>
<Name>bnhtrade.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
@@ -74,17 +79,15 @@
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>copy "$(SolutionDir)build\bnhtrade.ComTypeLib.RegAsmInstall.bat" "$(TargetDir)bnhtrade.ComTypeLib.RegAsmInstall.bat"
copy "$(SolutionDir)build\bnhtrade.ComTypeLib.RegAsmRefresh.bat" "$(TargetDir)bnhtrade.ComTypeLib.RegAsmRefresh.bat"
copy "$(SolutionDir)build\bnhtrade.ComTypeLib.RegAsmUninstall.bat" "$(TargetDir)bnhtrade.ComTypeLib.RegAsmUninstall.bat"</PostBuildEvent>
<PostBuildEvent>copy "$(ProjectDir)_RegAsmInstall.bat" "$(TargetDir)"
copy "$(ProjectDir)_RegAsmRefresh.bat" "$(TargetDir)"
copy "$(ProjectDir)_RegAsmUninstall.bat" "$(TargetDir)"</PostBuildEvent>
</PropertyGroup>
<Import Project="..\..\packages\ILRepack.Lib.MSBuild.Task.2.0.31\build\ILRepack.Lib.MSBuild.Task.targets" Condition="Exists('..\..\packages\ILRepack.Lib.MSBuild.Task.2.0.31\build\ILRepack.Lib.MSBuild.Task.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\ILMerge.3.0.29\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\ILMerge.3.0.29\build\ILMerge.props'))" />
<Error Condition="!Exists('..\..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props'))" />
<Error Condition="!Exists('..\..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets'))" />
<Error Condition="!Exists('..\..\packages\ILRepack.Lib.MSBuild.Task.2.0.31\build\ILRepack.Lib.MSBuild.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\ILRepack.Lib.MSBuild.Task.2.0.31\build\ILRepack.Lib.MSBuild.Task.targets'))" />
</Target>
<Import Project="..\..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets" Condition="Exists('..\..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" />
</Project>
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ILMerge" version="3.0.29" targetFramework="net471" />
<package id="MSBuild.ILMerge.Task" version="1.1.3" targetFramework="net471" />
<package id="ILRepack.Lib.MSBuild.Task" version="2.0.31" targetFramework="net472" developmentDependency="true" />
</packages>