Compare commits
No commits in common. "6484cac4f025bd84f7ffa2b2030d729dafe09d3d" and "69b336f2d51da40bbc299af276d350288ba0fc3b" have entirely different histories.
6484cac4f0
...
69b336f2d5
@ -4,7 +4,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dialog = RhSolutions.Models.Dialog;
|
using Dialog = RhSolutions.Models.Dialog;
|
||||||
using Range = Microsoft.Office.Interop.Excel.Range;
|
|
||||||
|
|
||||||
namespace RhSolutions.Controllers
|
namespace RhSolutions.Controllers
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using RhSolutions.Models;
|
using RhSolutions.Models;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Range = Microsoft.Office.Interop.Excel.Range;
|
|
||||||
|
|
||||||
namespace RhSolutions.Controllers
|
namespace RhSolutions.Controllers
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,6 @@ using System.IO;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Range = Microsoft.Office.Interop.Excel.Range;
|
|
||||||
|
|
||||||
namespace RhSolutions.Controllers
|
namespace RhSolutions.Controllers
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using RhSolutions.Services;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Range = Microsoft.Office.Interop.Excel.Range;
|
|
||||||
|
|
||||||
namespace RhSolutions.Controllers
|
namespace RhSolutions.Controllers
|
||||||
{
|
{
|
||||||
|
116
src/Models/Sku.cs
Normal file
116
src/Models/Sku.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace RhSolutions.Models
|
||||||
|
{
|
||||||
|
public class Sku
|
||||||
|
{
|
||||||
|
private const string matchPattern = @"([1\D]|\b)(?<Article>\d{6})([1\s-]|)(?<Variant>\d{3})\b";
|
||||||
|
private string _article;
|
||||||
|
private string _variant;
|
||||||
|
|
||||||
|
public Sku(string article, string variant)
|
||||||
|
{
|
||||||
|
Article = article;
|
||||||
|
Variant = variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Id
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return $"1{Article}1{Variant}";
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (TryParse(value, out IEnumerable<Sku> skus))
|
||||||
|
{
|
||||||
|
if (skus.Count() > 1)
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"More than one valid sku detected: {value}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Article = skus.First().Article;
|
||||||
|
this.Variant = skus.First().Variant;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"Invalid sku input: {value}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Article
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _article;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null || value.Length != 6 || value.Where(c => char.IsDigit(c)).Count() != 6)
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"Wrong Article: {Article}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_article = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Variant
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _variant;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null || value.Length != 3 || value.Where(c => char.IsDigit(c)).Count() != 3)
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"Wrong Variant: {Variant}");
|
||||||
|
}
|
||||||
|
else _variant = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static IEnumerable<Sku> GetValidSkus(string line)
|
||||||
|
{
|
||||||
|
MatchCollection matches = Regex.Matches(line, matchPattern);
|
||||||
|
if (matches.Count == 0)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (Match m in matches)
|
||||||
|
{
|
||||||
|
yield return new Sku(m.Groups["Article"].Value, m.Groups["Variant"].Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryParse(string line, out IEnumerable<Sku> skus)
|
||||||
|
{
|
||||||
|
MatchCollection matches = Regex.Matches(line, matchPattern);
|
||||||
|
if (matches.Count == 0)
|
||||||
|
{
|
||||||
|
skus = Enumerable.Empty<Sku>();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skus = GetValidSkus(line);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"1{Article}1{Variant}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Range = Microsoft.Office.Interop.Excel.Range;
|
|
||||||
|
|
||||||
namespace RhSolutions.Models
|
namespace RhSolutions.Models
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Range = Microsoft.Office.Interop.Excel.Range;
|
|
||||||
|
|
||||||
namespace RhSolutions.Models
|
namespace RhSolutions.Models
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Versioning;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
@ -33,5 +32,5 @@ using System.Runtime.Versioning;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.2.4.0")]
|
[assembly: AssemblyVersion("1.2.3.1")]
|
||||||
[assembly: AssemblyFileVersion("1.2.4.0")]
|
[assembly: AssemblyFileVersion("1.2.3.1")]
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"profiles": {
|
|
||||||
"Excel": {
|
|
||||||
"commandName": "Executable",
|
|
||||||
"executablePath": "C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE",
|
|
||||||
"commandLineArgs": "RhSolutions-AddIn64.xll"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
6
src/RehauSku.Assist-AddIn.dna
Normal file
6
src/RehauSku.Assist-AddIn.dna
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<DnaLibrary Name="RhXlPLugin" RuntimeVersion="v4.0" xmlns="http://schemas.excel-dna.net/addin/2020/07/dnalibrary">
|
||||||
|
<ExternalLibrary Path="RhXlPLugin.dll" ExplicitRegistration="true" LoadFromBytes="true" Pack="true" IncludePdb="false" />
|
||||||
|
<Reference Path="ExcelDna.Registration.dll" Pack="true" />
|
||||||
|
<Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
|
||||||
|
</DnaLibrary>
|
@ -3,8 +3,6 @@
|
|||||||
<ExternalLibrary Path="RhSolutions.AddIn.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" />
|
<ExternalLibrary Path="RhSolutions.AddIn.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" />
|
||||||
<Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
|
<Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
|
||||||
<Reference Path="Newtonsoft.Json.dll" Pack="true" />
|
<Reference Path="Newtonsoft.Json.dll" Pack="true" />
|
||||||
<Reference Path="RhSolutions.Sku.dll" Pack="true" />
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The RuntimeVersion attribute above allows only the following setting:
|
The RuntimeVersion attribute above allows only the following setting:
|
||||||
|
@ -1,23 +1,126 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.props" Condition="Exists('..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.props')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net472;net6.0-windows</TargetFrameworks>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{18A2FF67-0E46-4A86-B872-29F2B3F23ADF}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>RhSolutions.AddIn</RootNamespace>
|
<RootNamespace>RhSolutions.AddIn</RootNamespace>
|
||||||
<AssemblyName>RhSolutions.AddIn</AssemblyName>
|
<AssemblyName>RhSolutions.AddIn</AssemblyName>
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
<Deterministic>true</Deterministic>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<StartupObject />
|
<StartupObject />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ExcelDna.AddIn" Version="1.6.0" />
|
<Reference Include="ExcelDna.Integration, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f225e9659857edbe, processorArchitecture=MSIL">
|
||||||
<PackageReference Include="ExcelDna.IntelliSense" Version="1.6.0" />
|
<HintPath>..\packages\ExcelDna.Integration.1.6.0\lib\net452\ExcelDna.Integration.dll</HintPath>
|
||||||
<PackageReference Include="ExcelDna.Interop" Version="15.0.0" />
|
</Reference>
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<Reference Include="ExcelDna.IntelliSense, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f225e9659857edbe, processorArchitecture=MSIL">
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
<HintPath>..\packages\ExcelDna.IntelliSense.1.6.0\lib\net452\ExcelDna.IntelliSense.dll</HintPath>
|
||||||
<PackageReference Include="RhSolutions.Sku" Version="0.1.1" />
|
</Reference>
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\ExcelDna.Interop.15.0.0\lib\net452\Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Vbe.Interop, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\ExcelDna.Interop.15.0.0\lib\net452\Microsoft.Vbe.Interop.dll</HintPath>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\ExcelDna.Interop.15.0.0\lib\net452\Office.dll</HintPath>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data.OracleClient" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net" />
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Runtime.Caching" />
|
||||||
|
<Reference Include="System.Security" />
|
||||||
|
<Reference Include="System.ServiceProcess" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Services\EventsUtil.cs" />
|
||||||
|
<Compile Include="Services\RhDatabaseClient.cs" />
|
||||||
|
<Compile Include="Models\Sku.cs" />
|
||||||
|
<Compile Include="Models\StatusbarBase.cs" />
|
||||||
|
<Compile Include="Models\Dialog.cs" />
|
||||||
|
<Compile Include="Services\RegistryUtil.cs" />
|
||||||
|
<Compile Include="Models\ProgressBar.cs" />
|
||||||
|
<Compile Include="Models\ResultBar.cs" />
|
||||||
|
<Compile Include="Controllers\CombineTool.cs" />
|
||||||
|
<Compile Include="Controllers\ConvertTool.cs" />
|
||||||
|
<Compile Include="Models\Product.cs" />
|
||||||
|
<Compile Include="Controllers\ToolBase.cs" />
|
||||||
|
<Compile Include="Controllers\MergeTool.cs" />
|
||||||
|
<Compile Include="Models\PriceListBase.cs" />
|
||||||
|
<Compile Include="Models\PriceListHeaders.cs" />
|
||||||
|
<Compile Include="Models\SourcePriceList.cs" />
|
||||||
|
<Compile Include="Models\TargetPriceList.cs" />
|
||||||
|
<Compile Include="Controllers\RibbonController.cs" />
|
||||||
|
<Compile Include="Controllers\ExportTool.cs" />
|
||||||
|
<Compile Include="AddIn\RhSolutionsAddIn.cs" />
|
||||||
|
<Compile Include="AddIn\Functions.cs" />
|
||||||
|
<Compile Include="Models\WorksheetExtensions.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
<None Include="RhSolutions-AddIn.dna" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\ExcelDna.Build.props" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Import Project="packages\ExcelDna.AddIn.1.5.1\build\ExcelDna.AddIn.targets" Condition="Exists('packages\ExcelDna.AddIn.1.5.1\build\ExcelDna.AddIn.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\ExcelDna.Interop.15.0.0\build\ExcelDna.Interop.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ExcelDna.Interop.15.0.0\build\ExcelDna.Interop.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.props'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="..\packages\ExcelDna.Interop.15.0.0\build\ExcelDna.Interop.targets" Condition="Exists('..\packages\ExcelDna.Interop.15.0.0\build\ExcelDna.Interop.targets')" />
|
||||||
|
<Import Project="..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.targets" Condition="Exists('..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.targets')" />
|
||||||
</Project>
|
</Project>
|
9
src/packages.config
Normal file
9
src/packages.config
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="ExcelDna.AddIn" version="1.6.0" targetFramework="net48" />
|
||||||
|
<package id="ExcelDna.Integration" version="1.6.0" targetFramework="net48" />
|
||||||
|
<package id="ExcelDna.IntelliSense" version="1.6.0" targetFramework="net48" />
|
||||||
|
<package id="ExcelDna.Interop" version="15.0.0" targetFramework="net48" />
|
||||||
|
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net48" />
|
||||||
|
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net48" />
|
||||||
|
</packages>
|
Loading…
Reference in New Issue
Block a user