diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 93db28f1..2805f13d 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -3,7 +3,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using MP.Data.DatabaseModels; using NLog; -using StackExchange.Redis; using System; using System.Collections.Generic; using System.Data; @@ -330,80 +329,6 @@ namespace MP.Data.Controllers return answ; } - /// - /// Elenco giacenze - /// - /// id odl da cercare - /// - public List ListGiacenze(int IdxOdl) - { - List dbResult = new List(); - using (var dbCtx = new MoonPro_InveContext(_configuration)) - { - try - { - dbResult = dbCtx - .DbGiacenzeData - .AsNoTracking() - .Where(x => x.IdxOdl == IdxOdl) - .ToList(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante ListGiacenze{Environment.NewLine}{exc}"); - } - } - return dbResult; - } - - /// - /// Elenco TUTTI GLI ODL - /// - /// - public List ListOdlAll() - { - List dbResult = new List(); - using (var dbCtx = new MoonProContext(_configuration)) - { - try - { - dbResult = dbCtx - .DbSetODL - .AsNoTracking() - .ToList(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante ListOdlAll{Environment.NewLine}{exc}"); - } - } - return dbResult; - } - /// - /// ODL da chiave - /// - /// - public ODLExpModel OdlByKey(int IdxOdl) - { - ODLExpModel dbResult = new ODLExpModel(); - using (var dbCtx = new MoonProContext(_configuration)) - { - try - { - dbResult = dbCtx - .DbSetODLExp - .AsNoTracking() - .Where(x=> x.IdxOdl == IdxOdl) - .FirstOrDefault(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante OdlByKey{Environment.NewLine}{exc}"); - } - } - return dbResult; - } - /// /// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato /// macchina (ordinato x data registrazione) @@ -601,6 +526,32 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco giacenze + /// + /// id odl da cercare + /// + public List ListGiacenze(int IdxOdl) + { + List dbResult = new List(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + try + { + dbResult = dbCtx + .DbGiacenzeData + .AsNoTracking() + .Where(x => x.IdxOdl == IdxOdl) + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ListGiacenze{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + public List ListLinkFilt(string tipoLink) { List dbResult = new List(); @@ -616,6 +567,30 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco TUTTI GLI ODL + /// + /// + public List ListOdlAll() + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + dbResult = dbCtx + .DbSetODL + .AsNoTracking() + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ListOdlAll{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + /// /// Elenco ODL filtrati x stato, articolo, KeyRich (che contiene stato) /// @@ -632,7 +607,6 @@ namespace MP.Data.Controllers List dbResult = new List(); using (var dbCtx = new MoonProContext(_configuration)) { - var InCorso = new SqlParameter("@InCorso", inCorso); var CodArt = new SqlParameter("@CodArt", codArt); var KeyRich = new SqlParameter("@KeyRich", keyRichPart); @@ -661,7 +635,7 @@ namespace MP.Data.Controllers .Include(m => m.MachineNav) .Include(a => a.ArticoloNav) .OrderByDescending(x => x.IdxOdl) - .ToList(); + .ToList(); #endif } return dbResult; @@ -677,7 +651,6 @@ namespace MP.Data.Controllers /// public List ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate) { - List dbResult = new List(); using (var dbCtx = new MoonProContext(_configuration)) { @@ -698,32 +671,6 @@ namespace MP.Data.Controllers return dbResult; } -#if false - - /// - /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato) - /// - /// Cod articolo - /// KeyRich (parziale) da cercare (es cod stato x yacht) - /// - public List ListPODLFiltNOOdl(string codArt, string keyRichPart) - { - List dbResult = new List(); - using (var dbCtx = new MoonProContext(_configuration)) - { - dbResult = dbCtx - .DbSetPODL - .Where(x => (x.IdxOdl != 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt))) - .AsNoTracking() - .Include(m => m.MachineNav) - .Include(a => a.ArticoloNav) - .OrderByDescending(x => x.InsertDate) - .ToList(); - } - return dbResult; - } -#endif - /// /// Elenco valori ammessi x tabella/colonna /// @@ -805,6 +752,84 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco ODL dato batch selezionato + /// + /// Batch richiesto + /// + public List OdlByBatch(string batchSel) + { + List dbResult = new List(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + try + { + dbResult = dbCtx + .DbGiacenzeData + .AsNoTracking() + .Where(x => x.IdentRG == batchSel) + .Select(x => x.IdxOdl) + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OdlByBatch{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// ODL da chiave + /// + /// + public ODLExpModel OdlByKey(int IdxOdl) + { + ODLExpModel dbResult = new ODLExpModel(); + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + dbResult = dbCtx + .DbSetODLExp + .AsNoTracking() + .Where(x => x.IdxOdl == IdxOdl) + .FirstOrDefault(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OdlByKey{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + +#if false + + /// + /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato) + /// + /// Cod articolo + /// KeyRich (parziale) da cercare (es cod stato x yacht) + /// + public List ListPODLFiltNOOdl(string codArt, string keyRichPart) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetPODL + .Where(x => (x.IdxOdl != 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt))) + .AsNoTracking() + .Include(m => m.MachineNav) + .Include(a => a.ArticoloNav) + .OrderByDescending(x => x.InsertDate) + .ToList(); + } + return dbResult; + } +#endif + /// /// Chiusura ODL con eventuale conferma pezzi /// @@ -995,6 +1020,7 @@ namespace MP.Data.Controllers await Task.Delay(1); return dbResult; } + /// /// Recupero PODL da IdxOdl /// diff --git a/MP.SPEC/Components/ListGiacenze.razor b/MP.SPEC/Components/ListGiacenze.razor index b70f7390..11fed2e6 100644 --- a/MP.SPEC/Components/ListGiacenze.razor +++ b/MP.SPEC/Components/ListGiacenze.razor @@ -1,5 +1,5 @@  - +
diff --git a/MP.SPEC/Components/ListOdlLotto.razor b/MP.SPEC/Components/ListOdlLotto.razor new file mode 100644 index 00000000..b487dc46 --- /dev/null +++ b/MP.SPEC/Components/ListOdlLotto.razor @@ -0,0 +1,32 @@ + +
+
+ +
#
+ + + + + + + @if (elencoODL == null || elencoODL.Count == 0) + { + + } + else + { + @foreach (var item in elencoODL) + { + + + + } + } + +
ODL
+ + @item + +
+ + diff --git a/MP.SPEC/Components/ListOdlLotto.razor.cs b/MP.SPEC/Components/ListOdlLotto.razor.cs new file mode 100644 index 00000000..616e2bd3 --- /dev/null +++ b/MP.SPEC/Components/ListOdlLotto.razor.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.SPEC; +using MP.SPEC.Shared; +using MP.SPEC.Components; +using MP.SPEC.Data; + +namespace MP.SPEC.Components +{ + public partial class ListOdlLotto + { + + [Parameter] + public string BatchSel { get; set; } + + private List elencoODL { get; set; } = new List(); + + + [Inject] + private MpDataService MDService { get; set; } = null!; + protected override async Task OnParametersSetAsync() + { + if (!string.IsNullOrEmpty(BatchSel)) + { + elencoODL = await MDService.OdlByBatch(BatchSel); + } + else + { + elencoODL = new List(); + } + } + } +} \ No newline at end of file diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index e609cb16..d6c12f21 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -312,27 +312,6 @@ namespace MP.SPEC.Data return result; } - /// - /// Restituisce valore della stringa (SE disponibile) - /// - /// - /// - public async Task tryGetConfig(string keyName) - { - string answ = ""; - // preselezione valori - var configData = await ConfigGetAll(); - var currRec = configData.FirstOrDefault(x => x.Chiave == keyName); - if (currRec != null) - { - answ = currRec.Valore; - } - - return answ; - } - - - /// /// Reset dati cache config /// @@ -500,7 +479,7 @@ namespace MP.SPEC.Data public Task> ElencoGruppiFase() { #if false - return Task.FromResult(dbController.AnagGruppiFase()); + return Task.FromResult(dbController.AnagGruppiFase()); #endif List result = new List(); Stopwatch stopWatch = new Stopwatch(); @@ -560,7 +539,6 @@ namespace MP.SPEC.Data return answ; } - /// /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione) /// @@ -649,6 +627,79 @@ namespace MP.SPEC.Data return outVal; } + /// + /// + /// id odl da cercare + /// + public async Task> ListGiacenze(int IdxOdl) + { + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = $"{redisGiacenzaList}:{IdxOdl}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = await Task.FromResult(dbController.ListGiacenze(IdxOdl)); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ListGiacenze | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + + /// + /// elenco TUTTI gli ODL + /// + /// + /// + public List ListOdlAll() + { + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; +#if false + string currKey = $"{redisGiacenzaList}:{IdxOdl}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); + } + if (result == null) + { + result = new List(); + } +#endif + result = dbController.ListOdlAll(); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ListOdlAll | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + /// /// Elenco ODL filtrati x stato, articolo, KeyRich (che contiene stato) /// @@ -690,7 +741,6 @@ namespace MP.SPEC.Data Log.Debug($"ListODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms"); return result; - //return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, startDate, endDate)); } @@ -735,117 +785,6 @@ namespace MP.SPEC.Data return result; } - /// - /// - /// id odl da cercare - /// - public async Task> ListGiacenze(int IdxOdl) - { - List? result = new List(); - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string readType = "DB"; - string currKey = $"{redisGiacenzaList}:{IdxOdl}"; - // cerco in redis dato valore sel macchina... - RedisValue rawData = redisDb.StringGet(currKey); - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - readType = "REDIS"; - } - else - { - result = await Task.FromResult(dbController.ListGiacenze(IdxOdl)); - // serializzo e salvo... - rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); - } - if (result == null) - { - result = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ListGiacenze | Read from {readType}: {ts.TotalMilliseconds}ms"); - return result; - } - /// - /// elenco TUTTI gli ODL - /// - /// - /// - public List ListOdlAll() - { - List? result = new List(); - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string readType = "DB"; -#if false - string currKey = $"{redisGiacenzaList}:{IdxOdl}"; - // cerco in redis dato valore sel macchina... - RedisValue rawData = redisDb.StringGet(currKey); - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - readType = "REDIS"; - } - else - { - // serializzo e salvo... - rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); - } - if (result == null) - { - result = new List(); - } -#endif - result = dbController.ListOdlAll(); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ListOdlAll | Read from {readType}: {ts.TotalMilliseconds}ms"); - return result; - } - - - /// - /// ODL da chiave - /// - /// - /// - public ODLExpModel OdlByKey(int IdxOdl) - { - ODLExpModel? result = new ODLExpModel(); - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string readType = "DB"; -#if false - string currKey = $"{redisGiacenzaList}:{IdxOdl}"; - // cerco in redis dato valore sel macchina... - RedisValue rawData = redisDb.StringGet(currKey); - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - readType = "REDIS"; - } - else - { - // serializzo e salvo... - rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); - } - if (result == null) - { - result = new List(); - } -#endif - result = dbController.OdlByKey(IdxOdl); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"OdlByKey | Read from {readType}: {ts.TotalMilliseconds}ms"); - return result; - } - /// /// Elenco di tutte le macchine gestite /// @@ -918,6 +857,80 @@ namespace MP.SPEC.Data return result; } + /// + /// Elenco ODL dato batch selezionato + /// + /// Batch richiesto + /// + public async Task> OdlByBatch(string BatchSel) + { + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = redisOdlByBatch; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = await Task.FromResult(dbController.OdlByBatch(BatchSel)); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"OdlByBatch | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + + /// + /// ODL da chiave + /// + /// + /// + public ODLExpModel OdlByKey(int IdxOdl) + { + ODLExpModel? result = new ODLExpModel(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; +#if false + string currKey = $"{redisGiacenzaList}:{IdxOdl}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); + } + if (result == null) + { + result = new List(); + } +#endif + result = dbController.OdlByKey(IdxOdl); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"OdlByKey | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + /// /// Effettua chiusura dell'ODL indicato, andand /// @@ -1207,6 +1220,25 @@ namespace MP.SPEC.Data return answ; } + /// + /// Restituisce valore della stringa (SE disponibile) + /// + /// + /// + public async Task tryGetConfig(string keyName) + { + string answ = ""; + // preselezione valori + var configData = await ConfigGetAll(); + var currRec = configData.FirstOrDefault(x => x.Chiave == keyName); + if (currRec != null) + { + answ = currRec.Valore; + } + + return answ; + } + public async Task updateDossierValue(DossierModel currDoss, FluxLogDTO editFL) { bool answ = false; @@ -1322,27 +1354,22 @@ namespace MP.SPEC.Data private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt"; + private const string redisGiacenzaList = redisBaseAddr + ":GiacenzaList"; private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux"; private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList"; - - private const string redisXdlData = redisBaseAddr + "SPEC:Cache:XDL"; - + private const string redisOdlByBatch = redisXdlData + ":OdlByBatch"; private const string redisOdlCurrByMac = redisXdlData + ":OdlByMac"; private const string redisOdlList = redisXdlData + ":OdlList"; - private const string redisPOdlByOdl = redisXdlData + ":POdlByOdl"; private const string redisPOdlByPOdl = redisXdlData + ":POdlByPOdl"; private const string redisPOdlList = redisXdlData + ":POdlList"; - private const string redisGiacenzaList = redisBaseAddr + ":GiacenzaList"; private const string redisPOdlListNOOdl = redisXdlData + ":POdlListNOOdl"; private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom"; - private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt"; - private const string redisVocabolario = redisBaseAddr + "SPEC:Cache:Vocabolario"; - + private const string redisXdlData = redisBaseAddr + "SPEC:Cache:XDL"; private static IConfiguration _configuration = null!; private static ILogger _logger = null!; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index fc0f74e4..9eb3be2c 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2211.2917 + 6.16.2211.2918 diff --git a/MP.SPEC/Pages/Giacenze.razor b/MP.SPEC/Pages/Giacenze.razor index e9f70424..707f13b9 100644 --- a/MP.SPEC/Pages/Giacenze.razor +++ b/MP.SPEC/Pages/Giacenze.razor @@ -53,8 +53,8 @@ @if (!string.IsNullOrEmpty(BatchSel)) { -
- LIST ODL x @BatchSel +
+
}
diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index e9794914..1c81da15 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2211.2917

+

Versione: 6.16.2211.2918


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 02a93b28..c06ddf61 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2917 +6.16.2211.2918 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index c375d63e..d7cdf993 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2917 + 6.16.2211.2918 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