diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index 919aeecf..72d9af88 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_ISContext(_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/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.Data/DatabaseModels/AnagLottiArca.cs b/MP.Data/DatabaseModels/AnagLottiArca.cs index 42460fbc..e4440669 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; } @@ -15,8 +19,8 @@ namespace MP.Data.DatabaseModels public string Cd_MGUbicazione { get; set; } public string Cd_ARLotto { get; set; } public string Cd_DoSottoCommessa { get; set; } - public decimal Quantita { get; set; } - public decimal Valore { get; set; } + public string Quantita { get; set; } + public string Valore { get; set; } public string IniQ { get; set; } public string IniV { get; set; } public string RetQ { get; set; } 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.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..8c065481 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..f4761bdd 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, string 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 string currIdMag { get; set; } [Inject] private MiDataService MIDataservice { get; set; } = null!; 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 a204376c..a9d96e13 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -27,13 +27,15 @@ 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] public string userScan { get; set; } = null!; [Parameter] public int sessID { get; set; } = 0; + [Parameter] + public string magID { get; set; } = ""; [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; @@ -65,69 +69,93 @@ 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 { - searchRecordsLotto = MIService.ElencoLotti(); - lotto = searchRecordsLotto.Where(x => x.Lotto == lastScan).FirstOrDefault(); - if (lotto != null) + if (result != null) { - tipo = "LOTTO"; - currLotto = lotto; - lottoScan = lotto.Lotto; - articoloScan = lotto.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 { - currLotto = null; - currUdc = null; - alreadyScan = null; - lottoScan = lastScan; - articoloScan = ""; - quantitaScan = 0; - noteScan = ""; + if (lastScan.StartsWith("M") && lastScan.Length == 10) + { + searchRecordsLottoInterni = MIService.ElencoLotti(); + lottoInterno = searchRecordsLottoInterni.Where(x => (x.Lotto == lastScan) && x.Origine == "INT").FirstOrDefault(); + } + else + { + searchRecordsLottoEsterni = MIService.ListLottiEsterni(articoloScan, lastScan, magID); + lottoEsterno = searchRecordsLottoEsterni.FirstOrDefault(); + } + if (lottoInterno != null) + { + tipo = "LOTTO"; + currLotto = lottoInterno; + lottoScan = lottoInterno.Lotto; + articoloScan = lottoInterno.CodArt; + quantitaScan = 0; + } + else + { + if (lottoEsterno != null) + { + tipo = "LOTTO EXT"; + quantitaScan = 0; + } + else + { + currLotto = null; + currUdc = null; + alreadyScan = null; + lottoScan = lastScan; + articoloScan = ""; + quantitaScan = 0; + noteScan = ""; + } + } } } } @@ -137,96 +165,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/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 023cb27c..0b3b581e 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 = redisBaseAddr + redisLottiBaseAddr + ":LottiInterni"; + private const string redisLottiEsterni = redisBaseAddr + 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..2ebf9ef8 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.1218 diff --git a/MP.INVE/Pages/Acquisizione.razor b/MP.INVE/Pages/Acquisizione.razor index 67f099c5..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 9226e7c2..5462ddde 100644 --- a/MP.INVE/Pages/Acquisizione.razor.cs +++ b/MP.INVE/Pages/Acquisizione.razor.cs @@ -35,27 +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 string magazzinoId { get; set; } = ""; 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)) + 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 = _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/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/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)*@