diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index 919aeecf..c63e2840 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,43 @@ namespace MP.Data.Controllers { _configuration = null; } + + #region gestione lotti esterni + /// + /// Elenco lotti esterni presenti sul db di ARCA + /// + /// Codice articolo + /// Codice lotto + /// Codice magazzino + /// + 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", 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", false); + + 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/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.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/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 023cb27c..7ec0145f 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 codArt, string codLotto, string codMagazzino) + { + 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(codArt, codLotto, codMagazzino); + // 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"; 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 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