From ce6357271cd0ac31ed62729751d4d4b3bce54b4e Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Mon, 12 Dec 2022 10:25:33 +0100 Subject: [PATCH 01/12] aggiunti metodo e controller x db arca --- MP.Data/Controllers/MpInveController.cs | 37 ++++++++++++++++++++-- MP.Data/MoonPro_InveContext.cs | 1 + MP.INVE/Data/MiDataService.cs | 41 +++++++++++++++++++++++-- 3 files changed, 74 insertions(+), 5 deletions(-) diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index 919aeecf..de0f324c 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +using Microsoft.Data.SqlClient; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using MP.Data.DatabaseModels; using NLog; @@ -27,12 +28,44 @@ namespace MP.Data.Controllers { _configuration = null; } + + #region gestione lotti esterni + /// + /// Elenco lotti esterni presenti sul db di ARCA + /// + /// Codice articolo + /// Codice lotto + /// Codice magazzino + /// proprietà per definire scopo stored + /// + public List ListLottiEsterni(string codArt, string codLotto, string codMagazzino, bool onlyTest) + { + List dbResult = new List(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + var DataGiac = new SqlParameter("@DataGiac", null); + var CodArt = new SqlParameter("@CodArt", codArt); + var CodLotto = new SqlParameter("@CodLotto", codLotto); + var CodMagaz = new SqlParameter("@CodMagaz", codMagazzino); + var OnlyTest = new SqlParameter("@OnlyTest", onlyTest); + + dbResult = dbCtx + .DbLottoArca + .FromSqlRaw("exec dbo.stp_GIAC_getByDate @DataGiac,@CodArt,@CodLotto,@CodMagaz,@OnlyTest", DataGiac, CodArt, CodLotto, CodMagaz, OnlyTest) + .AsNoTracking() + //.AsEnumerable() + .ToList(); + } + return dbResult; + } + #endregion gestione lotti esterni + #region gestione articoli /// /// articolo MAG corrispondente all' articolo selezionato /// - /// + /// /// public AnagArticoli_MAG artBySearch(string artSearch) { diff --git a/MP.Data/MoonPro_InveContext.cs b/MP.Data/MoonPro_InveContext.cs index 323c5fa6..a6cec875 100644 --- a/MP.Data/MoonPro_InveContext.cs +++ b/MP.Data/MoonPro_InveContext.cs @@ -53,6 +53,7 @@ namespace MP.Data public virtual DbSet DbUdcData { get; set; } public virtual DbSet DbLottoData { get; set; } public virtual DbSet DbArtMag { get; set; } + public virtual DbSet DbLottoArca { get; set; } #endregion PER INVE #region PER SPEC diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 023cb27c..59b837be 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -297,6 +297,39 @@ namespace MP.INVE.Data return result; } + + public List ListLottiEsterni() + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + // cerco in redis... + RedisValue rawData = redisDb.StringGet(redisLottiEsterni); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + + source = "REDIS"; + } + else + { + result = dbController.ListLottiEsterni(); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSetAsync(redisLottiEsterni, rawData, getRandTOut(redisLongTimeCache)); + source = "DB"; + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ListLottiEsterni Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public List ScanList() { string source = ""; @@ -413,7 +446,7 @@ namespace MP.INVE.Data stopWatch.Start(); List? result = new List(); // cerco in redis... - RedisValue rawData = redisDb.StringGet(redisLottiBaseAddr); + RedisValue rawData = redisDb.StringGet(redisLottiInterni); if (!string.IsNullOrEmpty($"{rawData}")) { result = JsonConvert.DeserializeObject>($"{rawData}"); @@ -425,7 +458,7 @@ namespace MP.INVE.Data result = dbController.ElencoLotti(); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - redisDb.StringSetAsync(redisLottiBaseAddr, rawData, getRandTOut(redisLongTimeCache)); + redisDb.StringSetAsync(redisLottiInterni, rawData, getRandTOut(redisLongTimeCache)); source = "DB"; } if (result == null) @@ -599,8 +632,10 @@ namespace MP.INVE.Data private const string redisBaseAddr = "MP:INVE"; private const string redisSessionBaseAddr = ":Session"; private const string redisOperatoriBaseAddr = ":Operatore"; - private const string redisUdcBaseAddr = ":UDC"; private const string redisLottiBaseAddr = ":Lotti"; + private const string redisUdcBaseAddr = ":UDC"; + private const string redisLottiInterni = redisLottiBaseAddr + ":LottiInterni"; + private const string redisLottiEsterni = redisLottiBaseAddr + ":LottiEsterni"; private const string redisConfigBaseAddr = ":Config"; private const string redisScanBaseAddr = redisBaseAddr + ":Scan"; private const string redisElencoOperatori = redisBaseAddr + redisOperatoriBaseAddr + ":ListOperatori"; From d45deb6f00d6de2da5ebb241a56748d9b9859257 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Mon, 12 Dec 2022 12:06:38 +0100 Subject: [PATCH 02/12] fix tempo aggiornamento + cache x parametri opzionali --- MP.SPEC/Components/ParamsFilter.razor.cs | 8 ++++++++ MP.SPEC/Data/MpDataService.cs | 6 +++++- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/MP.SPEC/Components/ParamsFilter.razor.cs b/MP.SPEC/Components/ParamsFilter.razor.cs index a3bdab92..7978bb82 100644 --- a/MP.SPEC/Components/ParamsFilter.razor.cs +++ b/MP.SPEC/Components/ParamsFilter.razor.cs @@ -167,9 +167,17 @@ namespace MP.SPEC.Components { get => selMacchina != "*" || selFlux != "*"; } + protected int refreshRate = 2; protected override async Task OnInitializedAsync() { SelFilter = new SelectFluxParams(); + await MDService.ConfigResetCache(); + var result = await MDService.tryGetConfig("SPEC_ParamTempoAgg"); + if (result != null) + { + refreshRate = int.Parse(result); + } + selTempoAgg = refreshRate; setDtSnap(); DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddMonths(-1); DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Today.AddDays(1); diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 2018b81a..f8bf8e65 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -613,7 +613,11 @@ namespace MP.SPEC.Data result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, DtMin, IdxMacchina, CodFlux, MaxRec)); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2)); + var canCache = await tryGetConfig("SPEC_ParametriEnableReidsCache"); + if (canCache != "false") + { + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2)); + } } if (result == null) { diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 4d48a652..e35ea786 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2212.919 + 6.16.2212.1211 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 5986881d..58bba000 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2212.919

+

Versione: 6.16.2212.1211


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index c5c5539a..e2b22086 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.919 +6.16.2212.1211 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index c88019b5..295e69e5 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.919 + 6.16.2212.1211 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 From d5ea7cc51e6aff999c33aa17937b371cea3b4f04 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Mon, 12 Dec 2022 12:34:48 +0100 Subject: [PATCH 03/12] fix passaggio magId in URL --- MP.Data/Controllers/MpInveController.cs | 7 +- MP.Data/DatabaseModels/AnagLottiArca.cs | 6 +- MP.INVE/Components/InveSessionList.razor | 2 +- MP.INVE/Components/InveSessionList.razor.cs | 7 +- MP.INVE/Components/ProcSuggestion.razor.cs | 22 +-- MP.INVE/Data/MiDataService.cs | 4 +- MP.INVE/Data/SelectInveSessionParams.cs | 4 + MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Acquisizione.razor | 2 +- MP.INVE/Pages/Acquisizione.razor.cs | 4 +- MP.INVE/Pages/InveSession.razor | 147 +------------------- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 14 files changed, 43 insertions(+), 170 deletions(-) diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index de0f324c..c63e2840 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -36,18 +36,17 @@ namespace MP.Data.Controllers /// Codice articolo /// Codice lotto /// Codice magazzino - /// proprietà per definire scopo stored /// - public List ListLottiEsterni(string codArt, string codLotto, string codMagazzino, bool onlyTest) + public List ListLottiEsterni(string codArt, string codLotto, string codMagazzino) { List dbResult = new List(); using (var dbCtx = new MoonPro_InveContext(_configuration)) { - var DataGiac = new SqlParameter("@DataGiac", null); + var DataGiac = new SqlParameter("@DataGiac", DateTime.Now); var CodArt = new SqlParameter("@CodArt", codArt); var CodLotto = new SqlParameter("@CodLotto", codLotto); var CodMagaz = new SqlParameter("@CodMagaz", codMagazzino); - var OnlyTest = new SqlParameter("@OnlyTest", onlyTest); + var OnlyTest = new SqlParameter("@OnlyTest", false); dbResult = dbCtx .DbLottoArca diff --git a/MP.Data/DatabaseModels/AnagLottiArca.cs b/MP.Data/DatabaseModels/AnagLottiArca.cs index 42460fbc..ca93f08a 100644 --- a/MP.Data/DatabaseModels/AnagLottiArca.cs +++ b/MP.Data/DatabaseModels/AnagLottiArca.cs @@ -1,13 +1,17 @@ -using System; +using Microsoft.EntityFrameworkCore; +using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MP.Data.DatabaseModels { + [Keyless] public partial class AnagLottiArca { + public string Cd_MGEsercizio { get; set; } public string Cd_MG { get; set; } public string Cd_AR { get; set; } diff --git a/MP.INVE/Components/InveSessionList.razor b/MP.INVE/Components/InveSessionList.razor index b0c46970..c50b06f4 100644 --- a/MP.INVE/Components/InveSessionList.razor +++ b/MP.INVE/Components/InveSessionList.razor @@ -94,7 +94,7 @@ { - diff --git a/MP.INVE/Components/InveSessionList.razor.cs b/MP.INVE/Components/InveSessionList.razor.cs index d92c0c52..edf3bbdb 100644 --- a/MP.INVE/Components/InveSessionList.razor.cs +++ b/MP.INVE/Components/InveSessionList.razor.cs @@ -97,7 +97,7 @@ namespace MP.INVE.Components get { string answ = ""; - answ = $"{BaseUrlTab}IdSessione={currIdSess}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; + answ = $"{BaseUrlTab}IdSessione={currIdSess}&IdMag={currIdMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; return answ; } } @@ -111,9 +111,10 @@ namespace MP.INVE.Components } } - protected async Task getCurrSess(int idSess) + protected async Task getCurrSess(int idSess, int idMag) { currIdSess = idSess; + currIdMag = idMag; await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); } @@ -188,6 +189,8 @@ namespace MP.INVE.Components [Parameter] public int currIdSess { get; set; } + [Parameter] + public int currIdMag { get; set; } [Inject] private MiDataService MIDataservice { get; set; } = null!; diff --git a/MP.INVE/Components/ProcSuggestion.razor.cs b/MP.INVE/Components/ProcSuggestion.razor.cs index a204376c..fc2ff761 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -34,6 +34,8 @@ namespace MP.INVE.Components public string userScan { get; set; } = null!; [Parameter] public int sessID { get; set; } = 0; + [Parameter] + public int magID { get; set; } = 0; [Inject] public IJSRuntime JSRuntime { get; set; } = null!; [Inject] @@ -42,10 +44,12 @@ namespace MP.INVE.Components private string canMod = "false"; protected List? searchRecordsUDC; - protected List? searchRecordsLotto; + protected List? searchRecordsLottoInterni; + protected List? searchRecordsLottoEsterni; protected List? elencoScansioni; protected AnagUdcModel? udc; - protected AnagLottoModel? lotto; + protected AnagLottoModel? lottoInterno; + protected AnagLottiArca? lottoEsterno; protected ScanDataModel? alreadyScan; protected AnagUdcModel? currUdc; @@ -109,18 +113,20 @@ namespace MP.INVE.Components } else { - searchRecordsLotto = MIService.ElencoLotti(); - lotto = searchRecordsLotto.Where(x => x.Lotto == lastScan).FirstOrDefault(); - if (lotto != null) + searchRecordsLottoInterni = MIService.ElencoLotti(); + lottoInterno = searchRecordsLottoInterni.Where(x => x.Lotto == lastScan).FirstOrDefault(); + if (lottoInterno != null) { tipo = "LOTTO"; - currLotto = lotto; - lottoScan = lotto.Lotto; - articoloScan = lotto.CodArt; + currLotto = lottoInterno; + lottoScan = lottoInterno.Lotto; + articoloScan = lottoInterno.CodArt; quantitaScan = 0; } else { + searchRecordsLottoEsterni = MIService.ListLottiEsterni(articoloScan, lastScan, magID.ToString()); + lottoEsterno = searchRecordsLottoEsterni.FirstOrDefault(); currLotto = null; currUdc = null; alreadyScan = null; diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 59b837be..7ec0145f 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -298,7 +298,7 @@ namespace MP.INVE.Data } - public List ListLottiEsterni() + public List ListLottiEsterni(string codArt, string codLotto, string codMagazzino) { string source = ""; Stopwatch stopWatch = new Stopwatch(); @@ -314,7 +314,7 @@ namespace MP.INVE.Data } else { - result = dbController.ListLottiEsterni(); + result = dbController.ListLottiEsterni(codArt, codLotto, codMagazzino); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSetAsync(redisLottiEsterni, rawData, getRandTOut(redisLongTimeCache)); diff --git a/MP.INVE/Data/SelectInveSessionParams.cs b/MP.INVE/Data/SelectInveSessionParams.cs index 2c39818c..641536c3 100644 --- a/MP.INVE/Data/SelectInveSessionParams.cs +++ b/MP.INVE/Data/SelectInveSessionParams.cs @@ -21,6 +21,7 @@ namespace MP.INVE.Data public string idOperatore { get; set; } = ""; public string authKey { get; set; } = ""; public int currIdSession { get; set; } = 0; + public int currIdMag { get; set; } = 0; public bool reqNew { get; set; } = false; #endregion Public Properties @@ -52,6 +53,9 @@ namespace MP.INVE.Data if (currIdSession != item.currIdSession) return false; + if (currIdMag != item.currIdMag) + return false; + if (authKey != item.authKey) return false; diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 68592d06..b51e1a46 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.713 + 6.16.2212.1212 diff --git a/MP.INVE/Pages/Acquisizione.razor b/MP.INVE/Pages/Acquisizione.razor index 67f099c5..9b42ab01 100644 --- a/MP.INVE/Pages/Acquisizione.razor +++ b/MP.INVE/Pages/Acquisizione.razor @@ -21,7 +21,7 @@ { }*@
    - +
    diff --git a/MP.INVE/Pages/Acquisizione.razor.cs b/MP.INVE/Pages/Acquisizione.razor.cs index 9226e7c2..d6829cef 100644 --- a/MP.INVE/Pages/Acquisizione.razor.cs +++ b/MP.INVE/Pages/Acquisizione.razor.cs @@ -37,6 +37,7 @@ namespace MP.INVE.Pages protected string rawScan { get; set; } = null!; protected string idOPeratore { get; set; } = null!; protected int sessionId { get; set; } = 0; + protected int magazzinoId { get; set; } = 0; protected int nScansioniTot { get; set; } = 0; protected List? eleScansioni; //protected AnagUdcModel currUdc{ get; set; } = null!; @@ -44,10 +45,11 @@ namespace MP.INVE.Pages { await Task.Delay(1); var uri = NavManager.ToAbsoluteUri(NavManager.Uri); - if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOperatore", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId)) + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOperatore", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdMag", out var _idMag)) { idOPeratore = _matrOpr; sessionId = int.Parse(_inveSessionId); + magazzinoId = int.Parse(_idMag); eleScansioni = MIService.ScanBySession(sessionId); nScansioniTot = eleScansioni.Count(); diff --git a/MP.INVE/Pages/InveSession.razor b/MP.INVE/Pages/InveSession.razor index 6be0de66..b3e6dd71 100644 --- a/MP.INVE/Pages/InveSession.razor +++ b/MP.INVE/Pages/InveSession.razor @@ -32,156 +32,11 @@ } else { - - @*@if (reqNew) - { - -
    -
    -
    -
    -
    - Avvia una nuova sessione -
    -
    -
    -
    -
    -
    -
    -
    - Magazzino - -
    -
    -
    -
    - Descrizione - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - @if (magazzino != -1) - { -
    - -
    - } -
    -
    -
    -
    -
    -
    - } - - - - @if (inCorso) - { - - } - - - - - - - - - - - - @if (elencoSessioni != null) - { - @foreach (var item in elencoSessioni) - { - - @if (inCorso) - { - - } - - - - - - @if (item.DtEnd != null) - { - - } - else - { - - } - - - - - - } - } - -
    QRID sessioneMagazzinoOperatoreData inizioData fineDescriptionTrasferita
    - - - - @item.InveSessID - - @item.AnagMagNav.DescMag - - @item.UserCrea - - @item.DtStart - - @item.DtEnd - - In corso... - - @item.Description - - @if (item.Transferred) - { - - } - else - { - - - } - - -
    *@ + } diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index aa2b577b..b7a93e15 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

    Versione: 6.16.2212.713

    +

    Versione: 6.16.2212.1212


    Note di rilascio:
    • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 1e983b84..5ed644d1 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.713 +6.16.2212.1212 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index ecedee3f..b70c036d 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.713 + 6.16.2212.1212 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 From afa645dba23daec5ac16ea8f4e516ff42368f47b Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 12 Dec 2022 12:38:06 +0100 Subject: [PATCH 04/12] Fix attreazaggio PODL --- MP.SPEC/Components/ListPODL.razor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index 3d75d8b9..f481fb79 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -176,7 +176,7 @@ namespace MP.SPEC.Components await Task.Delay(1000); // registro inizio produzione - idxEvento = 2; + idxEvento = 1; evMess = $"Registrata inizio Produzione | PODL {selRec.IdxPromessa} | ODL {newOdl.IdxOdl} | ART {newOdl.CodArticolo}"; processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo); From e26ed56c4211fb6eeb2128df918fd273954683fb Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 12 Dec 2022 12:55:03 +0100 Subject: [PATCH 05/12] Ottimizzazione codice x rielttura parametri --- MP.SPEC/Data/MpDataService.cs | 13 +++++++++++-- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index f8bf8e65..4fbfe663 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -613,8 +613,11 @@ namespace MP.SPEC.Data result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, DtMin, IdxMacchina, CodFlux, MaxRec)); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - var canCache = await tryGetConfig("SPEC_ParametriEnableReidsCache"); - if (canCache != "false") + if (string.IsNullOrEmpty(canCacheParametri)) + { + canCacheParametri = await tryGetConfig("SPEC_ParametriEnableRedisCache"); + } + if (canCacheParametri != "false") { redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2)); } @@ -1377,6 +1380,12 @@ namespace MP.SPEC.Data #endregion Protected Fields + #region Protected Properties + + protected string canCacheParametri { get; set; } = ""; + + #endregion Protected Properties + #region Protected Methods /// diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index e35ea786..36b1e18a 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2212.1211 + 6.16.2212.1212 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 58bba000..4ffc3cea 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

      Versione: 6.16.2212.1211

      +

      Versione: 6.16.2212.1212


      Note di rilascio:
      • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index e2b22086..5ed644d1 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1211 +6.16.2212.1212 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 295e69e5..0ca4c5fd 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1211 + 6.16.2212.1212 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 From 0613d9a296c59e2ddad3fe784179fb408cf80ce6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 12 Dec 2022 13:27:00 +0100 Subject: [PATCH 06/12] bozza spostamento timer in pagina al posto del componente --- MP.SPEC/Components/ListPARAMS.razor.cs | 21 ++++++++---- MP.SPEC/Data/SelectFluxParams.cs | 11 +++++-- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Pages/PARAMS.razor.cs | 44 +++++++++++++++++++++++++- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 7 files changed, 71 insertions(+), 13 deletions(-) diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 0f840796..654ca456 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -53,20 +53,22 @@ namespace MP.SPEC.Components } } - public SelectFluxParams? LastFilter = null; public void Dispose() { +#if false aTimer.Elapsed -= ElapsedTimer; aTimer.Stop(); - aTimer.Dispose(); + aTimer.Dispose(); +#endif currRecord = null; SearchRecords = null; ListRecords = null; GC.Collect(); } +#if false public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) { if (!isLoading && LiveUpdate) @@ -88,7 +90,8 @@ namespace MP.SPEC.Components aTimer.Interval = deltaTime > 100 ? deltaTime : 100; aTimer.Start(); } - } + } +#endif public async Task reloadData(bool setChanged) { @@ -115,13 +118,15 @@ namespace MP.SPEC.Components isLoading = false; } +#if false public void StartTimer() { aTimer = new System.Timers.Timer(RefreshPeriod); aTimer.Elapsed += ElapsedTimer; aTimer.Enabled = true; aTimer.Start(); - } + } +#endif #endregion Public Methods @@ -142,10 +147,12 @@ namespace MP.SPEC.Components #region Protected Methods +#if false protected override void OnInitialized() { StartTimer(); - } + } +#endif //protected int RefreshPeriod { get; set; } = 5000; @@ -196,7 +203,9 @@ namespace MP.SPEC.Components #region Private Fields - private static System.Timers.Timer aTimer = null!; +#if false + private static System.Timers.Timer aTimer = null!; +#endif private int _totalCount = 0; private FluxLog? currRecord = null; diff --git a/MP.SPEC/Data/SelectFluxParams.cs b/MP.SPEC/Data/SelectFluxParams.cs index f6aab1b8..35836776 100644 --- a/MP.SPEC/Data/SelectFluxParams.cs +++ b/MP.SPEC/Data/SelectFluxParams.cs @@ -16,27 +16,30 @@ #region Public Properties public string CodFlux { get; set; } = "*"; + public int CurrCount { get; set; } = 0; public int CurrPage { get; set; } = 1; - public DateTime? dtRif { get; set; } = null; public DateTime? dtMax { get; set; } = null; public DateTime? dtMin { get; set; } = null; + public DateTime? dtRif { get; set; } = null; public DateTime? dtSnapMin { get; set; } = null; public string IdxMacchina { get; set; } = "*"; public string lastUpdate { get; set; } = "-"; public bool LiveUpdate { get; set; } = true; - public int NumRec { get; set; } = 10; public int MaxRecord { get; set; } = 100; + public int NumRec { get; set; } = 10; public int TempoAgg { get; set; } = 10000; public int TotCount { get; set; } = 0; #endregion Public Properties #region Public Methods + public SelectFluxParams clone() { SelectFluxParams clonedData = new SelectFluxParams() { CodFlux = this.CodFlux, + CurrCount = this.CurrCount, CurrPage = this.CurrPage, dtRif = this.dtRif, dtMax = this.dtMax, @@ -52,11 +55,15 @@ }; return clonedData; } + public override bool Equals(object obj) { if (!(obj is SelectFluxParams item)) return false; + if (CurrCount != item.CurrCount) + return false; + if (IdxMacchina != item.IdxMacchina) return false; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 36b1e18a..e6fa79e9 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2212.1212 + 6.16.2212.1213 diff --git a/MP.SPEC/Pages/PARAMS.razor.cs b/MP.SPEC/Pages/PARAMS.razor.cs index e0598d34..1e1daf48 100644 --- a/MP.SPEC/Pages/PARAMS.razor.cs +++ b/MP.SPEC/Pages/PARAMS.razor.cs @@ -2,11 +2,52 @@ using MP.Data.DatabaseModels; using MP.SPEC.Components; using MP.SPEC.Data; +using System.Diagnostics; namespace MP.SPEC.Pages { - public partial class PARAMS + public partial class PARAMS : IDisposable { + public void Dispose() + { + aTimer.Elapsed -= ElapsedTimer; + aTimer.Stop(); + aTimer.Dispose(); + GC.Collect(); + } + public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) + { + if (LiveUpdate) + { + aTimer.Stop(); + currFilter.CurrCount++; + currFilter.dtMax = DateTime.Now.AddSeconds(5); + aTimer.Interval = RefreshPeriod; + aTimer.Start(); + } + } + + public void StartTimer() + { + aTimer = new System.Timers.Timer(RefreshPeriod); + aTimer.Elapsed += ElapsedTimer; + aTimer.Enabled = true; + aTimer.AutoReset = true; + aTimer.Start(); + } + protected int RefreshPeriod + { + get => currFilter.TempoAgg; + } + protected bool LiveUpdate + { + get => currFilter.LiveUpdate; + } + + + + private static System.Timers.Timer aTimer = null!; + #region Protected Fields protected DataPager? pagerODL = null!; @@ -48,6 +89,7 @@ namespace MP.SPEC.Pages modFilter.CurrPage = 1; modFilter.LiveUpdate = (currPage == 1); currFilter = modFilter; + StartTimer(); await Task.Delay(1); isFiltering = false; } diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 4ffc3cea..661c3025 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

        Versione: 6.16.2212.1212

        +

        Versione: 6.16.2212.1213


        Note di rilascio:
        • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 5ed644d1..c53d0cbd 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1212 +6.16.2212.1213 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 0ca4c5fd..82282058 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1212 + 6.16.2212.1213 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 From dbc819542241eb30c2a939b60e09cbcd57ee949f Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 12 Dec 2022 14:07:54 +0100 Subject: [PATCH 07/12] Update refresh parametri --- MP.Data/Controllers/MpSpecController.cs | 1 + MP.SPEC/Components/ListPARAMS.razor.cs | 93 +++++++++++---------- MP.SPEC/Data/SelectFluxParams.cs | 5 -- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Pages/PARAMS.razor.cs | 103 +++++++----------------- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 8 files changed, 83 insertions(+), 127 deletions(-) diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 9a40ac55..920ba9b2 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -861,6 +861,7 @@ namespace MP.Data.Controllers public async Task ODLClose(int idxOdl, string idxMacchina, int matrOpr, bool confPezzi, bool confRett, int modoConfProd) { bool fatto = false; + await Task.Delay(1); if (idxOdl > 0) { using (var dbCtx = new MoonProContext(_configuration)) diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 654ca456..e296dcb2 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -3,12 +3,17 @@ using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.SPEC.Data; using System.Diagnostics; -using MP.Data; namespace MP.SPEC.Components { public partial class ListPARAMS : IDisposable { + #region Public Fields + + public SelectFluxParams? LastFilter = null; + + #endregion Public Fields + #region Public Properties [Parameter] @@ -26,7 +31,7 @@ namespace MP.SPEC.Components #endregion Public Properties #region Public Methods - private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 }; + public string checkSelect(FluxLog selRecord) { string answ = ""; @@ -42,33 +47,17 @@ namespace MP.SPEC.Components return answ; } - protected override async Task OnParametersSetAsync() - { - await Task.Delay(1); - // se sono cambiati --> rileggo... - if (!lastFilter.Equals(SelFilter)) - { - lastFilter = SelFilter.clone(); - await reloadData(true); - } - } - - public SelectFluxParams? LastFilter = null; - public void Dispose() { -#if false aTimer.Elapsed -= ElapsedTimer; aTimer.Stop(); - aTimer.Dispose(); -#endif + aTimer.Dispose(); currRecord = null; SearchRecords = null; ListRecords = null; GC.Collect(); } -#if false public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) { if (!isLoading && LiveUpdate) @@ -90,12 +79,13 @@ namespace MP.SPEC.Components aTimer.Interval = deltaTime > 100 ? deltaTime : 100; aTimer.Start(); } - } -#endif + } public async Task reloadData(bool setChanged) { isLoading = true; + SearchRecords = null; + ListRecords = null; DateTime dataFrom = DateTime.Today.AddMonths(-1); DateTime dataTo = DateTime.Now.AddMinutes(5); if (SelFilter != null && SelFilter.dtMin != null) @@ -107,7 +97,7 @@ namespace MP.SPEC.Components dataTo = (DateTime)SelDtMax; } - SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod/1000); + SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod / 1000); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); @@ -118,18 +108,20 @@ namespace MP.SPEC.Components isLoading = false; } -#if false public void StartTimer() { aTimer = new System.Timers.Timer(RefreshPeriod); aTimer.Elapsed += ElapsedTimer; aTimer.Enabled = true; aTimer.Start(); - } -#endif + } #endregion Public Methods + #region Protected Fields + + #endregion Protected Fields + #region Protected Properties [Inject] @@ -147,15 +139,22 @@ namespace MP.SPEC.Components #region Protected Methods -#if false protected override void OnInitialized() { StartTimer(); - } -#endif + } + protected override async Task OnParametersSetAsync() + { + await Task.Delay(1); + // se sono cambiati --> rileggo... + if (!lastFilter.Equals(SelFilter)) + { + lastFilter = SelFilter.clone(); + await reloadData(true); + } + } - //protected int RefreshPeriod { get; set; } = 5000; protected async void OnSeachUpdated() { await InvokeAsync(() => @@ -194,22 +193,16 @@ namespace MP.SPEC.Components #endregion Protected Methods - - private string traduci(string lemma) - { - var answ = MDService.Traduci(lemma, "IT"); - return answ; - } - #region Private Fields -#if false - private static System.Timers.Timer aTimer = null!; -#endif + private static System.Timers.Timer aTimer = null!; private int _totalCount = 0; + private FluxLog? currRecord = null; + private List? ListRecords; + private List? SearchRecords; #endregion Private Fields @@ -224,6 +217,8 @@ namespace MP.SPEC.Components private bool isLoading { get; set; } = false; + private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 }; + private bool LiveUpdate { get => SelFilter.LiveUpdate; @@ -234,12 +229,21 @@ namespace MP.SPEC.Components get => SelFilter.MaxRecord; } + [Inject] + private NavigationManager NavManager { get; set; } = null!; + private int numRecord { get => SelFilter.NumRec; set => SelFilter.NumRec = value; } + private DateTime? SelDtMax + { + get => SelFilter.dtMax; + set => SelFilter.dtMax = value; + } + private string SelFlux { get => SelFilter.CodFlux; @@ -249,11 +253,6 @@ namespace MP.SPEC.Components { get => SelFilter.IdxMacchina; } - private DateTime? SelDtMax - { - get => SelFilter.dtMax; - set => SelFilter.dtMax = value; - } private int totalCount { @@ -272,6 +271,12 @@ namespace MP.SPEC.Components #region Private Methods + private string traduci(string lemma) + { + var answ = MDService.Traduci(lemma, "IT"); + return answ; + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.SPEC/Data/SelectFluxParams.cs b/MP.SPEC/Data/SelectFluxParams.cs index 35836776..10c7ebee 100644 --- a/MP.SPEC/Data/SelectFluxParams.cs +++ b/MP.SPEC/Data/SelectFluxParams.cs @@ -16,7 +16,6 @@ #region Public Properties public string CodFlux { get; set; } = "*"; - public int CurrCount { get; set; } = 0; public int CurrPage { get; set; } = 1; public DateTime? dtMax { get; set; } = null; public DateTime? dtMin { get; set; } = null; @@ -39,7 +38,6 @@ SelectFluxParams clonedData = new SelectFluxParams() { CodFlux = this.CodFlux, - CurrCount = this.CurrCount, CurrPage = this.CurrPage, dtRif = this.dtRif, dtMax = this.dtMax, @@ -61,9 +59,6 @@ if (!(obj is SelectFluxParams item)) return false; - if (CurrCount != item.CurrCount) - return false; - if (IdxMacchina != item.IdxMacchina) return false; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index e6fa79e9..93010083 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2212.1213 + 6.16.2212.1214 diff --git a/MP.SPEC/Pages/PARAMS.razor.cs b/MP.SPEC/Pages/PARAMS.razor.cs index 1e1daf48..fb4e977c 100644 --- a/MP.SPEC/Pages/PARAMS.razor.cs +++ b/MP.SPEC/Pages/PARAMS.razor.cs @@ -1,66 +1,43 @@ -using Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; +using MP.Data.DatabaseModels; using MP.SPEC.Components; using MP.SPEC.Data; -using System.Diagnostics; namespace MP.SPEC.Pages { - public partial class PARAMS : IDisposable + public partial class PARAMS { - public void Dispose() - { - aTimer.Elapsed -= ElapsedTimer; - aTimer.Stop(); - aTimer.Dispose(); - GC.Collect(); - } - public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) - { - if (LiveUpdate) - { - aTimer.Stop(); - currFilter.CurrCount++; - currFilter.dtMax = DateTime.Now.AddSeconds(5); - aTimer.Interval = RefreshPeriod; - aTimer.Start(); - } - } - - public void StartTimer() - { - aTimer = new System.Timers.Timer(RefreshPeriod); - aTimer.Elapsed += ElapsedTimer; - aTimer.Enabled = true; - aTimer.AutoReset = true; - aTimer.Start(); - } - protected int RefreshPeriod - { - get => currFilter.TempoAgg; - } - protected bool LiveUpdate - { - get => currFilter.LiveUpdate; - } - - - - private static System.Timers.Timer aTimer = null!; - #region Protected Fields + protected int CurrCounter = 0; + protected DataPager? pagerODL = null!; #endregion Protected Fields - #region Protected Properties - - - #endregion Protected Properties - #region Protected Methods + protected async Task detailSel(FluxLog newRec) + { + await Task.Delay(1); + var updFilter = currFilter; + DateTime adesso = DateTime.Now.AddSeconds(1); + updFilter.LiveUpdate = (newRec == null); + // sistemo la data di riferimento x eventuale snapshot nel passato + updFilter.dtRif = newRec != null ? newRec.dtEvento : null; + if (newRec != null) + { + updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"{adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate; + updFilter.IdxMacchina = newRec.IdxMacchina; + //updFilter.CodFlux = newRec.CodFlux; + } + else + { + updFilter.lastUpdate = "-"; + } + // salvo filtro + currFilter = updFilter; + } + protected void ForceReload(int newNum) { numRecord = newNum; @@ -89,7 +66,6 @@ namespace MP.SPEC.Pages modFilter.CurrPage = 1; modFilter.LiveUpdate = (currPage == 1); currFilter = modFilter; - StartTimer(); await Task.Delay(1); isFiltering = false; } @@ -111,27 +87,9 @@ namespace MP.SPEC.Pages totalCount = newTotCount; } - - protected async Task detailSel(FluxLog newRec) + protected void UpdateTotCount(int newTotCount) { - await Task.Delay(1); - var updFilter = currFilter; - DateTime adesso = DateTime.Now.AddSeconds(1); - updFilter.LiveUpdate = (newRec == null); - // sistemo la data di riferimento x eventuale snapshot nel passato - updFilter.dtRif = newRec != null ? newRec.dtEvento : null; - if (newRec != null) - { - updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"{adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate; - updFilter.IdxMacchina = newRec.IdxMacchina; - //updFilter.CodFlux = newRec.CodFlux; - } - else - { - updFilter.lastUpdate = "-"; - } - // salvo filtro - currFilter = updFilter; + totalCount = newTotCount; } #endregion Protected Methods @@ -181,10 +139,7 @@ namespace MP.SPEC.Pages currFilter = newParams; isLoading = false; } - protected void UpdateTotCount(int newTotCount) - { - totalCount = newTotCount; - } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 661c3025..09159d86 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

          Versione: 6.16.2212.1213

          +

          Versione: 6.16.2212.1214


          Note di rilascio:
          • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index c53d0cbd..77ac8965 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1213 +6.16.2212.1214 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 82282058..d6afba70 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1213 + 6.16.2212.1214 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 From d00f76a1dd50abd0ae3ccdf1d4b4ded78a162ae5 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 12 Dec 2022 14:46:50 +0100 Subject: [PATCH 08/12] Fix gestione timer statico x update --- MP.SPEC/Components/CmpFooter.razor.cs | 2 +- MP.SPEC/Components/ListPARAMS.razor.cs | 6 +++--- MP.SPEC/Components/ParamsFilter.razor.cs | 2 +- MP.SPEC/Data/MpDataService.cs | 2 +- MP.SPEC/Data/SelectFluxParams.cs | 2 +- MP.SPEC/Pages/PARAMS.razor.cs | 11 ++++++++++- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/MP.SPEC/Components/CmpFooter.razor.cs b/MP.SPEC/Components/CmpFooter.razor.cs index 1633f803..f58b1fe0 100644 --- a/MP.SPEC/Components/CmpFooter.razor.cs +++ b/MP.SPEC/Components/CmpFooter.razor.cs @@ -47,7 +47,7 @@ namespace MP.SPEC.Components #region Private Fields - private static System.Timers.Timer aTimer = null!; + private System.Timers.Timer aTimer = null!; private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); private Version version = null!; diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index e296dcb2..097d6b94 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -51,6 +51,7 @@ namespace MP.SPEC.Components { aTimer.Elapsed -= ElapsedTimer; aTimer.Stop(); + aTimer.Close(); aTimer.Dispose(); currRecord = null; SearchRecords = null; @@ -97,7 +98,7 @@ namespace MP.SPEC.Components dataTo = (DateTime)SelDtMax; } - SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod / 1000); + SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod / 1000 * 1.1); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); @@ -179,7 +180,6 @@ namespace MP.SPEC.Components SelDtMax = selRec.dtEvento; // imposto pag 1 filtro SelFilter.CurrPage = 1; - //selDtMin = RoundDatetime(5).AddHours(-25); await reloadData(false); await RecordSel.InvokeAsync(selRec); await PagerResetReq.InvokeAsync(true); @@ -195,7 +195,7 @@ namespace MP.SPEC.Components #region Private Fields - private static System.Timers.Timer aTimer = null!; + private System.Timers.Timer aTimer = null!; private int _totalCount = 0; diff --git a/MP.SPEC/Components/ParamsFilter.razor.cs b/MP.SPEC/Components/ParamsFilter.razor.cs index 7978bb82..08968b94 100644 --- a/MP.SPEC/Components/ParamsFilter.razor.cs +++ b/MP.SPEC/Components/ParamsFilter.razor.cs @@ -267,7 +267,7 @@ namespace MP.SPEC.Components #region Private Fields - private static System.Timers.Timer aTimer = new System.Timers.Timer(); + private System.Timers.Timer aTimer = new System.Timers.Timer(); private List? ListFlux = null; private List? ListMacchine = null; private int numOreAnticipoSnapshot { get; set; } = 50; diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 4fbfe663..771ebbb4 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -619,7 +619,7 @@ namespace MP.SPEC.Data } if (canCacheParametri != "false") { - redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2)); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec)); } } if (result == null) diff --git a/MP.SPEC/Data/SelectFluxParams.cs b/MP.SPEC/Data/SelectFluxParams.cs index 10c7ebee..e20aa1b4 100644 --- a/MP.SPEC/Data/SelectFluxParams.cs +++ b/MP.SPEC/Data/SelectFluxParams.cs @@ -26,7 +26,7 @@ public bool LiveUpdate { get; set; } = true; public int MaxRecord { get; set; } = 100; public int NumRec { get; set; } = 10; - public int TempoAgg { get; set; } = 10000; + public int TempoAgg { get; set; } = 2000; public int TotCount { get; set; } = 0; #endregion Public Properties diff --git a/MP.SPEC/Pages/PARAMS.razor.cs b/MP.SPEC/Pages/PARAMS.razor.cs index fb4e977c..e537924d 100644 --- a/MP.SPEC/Pages/PARAMS.razor.cs +++ b/MP.SPEC/Pages/PARAMS.razor.cs @@ -4,8 +4,17 @@ using MP.SPEC.Data; namespace MP.SPEC.Pages { - public partial class PARAMS + public partial class PARAMS : IDisposable { + #region Public Methods + + public void Dispose() + { + GC.Collect(); + } + + #endregion Public Methods + #region Protected Fields protected int CurrCounter = 0; From 3f891feafac8111945d485da9bedb50efa8adcd8 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 12 Dec 2022 14:57:52 +0100 Subject: [PATCH 09/12] fIX spec --- MP.SPEC/Components/ListPARAMS.razor.cs | 2 +- MP.SPEC/Data/MpDataService.cs | 2 +- MP.SPEC/Pages/Test.razor.cs | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 097d6b94..bbc70671 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -98,7 +98,7 @@ namespace MP.SPEC.Components dataTo = (DateTime)SelDtMax; } - SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod / 1000 * 1.1); + SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, 1.1 * RefreshPeriod / 1000); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 771ebbb4..53070b2e 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -594,7 +594,7 @@ namespace MP.SPEC.Data /// *=tutti, altrimenti solo selezionato /// numero massimo record da restituire /// - public async Task> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec, int redisCacheSec) + public async Task> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec, double redisCacheSec) { List? result = new List(); Stopwatch stopWatch = new Stopwatch(); diff --git a/MP.SPEC/Pages/Test.razor.cs b/MP.SPEC/Pages/Test.razor.cs index 58be09e9..9d489526 100644 --- a/MP.SPEC/Pages/Test.razor.cs +++ b/MP.SPEC/Pages/Test.razor.cs @@ -39,6 +39,7 @@ namespace MP.SPEC.Pages CurrAction.Topic = "Chiusura ODL"; CurrAction.Message = "Rilevato possibile fine operazioni, Vuoi chiudere la commessa?"; MMDataService.ActionSetReq(CurrAction); + await Task.Delay(1); } protected override async Task OnInitializedAsync() From 10bd30d349941dc926f1933e26a2e2a02baf94a0 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 12 Dec 2022 16:27:36 +0100 Subject: [PATCH 10/12] Vari fix x recupero dati da DB IS --- MP.Data/Controllers/MpInveController.cs | 2 +- MP.Data/MoonPro_ISContext.cs | 89 +++++++ MP.INVE/Components/ProcSuggestion.razor | 17 +- MP.INVE/Components/ProcSuggestion.razor.cs | 276 +++++++++++---------- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Acquisizione.razor | 20 +- MP.INVE/Pages/Acquisizione.razor.cs | 23 +- MP.INVE/Pages/Jumper.razor.cs | 17 +- MP.INVE/Pages/_Layout.cshtml | 2 - MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- MP.INVE/appsettings.json | 1 + 13 files changed, 287 insertions(+), 168 deletions(-) create mode 100644 MP.Data/MoonPro_ISContext.cs diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index c63e2840..72d9af88 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -40,7 +40,7 @@ namespace MP.Data.Controllers public List ListLottiEsterni(string codArt, string codLotto, string codMagazzino) { List dbResult = new List(); - using (var dbCtx = new MoonPro_InveContext(_configuration)) + using (var dbCtx = new MoonPro_ISContext(_configuration)) { var DataGiac = new SqlParameter("@DataGiac", DateTime.Now); var CodArt = new SqlParameter("@CodArt", codArt); diff --git a/MP.Data/MoonPro_ISContext.cs b/MP.Data/MoonPro_ISContext.cs new file mode 100644 index 00000000..811c716b --- /dev/null +++ b/MP.Data/MoonPro_ISContext.cs @@ -0,0 +1,89 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.Extensions.Configuration; +using MP.Data.DatabaseModels; +using NLog; + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Data +{ + public partial class MoonPro_ISContext : DbContext + { + #region Private Fields + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + + private IConfiguration _configuration; + + #endregion Private Fields + + #region Public Constructors + + /// + /// Indispensabile x prima generazione migrations EFCore + /// + + [Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")] + public MoonPro_ISContext() + { + } + + public MoonPro_ISContext(IConfiguration configuration) + { + _configuration = configuration; + } + + public MoonPro_ISContext(DbContextOptions options) : base(options) + { + } + + #endregion Public Constructors + + #region Public Properties + + #region PER INVE + + public virtual DbSet DbLottoArca { get; set; } + + #endregion PER INVE + + #endregion Public Properties + + #region Private Methods + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); + + #endregion Private Methods + + #region Protected Methods + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (!optionsBuilder.IsConfigured) + { + string connString = _configuration.GetConnectionString("Mp.IS"); + if (!string.IsNullOrEmpty(connString)) + { + optionsBuilder.UseSqlServer(connString); + } + else + { + optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_IS_EdilChim;Trusted_Connection=True;"); + } + } + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS"); + + OnModelCreatingPartial(modelBuilder); + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.INVE/Components/ProcSuggestion.razor b/MP.INVE/Components/ProcSuggestion.razor index 755dab34..91a77d3c 100644 --- a/MP.INVE/Components/ProcSuggestion.razor +++ b/MP.INVE/Components/ProcSuggestion.razor @@ -57,7 +57,7 @@
          -
          +
          @if (articoloScan != "" && quantitaScan != 0) { @@ -79,7 +79,7 @@ } else if (alreadyScan != null) { -
            +
            • Codice Scannerizzato:
              @@ -119,7 +119,7 @@ else if (alreadyScan != null)
            -
            +
            @if (!alreadyScan.IsUnique) { @@ -127,9 +127,8 @@ else if (alreadyScan != null) } else { -
            Questo oggetto risulta essere univoco perciò non è possibile salvare una nuova scansione
            +
            Trovato UDC | scansione già effettuata / UDC caricato (impossibile caricare 2 volte)
            } -
            } else @@ -145,7 +144,7 @@ else
          • Articolo:
            - @if (lastScan != null && lastScan != "") + @if (!string.IsNullOrEmpty(lastScan)) { } @@ -159,7 +158,7 @@ else
          • Quantità:
            - @if (lastScan != null && lastScan != "") + @if (!string.IsNullOrEmpty(lastScan)) { } @@ -172,7 +171,7 @@ else
          • Note:
            - @if (lastScan != null && lastScan != "") + @if (!string.IsNullOrEmpty(lastScan)) { } @@ -183,7 +182,7 @@ else
          -
          +
          @if (articoloScan != "" && quantitaScan != 0) { diff --git a/MP.INVE/Components/ProcSuggestion.razor.cs b/MP.INVE/Components/ProcSuggestion.razor.cs index fc2ff761..10628f25 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -27,7 +27,7 @@ namespace MP.INVE.Components [Inject] private MiDataService MIService { get; set; } = null!; [Parameter] - public string lastScan { get; set; } = null!; + public string lastScan { get; set; } = ""; //[Parameter] //public EventCallback udcSend { get; set; } [Parameter] @@ -69,71 +69,90 @@ namespace MP.INVE.Components protected override async Task OnParametersSetAsync() { - await MIService.ConfigResetCache(); - var result = await MIService.tryGetConfig("MAG_SmartUdcEdit"); - elencoScansioni = MIService.ScanList(); - var exists = elencoScansioni.Select(x => x.ScanValue).Contains(lastScan); - var scansioneClone = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); - - if (exists) + // se il valore scansionato è != null... + if (string.IsNullOrEmpty(lastScan)) { - if (scansioneClone != null) - { - isScannedLotto = scansioneClone.ScanValue.StartsWith("M2"); - isMod = true; - if (scansioneClone.IsUnique) - { - isMod = false; - } - alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); - currUdc = null; - currLotto = null; - - } + await Task.Delay(1); } else { - if (result != null) - { - canMod = result; - } - await Task.Delay(1); - searchRecordsUDC = MIService.ElencoUDC(); - udc = searchRecordsUDC.Where(x => x.UDC == lastScan).FirstOrDefault(); + await MIService.ConfigResetCache(); + var result = await MIService.tryGetConfig("MAG_SmartUdcEdit"); + elencoScansioni = MIService.ScanList(); + var exists = elencoScansioni.Select(x => x.ScanValue).Contains(lastScan); + var scansioneClone = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); - if (udc != null && !udc.UDC.Contains("MSL")) + if (exists) { + if (scansioneClone != null) + { + isScannedLotto = scansioneClone.ScanValue.StartsWith("M2"); + isMod = true; + if (scansioneClone.IsUnique) + { + isMod = false; + } + alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); + currUdc = null; + currLotto = null; - currUdc = udc; - tipo = "UDC"; - lottoScan = udc.lottoNav.Lotto; - articoloScan = udc.lottoNav.CodArt; - quantitaScan = udc.Qta; - noteScan = udc.Note; + } } else { - searchRecordsLottoInterni = MIService.ElencoLotti(); - lottoInterno = searchRecordsLottoInterni.Where(x => x.Lotto == lastScan).FirstOrDefault(); - if (lottoInterno != null) + if (result != null) { - tipo = "LOTTO"; - currLotto = lottoInterno; - lottoScan = lottoInterno.Lotto; - articoloScan = lottoInterno.CodArt; - quantitaScan = 0; + canMod = result; + } + await Task.Delay(1); + searchRecordsUDC = MIService.ElencoUDC(); + udc = searchRecordsUDC.Where(x => x.UDC == lastScan).FirstOrDefault(); + + if (udc != null && !udc.UDC.Contains("MSL")) + { + + currUdc = udc; + tipo = "UDC"; + lottoScan = udc.lottoNav.Lotto; + articoloScan = udc.lottoNav.CodArt; + quantitaScan = udc.Qta; + noteScan = udc.Note; } else { - searchRecordsLottoEsterni = MIService.ListLottiEsterni(articoloScan, lastScan, magID.ToString()); - lottoEsterno = searchRecordsLottoEsterni.FirstOrDefault(); - currLotto = null; - currUdc = null; - alreadyScan = null; - lottoScan = lastScan; - articoloScan = ""; - quantitaScan = 0; - noteScan = ""; + searchRecordsLottoInterni = MIService.ElencoLotti(); + lottoInterno = searchRecordsLottoInterni.Where(x => x.Lotto == lastScan).FirstOrDefault(); + if (lottoInterno != null) + { + tipo = "LOTTO"; + currLotto = lottoInterno; + lottoScan = lottoInterno.Lotto; + articoloScan = lottoInterno.CodArt; + quantitaScan = 0; + } + else + { + searchRecordsLottoEsterni = MIService.ListLottiEsterni(articoloScan, lastScan, magID.ToString()); + lottoEsterno = searchRecordsLottoEsterni.FirstOrDefault(); + if (lottoEsterno != null) + { + tipo = "LOTTO EXT"; + //currLotto = lottoEsterno; + //lottoScan = lottoEsterno.Lotto; + //articoloScan = lottoInterno.CodArt; + quantitaScan = 0; + } + else + { + currLotto = null; + currUdc = null; + alreadyScan = null; + lottoScan = lastScan; + articoloScan = ""; + quantitaScan = 0; + noteScan = ""; + } + } } } } @@ -143,96 +162,95 @@ namespace MP.INVE.Components protected decimal qtaLotto = 0; protected async void insertScan() { - + var artExists = await MIService.artBySearch(articoloScan); if (artExists != null) { - var alertInsert = await JSRuntime.InvokeAsync("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?"); - if (alertInsert) + //var alertInsert = await JSRuntime.InvokeAsync("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?"); + //if (alertInsert) + //{ + if (currUdc != null) { - - if (currUdc != null) + if ((currUdc.lottoNav.CodArt != udc.lottoNav.CodArt) || (currUdc.Qta != udc.Qta)) { - if ((currUdc.lottoNav.CodArt != udc.lottoNav.CodArt) || (currUdc.Qta != udc.Qta)) - { - isForced = true; - } - //if() - - ScanDataModel newScan = new ScanDataModel() - { - DtScan = DateTime.Now, - UserScan = userScan, - ScanValue = lastScan, - IsForced = isForced, - CodArticolo = currUdc.lottoNav.CodArt, - Lotto = currUdc.lottoNav.Lotto, - RifExt = currUdc.lottoNav.RifExt, - Qty = currUdc.Qta, - Note = currUdc.Note, - IsKnown = true, - IsUnique = true, - InveSessID = sessID - }; - - - - await MIService.InsertNewScansione(newScan); - NavManager.NavigateTo(NavManager.Uri, true); + isForced = true; } - else if (currLotto != null) + //if() + + ScanDataModel newScan = new ScanDataModel() { - ScanDataModel newScan = new ScanDataModel() - { - DtScan = DateTime.Now, - UserScan = userScan, - ScanValue = lastScan, - IsForced = true, - CodArticolo = currLotto.CodArt, - Lotto = currLotto.Lotto, - RifExt = currLotto.RifExt, - Qty = qtaLotto, - Note = currLotto.Note, - IsKnown = true, - IsUnique = false, - InveSessID = sessID - }; - await MIService.InsertNewScansione(newScan); - NavManager.NavigateTo(NavManager.Uri, true); - } - else if (alreadyScan != null) - { - ScanDataModel newScan = new ScanDataModel() - { - DtScan = DateTime.Now, - UserScan = userScan, - ScanValue = lastScan, - IsForced = true, - CodArticolo = alreadyScan.CodArticolo, - Lotto = alreadyScan.Lotto, - RifExt = alreadyScan.RifExt, - Qty = alreadyScan.Qty, - Note = alreadyScan.Note, - IsKnown = alreadyScan.IsKnown, - IsUnique = alreadyScan.IsUnique, - InveSessID = sessID - }; - await MIService.InsertNewScansione(newScan); - NavManager.NavigateTo(NavManager.Uri, true); - } - } - else - { - currLotto = null; - currUdc = null; - alreadyScan = null; + DtScan = DateTime.Now, + UserScan = userScan, + ScanValue = lastScan, + IsForced = isForced, + CodArticolo = currUdc.lottoNav.CodArt, + Lotto = currUdc.lottoNav.Lotto, + RifExt = currUdc.lottoNav.RifExt, + Qty = currUdc.Qta, + Note = currUdc.Note, + IsKnown = true, + IsUnique = true, + InveSessID = sessID + }; + + + + await MIService.InsertNewScansione(newScan); NavManager.NavigateTo(NavManager.Uri, true); } + else if (currLotto != null) + { + ScanDataModel newScan = new ScanDataModel() + { + DtScan = DateTime.Now, + UserScan = userScan, + ScanValue = lastScan, + IsForced = true, + CodArticolo = currLotto.CodArt, + Lotto = currLotto.Lotto, + RifExt = currLotto.RifExt, + Qty = qtaLotto, + Note = currLotto.Note, + IsKnown = true, + IsUnique = false, + InveSessID = sessID + }; + await MIService.InsertNewScansione(newScan); + NavManager.NavigateTo(NavManager.Uri, true); + } + else if (alreadyScan != null) + { + ScanDataModel newScan = new ScanDataModel() + { + DtScan = DateTime.Now, + UserScan = userScan, + ScanValue = lastScan, + IsForced = true, + CodArticolo = alreadyScan.CodArticolo, + Lotto = alreadyScan.Lotto, + RifExt = alreadyScan.RifExt, + Qty = alreadyScan.Qty, + Note = alreadyScan.Note, + IsKnown = alreadyScan.IsKnown, + IsUnique = alreadyScan.IsUnique, + InveSessID = sessID + }; + await MIService.InsertNewScansione(newScan); + NavManager.NavigateTo(NavManager.Uri, true); + } + //} + //else + //{ + // currLotto = null; + // currUdc = null; + // alreadyScan = null; + // NavManager.NavigateTo(NavManager.Uri, true); + //} } else { - await JSRuntime.InvokeVoidAsync("alert", $"l'articolo {articoloScan} non risulta presente nelle nostre anagrafiche. Inserire un articolo giusto o controllare di non aver sbagliato a digitare"); + await JSRuntime.InvokeVoidAsync("alert", $"Articolo errato: {articoloScan} non trovato in anagrafica"); } } diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index b51e1a46..c1bcd4ce 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1212 + 6.16.2212.1216 diff --git a/MP.INVE/Pages/Acquisizione.razor b/MP.INVE/Pages/Acquisizione.razor index 9b42ab01..94640064 100644 --- a/MP.INVE/Pages/Acquisizione.razor +++ b/MP.INVE/Pages/Acquisizione.razor @@ -1,37 +1,33 @@ @page "/Acquisizione" - - -
          -
          -

          Acquisizione

          -
          -
          -
          +
          Last scan: @rawScan
          -
          +
          @*if (rawScan != null) { }*@
          - +
          diff --git a/MP.INVE/Pages/Acquisizione.razor.cs b/MP.INVE/Pages/Acquisizione.razor.cs index d6829cef..9729773e 100644 --- a/MP.INVE/Pages/Acquisizione.razor.cs +++ b/MP.INVE/Pages/Acquisizione.razor.cs @@ -35,29 +35,44 @@ namespace MP.INVE.Pages private bool logged { get; set; } = false; protected string rawScan { get; set; } = null!; - protected string idOPeratore { get; set; } = null!; + protected string idOpr { get; set; } = null!; protected int sessionId { get; set; } = 0; protected int magazzinoId { get; set; } = 0; protected int nScansioniTot { get; set; } = 0; + + protected string descr { get; set; } = ""; + protected string magInv { get; set; } = ""; + protected List? eleScansioni; //protected AnagUdcModel currUdc{ get; set; } = null!; protected override async Task OnInitializedAsync() { await Task.Delay(1); var uri = NavManager.ToAbsoluteUri(NavManager.Uri); - if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOperatore", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdMag", out var _idMag)) + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSess", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("codMag", out var _idMag)) { - idOPeratore = _matrOpr; + idOpr = _matrOpr; sessionId = int.Parse(_inveSessionId); magazzinoId = int.Parse(_idMag); eleScansioni = MIService.ScanBySession(sessionId); nScansioniTot = eleScansioni.Count(); + // recupero dati della sessione di inventario... + var currSessions = MIService.InventSessCurrList(); + var currInv = currSessions.Where(x=> x.InveSessID== sessionId).FirstOrDefault(); + if (currInv != null) + { + descr = currInv.Description; + magInv = currInv.AnagMagNav.DescMag; + } } } protected void saveScan(string newScan) { - rawScan = newScan; + if (!string.IsNullOrEmpty(newScan)) + { + rawScan = newScan; + } } } } \ No newline at end of file diff --git a/MP.INVE/Pages/Jumper.razor.cs b/MP.INVE/Pages/Jumper.razor.cs index a7efba86..c0cc5080 100644 --- a/MP.INVE/Pages/Jumper.razor.cs +++ b/MP.INVE/Pages/Jumper.razor.cs @@ -12,9 +12,11 @@ namespace MP.INVE.Pages { #region Protected Properties - protected string authKey { get; set; } = null!; + protected string authKey { get; set; } = ""; - protected string idOPeratore { get; set; } = null!; + protected string codMag { get; set; } = ""; + + protected string idOpr { get; set; } = ""; protected int inveSessionId { get; set; } = 0; @@ -38,21 +40,22 @@ namespace MP.INVE.Pages { await Task.Delay(1); var uri = NavManager.ToAbsoluteUri(NavManager.Uri); - if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId)) + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idMag", out var _codMag)) { - idOPeratore = _matrOpr; + idOpr = _matrOpr; authKey = _authKey; + codMag = _codMag; inveSessionId = int.Parse(_inveSessionId); } string pw = MIService.DeriptData(authKey); - logged = MIService.loginOperatore(int.Parse(idOPeratore), pw); + logged = MIService.loginOperatore(int.Parse(idOpr), pw); if (logged) { operatore = MIService.ElencoOperatori(); if (operatore != null) { - AnagOperatoriModel? currOpr = operatore.Where(x => (x.MatrOpr == int.Parse(idOPeratore)) && (x.authKey == pw)).SingleOrDefault(); + AnagOperatoriModel? currOpr = operatore.Where(x => (x.MatrOpr == int.Parse(idOpr)) && (x.authKey == pw)).SingleOrDefault(); if (currOpr != null) { @@ -69,7 +72,7 @@ namespace MP.INVE.Pages await localStorage.SetItemAsync("MatrOpr", currOpr); await sessionStorage.SetItemAsync("idSessione", inveSessionId); } - NavManager.NavigateTo($"Acquisizione?idSessione={inveSessionId}&idOperatore={idOPeratore}"); + NavManager.NavigateTo($"Acquisizione?idSess={inveSessionId}&idOpr={idOpr}&codMag={codMag}"); } } } diff --git a/MP.INVE/Pages/_Layout.cshtml b/MP.INVE/Pages/_Layout.cshtml index 3059250f..7c5553b6 100644 --- a/MP.INVE/Pages/_Layout.cshtml +++ b/MP.INVE/Pages/_Layout.cshtml @@ -32,9 +32,7 @@ - - @*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@