diff --git a/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs b/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs index 9509be20..1377910d 100644 --- a/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs +++ b/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs @@ -50,10 +50,10 @@ namespace EgwCoreLib.Lux.Data // inizializzazione dei valori di default x gruppi item modelBuilder.Entity().HasData( - new ItemGroupModel { CodGroup = "BARRA", Description = "Barre legno per lavorazione" }, - new ItemGroupModel { CodGroup = "VETRO", Description = "Vetri serramento" }, - new ItemGroupModel { CodGroup = "VERNICE", Description = "Vernici per legno" }, - new ItemGroupModel { CodGroup = "FERRAMENTA", Description = "Ferramenta serramento" } + new ItemGroupModel { CodGroup = "WindowTrunk", Description = "Barre legno per lavorazione" }, + new ItemGroupModel { CodGroup = "WindowGlass", Description = "Vetri serramento" }, + new ItemGroupModel { CodGroup = "WindowVarnish", Description = "Vernici per legno" }, + new ItemGroupModel { CodGroup = "WindowHardware", Description = "Ferramenta serramento" } ); // inizializzazione tipo mov mag @@ -69,24 +69,24 @@ namespace EgwCoreLib.Lux.Data // inizializzazione dei valori di default x Item di magazzino modelBuilder.Entity().HasData( // barre grezzo - new ItemModel { ItemID = 1, CodGroup = "BARRA", IsService = false, ItemCode = 1001, Description = "BARRA-60x80 generica", SupplCode = "BARR.001", Cost = 20, Margin = 0.3, UM = "#" }, - new ItemModel { ItemID = 2, CodGroup = "BARRA", IsService = false, ItemCode = 1002, ExtItemCode = "BARRA-60x80x12000", SupplCode = "ABC.00123.12000", Description = "Barra 60x80, lunghezza 12m", Cost = 16.5, Margin = 0.21, UM = "#" }, - new ItemModel { ItemID = 3, CodGroup = "BARRA", IsService = false, ItemCode = 1003, ExtItemCode = "BARRA-60x80x8000", SupplCode = "ABC.00123.8000", Description = "Barra 60x80, lunghezza 8m", Cost = 17.5, Margin = 0.22, UM = "#" }, - new ItemModel { ItemID = 4, CodGroup = "BARRA", IsService = false, ItemCode = 1004, ExtItemCode = "BARRA-60x80x16000", SupplCode = "ABC.00123.16000", Description = "Barra 60x80, lunghezza 16m", Cost = 15.5, Margin = 0.2, UM = "#" }, + new ItemModel { ItemID = 1, CodGroup = "WindowTrunk", IsService = false, ItemCode = 1001, Description = "BARRA-60x80 generica", SupplCode = "BARR.001", Cost = 20, Margin = 0.3, UM = "#" }, + new ItemModel { ItemID = 2, CodGroup = "WindowTrunk", IsService = false, ItemCode = 1002, ExtItemCode = "BARRA-60x80x12000", SupplCode = "ABC.00123.12000", Description = "Barra 60x80, lunghezza 12m", Cost = 16.5, Margin = 0.21, UM = "#" }, + new ItemModel { ItemID = 3, CodGroup = "WindowTrunk", IsService = false, ItemCode = 1003, ExtItemCode = "BARRA-60x80x8000", SupplCode = "ABC.00123.8000", Description = "Barra 60x80, lunghezza 8m", Cost = 17.5, Margin = 0.22, UM = "#" }, + new ItemModel { ItemID = 4, CodGroup = "WindowTrunk", IsService = false, ItemCode = 1004, ExtItemCode = "BARRA-60x80x16000", SupplCode = "ABC.00123.16000", Description = "Barra 60x80, lunghezza 16m", Cost = 15.5, Margin = 0.2, UM = "#" }, // vetri - new ItemModel { ItemID = 5, CodGroup = "VETRO", IsService = false, ItemCode = 2001, ExtItemCode = "VETRO-3L-THERMO-800x1000", SupplCode = "V3T.800.1000", Description = "Vetro triplo, basso indice termico, 800x1000", Cost = 300, Margin = 0.20, UM = "m2" }, - new ItemModel { ItemID = 6, CodGroup = "VETRO", IsService = false, ItemCode = 2002, ExtItemCode = "VETRO-2L-800x1000", SupplCode = "V2.800.1000", Description = "Vetro doppio, 800x1000", Cost = 200, Margin = 0.15, UM = "m2" }, - new ItemModel { ItemID = 7, CodGroup = "VETRO", IsService = false, ItemCode = 2003, ExtItemCode = "VETRO-3L-800x1000", SupplCode = "V3.800.1000", Description = "Vetro triplo, 800x1000", Cost = 250, Margin = 0.18, UM = "m2" }, + new ItemModel { ItemID = 5, CodGroup = "WindowGlass", IsService = false, ItemCode = 2001, ExtItemCode = "VETRO-3L-THERMO-800x1000", SupplCode = "V3T.800.1000", Description = "Vetro triplo, basso indice termico, 800x1000", Cost = 300, Margin = 0.20, UM = "m2" }, + new ItemModel { ItemID = 6, CodGroup = "WindowGlass", IsService = false, ItemCode = 2002, ExtItemCode = "VETRO-2L-800x1000", SupplCode = "V2.800.1000", Description = "Vetro doppio, 800x1000", Cost = 200, Margin = 0.15, UM = "m2" }, + new ItemModel { ItemID = 7, CodGroup = "WindowGlass", IsService = false, ItemCode = 2003, ExtItemCode = "VETRO-3L-800x1000", SupplCode = "V3.800.1000", Description = "Vetro triplo, 800x1000", Cost = 250, Margin = 0.18, UM = "m2" }, // vernici - new ItemModel { ItemID = 8, CodGroup = "VERNICE", IsService = false, ItemCode = 3001, ExtItemCode = "VERN-TRASP", SupplCode = "VT.STD", Description = "Vernice trasparente", Cost = 20, Margin = 0.20, UM = "l" }, + new ItemModel { ItemID = 8, CodGroup = "WindowVarnish", IsService = false, ItemCode = 3001, ExtItemCode = "VERN-TRASP", SupplCode = "VT.STD", Description = "Vernice trasparente", Cost = 20, Margin = 0.20, UM = "l" }, // ferramenta - new ItemModel { ItemID = 9, CodGroup = "FERRAMENTA", IsService = false, ItemCode = 5001, ExtItemCode = "KIT-001", SupplCode = "AGB-KIT-001", Description = "Kit standard completo AGB tipo 001", Cost = 65, Margin = 0.20, UM = "#" }, - new ItemModel { ItemID = 10, CodGroup = "FERRAMENTA", IsService = false, ItemCode = 5002, ExtItemCode = "CERN-001", SupplCode = "AGB-CERN-001", Description = "Cerniera AGB tipo 001", Cost = 10, Margin = 0.20, UM = "#" }, - new ItemModel { ItemID = 11, CodGroup = "FERRAMENTA", IsService = false, ItemCode = 5003, ExtItemCode = "SERR-001", SupplCode = "AGB-SERR-001", Description = "Serratura AGB tipo 001", Cost = 15, Margin = 0.20, UM = "#" }, - new ItemModel { ItemID = 12, CodGroup = "FERRAMENTA", IsService = false, ItemCode = 5004, ExtItemCode = "MAN-001", SupplCode = "AGB-MAN-001", Description = "Maniglia AGB tipo 001", Cost = 25, Margin = 0.20, UM = "#" } + new ItemModel { ItemID = 9, CodGroup = "WindowHardware", IsService = false, ItemCode = 5001, ExtItemCode = "KIT-001", SupplCode = "AGB-KIT-001", Description = "Kit standard completo AGB tipo 001", Cost = 65, Margin = 0.20, UM = "#" }, + new ItemModel { ItemID = 10, CodGroup = "WindowHardware", IsService = false, ItemCode = 5002, ExtItemCode = "CERN-001", SupplCode = "AGB-CERN-001", Description = "Cerniera AGB tipo 001", Cost = 10, Margin = 0.20, UM = "#" }, + new ItemModel { ItemID = 11, CodGroup = "WindowHardware", IsService = false, ItemCode = 5003, ExtItemCode = "SERR-001", SupplCode = "AGB-SERR-001", Description = "Serratura AGB tipo 001", Cost = 15, Margin = 0.20, UM = "#" }, + new ItemModel { ItemID = 12, CodGroup = "WindowHardware", IsService = false, ItemCode = 5004, ExtItemCode = "MAN-001", SupplCode = "AGB-MAN-001", Description = "Maniglia AGB tipo 001", Cost = 25, Margin = 0.20, UM = "#" } ); // inizializzazione dei valori di default x Item di giacenza @@ -203,9 +203,9 @@ namespace EgwCoreLib.Lux.Data // inizializzazione dei valori di default x OfferRow modelBuilder.Entity().HasData( - new OfferRowModel { OfferRowID = 1, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 950, SellingItemID = 1, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Finestra anta singola 2025", ItemSPP = "{}" }, - new OfferRowModel { OfferRowID = 2, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 160, SellingItemID = 2, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Persiana per Finestra anta singola 2025", ItemSPP = "{}" }, - new OfferRowModel { OfferRowID = 3, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 200, SellingItemID = 3, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Installazione serramento", ItemSPP = "{}" } + new OfferRowModel { OfferRowID = 1, OfferID = 1, OfferRowUID= "OFF0000000001", Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 950, SellingItemID = 1, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Finestra anta singola 2025", ItemSPP = "{}" }, + new OfferRowModel { OfferRowID = 2, OfferID = 1, OfferRowUID = "OFF0000000002", Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 160, SellingItemID = 2, Qty = 3, RowNum = 2, SerStruct = "{}", Note = "Persiana per Finestra anta singola 2025", ItemSPP = "{}" }, + new OfferRowModel { OfferRowID = 3, OfferID = 1, OfferRowUID = "OFF0000000003", Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 200, SellingItemID = 3, Qty = 3, RowNum = 3, SerStruct = "{}", Note = "Installazione serramento", ItemSPP = "{}" } ); } diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index fd8d723a..e8985aef 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -1,5 +1,7 @@ -using EgwCoreLib.Lux.Data.Controllers; +using EgwCoreLib.Lux.Core.RestPayload; +using EgwCoreLib.Lux.Data.Controllers; using EgwCoreLib.Lux.Data.DbModel; +using EgwMultiEngineManager.Data; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using NLog; @@ -340,6 +342,34 @@ namespace EgwCoreLib.Lux.Data.Services return answ; } + /// + /// Esegue salvataggio BOM sul DB + /// + /// + /// + /// + /// + public async Task SaveBomAsync(string uID, Constants.EXECENVIRONMENTS execEnvironment, string bomContent) + { + // salvo sul DB il risultato della BOM + if (!string.IsNullOrEmpty(bomContent)) + { + try + { + // deserializzo la Bom... + var bomList = JsonConvert.DeserializeObject>(bomContent); + if (bomList != null) + { + // verifico 1:1 gli item sul DB x eventuale insert + dbController.ItemUpsertFromBom(bomList); + // salvo la BOM nel record del DB + } + } + catch { } + } + await Task.Delay(1); + } + #endregion Protected Methods #region Private Fields diff --git a/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs b/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs index 4421123e..27a966d5 100644 --- a/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs +++ b/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Configuration; +using EgwCoreLib.Lux.Core.RestPayload; +using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using NLog; using RestSharp; @@ -97,7 +98,7 @@ namespace EgwCoreLib.Lux.Data.Services response = await client.ExecutePostAsync(request); } return response; - } + } /// /// Calcola URL immagine dato @@ -163,15 +164,15 @@ namespace EgwCoreLib.Lux.Data.Services /// /// Salva e invia su channel img redis SVG per il doc richiesto /// - /// + /// /// - public async Task SaveBomAsync(string imgId, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS env, string bomContent) + public async Task SaveBomAsync(string uid, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS env, string bomContent) { // salvo img in cache - string currKey = $"{redisBaseKey}:{env}:BOM:{imgId.Replace("/", ":")}"; + string currKey = $"{redisBaseKey}:{env}:BOM:{uid.Replace("/", ":")}"; var done = await _redisService.SetAsync(currKey, bomContent); // invio notifica nuova svg generata sul canale... viene inviato solo svg con ID nel canale - string notifyChannel = $"{bomChannel}:{imgId}"; + string notifyChannel = $"{bomChannel}:{uid}"; long numSent = await _redisService.PublishAsync(notifyChannel, bomContent); return done; } diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index c7376ef2..9f4511b8 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2508.0618 + 0.9.2508.0717 diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs index 56ca5402..d7ef54a3 100644 --- a/Lux.API/Program.cs +++ b/Lux.API/Program.cs @@ -45,6 +45,7 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); // altri servizi! builder.Services.AddSingleton(); +builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddHostedService(); diff --git a/Lux.API/Services/ExternalMessageProcessor.cs b/Lux.API/Services/ExternalMessageProcessor.cs index f80928bb..42400f66 100644 --- a/Lux.API/Services/ExternalMessageProcessor.cs +++ b/Lux.API/Services/ExternalMessageProcessor.cs @@ -12,9 +12,15 @@ namespace Lux.API.Services { #region Public Constructors - public ExternalMessageProcessor(ImageCacheService imgService) + /// + /// Init classe message processor con accesso REDIS e DB + /// + /// + /// + public ExternalMessageProcessor(ImageCacheService imgService, DataLayerServices dlService) { - _cacheService = imgService; + cacheService = imgService; + dbService = dlService; } #endregion Public Constructors @@ -43,14 +49,15 @@ namespace Lux.API.Services // salvo SVG string newSvg = retData.Args["Svg"]; string UID = retData.Args["UID"]; - await _cacheService.SaveSvgAsync(UID, retData.ExecEnvironment, newSvg); + await cacheService.SaveSvgAsync(UID, retData.ExecEnvironment, newSvg); } if(retData.Args.ContainsKey("BOM")) { // salvo BOM ricevuta string newBom = retData.Args["BOM"]; string UID = retData.Args["UID"]; - await _cacheService.SaveBomAsync(UID, retData.ExecEnvironment, newBom); + await cacheService.SaveBomAsync(UID, retData.ExecEnvironment, newBom); + await dbService.SaveBomAsync(UID, retData.ExecEnvironment, newBom); } } } @@ -74,7 +81,8 @@ namespace Lux.API.Services #region Private Fields - private readonly ImageCacheService _cacheService; + private readonly ImageCacheService cacheService; + private readonly DataLayerServices dbService; private static Logger Log = LogManager.GetCurrentClassLogger(); #endregion Private Fields diff --git a/Lux.API/appsettings.json b/Lux.API/appsettings.json index f4e0bd62..35681f79 100644 --- a/Lux.API/appsettings.json +++ b/Lux.API/appsettings.json @@ -52,7 +52,6 @@ "ConnectionStrings": { //"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50;Trusted_Connection=True;MultipleActiveResultSets=true", "DefaultConnection": "Server=mdb.ufficio;port=3306;database=Lux_000;uid=lux_user;pwd=Egal_pwd!;sslmode=None;", - "Lux.All": "Server=SQL2016DEV;Database=MoonPro_STATS; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.Land;", "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true" }, diff --git a/Lux.UI/Components/Compo/OfferRowMan.razor b/Lux.UI/Components/Compo/OfferRowMan.razor index a6fb4c19..a68df578 100644 --- a/Lux.UI/Components/Compo/OfferRowMan.razor +++ b/Lux.UI/Components/Compo/OfferRowMan.razor @@ -1,6 +1,6 @@ @if (EditRecord != null) { -

@EditRecord.OfferRowCode

+

@EditRecord.OfferRowUID

} else { @@ -60,7 +60,7 @@ else } - @item.OfferRowCode + @item.OfferRowUID @item.Note @item.Qty @($"{item.Cost:C2}") diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index dc8d276d..c52c996a 100644 --- a/Lux.UI/Lux.UI.csproj +++ b/Lux.UI/Lux.UI.csproj @@ -5,7 +5,7 @@ enable enable aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50 - 0.9.2508.0712 + 0.9.2508.0717 diff --git a/Lux.UI/appsettings.json b/Lux.UI/appsettings.json index dc5a90d6..3bec57dc 100644 --- a/Lux.UI/appsettings.json +++ b/Lux.UI/appsettings.json @@ -53,7 +53,6 @@ "ConnectionStrings": { //"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50;Trusted_Connection=True;MultipleActiveResultSets=true", "DefaultConnection": "Server=mdb.ufficio;port=3306;database=Lux_000;uid=lux_user;pwd=Egal_pwd!;sslmode=None;", - "Lux.All": "Server=SQL2016DEV;Database=MoonPro_STATS; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.Land;", "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true" }, diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 737bce40..587bd45a 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 0.9.2508.0712

+

Versione: 0.9.2508.0717


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 59bea34f..7e9c453a 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -0.9.2508.0712 +0.9.2508.0717 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index ec01127c..f61a776f 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 0.9.2508.0712 + 0.9.2508.0717 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false