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
11 KiB
ActionPrice System Documentation
Overview
The ActionPrice (Aktionspreis) system in c-entron manages time-limited promotional pricing from distributors and manufacturers. It integrates seamlessly with the price matrix (Preismatrix) to provide users with current action prices alongside other pricing sources.
Table of Contents
- Database Structure
- Architecture & Components
- Data Flow
- Data Sources
- UI Access
- Integration with Price Matrix
- API Reference
- Business Rules
Database Structure
Table: HerstellerArtikAktionspreis
Location: SQL Server database
Mapped by: ActionPriceMaps.cs
| Column | Data Type | Description |
|---|---|---|
I3D |
int IDENTITY(1,1) | Primary key |
ArtikelI3D |
int | Foreign key to Article table |
Artikelcode |
nvarchar(60) | Article code |
Preis |
decimal | Action price |
Distributor |
nvarchar(100) | Distributor name |
GueltigAb |
datetime2(2) | Effective from date |
GueltigBis |
datetime2(2) | Effective until date |
Text |
nvarchar(500) | Description/notes |
Hersteller |
nvarchar(60) | Manufacturer |
BearbeiterI3D |
int | Editor user ID |
EDI_I3D |
int | EDI integration ID (reserved) |
Verfuegbarkeit |
nvarchar(50) | Availability |
VK |
decimal | Selling price |
Kreditorcode |
nvarchar(50) | Creditor code |
Status |
int | Status flag |
DistID |
nvarchar(50) | Distributor product ID |
Architecture & Components
Core Components
1. Entity Layer
- File:
Centron.Entities/Warehousing/ActionPrice.cs - Purpose: Domain entity representing action price data
- Properties: Maps 1:1 with database columns
2. Data Access Layer (DAO)
- File:
Centron.DAO/Mappings/Warehousing/ActionPriceMaps.cs - Purpose: NHibernate mapping for ActionPrice entity
- Technology: FluentNHibernate
3. Business Logic Layer (BL)
- File:
Centron.BL/Warehousing/ActionPriceBL.cs - Methods:
GetActionPrice(int actionPriceI3D)GetActionPricesByArticleI3D(int articleI3D)SaveOrUpdateActionPrice(ActionPrice actionPrice)DeleteActionPrice(ActionPrice actionPrice)
4. Web Service Layer
- File:
Centron.BL/WebServices/Warehousing/ActionPriceWebServiceBL.cs - Purpose: DTO conversion and web service operations
- Features: Entity ↔ DTO mapping using ObjectMapper
5. REST API
- File:
CentronRestService.cs - Endpoints:
POST /GetActionPricePOST /GetActionPricesByArticleI3DPOST /SaveOrUpdateActionPricePOST /DeleteActionPrice
Dual Implementation Pattern
Following c-entron's standard pattern, ActionPrice supports both connection types:
BL Logic (Direct Database)
- File:
BLActionPriceLogic.cs - Connection:
CentronConnectionType.SqlServer - Access: Direct database via NHibernate
WS Logic (Web Service)
- File:
WSActionPriceLogic.cs - Connection:
CentronConnectionType.CentronWebServices - Access: REST API calls
Data Flow
Reading ActionPrices
1. Price Matrix Request
↓
2. Article Lookup (by ManufacturerCode or EAN)
↓
3. IActionPriceLogic.GetActionPricesByArticleI3D()
↓
4. Filter by Date Range (current valid prices only)
↓
5. Convert to PriceItemViewModel
↓
6. Display in Price Matrix Grid
Creating ActionPrices
1. User Right-clicks Price Matrix Grid
↓
2. Select "Aktionspreis hinzufügen"
↓
3. AddActionPriceViewModel Dialog Opens
↓
4. User Enters Data (Distributor, Price, Dates)
↓
5. Validation (Distributor required, valid date range)
↓
6. IActionPriceLogic.SaveOrUpdateActionPrice()
↓
7. Data Saved to Database
↓
8. Price Matrix Refreshed
Data Sources
Current Active Sources
1. Manual Entry (Primary)
- Location: Article Management → Additional Info → Preisspiegel Tab
- Method: Right-click context menu → "Aktionspreis hinzufügen"
- Validation:
- Distributor name required
- EffectiveFrom ≤ EffectiveUntil
- User Tracking: EditorI3D field tracks creator
Potential Sources (Infrastructure Exists)
1. EDI Integration
- Evidence:
EDI_I3Dfield in database - Status: Infrastructure exists but no active implementation found
- Purpose: Automated import from supplier EDI systems
2. Bulk Import
- Evidence: Standard c-entron import patterns
- Status: No specific ActionPrice import modules identified
- Potential: Could be implemented for supplier data feeds
UI Access
Step-by-Step Navigation
-
Open Article Management
- Navigate: Warehousing → Article Management
-
Select Article
- Search for and open an existing article
-
Access Additional Info
- Navigate to "Zusatzinfo" (Additional Info) section
-
Open Preisspiegel Tab
- Click on "Preisspiegel" tab
- This displays the price matrix grid
-
Access ActionPrice Functions
- Right-click on the price matrix grid
- Context menu appears with options:
- "Preisspiegel aktualisieren" (Refresh)
- "Aktionspreis hinzufügen" (Add ActionPrice)
- "Aktionspreis bearbeiten" (Edit ActionPrice)
- "Aktionspreis löschen" (Delete ActionPrice)
UI Components
- View:
ArticleAdditionalInfoView.xaml - ViewModel:
ArticleAdditionalInfoViewModel.cs - Grid:
PriceWatchGridControl(line 68) - Tab: "Preisspiegel" (line 64)
- Context Menu: Lines 123-141
Integration with Price Matrix
Price Matrix Sources
ActionPrice is one of 7 parallel price sources in the matrix:
- ITscope - External API
- Article Import - Imported price data
- COP - External API
- NEOS - External API
- TradersGuide - External API
- EGIS - External API
- Aktionspreise - Internal action prices ←
Display Logic
- File:
PriceMatrixViewModel.cs - Method:
GetPriceItemsFromArticleActionPrices()(lines 416-459) - Filtering: Only shows prices where current date is within EffectiveFrom/EffectiveUntil range
- Service Label: Displays as "Aktionspreise" in Service column
- Description Format: "Aktionspreis vom {EffectiveFrom:d} bis {EffectiveUntil:d}. {Text}"
Price Item Properties
// ActionPrice in Price Matrix
Service = "Aktionspreise"
Supplier = actionPrice.Distributor
PurchasePrice = actionPrice.Price
RawPurchasePrice = actionPrice.Price
Date = actionPrice.EffectiveFrom
Stock = null // Always visible
ArticleDescription = "Aktionspreis vom ... bis ... {Text}"
API Reference
REST Endpoints
Get Single ActionPrice
POST /GetActionPrice
Content-Type: application/json
{
"Data": 123 // ActionPrice I3D
}
Get ActionPrices by Article
POST /GetActionPricesByArticleI3D
Content-Type: application/json
{
"Data": 456 // Article I3D
}
Save or Update ActionPrice
POST /SaveOrUpdateActionPrice
Content-Type: application/json
{
"Data": {
"I3D": 0, // 0 for new, >0 for update
"ArticleI3D": 456,
"ArticleCode": "ART001",
"Price": 99.99,
"Distributor": "Supplier Name",
"EffectiveFrom": "2024-01-01T00:00:00",
"EffectiveUntil": "2024-12-31T23:59:59",
"Text": "Special promotion",
"Manufacturer": "Brand Name"
}
}
Delete ActionPrice
POST /DeleteActionPrice
Content-Type: application/json
{
"Data": {
"I3D": 123,
// ... other properties
}
}
Code Usage
Get ActionPrices for Article
var actionPrices = await ClassContainer.Instance
.WithInstance((IActionPriceLogic logic) =>
logic.GetActionPricesByArticleI3D(articleI3D))
.ThrowIfError();
Save New ActionPrice
var actionPriceDTO = new ActionPriceDTO
{
ArticleI3D = articleI3D,
Distributor = "Supplier Name",
Price = 99.99,
EffectiveFrom = DateTime.Now,
EffectiveUntil = DateTime.Now.AddMonths(3),
Text = "Special promotion"
};
await ClassContainer.Instance
.WithInstance((IActionPriceLogic logic) =>
logic.SaveOrUpdateActionPrice(actionPriceDTO))
.ThrowIfError();
Business Rules
Validation Rules
-
Required Fields
Distributor- Must not be empty or whitespace
-
Date Validation
EffectiveFrommust be ≤EffectiveUntil- Both dates are required
-
Display Rules
- Only ActionPrices with current date within effective range show in Price Matrix
- Filter:
EffectiveFrom.StartOfDay() <= DateTime.Now && EffectiveUntil >= DateTime.Now
Data Integrity
-
Article Linking
- ActionPrices are linked to articles via
ArticleI3D - Article must exist in system
- ActionPrices are linked to articles via
-
User Tracking
EditorI3Dtracks who created/modified the record- Automatically set during save operations
-
Status Management
Statusfield available for workflow management- Currently not actively used in UI
Price Matrix Integration
-
Loading Priority
- ActionPrices loaded in parallel with other price sources
- No specific priority ordering
-
Cache Behavior
- Price matrix results are cached by ManufacturerCode + EANCode
- Cache invalidated when ActionPrices are modified
-
Display Formatting
- ActionPrices always show Stock as null (always visible)
- Service column shows "Aktionspreise"
- Description includes date range and text
Troubleshooting
Common Issues
-
ActionPrice Not Visible in Price Matrix
- Check if current date is within EffectiveFrom/EffectiveUntil range
- Verify article linking via ArticleI3D
- Ensure Price Matrix cache is refreshed
-
Context Menu Not Appearing
- Ensure right-clicking directly on the Price Matrix grid
- Check if article is properly selected
- Verify user is in "Preisspiegel" tab
-
Save Validation Errors
- Verify Distributor field is not empty
- Check date range: EffectiveFrom ≤ EffectiveUntil
- Ensure all required fields are populated
Debug Information
- Price Matrix Loading: Check
PriceMatrixViewModel.GetPriceItemsFromArticleActionPrices() - Article Lookup: Verify article found by ManufacturerCode or EANCode
- Date Filtering: Current ActionPrice validation logic
- UI Binding: Check
ArticleAdditionalInfoViewModel.ActionPricescollection
Development Notes
Future Enhancements
-
EDI Integration
EDI_I3Dfield suggests planned EDI integration- Could automate ActionPrice imports from suppliers
-
Bulk Import
- Standard c-entron import patterns could be applied
- Excel/CSV import functionality possible
-
Workflow Management
Statusfield could support approval workflows- Multi-step ActionPrice approval process
-
Advanced Filtering
- Additional filter options in Price Matrix
- ActionPrice-specific search capabilities
Code Maintenance
- Entity Changes: Update both
ActionPriceentity andActionPriceDTO - Database Changes: Update
ActionPriceMapsNHibernate mapping - API Changes: Update both BL and WS logic implementations
- UI Changes: Update both View and ViewModel files
This documentation covers the complete ActionPrice system as implemented in c-entron. For questions or updates, refer to the source code files referenced throughout this document.