add basic sales forecast pipeline incl. dummy data
This commit is contained in:
@@ -27,7 +27,7 @@ namespace dopt.DeltaBarth.JsonStructs
|
||||
}
|
||||
public readonly struct Credentials
|
||||
{
|
||||
public string user_name { get; init; }
|
||||
public string username { get; init; }
|
||||
public string password { get; init; }
|
||||
public string database { get; init; }
|
||||
public string mandant { get; init; }
|
||||
@@ -36,7 +36,7 @@ namespace dopt.DeltaBarth.JsonStructs
|
||||
{
|
||||
public int jahr { get; init; }
|
||||
public int monat { get; init; }
|
||||
public float vorhersage { get; init; }
|
||||
public decimal vorhersage { get; init; }
|
||||
}
|
||||
public readonly struct UmsatzPrognoseErgebnisse
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using dopt;
|
||||
using Python.Runtime;
|
||||
using Python.Runtime;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace dopt.DeltaBarth
|
||||
@@ -9,7 +7,7 @@ namespace dopt.DeltaBarth
|
||||
{
|
||||
protected dynamic pyModManagement;
|
||||
protected dynamic pyModPipeline;
|
||||
public Plugin() : base()
|
||||
public Plugin() : base(verbose: false)
|
||||
{
|
||||
base.Initialise();
|
||||
using (Py.GIL())
|
||||
@@ -18,25 +16,64 @@ namespace dopt.DeltaBarth
|
||||
pyModPipeline = Py.Import("delta_barth.pipelines");
|
||||
}
|
||||
}
|
||||
public void Startup(string basisApiUrl, string nutzername, string passwort, string datenbank, string mandant)
|
||||
{
|
||||
SetzeBasisApiUrl(basisApiUrl);
|
||||
SetzeNutzerdaten(nutzername, passwort, datenbank, mandant);
|
||||
}
|
||||
public void Shutdown()
|
||||
{
|
||||
base.Finalise();
|
||||
}
|
||||
public void SetCredentials(string username, string password, string database, string mandant)
|
||||
public void SetzeBasisApiUrl(string basisApiUrl)
|
||||
{
|
||||
using (Py.GIL()) {
|
||||
pyModManagement.set_credentials(username, password, database, mandant);
|
||||
}
|
||||
|
||||
pyModManagement.set_base_url(basisApiUrl);
|
||||
}
|
||||
public JsonStructs.Credentials GetCredentials()
|
||||
public void SetzeNutzerdaten(string nutzername, string passwort, string datenbank, string mandant)
|
||||
{
|
||||
using (Py.GIL()) {
|
||||
pyModManagement.set_credentials(nutzername, passwort, datenbank, mandant);
|
||||
}
|
||||
}
|
||||
public JsonStructs.UmsatzPrognoseAusgabe UmsatzprognoseDummy(int? firmaId, DateTime? buchungsDatum)
|
||||
{
|
||||
string pyJson;
|
||||
using (Py.GIL())
|
||||
{
|
||||
pyJson = pyModPipeline.pipeline_sales_forecast_dummy(firmaId, buchungsDatum);
|
||||
}
|
||||
var parsed = JsonSerializer.Deserialize<JsonStructs.UmsatzPrognoseAusgabe>(pyJson);
|
||||
|
||||
return parsed;
|
||||
}
|
||||
public JsonStructs.UmsatzPrognoseAusgabe Umsatzprognose(int? firmaId, DateTime? buchungsDatum)
|
||||
{
|
||||
string pyJson;
|
||||
using (Py.GIL())
|
||||
{
|
||||
pyJson = pyModPipeline.pipeline_sales_forecast(firmaId, buchungsDatum);
|
||||
}
|
||||
var parsed = JsonSerializer.Deserialize<JsonStructs.UmsatzPrognoseAusgabe>(pyJson);
|
||||
|
||||
return parsed;
|
||||
}
|
||||
protected string GetBaseApiUrl()
|
||||
{
|
||||
string pyJson;
|
||||
using (Py.GIL())
|
||||
{
|
||||
pyJson = (string)pyModManagement.get_base_url();
|
||||
}
|
||||
return pyJson;
|
||||
}
|
||||
protected JsonStructs.Credentials GetCredentials()
|
||||
{
|
||||
string pyJson;
|
||||
using (Py.GIL())
|
||||
{
|
||||
pyJson = (string)pyModManagement.get_credentials();
|
||||
}
|
||||
|
||||
|
||||
JsonStructs.Credentials credentials = JsonSerializer.Deserialize<JsonStructs.Credentials>(pyJson);
|
||||
|
||||
return credentials;
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<Platforms>x64</Platforms>
|
||||
<Version>0.1.0-alpha1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="dopt.SharpPython" Version="0.1.2" />
|
||||
<PackageReference Include="dopt.SharpPython" Version="0.2.1" />
|
||||
<Content Include="..\python\**\*">
|
||||
<Link>python\%(RecursiveDir)/%(FileName)%(Extension)</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
Reference in New Issue
Block a user