add selection with multiple company IDs for forecast pipeline, closes #14
This commit is contained in:
parent
725e323f98
commit
fd86abd872
@ -173,16 +173,31 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[TestCategory("ActiveAPI")]
|
[TestCategory("ActiveAPI")]
|
||||||
|
public void Umsatzprognose_WithCompanyIdWithDate_Test()
|
||||||
|
{
|
||||||
|
var test = new TPlugin();
|
||||||
|
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
|
||||||
|
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
|
||||||
|
var date = new DateTime(2023, 8, 15, 12, 45, 30);
|
||||||
|
List<int> comp_id = new List<int> { 1027, 5661, 1024 };
|
||||||
|
var res = test.Umsatzprognose(comp_id, date);
|
||||||
|
PrettyPrint(res);
|
||||||
|
Assert.AreEqual(4, res.status.code);
|
||||||
|
Assert.AreEqual((int)StatusCodes.DatensatzZuWenigeMonatsdatenpunkte, res.status.code);
|
||||||
|
test.Dispose();
|
||||||
|
}
|
||||||
|
[TestMethod]
|
||||||
|
[TestCategory("ActiveAPI")]
|
||||||
public void Umsatzprognose_WithCompanyIdWithoutDate_Test()
|
public void Umsatzprognose_WithCompanyIdWithoutDate_Test()
|
||||||
{
|
{
|
||||||
var test = new TPlugin();
|
var test = new TPlugin();
|
||||||
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
|
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
|
||||||
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
|
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
|
||||||
var comp_id = 1024;
|
List<int> comp_id = new List<int> { 5661 };
|
||||||
var res = test.Umsatzprognose(comp_id, null);
|
var res = test.Umsatzprognose(comp_id, null);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
Assert.AreEqual(0, res.status.code);
|
Assert.AreEqual(4, res.status.code);
|
||||||
Assert.AreEqual((int)StatusCodes.Erfolg, res.status.code);
|
Assert.AreEqual((int)StatusCodes.DatensatzZuWenigeMonatsdatenpunkte, res.status.code);
|
||||||
test.Dispose();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@ -191,7 +206,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
var test = new TPlugin();
|
var test = new TPlugin();
|
||||||
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
|
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
|
||||||
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
|
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
|
||||||
var comp_id = 1024;
|
List<int> comp_id = new List<int> { 5661 };
|
||||||
var res = test.Umsatzprognose(comp_id, null);
|
var res = test.Umsatzprognose(comp_id, null);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
Assert.AreEqual(1, res.status.code);
|
Assert.AreEqual(1, res.status.code);
|
||||||
@ -232,7 +247,7 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
var test = new TPlugin();
|
var test = new TPlugin();
|
||||||
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
|
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
|
||||||
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
|
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
|
||||||
var date = new DateTime(2015, 1, 1, 12, 45, 30);
|
var date = new DateTime(2021, 1, 1, 12, 45, 30);
|
||||||
var res = test.Umsatzprognose(null, date);
|
var res = test.Umsatzprognose(null, date);
|
||||||
PrettyPrint(res);
|
PrettyPrint(res);
|
||||||
Assert.AreEqual(0, res.status.code);
|
Assert.AreEqual(0, res.status.code);
|
||||||
@ -252,20 +267,5 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
Assert.AreEqual((int)StatusCodes.VerbindungTimeout, res.status.code);
|
Assert.AreEqual((int)StatusCodes.VerbindungTimeout, res.status.code);
|
||||||
test.Dispose();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
|
||||||
public void Umsatzprognose_WithoutCompanyIdWithValidDate_Test_DoubleDispose()
|
|
||||||
{
|
|
||||||
var test = new TPlugin();
|
|
||||||
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
|
|
||||||
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
|
|
||||||
var date = new DateTime(2015, 1, 1, 12, 45, 30);
|
|
||||||
var res = test.Umsatzprognose(null, date);
|
|
||||||
PrettyPrint(res);
|
|
||||||
Assert.AreEqual(1, res.status.code);
|
|
||||||
Assert.AreEqual((int)StatusCodes.VerbindungTimeout, res.status.code);
|
|
||||||
test.Dispose();
|
|
||||||
test.Dispose();
|
|
||||||
Console.WriteLine("After double dispose");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -160,20 +160,20 @@ namespace dopt.DeltaBarth
|
|||||||
/// Es werden API-Abrufe durchgeführt und somit auch Live-Daten genutzt.
|
/// Es werden API-Abrufe durchgeführt und somit auch Live-Daten genutzt.
|
||||||
/// Hierfür muss sichergestellt sein, dass der API-Server erreichbar und abrufbereit ist.
|
/// Hierfür muss sichergestellt sein, dass der API-Server erreichbar und abrufbereit ist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="firmaId">optional: Firmen-ID, für die die Pipeline ausgeführt werden soll.
|
/// <param name="firmaIds">optional: Liste von Firmen-IDs, für die die Pipeline ausgeführt werden soll.
|
||||||
/// Wird der Parameter nicht zur Verfügung gestellt, werden alle Firmen bzw. Kunden abgerufen</param>
|
/// Wird der Parameter nicht zur Verfügung gestellt, werden alle Firmen bzw. Kunden abgerufen</param>
|
||||||
/// <param name="analyseBeginn">optional: Start-Datum, ab dem die Daten für die Erstellung des Prognosemodells genutzt werden.
|
/// <param name="analyseBeginn">optional: Start-Datum, ab dem die Daten für die Erstellung des Prognosemodells genutzt werden.
|
||||||
/// Daten, die weiter in der Vergangenheit liegen, werden nicht berücksichtigt.
|
/// Daten, die weiter in der Vergangenheit liegen, werden nicht berücksichtigt.
|
||||||
/// Wird der Parameter nicht zur Verfügung gestellt, wird die gesamte Historie genutzt.</param>
|
/// Wird der Parameter nicht zur Verfügung gestellt, wird die gesamte Historie genutzt.</param>
|
||||||
/// <returns cref="DataObjects.UmsatzPrognoseAusgabe">Umsatzprognose inkl. Status-Objekt zur Nachvollziehbarkeit etwaig aufgetretener Fehler.</returns>
|
/// <returns cref="DataObjects.UmsatzPrognoseAusgabe">Umsatzprognose inkl. Status-Objekt zur Nachvollziehbarkeit etwaig aufgetretener Fehler.</returns>
|
||||||
/// <exception cref="PythonParsingException"></exception>
|
/// <exception cref="PythonParsingException"></exception>
|
||||||
public DataObjects.UmsatzPrognoseAusgabe Umsatzprognose(int? firmaId, DateTime? analyseBeginn)
|
public DataObjects.UmsatzPrognoseAusgabe Umsatzprognose(List<int>? firmaIds, DateTime? analyseBeginn)
|
||||||
{
|
{
|
||||||
AssertNotDisposed();
|
AssertNotDisposed();
|
||||||
string pyJson;
|
string pyJson;
|
||||||
using (Py.GIL())
|
using (Py.GIL())
|
||||||
{
|
{
|
||||||
pyJson = pyModPipeline.pipeline_sales_forecast(firmaId, analyseBeginn);
|
pyJson = pyModPipeline.pipeline_sales_forecast(firmaIds, analyseBeginn);
|
||||||
}
|
}
|
||||||
var parsed = JsonSerializer.Deserialize<DataObjects.UmsatzPrognoseAusgabe>(pyJson) ?? throw new PythonParsingException("Could not correctly parse object from Python");
|
var parsed = JsonSerializer.Deserialize<DataObjects.UmsatzPrognoseAusgabe>(pyJson) ?? throw new PythonParsingException("Could not correctly parse object from Python");
|
||||||
return parsed;
|
return parsed;
|
||||||
|
|||||||
@ -6,12 +6,12 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<Version>0.4.0-alpha1</Version>
|
<Version>0.4.0</Version>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="dopt.SharpPython" Version="0.4.2-alpha3" />
|
<PackageReference Include="dopt.SharpPython" Version="0.4.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user