Add product division gateway mapping
This commit is contained in:
@@ -70,6 +70,13 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
Material = r.Material,
|
||||
Name = r.Name,
|
||||
ProductGroup = r.ProductGroup,
|
||||
ProductHierarchyCode = r.ProductHierarchyCode,
|
||||
ProductHierarchyText = r.ProductHierarchyText,
|
||||
ProductFamilyCode = r.ProductFamilyCode,
|
||||
ProductFamilyText = r.ProductFamilyText,
|
||||
ProductDivisionCode = r.ProductDivisionCode,
|
||||
ProductDivisionText = r.ProductDivisionText,
|
||||
ProductMappingAssigned = r.ProductMappingAssigned,
|
||||
Quantity = r.Quantity,
|
||||
SupplierNumber = r.SupplierNumber,
|
||||
SupplierName = r.SupplierName,
|
||||
@@ -164,7 +171,8 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
command.CommandText = """
|
||||
INSERT INTO CentralSalesRecords (
|
||||
StoredAtUtc, SiteId, SourceSystem, ExtractionDate, Tsc, DocumentEntry, InvoiceNumber, PositionOnInvoice,
|
||||
Material, Name, ProductGroup, Quantity, SupplierNumber, SupplierName, SupplierCountry,
|
||||
Material, Name, ProductGroup, ProductHierarchyCode, ProductHierarchyText, ProductFamilyCode, ProductFamilyText,
|
||||
ProductDivisionCode, ProductDivisionText, ProductMappingAssigned, Quantity, SupplierNumber, SupplierName, SupplierCountry,
|
||||
CustomerNumber, CustomerName, CustomerCountry, CustomerIndustry, StandardCost,
|
||||
StandardCostCurrency, PurchaseOrderNumber, SalesPriceValue, SalesCurrency, Incoterms2020,
|
||||
DocumentCurrency, DocumentTotalForeignCurrency, DocumentTotalLocalCurrency, VatSumForeignCurrency,
|
||||
@@ -172,7 +180,8 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
)
|
||||
VALUES (
|
||||
$storedAtUtc, $siteId, $sourceSystem, $extractionDate, $tsc, $documentEntry, $invoiceNumber, $positionOnInvoice,
|
||||
$material, $name, $productGroup, $quantity, $supplierNumber, $supplierName, $supplierCountry,
|
||||
$material, $name, $productGroup, $productHierarchyCode, $productHierarchyText, $productFamilyCode, $productFamilyText,
|
||||
$productDivisionCode, $productDivisionText, $productMappingAssigned, $quantity, $supplierNumber, $supplierName, $supplierCountry,
|
||||
$customerNumber, $customerName, $customerCountry, $customerIndustry, $standardCost,
|
||||
$standardCostCurrency, $purchaseOrderNumber, $salesPriceValue, $salesCurrency, $incoterms2020,
|
||||
$documentCurrency, $documentTotalForeignCurrency, $documentTotalLocalCurrency, $vatSumForeignCurrency,
|
||||
@@ -191,6 +200,13 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
command.Parameters.Add("$material", SqliteType.Text);
|
||||
command.Parameters.Add("$name", SqliteType.Text);
|
||||
command.Parameters.Add("$productGroup", SqliteType.Text);
|
||||
command.Parameters.Add("$productHierarchyCode", SqliteType.Text);
|
||||
command.Parameters.Add("$productHierarchyText", SqliteType.Text);
|
||||
command.Parameters.Add("$productFamilyCode", SqliteType.Text);
|
||||
command.Parameters.Add("$productFamilyText", SqliteType.Text);
|
||||
command.Parameters.Add("$productDivisionCode", SqliteType.Text);
|
||||
command.Parameters.Add("$productDivisionText", SqliteType.Text);
|
||||
command.Parameters.Add("$productMappingAssigned", SqliteType.Text);
|
||||
command.Parameters.Add("$quantity", SqliteType.Real);
|
||||
command.Parameters.Add("$supplierNumber", SqliteType.Text);
|
||||
command.Parameters.Add("$supplierName", SqliteType.Text);
|
||||
@@ -235,6 +251,13 @@ public class CentralSalesRecordService : ICentralSalesRecordService
|
||||
command.Parameters["$material"].Value = record.Material ?? string.Empty;
|
||||
command.Parameters["$name"].Value = record.Name ?? string.Empty;
|
||||
command.Parameters["$productGroup"].Value = record.ProductGroup ?? string.Empty;
|
||||
command.Parameters["$productHierarchyCode"].Value = record.ProductHierarchyCode ?? string.Empty;
|
||||
command.Parameters["$productHierarchyText"].Value = record.ProductHierarchyText ?? string.Empty;
|
||||
command.Parameters["$productFamilyCode"].Value = record.ProductFamilyCode ?? string.Empty;
|
||||
command.Parameters["$productFamilyText"].Value = record.ProductFamilyText ?? string.Empty;
|
||||
command.Parameters["$productDivisionCode"].Value = record.ProductDivisionCode ?? string.Empty;
|
||||
command.Parameters["$productDivisionText"].Value = record.ProductDivisionText ?? string.Empty;
|
||||
command.Parameters["$productMappingAssigned"].Value = record.ProductMappingAssigned ?? string.Empty;
|
||||
command.Parameters["$quantity"].Value = record.Quantity;
|
||||
command.Parameters["$supplierNumber"].Value = record.SupplierNumber ?? string.Empty;
|
||||
command.Parameters["$supplierName"].Value = record.SupplierName ?? string.Empty;
|
||||
|
||||
@@ -428,6 +428,13 @@ public class ConfigTransferService : IConfigTransferService
|
||||
Material = record.Material,
|
||||
Name = record.Name,
|
||||
ProductGroup = record.ProductGroup,
|
||||
ProductHierarchyCode = record.ProductHierarchyCode,
|
||||
ProductHierarchyText = record.ProductHierarchyText,
|
||||
ProductFamilyCode = record.ProductFamilyCode,
|
||||
ProductFamilyText = record.ProductFamilyText,
|
||||
ProductDivisionCode = record.ProductDivisionCode,
|
||||
ProductDivisionText = record.ProductDivisionText,
|
||||
ProductMappingAssigned = record.ProductMappingAssigned,
|
||||
Quantity = record.Quantity,
|
||||
SupplierNumber = record.SupplierNumber,
|
||||
SupplierName = record.SupplierName,
|
||||
|
||||
@@ -91,6 +91,13 @@ CREATE TABLE CentralSalesRecords (
|
||||
Material TEXT NOT NULL,
|
||||
Name TEXT NOT NULL,
|
||||
ProductGroup TEXT NOT NULL,
|
||||
ProductHierarchyCode TEXT NOT NULL DEFAULT '',
|
||||
ProductHierarchyText TEXT NOT NULL DEFAULT '',
|
||||
ProductFamilyCode TEXT NOT NULL DEFAULT '',
|
||||
ProductFamilyText TEXT NOT NULL DEFAULT '',
|
||||
ProductDivisionCode TEXT NOT NULL DEFAULT '',
|
||||
ProductDivisionText TEXT NOT NULL DEFAULT '',
|
||||
ProductMappingAssigned TEXT NOT NULL DEFAULT '',
|
||||
Quantity TEXT NOT NULL,
|
||||
SupplierNumber TEXT NOT NULL,
|
||||
SupplierName TEXT NOT NULL,
|
||||
|
||||
@@ -52,6 +52,13 @@ public class DatabaseSchemaMaintenanceService : IDatabaseSchemaMaintenanceServic
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "VatSumLocalCurrency", "TEXT NOT NULL DEFAULT '0'");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "DocumentRate", "TEXT NOT NULL DEFAULT '0'");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "CompanyCurrency", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "ProductHierarchyCode", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "ProductHierarchyText", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "ProductFamilyCode", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "ProductFamilyText", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "ProductDivisionCode", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "ProductDivisionText", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "ProductMappingAssigned", "TEXT NOT NULL DEFAULT ''");
|
||||
AddColumnIfMissing(db, "CentralSalesRecords", "PostingDate", "TEXT NULL");
|
||||
EnsureAppEventLogTable(db);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,13 @@ public class ExcelExportService : IExcelExportService
|
||||
"Material",
|
||||
"Name",
|
||||
"Product Group",
|
||||
"Product Hierarchy Code",
|
||||
"Product Hierarchy Text",
|
||||
"Product Family Code",
|
||||
"Product Family Text",
|
||||
"Product Division Code",
|
||||
"Product Division Text",
|
||||
"Product Mapping Assigned",
|
||||
"Quantity",
|
||||
"Supplier number",
|
||||
"Supplier name",
|
||||
@@ -137,44 +144,51 @@ public class ExcelExportService : IExcelExportService
|
||||
ws.Cell(row, 6).Value = record.Material;
|
||||
ws.Cell(row, 7).Value = record.Name;
|
||||
ws.Cell(row, 8).Value = record.ProductGroup;
|
||||
ws.Cell(row, 9).Value = record.Quantity;
|
||||
ws.Cell(row, 10).Value = record.SupplierNumber;
|
||||
ws.Cell(row, 11).Value = record.SupplierName;
|
||||
ws.Cell(row, 12).Value = record.SupplierCountry;
|
||||
ws.Cell(row, 13).Value = record.CustomerNumber;
|
||||
ws.Cell(row, 14).Value = record.CustomerName;
|
||||
ws.Cell(row, 15).Value = record.CustomerCountry;
|
||||
ws.Cell(row, 16).Value = record.CustomerIndustry;
|
||||
ws.Cell(row, 17).Value = record.StandardCost;
|
||||
ws.Cell(row, 18).Value = record.StandardCostCurrency;
|
||||
ws.Cell(row, 19).Value = record.PurchaseOrderNumber;
|
||||
ws.Cell(row, 20).Value = record.SalesPriceValue;
|
||||
ws.Cell(row, 21).Value = record.SalesCurrency;
|
||||
ws.Cell(row, 22).Value = record.DocumentCurrency;
|
||||
ws.Cell(row, 23).Value = record.DocumentTotalForeignCurrency;
|
||||
ws.Cell(row, 24).Value = record.DocumentTotalLocalCurrency;
|
||||
ws.Cell(row, 25).Value = record.VatSumForeignCurrency;
|
||||
ws.Cell(row, 26).Value = record.VatSumLocalCurrency;
|
||||
ws.Cell(row, 27).Value = record.DocumentRate;
|
||||
ws.Cell(row, 28).Value = record.CompanyCurrency;
|
||||
ws.Cell(row, 29).Value = record.Incoterms2020;
|
||||
ws.Cell(row, 30).Value = record.SalesResponsibleEmployee;
|
||||
ws.Cell(row, 31).Value = record.PostingDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 32).Value = record.InvoiceDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 33).Value = record.OrderDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 34).Value = record.Land;
|
||||
ws.Cell(row, 35).Value = record.DocumentType;
|
||||
ws.Cell(row, 9).Value = record.ProductHierarchyCode;
|
||||
ws.Cell(row, 10).Value = record.ProductHierarchyText;
|
||||
ws.Cell(row, 11).Value = record.ProductFamilyCode;
|
||||
ws.Cell(row, 12).Value = record.ProductFamilyText;
|
||||
ws.Cell(row, 13).Value = record.ProductDivisionCode;
|
||||
ws.Cell(row, 14).Value = record.ProductDivisionText;
|
||||
ws.Cell(row, 15).Value = record.ProductMappingAssigned;
|
||||
ws.Cell(row, 16).Value = record.Quantity;
|
||||
ws.Cell(row, 17).Value = record.SupplierNumber;
|
||||
ws.Cell(row, 18).Value = record.SupplierName;
|
||||
ws.Cell(row, 19).Value = record.SupplierCountry;
|
||||
ws.Cell(row, 20).Value = record.CustomerNumber;
|
||||
ws.Cell(row, 21).Value = record.CustomerName;
|
||||
ws.Cell(row, 22).Value = record.CustomerCountry;
|
||||
ws.Cell(row, 23).Value = record.CustomerIndustry;
|
||||
ws.Cell(row, 24).Value = record.StandardCost;
|
||||
ws.Cell(row, 25).Value = record.StandardCostCurrency;
|
||||
ws.Cell(row, 26).Value = record.PurchaseOrderNumber;
|
||||
ws.Cell(row, 27).Value = record.SalesPriceValue;
|
||||
ws.Cell(row, 28).Value = record.SalesCurrency;
|
||||
ws.Cell(row, 29).Value = record.DocumentCurrency;
|
||||
ws.Cell(row, 30).Value = record.DocumentTotalForeignCurrency;
|
||||
ws.Cell(row, 31).Value = record.DocumentTotalLocalCurrency;
|
||||
ws.Cell(row, 32).Value = record.VatSumForeignCurrency;
|
||||
ws.Cell(row, 33).Value = record.VatSumLocalCurrency;
|
||||
ws.Cell(row, 34).Value = record.DocumentRate;
|
||||
ws.Cell(row, 35).Value = record.CompanyCurrency;
|
||||
ws.Cell(row, 36).Value = record.Incoterms2020;
|
||||
ws.Cell(row, 37).Value = record.SalesResponsibleEmployee;
|
||||
ws.Cell(row, 38).Value = record.PostingDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 39).Value = record.InvoiceDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 40).Value = record.OrderDate?.ToString("dd.MM.yyyy") ?? string.Empty;
|
||||
ws.Cell(row, 41).Value = record.Land;
|
||||
ws.Cell(row, 42).Value = record.DocumentType;
|
||||
var financeCountryKey = ResolveFinanceCountryKey(record.Land, record.Tsc);
|
||||
var financeDate = financeRuleEngine.ResolveFinanceDate(record, financeCountryKey);
|
||||
var financeInclude = financeRuleEngine.ShouldInclude(record, financeCountryKey);
|
||||
var financeNetSalesActual = financeRuleEngine.ResolveNetSalesActual(record, financeCountryKey, financeInclude);
|
||||
ws.Cell(row, 36).Value = financeDate.Year;
|
||||
ws.Cell(row, 37).Value = financeCountryKey;
|
||||
ws.Cell(row, 38).Value = financeDate.ToString("dd.MM.yyyy");
|
||||
ws.Cell(row, 39).Value = financeNetSalesActual;
|
||||
ws.Cell(row, 40).Value = ResolveFinanceCurrency(record);
|
||||
ws.Cell(row, 41).Value = financeInclude && financeNetSalesActual != 0m ? "TRUE" : "FALSE";
|
||||
ws.Cell(row, 42).Value = financeInclude
|
||||
ws.Cell(row, 43).Value = financeDate.Year;
|
||||
ws.Cell(row, 44).Value = financeCountryKey;
|
||||
ws.Cell(row, 45).Value = financeDate.ToString("dd.MM.yyyy");
|
||||
ws.Cell(row, 46).Value = financeNetSalesActual;
|
||||
ws.Cell(row, 47).Value = ResolveFinanceCurrency(record);
|
||||
ws.Cell(row, 48).Value = financeInclude && financeNetSalesActual != 0m ? "TRUE" : "FALSE";
|
||||
ws.Cell(row, 49).Value = financeInclude
|
||||
? "Sales Price/Value"
|
||||
: financeRuleEngine.ResolveExclusionReason(record, financeCountryKey);
|
||||
row++;
|
||||
|
||||
@@ -24,6 +24,13 @@ public class ManualExcelImportService : IManualExcelImportService
|
||||
["material"] = nameof(SalesRecord.Material),
|
||||
["name"] = nameof(SalesRecord.Name),
|
||||
["productgroup"] = nameof(SalesRecord.ProductGroup),
|
||||
["producthierarchycode"] = nameof(SalesRecord.ProductHierarchyCode),
|
||||
["producthierarchytext"] = nameof(SalesRecord.ProductHierarchyText),
|
||||
["productfamilycode"] = nameof(SalesRecord.ProductFamilyCode),
|
||||
["productfamilytext"] = nameof(SalesRecord.ProductFamilyText),
|
||||
["productdivisioncode"] = nameof(SalesRecord.ProductDivisionCode),
|
||||
["productdivisiontext"] = nameof(SalesRecord.ProductDivisionText),
|
||||
["productmappingassigned"] = nameof(SalesRecord.ProductMappingAssigned),
|
||||
["quantity"] = nameof(SalesRecord.Quantity),
|
||||
["suppliernumber"] = nameof(SalesRecord.SupplierNumber),
|
||||
["suppliername"] = nameof(SalesRecord.SupplierName),
|
||||
@@ -162,6 +169,13 @@ public class ManualExcelImportService : IManualExcelImportService
|
||||
Material = ReadString(headerIndexes, fields, nameof(SalesRecord.Material)),
|
||||
Name = ReadString(headerIndexes, fields, nameof(SalesRecord.Name)),
|
||||
ProductGroup = ReadString(headerIndexes, fields, nameof(SalesRecord.ProductGroup)),
|
||||
ProductHierarchyCode = ReadString(headerIndexes, fields, nameof(SalesRecord.ProductHierarchyCode)),
|
||||
ProductHierarchyText = ReadString(headerIndexes, fields, nameof(SalesRecord.ProductHierarchyText)),
|
||||
ProductFamilyCode = ReadString(headerIndexes, fields, nameof(SalesRecord.ProductFamilyCode)),
|
||||
ProductFamilyText = ReadString(headerIndexes, fields, nameof(SalesRecord.ProductFamilyText)),
|
||||
ProductDivisionCode = ReadString(headerIndexes, fields, nameof(SalesRecord.ProductDivisionCode)),
|
||||
ProductDivisionText = ReadString(headerIndexes, fields, nameof(SalesRecord.ProductDivisionText)),
|
||||
ProductMappingAssigned = ReadString(headerIndexes, fields, nameof(SalesRecord.ProductMappingAssigned)),
|
||||
Quantity = ReadDecimal(headerIndexes, fields, nameof(SalesRecord.Quantity)),
|
||||
SupplierNumber = ReadString(headerIndexes, fields, nameof(SalesRecord.SupplierNumber)),
|
||||
SupplierName = ReadString(headerIndexes, fields, nameof(SalesRecord.SupplierName)),
|
||||
|
||||
Reference in New Issue
Block a user