import exxport settings, join over sap hana tables

This commit is contained in:
2026-04-14 11:34:43 +02:00
parent 36a22202bf
commit 59e195af71
21 changed files with 1369 additions and 16 deletions
@@ -0,0 +1,41 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace TrafagSalesExporter.Models;
public class CentralSalesRecord
{
public int Id { get; set; }
public DateTime StoredAtUtc { get; set; }
public int SiteId { get; set; }
[ForeignKey(nameof(SiteId))]
public Site? Site { get; set; }
public string SourceSystem { get; set; } = string.Empty;
public DateTime ExtractionDate { get; set; }
public string Tsc { get; set; } = string.Empty;
public string InvoiceNumber { get; set; } = string.Empty;
public int PositionOnInvoice { get; set; }
public string Material { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string ProductGroup { get; set; } = string.Empty;
public decimal Quantity { get; set; }
public string SupplierNumber { get; set; } = string.Empty;
public string SupplierName { get; set; } = string.Empty;
public string SupplierCountry { get; set; } = string.Empty;
public string CustomerNumber { get; set; } = string.Empty;
public string CustomerName { get; set; } = string.Empty;
public string CustomerCountry { get; set; } = string.Empty;
public string CustomerIndustry { get; set; } = string.Empty;
public decimal StandardCost { get; set; }
public string StandardCostCurrency { get; set; } = string.Empty;
public string PurchaseOrderNumber { get; set; } = string.Empty;
public decimal SalesPriceValue { get; set; }
public string SalesCurrency { get; set; } = string.Empty;
public string Incoterms2020 { get; set; } = string.Empty;
public string SalesResponsibleEmployee { get; set; } = string.Empty;
public DateTime? InvoiceDate { get; set; }
public DateTime? OrderDate { get; set; }
public string Land { get; set; } = string.Empty;
public string DocumentType { get; set; } = string.Empty;
}
@@ -0,0 +1,102 @@
namespace TrafagSalesExporter.Models;
public class ConfigTransferPackage
{
public int Version { get; set; } = 1;
public DateTime ExportedAtUtc { get; set; } = DateTime.UtcNow;
public bool IncludesSecrets { get; set; }
public ConfigTransferSharePoint? SharePointConfig { get; set; }
public ConfigTransferExportSettings? ExportSettings { get; set; }
public List<ConfigTransferHanaServer> HanaServers { get; set; } = [];
public List<ConfigTransferSite> Sites { get; set; } = [];
public List<FieldTransformationRule> FieldTransformationRules { get; set; } = [];
public List<ConfigTransferSapSourceDefinition> SapSourceDefinitions { get; set; } = [];
public List<ConfigTransferSapJoinDefinition> SapJoinDefinitions { get; set; } = [];
public List<ConfigTransferSapFieldMapping> SapFieldMappings { get; set; } = [];
}
public class ConfigTransferSharePoint
{
public string SiteUrl { get; set; } = string.Empty;
public string ExportFolder { get; set; } = string.Empty;
public string TenantId { get; set; } = string.Empty;
public string ClientId { get; set; } = string.Empty;
public string? ClientSecret { get; set; }
}
public class ConfigTransferExportSettings
{
public string DateFilter { get; set; } = "2025-01-01";
public int TimerHour { get; set; } = 3;
public int TimerMinute { get; set; }
public bool TimerEnabled { get; set; } = true;
public string? SapUsername { get; set; }
public string? SapPassword { get; set; }
public string? Bi1Username { get; set; }
public string? Bi1Password { get; set; }
public string? SageUsername { get; set; }
public string? SagePassword { get; set; }
}
public class ConfigTransferHanaServer
{
public string Key { get; set; } = Guid.NewGuid().ToString("N");
public string Name { get; set; } = string.Empty;
public string Host { get; set; } = string.Empty;
public int Port { get; set; } = 30015;
public string? Username { get; set; }
public string? Password { get; set; }
public string DatabaseName { get; set; } = string.Empty;
public bool UseSsl { get; set; }
public bool ValidateCertificate { get; set; }
public string AdditionalParams { get; set; } = string.Empty;
}
public class ConfigTransferSite
{
public string Key { get; set; } = Guid.NewGuid().ToString("N");
public string? HanaServerKey { get; set; }
public string Schema { get; set; } = string.Empty;
public string TSC { get; set; } = string.Empty;
public string Land { get; set; } = string.Empty;
public string SourceSystem { get; set; } = "SAP";
public string? UsernameOverride { get; set; }
public string? PasswordOverride { get; set; }
public string SapServiceUrl { get; set; } = string.Empty;
public string SapEntitySet { get; set; } = string.Empty;
public string SapEntitySetsCache { get; set; } = string.Empty;
public DateTime? SapEntitySetsRefreshedAtUtc { get; set; }
public bool IsActive { get; set; } = true;
}
public class ConfigTransferSapSourceDefinition
{
public string SiteKey { get; set; } = string.Empty;
public string Alias { get; set; } = string.Empty;
public string EntitySet { get; set; } = string.Empty;
public bool IsPrimary { get; set; }
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; }
}
public class ConfigTransferSapJoinDefinition
{
public string SiteKey { get; set; } = string.Empty;
public string LeftAlias { get; set; } = string.Empty;
public string RightAlias { get; set; } = string.Empty;
public string LeftKeys { get; set; } = string.Empty;
public string RightKeys { get; set; } = string.Empty;
public string JoinType { get; set; } = "Left";
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; }
}
public class ConfigTransferSapFieldMapping
{
public string SiteKey { get; set; } = string.Empty;
public string TargetField { get; set; } = string.Empty;
public string SourceExpression { get; set; } = string.Empty;
public bool IsRequired { get; set; }
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; }
}
@@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TrafagSalesExporter.Models;
public class SapFieldMapping
{
public int Id { get; set; }
public int SiteId { get; set; }
[ForeignKey(nameof(SiteId))]
public Site? Site { get; set; }
[Required]
public string TargetField { get; set; } = nameof(SalesRecord.Material);
[Required]
public string SourceExpression { get; set; } = string.Empty;
public bool IsRequired { get; set; }
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; }
}
@@ -0,0 +1,32 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TrafagSalesExporter.Models;
public class SapJoinDefinition
{
public int Id { get; set; }
public int SiteId { get; set; }
[ForeignKey(nameof(SiteId))]
public Site? Site { get; set; }
[Required]
public string LeftAlias { get; set; } = string.Empty;
[Required]
public string RightAlias { get; set; } = string.Empty;
[Required]
public string LeftKeys { get; set; } = string.Empty;
[Required]
public string RightKeys { get; set; } = string.Empty;
public string JoinType { get; set; } = "Left";
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; }
}
@@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TrafagSalesExporter.Models;
public class SapSourceDefinition
{
public int Id { get; set; }
public int SiteId { get; set; }
[ForeignKey(nameof(SiteId))]
public Site? Site { get; set; }
[Required]
public string Alias { get; set; } = string.Empty;
[Required]
public string EntitySet { get; set; } = string.Empty;
public bool IsPrimary { get; set; }
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; }
}