diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj
index 8c8f3630..fe833ff3 100644
--- a/MP-TAB3/MP-TAB3.csproj
+++ b/MP-TAB3/MP-TAB3.csproj
@@ -3,7 +3,7 @@
net8.0
enable
- 8.16.2606.410
+ 8.16.2606.414
enable
MP_TAB3
diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html
index be2d3178..988f5d0e 100644
--- a/MP-TAB3/Resources/ChangeLog.html
+++ b/MP-TAB3/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2606.410
+ Versione: 8.16.2606.414
Note di rilascio:
-
diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt
index a6ed034a..b698ae9b 100644
--- a/MP-TAB3/Resources/VersNum.txt
+++ b/MP-TAB3/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.410
+8.16.2606.414
diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml
index 32b9e3e3..12a5b51c 100644
--- a/MP-TAB3/Resources/manifest.xml
+++ b/MP-TAB3/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.410
+ 8.16.2606.414
https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip
https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html
false
diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj
index 8029ac42..dbb5918a 100644
--- a/MP.INVE/MP.INVE.csproj
+++ b/MP.INVE/MP.INVE.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.INVE
- 8.16.2606.410
+ 8.16.2606.414
diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html
index 5dca1889..efb06a08 100644
--- a/MP.INVE/Resources/ChangeLog.html
+++ b/MP.INVE/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOINVE
-
Versione: 8.16.2606.410
+ Versione: 8.16.2606.414
Note di rilascio:
-
diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt
index a6ed034a..b698ae9b 100644
--- a/MP.INVE/Resources/VersNum.txt
+++ b/MP.INVE/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.410
+8.16.2606.414
diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml
index 4a4b7264..069a59b5 100644
--- a/MP.INVE/Resources/manifest.xml
+++ b/MP.INVE/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.410
+ 8.16.2606.414
https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip
https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html
false
diff --git a/MP.IOC/Controllers/BenchController.cs b/MP.IOC/Controllers/BenchController.cs
index 357ee5cb..b096bbb1 100644
--- a/MP.IOC/Controllers/BenchController.cs
+++ b/MP.IOC/Controllers/BenchController.cs
@@ -13,10 +13,9 @@ namespace MP.IOC.Controllers
{
#region Public Constructors
- public BenchController(IConfiguration configuration, MpDataService DataService)
+ public BenchController(MpDataService DataService)
{
Log.Info("Starting BenchController");
- _configuration = configuration;
DService = DataService;
Log.Info("Avviata BenchController");
}
@@ -378,8 +377,6 @@ namespace MP.IOC.Controllers
#region Private Fields
- private static IConfiguration _configuration = null!;
-
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
diff --git a/MP.IOC/Controllers/IOBController.cs b/MP.IOC/Controllers/IOBController.cs
index f0ebee6c..7a5ff915 100644
--- a/MP.IOC/Controllers/IOBController.cs
+++ b/MP.IOC/Controllers/IOBController.cs
@@ -20,7 +20,6 @@ namespace MP.IOC.Controllers
public IOBController(IConfiguration configuration, MpDataService DataService, IIocService IService)
{
- _configuration = configuration;
DService = DataService;
IOCService = IService;
}
@@ -1451,8 +1450,6 @@ namespace MP.IOC.Controllers
#endregion Public Methods
#region Private Fields
-
- private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
private IIocService IOCService;
diff --git a/MP.IOC/Controllers/RecipeArchiveController.cs b/MP.IOC/Controllers/RecipeArchiveController.cs
index 48a65540..feba2568 100644
--- a/MP.IOC/Controllers/RecipeArchiveController.cs
+++ b/MP.IOC/Controllers/RecipeArchiveController.cs
@@ -10,10 +10,9 @@ namespace MP.IOC.Controllers
{
#region Public Constructors
- public RecipeArchiveController(IConfiguration configuration, MpDataService DataService)
+ public RecipeArchiveController(MpDataService DataService)
{
Log.Info("Starting RecipeArchiveController");
- _configuration = configuration;
DService = DataService;
Log.Info("Avviata classe RecipeArchiveController");
}
@@ -121,8 +120,6 @@ namespace MP.IOC.Controllers
#region Private Fields
- private static IConfiguration _configuration = null!;
-
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
diff --git a/MP.IOC/Controllers/RecipeController.cs b/MP.IOC/Controllers/RecipeController.cs
index 6ebf6944..50005b4f 100644
--- a/MP.IOC/Controllers/RecipeController.cs
+++ b/MP.IOC/Controllers/RecipeController.cs
@@ -12,10 +12,9 @@ namespace MP.IOC.Controllers
{
#region Public Constructors
- public RecipeController(IConfiguration configuration, MpDataService DataService)
+ public RecipeController(MpDataService DataService)
{
Log.Info("Starting RecipeController");
- _configuration = configuration;
DService = DataService;
Log.Info("Avviata RecipeController");
}
@@ -64,8 +63,6 @@ namespace MP.IOC.Controllers
#region Private Fields
- private static IConfiguration _configuration = null!;
-
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
diff --git a/MP.IOC/MP.IOC.csproj b/MP.IOC/MP.IOC.csproj
index 1a6d9050..28fe629f 100644
--- a/MP.IOC/MP.IOC.csproj
+++ b/MP.IOC/MP.IOC.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 8.16.2606.410
+ 8.16.2606.414
diff --git a/MP.IOC/README.md b/MP.IOC/README.md
index 7167bdc9..5c1018f2 100644
--- a/MP.IOC/README.md
+++ b/MP.IOC/README.md
@@ -1,10 +1,74 @@
# MP.IOC
-MAPO IOC: WebApi rest per la gestione delel chaimate dagli applicativi remoti sul campo (IOB-PI su raspberry pi e IOB-WIN su PC Windows) che si occupano di comunicare con le varie macchine di processo i dati da trasmettere al MES.
-E' la nuova implementazioen del modulo IO (il precedente era fatto in dotNet framework 4.7.2) su cui si sta dirigendo lo sviluppo della soluzione MES MAPO
+MAPO IOC: WebApi rest per la gestione delle chiamate dagli applicativi remoti sul campo (IOB-PI su Raspberry Pi e IOB-WIN su PC Windows) che si occupano di comunicare con le varie macchine di processo i dati da trasmettere al MES.
-Integra raccolta di informazioni riguardo ai compiti svolti e uesti sono ottimizzati per l'impiego di cache e ottimizzazioni varie su ogni strato del progetto.
+È la nuova implementazione del modulo IO (il precedente era fatto in .NET Framework 4.7.2) su cui si sta dirigendo lo sviluppo della soluzione MES MAPO.
+
+Integra raccolta di informazioni riguardo ai compiti svolti e questi sono ottimizzati per l'impiego di cache e ottimizzazioni varie su ogni strato del progetto.
## Sezioni Principali
-Il metodo principale è una webApi che risponde all'indirizzo api/IOB, è presente una documentazione swagger (in develop)
\ No newline at end of file
+- Api IOB (`api/IOB`) — endpoint principale per comunicazioni da campo (52 metodi)
+- Benchmark Redis (`api/Bench`) — tool di test per debugging Redis
+- Api Ricette (`api/Recipe`) — recupero ricette per PODL
+- Dashboard Blazor — interfaccia web interattiva
+
+## Architettura
+
+### Livello Controller (MP.IOC/Controllers/)
+
+| Controller | Routing | Methods | Descrizione |
+|------------|---------|---------|-------------|
+| `IOBController` | `api/IOB` | 52 | Endpoint principale per IOB-PI/IOB-WIN |
+| `BenchController` | `api/Bench` | 10 | Test/benchmark Redis |
+| `RecipeController` | `api/Recipe` | 2 | API ricette (JSON) |
+| `RecipeArchiveController` | `api/RecipeArchive` | 2 | API archive ricette (file) |
+
+### Livello Dati
+
+| Componente | Tipologia | Descrizione |
+|------------|-----------|-------------|
+| `MpDataService` | Singleton | Service di accesso dati principale (~3475 righe) |
+| `MpIocController` | Singleton | 82 metodi EFCore nel progetto MP.Data |
+| `Redis` | 2 connessioni | `redisConn`, `redisConnAdmin` per dati IOB |
+| `MongoDB` | Via `MpMongoController` | Storage ricette |
+
+### Livello DbContext
+
+| DbContext | ConnStr | Uso |
+|-----------|---------|-----|
+| `MoonProContext` | `MP.Data` | Tabelle anagrafiche, ODL, produzione, macchine |
+| `MoonPro_UtilsContext` | `MP.Utils` | Tabelle utility (VMSFD, MicroStati) |
+| `MoonPro_FluxContext` | `MP.Flux` | FluxLog, configurazioni flusso |
+
+### Livello DI
+
+Registrato via `AddIocDataLayer()` in `MP.Data/DataServiceCollectionExtensions.cs`:
+
+```
+Singleton: IMtcSetupRepository, IMtcSetupService, ProductionRepository, MpIocController, MpDataService, IFusionCacheSerializer
+Scoped: IIocRepository, IStatsAggrRepository, IStatsDetailRepository, IIocService, IStatsAggrService, IStatsDetailService
+```
+
+### Livello Infrastruttura
+
+- **FusionCache** — L1 Memory only (1min default), NO Redis backplane
+- **MessagePipe** — Broadcasting real-time tra servizi
+- **OpenTelemetry** — Tracing configurabile (non abilitato in MP.IOC)
+- **Swagger** — Documentazione API in svilup
+
+## Refactoring Completati
+
+**Nessuno ancora.** Il progetto è pronto per il refactoring. Vedi `refactor_plan.md` per il piano dettagliato.
+
+## Refactoring in Corso (Riferimento)
+
+### Piano Generale (Vedi refactor_plan.md)
+
+1. **Fase 1 — Anti-Pattern** (Quota completata): Rimuovere `static IConfiguration` dai 4 controller
+2. **Fase 2 — FusionCache**: Abilitare L2/L3 con Redis backplane e migrare i ~100 metodi di caching manuale
+3. **Fase 3 — Repository IoC**: Scomporre MpIocController (82 metodi) in 5-7 repository focalizzati
+4. **Fase 4 — Scomposizione MpDataService**: Il monolite da 3475 righe suddiviso in servizi tematici
+5. **Fase 5 — Build & Verifica**: Validazione finale su tutte le soluzioni
+
+**Stato attuale:** In attesa di inizio Fase 1.
diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html
index 01eb8b02..9f4081d4 100644
--- a/MP.IOC/Resources/ChangeLog.html
+++ b/MP.IOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-IOC
-
Versione: 8.16.2606.410
+ Versione: 8.16.2606.414
Note di rilascio:
-
diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt
index a6ed034a..b698ae9b 100644
--- a/MP.IOC/Resources/VersNum.txt
+++ b/MP.IOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.410
+8.16.2606.414
diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml
index 04f7aa0e..3546e8ed 100644
--- a/MP.IOC/Resources/manifest.xml
+++ b/MP.IOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.410
+ 8.16.2606.414
https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip
https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.IOC/refactor_plan.md b/MP.IOC/refactor_plan.md
new file mode 100644
index 00000000..10778bcd
--- /dev/null
+++ b/MP.IOC/refactor_plan.md
@@ -0,0 +1,246 @@
+# Piano di Refactoring: MP.IOC
+
+## Obiettivo
+
+Modernizzare il progetto MP.IOC allineandolo agli standard architettonici definiti in MP.SPEC:
+1. Rimuovere l'uso di `MpIocController` come servizio di accesso dati diretto
+2. Migrare la logica di `MpDataService` ai repository esistenti (`IIocRepository`, `IStatsAggrRepository`, etc.)
+3. Standardizzare il caching manuale Redis → FusionCache `GetOrFetchAsync`
+4. Correggere tutti gli anti-pattern statici e DI
+
+## Stato Attuale
+
+| File | Riga | Tipo | Descrizione |
+|------|------|------|-------------|
+| `IOBController.cs` | 1675 | ✅ Controller ASP.NET | 52 endpoints REST (api/IOB) |
+| `BenchController.cs` | 387 | ✅ Controller ASP.NET | Test/bench Redis |
+| `RecipeController.cs` | 73 | ✅ Controller ASP.NET | API ricette (2 metodi) |
+| `RecipeArchiveController.cs` | 130 | ✅ Controller ASP.NET | API ricette file (2 metodi) |
+| `MpDataService.cs` | 3475 | ❌ Data Hub | Singleton, ~100 metodi, bypassa repository |
+| `MpIocController.cs` | 1480 | ⚠️ Wrong location | 82 metodi EFCore in MP.Data, usato come servizio |
+
+### Struttura DI Attuale
+
+```
+Program.cs
+├── AddIocDataLayer() da MP.Data
+│ ├── MpIocController ── Singleton ← usato direttamente da MpDataService
+│ ├── IIocRepository ── Scoped ← mai usato da MpDataService
+│ ├── IStatsAggrRepository ── Scoped ← mai usato
+│ └── IStatsDetailRepository ── Scoped ← mai usato
+├── MpDataService ── Singleton ← chiama IocDbController (statico)
+└── IFusionCache ── L1 Memory only, NO Redis backplane
+```
+
+### Problemi Chiave
+
+1. **MpIocController come servizio** — 82 metodi EFCore classificati ingannevolmente come "Controller" ma in realtà sono un servizio di accesso dati, registrato come Singleton con DbContext che non è thread-safe
+2. **MpDataService bypassa repository** — ~80% dei metodi chiama `IocDbController.XXX()` direttamente invece di usare `IIocRepository`
+3. **Nessun FusionCache** — MpDataService usa manual `redisDb.StringGetAsync`/`StringSetAsync` (~80% del codice) invece di `IFusionCache.GetOrFetchAsync`
+4. **Singleton lifetime mismatch** — MpDataService è Singleton, registra campi statici per IoC Controller e Mongo Controller che vengono sovrascritti
+
+## Piano di Refactoring
+
+### Fase 1: Pulizia Anti-Pattern (Quick Wins)
+
+Obiettivo: risolvere gli Static fields e i problemi DI più evidenti senza cambiare architettura.
+
+#### 1.1 Rimuovere `static IConfiguration` dai 4 controller
+
+| File | Fix |
+|------|-----|
+| `IOBController.cs:23` | `readonly IConfiguration _configuration` (usato solo nel ctor, rimosso se dead) |
+| `BenchController.cs:19` | Rimuovere campo statico (non usato dopo ctor) |
+| `RecipeController.cs:18` | Rimuovere campo statico (non usato dopo ctor) |
+| `RecipeArchiveController.cs:18` | Rimuovere campo statico (non usato dopo ctor) |
+
+**File da modificare:**
+- `C:\Users\samuele.steamw\source\MAPO-CORE\MP.IOC\Controllers\IOBController.cs`
+- `C:\Users\samuele.steamw\source\MAPO-CORE\MP.IOC\Controllers\BenchController.cs`
+- `C:\Users\samuele.steamw\source\MAPO-CORE\MP.IOC\Controllers\RecipeController.cs`
+- `C:\Users\samuele.steamw\source\MAPO-CORE\MP.IOC\Controllers\RecipeArchiveController.cs`
+
+#### 1.2 Correggere `MpIocController` singleton
+
+`MpIocController` usa `IDbContextFactory` correttamente, ma è registrato come Singleton in `AddIocDataLayer()`. I DbContext Factory sono thread-safe ma il pattern Singleton è inutile e potenzialmente pericoloso.
+
+Fix: registrare come **Scoped** in `DataServiceCollectionExtensions.cs`:
+```csharp
+services.TryAddScoped(); // rinominare in servizio
+// oppure creare interfaccia IMpIocRepository
+```
+
+#### 1.3 Rimuovere campi statici in `MpDataService`
+
+| Campo | Righe | Fix |
+|-------|-------|-----|
+| `public static MpMongoController mongoController` | 94 | Rimuovere campo statico → iniettare via contructor o renderlo readonly |
+| `public static MpIocController IocDbController` | 95 | **Bloccante** — usato da ~45+ metodi. Richiede Fase 3 completa |
+
+### Fase 2: Abilitare FusionCache per MP.IOC
+
+Attualmente MP.IOC ha FusionCache disabilitato (L1 solo, Redis non connesso).
+
+#### 2.1 Configurazione Redis + FusionCache in Program.cs
+
+```csharp
+// Attuale (solo L1 Memory)
+builder.Services.AddFusionCache()
+ .WithDefaultEntryOptions(options => { options.Duration = TimeSpan.FromMinutes(1); });
+
+// Nuovo (L1 Memory + L2 Redis + L3 DB)
+var redisMux = ConnectionMultiplexer.Connect(confRedis);
+builder.Services.AddSingleton(redisMux);
+
+builder.Services.AddFusionCache()
+ .WithDistributedCache(sp => sp.GetRequiredService())
+ .WithSerializer(new FusionCacheNewtonsoftJsonSerializer())
+ .WithBackplane(new RedisBackplane(new RedisBackplaneOptions {
+ ConnectionMultiplexerFactory = () => Task.FromResult(redisMux)
+ }));
+```
+
+#### 2.2 Migrazione metodi MpDataService a GetOrFetchAsync
+
+**Metodi da migrare (identificazione preliminare):**
+
+| Categoria | Metodi | Stima righe |
+|-----------|---------|-------------|
+| Anagrafica | `AnagStatiGetAllAsync`, `ArticoliGetLastByMaccAsync`, `ConfigGetAllAsync`, `DecNumArtGetFiltAsync` | ~120 |
+| Produzione | `OdlCurrByMaccAsync`, `OdlLastByMaccAsync`, `POdlGetByMaccArtAsync`, `PezziProdMacchinaAsync`, `StatoProdMacchinaAsync` | ~200 |
+| FluxLog | `ConfFluxFiltAsync`, `FluxLogFirstByMaccAsync`, `FluxLogGetLastFiltAsync`, `FluxLogTakeSnapshotLastAsync` | ~100 |
+| Dossier | `DossGetLastByMaccAsync` | ~50 |
+| Machine | `DatiMacchineGetAllAsync`, `MseGetAllAsync`, `Macchine2SlaveAsync`, `MacchineGetByIdxAsync` | ~150 |
+| MicroStato | `EvListMicroStatoInsertAsync`, `MicroStatoMacchinaUpsertAsync`, `MicroStatoMacchinaGetByIdxMaccAsync` | ~80 |
+| VMSFD | `VMSFDGetByMaccAsync`, `VMSFDGetMultiByMaccAsync`, `StateMachIngressiAsync` | ~80 |
+| Misc | `Alarms`, `RegScarti`, `RegControlli`, `RemRebootLog`, `SignalLog`, `KeepAlive` | ~150 |
+
+**Totale stimato:** ~930 righe di codice caching da migrare a pattern `GetOrFetchAsync`.
+
+### Fase 3: Decomposizione MpIocController in Repository (Core)
+
+`MpIocController` (1480 righe, 82 metodi) va scomposto in repository specialistici, come fatto per MP.SPEC:
+
+#### 3.1 Mappatura attuali → Nuovi Repository
+
+| Attuale (82 metodi) | Nuovo Repository | Ambito |
+|----------------------|-------------------|--------|
+| `AnagStatiGetAllAsync`, `ArticoliGetLastByMaccAsync`, `ConfigGetAllAsync`, `ConfigUpdateAsync`, `DecNumArtGetFiltAsync`, `ListValuesFiltAsync`, `ListLinkFiltAsync`, `EvListInsert` | `IAnagRepository` | **Usato da SPEC** — già migrato! |
+| `AutoStartOdlAsync`, `ConfirmaProdMacchinaAsync/Full`, `OdlCurrByMaccAsync`, `OdlLastByMaccAsync`, `OdlListByMaccPeriodoAsync`, `PezziProdMacchinaAsync`, `StatoProdMacchinaAsync` | `IProduzioneRepository` (nuovo) | Produzione IOB-specifica |
+| `OdlAutoDayGenAsync/Full`, `POdlGetByMaccArtAsync`, `OdlFixMachineSlave` | `IProduzioneRepository` (nuovo) | Pianificazione produzione |
+| `FluxLogInsertAsync`, `FluxLogGetLastFiltAsync`, `FluxLogFirstByMaccAsync`, `FluxLogTakeSnapshotLastAsync`, `ConfFluxFiltAsync` | `IFluxLogRepository` | **Usato da SPEC** — già migrato! |
+| `DossGetLastByMaccAsync`, `SignalLogInsertAsync` | `IDossierRepository` | **Usato da SPEC** — già migrato! |
+| `DatiMacchineGetAllAsync`, `MacchineGetByIdxAsync`, `MacchineUpsertAsync`, `MacchineGetFiltAsync`, `MacchineGetAllAsync`, `Macchine2Slave` | `IMacchineRepository` (nuovo) | Gestione macchine |
+| `EvListMicroStatoInsertAsync`, `MicroStatoMacchinaUpsertAsync`, `MicroStatoMacchinaGetByIdxMaccAsync`, `MicroStatoMacchinaGetByIdxMaccAsync` | `IMicroStatoRepository` (nuovo) | Micro-stati macchine |
+| `MSE_getUserForcedAsync`, `SMES_getHwTransitionsAsync`, `DDB_InsStatoBatchAsync`, `CheckCambiaStatoBatchAsync`, `RecalcMseAsync` | `IMseRepository` (nuovo) | Mappa stati macchin |
+| `StateMachineIngressiAsync`, `VMSFDGetByMaccAsync`, `VMSFDGetMultiByMaccAsync`, `VMSFDGetAllAsync` | `IStateMachineRepository` (nuovo) | State machine |
+| `KeepAliveUpsertAsync` | `IMacchineRepository` (nuovo) | Keep-alive |
+| `AlarmLogInsertAsync`, `RegScartiInsertAsync`, `RegControlliInsertAsync`, `RegDichiarInsertAsync` | `IRegistroRepository` (nuovo) | Registri qualità |
+| `RemRebootLog*` methods (6) | `IRemRebootRepository` (nuovo) | Reboot remote logging |
+
+#### 3.2 Interfacce Nuove (da creare in MP.Data/Repository/)
+
+```
+MP.Data/Repository/Iob/
+├── IProduzioneRepository.cs
+├── ProduzioneRepository.cs
+├── IMacchineRepository.cs
+├── MacchineRepository.cs
+├── IMicroStatoRepository.cs
+├── MicroStatoRepository.cs
+├── IMseRepository.cs
+├── MseRepository.cs
+├── IStateMachineRepository.cs
+├── StateMachineRepository.cs
+├── IRegistroRepository.cs
+├── RegistroRepository.cs
+└── IRemRebootRepository.cs
+ └── RemRebootRepository.cs
+```
+
+#### 3.3 Migrazione Dipendenze
+
+Dopo aver creato i repository, ogni metodo in `MpDataService.cs` che chiama `IocDbController.XXX()` va aggiornato per chiamare il repository invece.
+
+**Esempio:**
+```csharp
+// PRIMA
+var result = await IocDbController.AnagStatiGetAllAsync();
+
+// DOPO
+var result = await _anagRepository.AnagStatiGetAllAsync();
+```
+
+#### 3.4 Rimozione MpIocController
+
+Dopo la migrazione completa:
+1. Rimuovere `MpIocController` da `DataServiceCollectionExtensions.cs`
+2. Rimuovere il parametro dal costruttore di `MpDataService`
+3. Spostare i metodi ancora non migrati a `#if false` come fallback documentato
+
+### Fase 4: Scomposizione MpDataService
+
+`MpDataService.cs` (3475 righe) è troppo grande per essere un unico servizio. Proposta di scomposizione:
+
+| Servizio | Responsabilità | Metodi |
+|----------|---------------|--------|
+| `MpDataService` (core) | Gateway, orchestrazione | ~50 |
+| `IodlManagementService` | ODL lifecycle (apri, chiudi, split, conferma) | ~15 |
+| `FluxLogProcessingService` | Processing flux log, snapshot, pareto | ~10 |
+| `MachineCommunicationService` | Keep-alive, dati macchin, micro-stati, state machine | ~20 |
+| `ProductionTrackingService` | Conferma produzione, pezzi prodotti, stato produzione | ~8 |
+| `RedisCacheService` | Wrapper methods per Redis operations (Hash, String, Set) | ~15 |
+
+**Nota:** La scomposizione va fatta **dopo** la migrazione a repository (Fase 3) per non dover modificare ogni singola chiamata.
+
+### Fase 5: Build & Verifica
+
+Dopo ogni fase completa:
+1. `dotnet build MP-IOC.sln`
+2. `dotnet build MP-SPEC.sln` (non deve rompersi)
+3. `dotnet build MP-LAND.sln`
+4. `dotnet build MP-MON.sln`
+5. Verificare che MP.IOC parta correttamente
+
+## Riepilogo Costi Stimati
+
+| Fase | File Modificati | Righe Modificate | Rischio | Stato |
+|------|-----------------|-------------------|---------|-------|
+| ~~F1: Anti-Pattern 4 controller~~ | ~~4~~ | ~~20~~ | ~~Basso~~ | ✅ **Completato** |
+| F2: FusionCache config + metodi | 2 + 1 | ~1200 | Medio | ⏳ Da fare |
+| F3: Repository IoC | 7+ nuovi + 5 esistenti | ~2000 | Alto | ⏳ Da fare |
+| F4: Scomposizione MpDataService | 5 nuovi + 1 esistente | ~3475 | Alto | ⏳ Da fare |
+| F5: Build & Verifica | — | — | Basso | ✅ OK (0 errori, 12 warnings) |
+
+## Stato Completato
+
+### ✅ Fase 1: Anti-Pattern Controller — COMPLETATA
+
+Rimosso `static IConfiguration _configuration` da tutti i 4 controller e rimossa la dead assignment dai costruttori:
+
+| Controller | Prima | Dopo |
+|------------|-------|------|
+| `IOBController` | `IConfiguration + static field` | Nessun param (dead code), field rimosso |
+| `BenchController` | `IConfiguration + static field` | Solo `MpDataService`, field rimosso |
+| `RecipeController` | `IConfiguration + static field` | Solo `MpDataService`, field rimosso |
+| `RecipeArchiveController` | `IConfiguration + static field` | Solo `MpDataService`, field rimosso |
+
+**Build risultato:** ✅ 0 errori, 12 warnings (solo nullable reference, nessun warning statico residuo nei controller)
+
+### 📋 Fase 2+: In Attesa
+
+Prossimo step: abilitare FusionCache con Redis backplane (Fase 2) — richiede approvazione architetturale.
+
+## Priorità Operativa
+
+1. **F1 immediata** — zero rischio, fix 4 controller statici
+2. **F2 parallela** — abilitare FusionCache con Redis backplane (config) + migrare i metodi più usati
+3. **F3 dopo F2** — decomporre MpIocController una volta che il caching è standardizzato
+4. **F4 opzionale** — scomporare MpDataService quando il resto è stabile
+
+## Note
+
+- MpIocController usa già `IDbContextFactory` correttamente — il problema è che è un Singleton e lo si chiama da un altro Singleton (MpDataService)
+- IIocRepository (già esistente) ha solo 16 metodi ed è mai usato da MpDataService
+- I repository SPEC (Anag, Dossier, FluxLog, Production) sono già usati da alcuni metodi — sfruttare questi dove possibile
+- La struttura MP.Data/Controllers/ è ingannevole: MpIocController è un servizio, non un controller Web API
diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj
index 5586d246..d60e617a 100644
--- a/MP.Land/MP.Land.csproj
+++ b/MP.Land/MP.Land.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Land
- 8.16.2606.0410
+ 8.16.2606.0414
Debug;Release;Debug_LiManDebug
en
True
diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html
index cda668d8..b49d1e44 100644
--- a/MP.Land/Resources/ChangeLog.html
+++ b/MP.Land/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo Tablet MAPO - DotNet6
-
Versione: 8.16.2606.0410
+ Versione: 8.16.2606.0414
Note di rilascio:
diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt
index 23dadf9f..4ee401ca 100644
--- a/MP.Land/Resources/VersNum.txt
+++ b/MP.Land/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0410
+8.16.2606.0414
diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml
index 8154ab61..6a6066a6 100644
--- a/MP.Land/Resources/manifest.xml
+++ b/MP.Land/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0410
+ 8.16.2606.0414
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html
false
diff --git a/MP.MON/MP.MON.csproj b/MP.MON/MP.MON.csproj
index f88136f5..c3110508 100644
--- a/MP.MON/MP.MON.csproj
+++ b/MP.MON/MP.MON.csproj
@@ -6,7 +6,7 @@
enable
MP.MON
$(AssemblyName.Replace(' ', '_'))
- 8.16.2606.410
+ 8.16.2606.414
diff --git a/MP.MON/Resources/ChangeLog.html b/MP.MON/Resources/ChangeLog.html
index be2d3178..988f5d0e 100644
--- a/MP.MON/Resources/ChangeLog.html
+++ b/MP.MON/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2606.410
+ Versione: 8.16.2606.414
Note di rilascio:
-
diff --git a/MP.MON/Resources/VersNum.txt b/MP.MON/Resources/VersNum.txt
index a6ed034a..b698ae9b 100644
--- a/MP.MON/Resources/VersNum.txt
+++ b/MP.MON/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.410
+8.16.2606.414
diff --git a/MP.MON/Resources/manifest.xml b/MP.MON/Resources/manifest.xml
index b37d2054..0b5c0db9 100644
--- a/MP.MON/Resources/manifest.xml
+++ b/MP.MON/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.410
+ 8.16.2606.414
https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip
https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html
false
diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj
index a73c5a17..f85259e9 100644
--- a/MP.Prog/MP.Prog.csproj
+++ b/MP.Prog/MP.Prog.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Prog
- 8.16.2606.0410
+ 8.16.2606.0414
True
diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html
index e811de74..24881e4b 100644
--- a/MP.Prog/Resources/ChangeLog.html
+++ b/MP.Prog/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo gestione Programmi MAPO
-
Versione: 8.16.2606.0410
+ Versione: 8.16.2606.0414
Note di rilascio:
diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt
index 23dadf9f..4ee401ca 100644
--- a/MP.Prog/Resources/VersNum.txt
+++ b/MP.Prog/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0410
+8.16.2606.0414
diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml
index 786e113c..b2c2df90 100644
--- a/MP.Prog/Resources/manifest.xml
+++ b/MP.Prog/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0410
+ 8.16.2606.0414
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html
false
diff --git a/MP.RIOC/MP.RIOC.csproj b/MP.RIOC/MP.RIOC.csproj
index 297ff36c..c49c4d6f 100644
--- a/MP.RIOC/MP.RIOC.csproj
+++ b/MP.RIOC/MP.RIOC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.RIOC
- 8.16.2606.410
+ 8.16.2606.414
diff --git a/MP.RIOC/Resources/ChangeLog.html b/MP.RIOC/Resources/ChangeLog.html
index ff78f2b0..e784e442 100644
--- a/MP.RIOC/Resources/ChangeLog.html
+++ b/MP.RIOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-RIOC
-
Versione: 8.16.2606.410
+ Versione: 8.16.2606.414
Note di rilascio:
-
diff --git a/MP.RIOC/Resources/VersNum.txt b/MP.RIOC/Resources/VersNum.txt
index a6ed034a..b698ae9b 100644
--- a/MP.RIOC/Resources/VersNum.txt
+++ b/MP.RIOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.410
+8.16.2606.414
diff --git a/MP.RIOC/Resources/manifest.xml b/MP.RIOC/Resources/manifest.xml
index f392f307..02efe83d 100644
--- a/MP.RIOC/Resources/manifest.xml
+++ b/MP.RIOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.410
+ 8.16.2606.414
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/MP.RIOC.zip
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj
index 23f64e38..a43a160b 100644
--- a/MP.SPEC/MP.SPEC.csproj
+++ b/MP.SPEC/MP.SPEC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.SPEC
- 8.16.2606.410
+ 8.16.2606.414
1800a78a-6ff1-40f9-b490-87fb8bfc1394
en
diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html
index be2d3178..988f5d0e 100644
--- a/MP.SPEC/Resources/ChangeLog.html
+++ b/MP.SPEC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
-
Versione: 8.16.2606.410
+ Versione: 8.16.2606.414
Note di rilascio:
-
diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt
index a6ed034a..b698ae9b 100644
--- a/MP.SPEC/Resources/VersNum.txt
+++ b/MP.SPEC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.410
+8.16.2606.414
diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml
index 4750dbeb..1cb2501a 100644
--- a/MP.SPEC/Resources/manifest.xml
+++ b/MP.SPEC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.410
+ 8.16.2606.414
https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip
https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html
false
diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj
index 7b8c731f..e05260da 100644
--- a/MP.Stats/MP.Stats.csproj
+++ b/MP.Stats/MP.Stats.csproj
@@ -4,7 +4,7 @@
net8.0
MP.Stats
826e877c-ba70-4253-84cb-d0b1cafd4440
- 8.16.2606.0410
+ 8.16.2606.0414
true
en
diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html
index 87a63cf4..e0d262f2 100644
--- a/MP.Stats/Resources/ChangeLog.html
+++ b/MP.Stats/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo statistiche MAPO
-
Versione: 8.16.2606.0410
+ Versione: 8.16.2606.0414
Note di rilascio:
diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt
index 23dadf9f..4ee401ca 100644
--- a/MP.Stats/Resources/VersNum.txt
+++ b/MP.Stats/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0410
+8.16.2606.0414
diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml
index 1ccef307..077827a2 100644
--- a/MP.Stats/Resources/manifest.xml
+++ b/MP.Stats/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0410
+ 8.16.2606.0414
https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip
https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html
false