QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
5.4 KiB
5.4 KiB
RMM-Article Logic in Contract Billing
Overview
The Remote Monitoring Management (RMM) Article functionality in c-entron.NET allows for automatic billing of usage-based services that are measured by an external RMM system. This document outlines the rules, workflow, and technical implementation of the RMM Article billing process.
Key Concepts
RMM System Integration
- The c-entron.NET application integrates with external RMM systems (e.g., "Riverbird") to retrieve usage statistics
- Usage data is collected for specified periods and used to calculate billing amounts
- Communication happens via the
RiverConnectionBLclass which connects to the RMM service
Contract Article References
- Each billable RMM item is defined as a
ContractArticleReferenzesentity - These references link articles in c-entron.NET to specific metrics in the RMM system
- Article references contain configuration for billing calculation rules
Workflow
1. Contract Configuration
- A contract is configured to use RMM billing (
WhetherRMMreturns true) - Contract article references are configured, specifying:
- Article type (e.g., server, workstation)
- Article reference (linking to the inventory item)
- Pricing rules
2. Invoice Generation Process
- During the
CreateInvoiceToContractCompleteprocess,CheckRMMArticleis called - The system checks if the contract has RMM enabled
- The system looks for a placeholder tag
@@RMMArtikel@@in the invoice template - Contract article references are retrieved for the specific contract
- The system queries the external RMM service for usage data in the billing period
- For each article reference with available usage data:
- Usage amount is calculated using
CalculateContractBillingAmount - An invoice line item is created with the calculated amount
- Descriptive text is added explaining the service type
- The item is inserted at the position marked by
@@RMMArtikel@@or near the end of the invoice
- Usage amount is calculated using
3. Placeholder Handling
- If the invoice template contains a text element with
@@RMMArtikel@@, it serves as a position marker - This placeholder is removed and replaced with the actual RMM article items
- If no placeholder is found, RMM items are inserted near the end of the invoice (count - 2 position)
Error Handling
External Service Unavailability
- If the RMM service is unavailable during invoice generation, and the contract requires RMM data:
- An
RMMServiceUnavailableExceptionis thrown - The invoice creation process is aborted
- An error message is logged with details about the failure
- An
- This prevents invoices from being created with incomplete usage data, ensuring customers are billed correctly
Data Integrity Rules
- When a parent entity is deleted (State = 0), related child entities should also be marked as deleted
- This ensures data consistency when RMM configurations change
Technical Implementation Details
RMM Article Detection
var rmmItem = invoice.Items.FirstOrDefault(f =>
(f.RichText != null && f.RichText.IndexOf("@@RMMArtikel@@", StringComparison.InvariantCulture) > -1) ||
(f.Text != null && f.Text.IndexOf("@@RMMArtikel@@", StringComparison.InvariantCulture) > -1));
Usage Data Retrieval
var riverbirdStatisticsResult = new RiverConnectionBL(this.Session).GetContractBillingAmounts(
billingParam.InvoiceFrom.Value,
billingParam.InvoiceTo.Value.AddDays(1),
invoice.CustomerI3D,
rmmArticleReferences);
Error Handling for Service Unavailability
if (riverbirdStatisticsResult.Status is ResultStatus.Error)
{
// Only throw exception when RMM articles are expected
if (rmmItem != null || rmmArticleReferences.Any())
{
string errorMsg = $"Die Rechnung kann nicht erstellt werden, da der RMM-Service nicht erreichbar ist. " +
$"Fehlermeldung: {riverbirdStatisticsResult.Message}";
_logger.Error(errorMsg);
throw new RMMServiceUnavailableException(errorMsg);
}
return;
}
Best Practices
-
Service Configuration
- Ensure the RMM service URL is properly configured in application settings
- Verify authentication tickets are valid for the RMM service
-
Contract Setup
- Associate correct article references with appropriate RMM metrics
- Set proper calculation rules for each article type
-
Invoice Templates
- Include the
@@RMMArtikel@@placeholder in invoice templates where RMM items should appear - Ensure proper formatting and positioning for RMM article items
- Include the
-
Monitoring
- Monitor logs for RMM service connectivity issues
- Periodically verify that usage data is being correctly retrieved and calculated
Troubleshooting
| Problem | Possible Cause | Solution |
|---|---|---|
| No RMM items in invoice | RMM not enabled for contract | Check contract configuration |
| No RMM items in invoice | No usage data in RMM system | Verify usage data in RMM system |
| Invoice creation fails | RMM service unavailable | Check network connectivity and service status |
| Incorrect billing amounts | Calculation rules misconfigured | Review article reference configuration |
Related Components
AutomaticFacturaWebServiceBL- Main billing logicRiverConnectionBL- Handles communication with RMM serviceContractArticleReferenzes- Defines article references for RMM billing