diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index 72d9af88..e371b009 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -5,6 +5,7 @@ using MP.Data.DatabaseModels; using NLog; using System; using System.Collections.Generic; +using System.Formats.Asn1; using System.Linq; using System.Threading.Tasks; @@ -37,12 +38,12 @@ namespace MP.Data.Controllers /// Codice lotto /// Codice magazzino /// - public List ListLottiEsterni(string codArt, string codLotto, string codMagazzino) + public List LottoEsterno(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 DataGiac = new SqlParameter("@DataGiac", DBNull.Value); var CodArt = new SqlParameter("@CodArt", codArt); var CodLotto = new SqlParameter("@CodLotto", codLotto); var CodMagaz = new SqlParameter("@CodMagaz", codMagazzino); @@ -52,7 +53,7 @@ namespace MP.Data.Controllers .DbLottoArca .FromSqlRaw("exec dbo.stp_GIAC_getByDate @DataGiac,@CodArt,@CodLotto,@CodMagaz,@OnlyTest", DataGiac, CodArt, CodLotto, CodMagaz, OnlyTest) .AsNoTracking() - //.AsEnumerable() + .AsEnumerable() .ToList(); } return dbResult; @@ -123,28 +124,54 @@ namespace MP.Data.Controllers return dbResult; } - -#if false /// /// Elenco Scansioni Totali /// - /// /// - public List ScanBySession(int InveSessId) + public ScanDataModel ScanByUdcSession(string udc, int InveSessId) + { + ScanDataModel dbResult = new ScanDataModel(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + if (InveSessId != 0) + { + dbResult = dbCtx + .DbScanData + .Where(x => (x.ScanValue == udc) && (x.InveSessID == InveSessId)) + .AsNoTracking() + .OrderByDescending(x => x.DtScan) + .FirstOrDefault(); + } + else + { + dbResult = dbCtx + .DbScanData + .Where(x => (x.ScanValue == udc)) + .AsNoTracking() + .OrderByDescending(x => x.DtScan) + .FirstOrDefault(); + } + } + return dbResult; + } + /// + /// Elenco Scansioni per valore, operatore e sessione + /// + /// + public List ScanByValueSessionOpr(string scanData, int InveSessId, string idOpr) { List dbResult = new List(); using (var dbCtx = new MoonPro_InveContext(_configuration)) { dbResult = dbCtx .DbScanData + .Where(x => (x.ScanValue == scanData) && (x.InveSessID == InveSessId) && (x.UserScan == idOpr)) .AsNoTracking() - .Where(x => x.InveSessID == InveSessId) .OrderByDescending(x => x.DtScan) .ToList(); } return dbResult; - } -#endif + } /// /// Elenco Scansioni dato Id sessione inventario @@ -228,6 +255,31 @@ namespace MP.Data.Controllers return fatto; } + /// + /// delete scansione + /// + /// + public async Task deleteScansione(ScanDataModel record) + { + bool fatto = false; + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + try + { + dbCtx + .DbScanData + .Remove(record); + await dbCtx.SaveChangesAsync(); + fatto = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante deleteScansione{Environment.NewLine}{exc}"); + } + } + return fatto; + } + #endregion gestione scansioni @@ -408,35 +460,29 @@ namespace MP.Data.Controllers } return dbResult; } - /// /// check udc /// /// /// - public bool IsUDC(string Udc) + public AnagUdcModel IsUDC(string Udc) { - List dbResult = new List(); - bool answ = false; + AnagUdcModel dbResult = new AnagUdcModel(); using (var dbCtx = new MoonPro_InveContext(_configuration)) { dbResult = dbCtx .DbUdcData .Where(x => x.UDC == Udc) + .Include(m => m.lottoNav) .AsNoTracking() .OrderByDescending(x => x.UDC) - .ToList(); - - if (dbResult.Count == 1) - { - answ = true; - } + .FirstOrDefault(); ; } - return answ; + return dbResult; } #endregion gestione UDC - #region gestione lotti + #region gestione lotti interni /// /// elenco lotti /// @@ -454,17 +500,14 @@ namespace MP.Data.Controllers } return dbResult; } - - /// /// check lotto /// /// /// - public bool IsLotto(string lotto) + public AnagLottoModel LottoInterno(string lotto) { - List dbResult = new List(); - bool answ = false; + AnagLottoModel dbResult = new AnagLottoModel(); using (var dbCtx = new MoonPro_InveContext(_configuration)) { dbResult = dbCtx @@ -472,17 +515,12 @@ namespace MP.Data.Controllers .Where(x => x.Lotto == lotto) .AsNoTracking() .OrderByDescending(x => x.Lotto) - .ToList(); - - if (dbResult.Count == 1) - { - answ = true; - } + .FirstOrDefault(); } - return answ; + return dbResult; } - #endregion gestione lotti + #endregion gestione lotti interni #region gestione sessione @@ -536,20 +574,40 @@ namespace MP.Data.Controllers return fatto; } + /// + /// Elenco Inventari Filtrati per id + /// + /// + public InventorySessionModel InventSessByID(int sessID) + { + InventorySessionModel dbResult = new InventorySessionModel(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + dbResult = dbCtx + .DbInveSess + .Where(x => x.InveSessID == sessID) + .Include(m => m.AnagMagNav) + .AsNoTracking() + .OrderByDescending(x => x.DtStart) + .FirstOrDefault(); + } + return dbResult; + } + /// /// Elenco Inventari tipo Azienda (TUTTI, chiusi e paerti) filtrati x data /// /// /// /// - public List InventSessHistList(DateTime FromDate, DateTime ToDate) + public List InventSessHistList() { List dbResult = new List(); using (var dbCtx = new MoonPro_InveContext(_configuration)) { dbResult = dbCtx .DbInveSess - .Where(x => x.DtStart >= FromDate && x.DtStart <= ToDate && x.DtEnd != null) + .Where(x => x.Transferred) .Include(m => m.AnagMagNav) .AsNoTracking() .OrderByDescending(x => x.DtStart) @@ -569,7 +627,7 @@ namespace MP.Data.Controllers { dbResult = dbCtx .DbInveSess - .Where(x => x.DtEnd == null) + .Where(x => (x.DtEnd == null) || !(x.Transferred)) .Include(m => m.AnagMagNav) .AsNoTracking() .OrderByDescending(x => x.DtStart) @@ -578,8 +636,76 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Chiusura/apertura sessione + /// + /// + /// + /// + public async Task CloseOpenSessione(int sessID, bool flgClose) + { + bool answ = false; + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + var SessID = new SqlParameter("@InveSessID", sessID); + var FlgClose = new SqlParameter("@FlgClose", flgClose); + + var callResulr = await dbCtx + .Database + .ExecuteSqlRawAsync("exec dbo.stp_INV_CloseOpen @InveSessID, @FlgClose", SessID, FlgClose); + + answ = true; + } + return answ; + } + /// + /// Trasferimento + /// + /// + /// + public async Task TransferSessione(int sessID) + { + bool answ = false; + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + var SessID = new SqlParameter("@InveSessID", sessID); + + var callResulr = await dbCtx + .Database + .ExecuteSqlRawAsync("exec dbo.stp_INV_InveSess_Transfer @InveSessID", SessID); + + answ = true; + } + return answ; + } #endregion gestione sessione + #region gestione totale lotti + + + /// + /// Elenco Totale lotti x sessione + /// + /// + /// + public List InveSessTotLotList(int sessID) + { + List dbResult = new List(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + var SessID = new SqlParameter("@sessId", sessID); + + dbResult = dbCtx + .DbTotLotti + .FromSqlRaw("exec dbo.stp_INVE_TotLotBySess @sessId", SessID) + .AsNoTracking() + .AsEnumerable() + .ToList(); + } + return dbResult; + } + #endregion gestione totale lotti + #endregion Public Methods #region Private Fields diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 920ba9b2..3f8b3c6d 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -665,7 +665,6 @@ namespace MP.Data.Controllers .DbSetPODLExp .FromSqlRaw("EXEC stp_PODL_getByFiltSpec @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina, @DateFrom, @DateTo", Lanc, KeyRich, CodGrp, IdxMacc, DateFrom, DateTo) .AsNoTracking() - //.AsEnumerable() .ToList(); } return dbResult; diff --git a/MP.Data/DatabaseModels/AnagLottiArca.cs b/MP.Data/DatabaseModels/AnagLottiArca.cs index e4440669..688dfaf6 100644 --- a/MP.Data/DatabaseModels/AnagLottiArca.cs +++ b/MP.Data/DatabaseModels/AnagLottiArca.cs @@ -11,35 +11,34 @@ 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; } - public string Id_DoDB { get; set; } - public string Cd_MGUbicazione { get; set; } - public string Cd_ARLotto { get; set; } - public string Cd_DoSottoCommessa { 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; } - public string RetV { get; set; } - public string CarQ { get; set; } - public string CarV { get; set; } - public string ScaQ { get; set; } - public string ScaV { get; set; } - public string CarQA { get; set; } - public string CarVA { get; set; } - public string CarQP { get; set; } - public string CarVP { get; set; } - public string CarQT { get; set; } - public string CarVT { get; set; } - public string ScaQV { get; set; } - public string ScaVV { get; set; } - public string ScaQP { get; set; } - public string ScaVP { get; set; } - public string ScaQT { get; set; } - public string ScaVT { get; set; } + public int? Id_DoDB { get; set; } + 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 decimal IniQ { get; set; } + public decimal IniV { get; set; } + public decimal RetQ { get; set; } + public decimal RetV { get; set; } + public decimal CarQ { get; set; } + public decimal CarV { get; set; } + public decimal ScaQ { get; set; } + public decimal ScaV { get; set; } + public decimal CarQA { get; set; } + public decimal CarVA { get; set; } + public decimal CarQP { get; set; } + public decimal CarVP { get; set; } + public decimal CarQT { get; set; } + public decimal CarVT { get; set; } + public decimal ScaQV { get; set; } + public decimal ScaVV { get; set; } + public decimal ScaQP { get; set; } + public decimal ScaVP { get; set; } + public decimal ScaQT { get; set; } + public decimal ScaVT { get; set; } } } diff --git a/MP.Data/DatabaseModels/InveSessTotLotModel.cs b/MP.Data/DatabaseModels/InveSessTotLotModel.cs new file mode 100644 index 00000000..a4966250 --- /dev/null +++ b/MP.Data/DatabaseModels/InveSessTotLotModel.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data.DatabaseModels +{ + [Keyless] + public partial class InveSessTotLotModel + { + public int InveSessID { get; set; } + public int MagID { get; set; } + public string CodMag { get; set; } + public string DescMag { get; set; } + public string Lotto { get; set; } + public string CodArticolo { get; set; } + public string DescrArt { get; set; } + public int NumColli { get; set; } + public decimal TotLotto { get; set; } + public bool IsForced { get; set; } + } +} diff --git a/MP.Data/MoonPro_InveContext.cs b/MP.Data/MoonPro_InveContext.cs index a6cec875..383ecec5 100644 --- a/MP.Data/MoonPro_InveContext.cs +++ b/MP.Data/MoonPro_InveContext.cs @@ -54,6 +54,7 @@ namespace MP.Data public virtual DbSet DbLottoData { get; set; } public virtual DbSet DbArtMag { get; set; } public virtual DbSet DbLottoArca { get; set; } + public virtual DbSet DbTotLotti { get; set; } #endregion PER INVE #region PER SPEC diff --git a/MP.INVE/Components/CodeScan.razor b/MP.INVE/Components/CodeScan.razor index cc6b2c68..d25c37a8 100644 --- a/MP.INVE/Components/CodeScan.razor +++ b/MP.INVE/Components/CodeScan.razor @@ -1,7 +1,7 @@ 
- - + +
diff --git a/MP.INVE/Components/CodeScan.razor.cs b/MP.INVE/Components/CodeScan.razor.cs index 2c0002dd..c05cbbeb 100644 --- a/MP.INVE/Components/CodeScan.razor.cs +++ b/MP.INVE/Components/CodeScan.razor.cs @@ -39,7 +39,7 @@ namespace MP.INVE.Components get => _lastScan; set { - _lastScan = value; + _lastScan = value.Trim(); if (value != "") { saveSel(LastScan); diff --git a/MP.INVE/Components/InveSessionList.razor b/MP.INVE/Components/InveSessionList.razor index 8c065481..f777e5c3 100644 --- a/MP.INVE/Components/InveSessionList.razor +++ b/MP.INVE/Components/InveSessionList.razor @@ -67,7 +67,7 @@ } - +
@if (inCorso) @@ -90,15 +90,12 @@ @foreach (var item in elencoSessioni) { - @if (inCorso) - { - - } + @@ -139,9 +136,12 @@ } diff --git a/MP.INVE/Components/InveSessionList.razor.cs b/MP.INVE/Components/InveSessionList.razor.cs index f4761bdd..02c22582 100644 --- a/MP.INVE/Components/InveSessionList.razor.cs +++ b/MP.INVE/Components/InveSessionList.razor.cs @@ -170,7 +170,7 @@ namespace MP.INVE.Components } else { - SearchRecords = MIDataservice.InventSessHistList(dtStart, dtEnd); + SearchRecords = MIDataservice.InventSessHistList(); } totalCount = SearchRecords.Count; elencoSessioni = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); @@ -186,10 +186,7 @@ namespace MP.INVE.Components [Parameter] public bool isLoading { get; set; } - - [Parameter] public int currIdSess { get; set; } - [Parameter] public string currIdMag { get; set; } [Inject] diff --git a/MP.INVE/Components/ListScan.razor b/MP.INVE/Components/ListScan.razor new file mode 100644 index 00000000..7cc8ac6d --- /dev/null +++ b/MP.INVE/Components/ListScan.razor @@ -0,0 +1,47 @@ +

ListScan

+ +
- - - + + + + + @item.InveSessID - + @if (!item.Transferred) + { + + }
+ + + + + + + + @if (elencoSCAN != null) + { + @foreach (var item in elencoSCAN) + { + + + + + + + } + } + +
Oggetto
+
+
+ Cod: @item.ScanValue +
+
+ Lotto: @item.Lotto +
+
+
+
+ Art: @item.CodArticolo +
+
+ Qty: @Math.Round(item.Qty, 0) +
+
+
+
+ +
+
diff --git a/MP.INVE/Components/ListScan.razor.cs b/MP.INVE/Components/ListScan.razor.cs new file mode 100644 index 00000000..8ffdd6e3 --- /dev/null +++ b/MP.INVE/Components/ListScan.razor.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; +using MP.Data.DatabaseModels; +using MP.INVE.Data; + +namespace MP.INVE.Components +{ + public partial class ListScan + { + [Inject] + MiDataService MIService { get; set; } = null!; + [Inject] + IJSRuntime JSRuntime { get; set; } = null!; + [Parameter] + public string lastScan { get; set; } = ""; + [Parameter] + public string userScan { get; set; } = null!; + [Parameter] + public int sessID { get; set; } = 0; + [Parameter] + public string magID { get; set; } = ""; + protected string rawScan { get; set; } = null!; + + List? elencoSCAN; + protected override async Task OnParametersSetAsync() + { + await Task.Delay(1); + + } + + } +} \ No newline at end of file diff --git a/MP.INVE/Components/ListTotLotto.razor b/MP.INVE/Components/ListTotLotto.razor new file mode 100644 index 00000000..7d3c919d --- /dev/null +++ b/MP.INVE/Components/ListTotLotto.razor @@ -0,0 +1,38 @@ +

Totale lotti

+ + + + + + + + + + + + + @if (elencoTotLotto != null) + { + @foreach (var item in elencoTotLotto) + { + + + + + + + + } + } + +
LottoArticoloDescrizione ArtTot colliTot lotto
+ @item.Lotto + + @item.CodArticolo + + @item.DescrArt + + @item.NumColli + + @($"{item.TotLotto:N2}") +
diff --git a/MP.INVE/Components/ListTotLotto.razor.cs b/MP.INVE/Components/ListTotLotto.razor.cs new file mode 100644 index 00000000..b8bc91a2 --- /dev/null +++ b/MP.INVE/Components/ListTotLotto.razor.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; +using MP.Data.DatabaseModels; +using MP.INVE.Data; + +namespace MP.INVE.Components +{ + public partial class ListTotLotto + { + public void Dispose() + { + elencoTotLotto = null; + SearchRecords = null; + GC.Collect(); + } + [Parameter] + public int SessionID { get; set; } = 0; + + [Inject] + protected MiDataService MIService { get; set; } = null!; + private int totalCount + { + get => currParams.TotCount; + set + { + currParams.TotCount = value; + StateHasChanged(); + } + } + private int numRecord + { + get => currParams.NumRec; + set + { + currParams.NumRec = value; + StateHasChanged(); + } + } + private int currPage + { + get => currParams.CurrPage; + set + { + currParams.CurrPage = value; + StateHasChanged(); + } + } + + protected async override Task OnParametersSetAsync() + { + await Task.Delay(1); + if (SessionID != 0) + { + await reloadData(); + } + } + private async Task reloadData() + { + elencoTotLotto = null; + totalCount = 0; + isLoading = true; + SearchRecords = MIService.InveSessTotLotList(SessionID); + totalCount = SearchRecords.Count; + elencoTotLotto = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + await Task.Delay(1); + isLoading = false; + } + protected List? elencoTotLotto; + private List? SearchRecords; + [Parameter] + public SelectInvioParams currParams { get; set; } = null!; + + [Parameter] + public bool isLoading { get; set; } + } +} \ No newline at end of file diff --git a/MP.INVE/Components/MagList.razor b/MP.INVE/Components/MagList.razor index 680ddf22..5cd00ecc 100644 --- a/MP.INVE/Components/MagList.razor +++ b/MP.INVE/Components/MagList.razor @@ -73,7 +73,7 @@ } - +
diff --git a/MP.INVE/Components/NavMenuTerm.razor b/MP.INVE/Components/NavMenuTerm.razor new file mode 100644 index 00000000..d58eaf02 --- /dev/null +++ b/MP.INVE/Components/NavMenuTerm.razor @@ -0,0 +1,47 @@ +@using MP.INVE.Components +@using MP.INVE.Data + + + +
+ +
+ diff --git a/MP.INVE/Components/NavMenuTerm.razor.cs b/MP.INVE/Components/NavMenuTerm.razor.cs new file mode 100644 index 00000000..19867279 --- /dev/null +++ b/MP.INVE/Components/NavMenuTerm.razor.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; +using MP.INVE.Data; +using MP.Data.DTO; +using Blazored.LocalStorage; + +namespace MP.INVE.Components +{ + public partial class NavMenuTerm + { + private bool collapseNavMenu = true; + //public List? ElencoLink { get; set; } + private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; + private void ToggleNavMenu() + { + collapseNavMenu = !collapseNavMenu; + } + + protected string cssScan = ""; + protected string cssCanc = ""; + + protected string cssScanBack = ""; + protected string cssCancBack = ""; + + protected string @cssCancScan = ""; + protected override async Task OnInitializedAsync() + { + if (isScan) + { + cssCancScan = "bg-info"; + + cssScanBack = "background-color: rgba(255,255,255,0.7)"; + cssScan = "fw-bold text-decoration-underline"; + } + else + { + cssCancScan = "bg-danger"; + cssCancBack = "background-color: rgba(255,255,255,0.7)"; + cssCanc = "fw-bold text-decoration-underline"; + } + // recupero elenco JQM + //ElencoLink = await MDService.ElencoLink(); + } + + protected bool showText { get; set; } = true; + protected void ToggleCompress() + { + showText = !showText; + EC_compressUpdated.InvokeAsync(showText); + } + protected async Task goBack() + { + if (NavigationManager.Uri.Contains("")) + await JSRuntime.InvokeVoidAsync("history.go", -1); + } + protected string hideText { get => showText ? "" : "invisible"; } + + [Parameter] + public EventCallback EC_compressUpdated { get; set; } + [Parameter] + public bool isScan { get; set; } = false; + [Parameter] + public string link { get; set; } = ""; + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + [Inject] + protected NavigationManager NavigationManager { get; set; } = null!; + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + } +} \ No newline at end of file diff --git a/MP.INVE/Components/NavMenuTerm.razor.css b/MP.INVE/Components/NavMenuTerm.razor.css new file mode 100644 index 00000000..a8904f9e --- /dev/null +++ b/MP.INVE/Components/NavMenuTerm.razor.css @@ -0,0 +1,62 @@ +.navbar-toggler { + background-color: rgba(255,255,255,0); +} + +.top-row { + height: 3.5rem; + background-color: rgba(255,255,255,1); +} + +.navbar-brand { + font-size: 1.1rem; +} + +.oi { + width: 2rem; + font-size: 1.1rem; + vertical-align: text-top; + top: -2px; +} + +.nav-item { + font-size: 0.9rem; + padding-bottom: 0.5rem; +} + + .nav-item:first-of-type { + padding-top: 1rem; + } + + .nav-item:last-of-type { + padding-bottom: 1rem; + } + + .nav-item ::deep a { + color: #d7d7d7; + border-radius: 4px; + height: 3rem; + display: flex; + align-items: center; + line-height: 3rem; + } + + .nav-item ::deep a.active { + background-color: rgba(255,255,255,0.25); + color: white; + } + + .nav-item ::deep a:hover { + background-color: rgba(255,255,255,0.1); + color: white; + } + +@media (min-width: 641px) { + .navbar-toggler { + display: none; + } + + .collapse { + /* Never collapse the sidebar for wide screens */ + display: block; + } +} \ No newline at end of file diff --git a/MP.INVE/Components/ProcSuggestion.razor b/MP.INVE/Components/ProcSuggestion.razor index 91a77d3c..5f7eb404 100644 --- a/MP.INVE/Components/ProcSuggestion.razor +++ b/MP.INVE/Components/ProcSuggestion.razor @@ -8,22 +8,22 @@
  • totalmente ignoto
  • *@ - -@if (currUdc != null || currLotto != null) +@if (!firstMsg) { +
      -
    • +
    • Lotto:
      @tipo
    • -
    • +
    • Articolo:
      - @if ((canMod != "false") || (tipo != "UDC")) + @if ((canMod != "false") || (tipo != "U") || (!isKnown)) {
    • -
    • +
    • Quantità:
      - @if (currLotto != null) + @if (currLottoInterno != null || currLottoEsterno != null) { } @@ -42,7 +42,7 @@ { } - @if ((canMod != "false") || (tipo != "UDC")) + @if ((canMod != "false") || (tipo != "U") || (!isKnown)) {
    • -
    • +
    • Note:
    -
    - @if (articoloScan != "" && quantitaScan != 0) +
    + @if (articoloScan != "" && quantitaScan != 0 && canSave) { } else if (articoloScan == "" && quantitaScan != 0) { -
    Dati mancanti: Codice articolo
    +
    Dati mancanti: Codice articolo
    } else if (quantitaScan == 0 && articoloScan != "") { -
    Dati mancanti: Quantità a "0"
    +
    Dati mancanti: Quantità a "0"
    + } + else if (isKnown) + { +
    Codice già scansionato per la sessione corrente
    } else { -
    Dati mancanti: Codice articolo e Quantità
    - } -
    -} -else if (alreadyScan != null) -{ -
      -
    • - Codice Scannerizzato: -
      - -
      -
    • -
    • - Articolo: -
      - - @if (isMod) - { - - - } -
      -
    • -
    • - Quantità: -
      - - @if (isMod) - { - - - } -
      -
    • -
    • - Note: -
      - -
      -
    • -
    -
    - @if (!alreadyScan.IsUnique) - { - - - } - else - { -
    Trovato UDC | scansione già effettuata / UDC caricato (impossibile caricare 2 volte)
    +
    Dati mancanti: Codice articolo e Quantità
    }
    } else { -
      -
    • - Lotto: -
      - - @tipo -
      -
    • -
    • - Articolo: -
      - @if (!string.IsNullOrEmpty(lastScan)) - { - - } - else - { - - } - -
      -
    • -
    • - Quantità: -
      - @if (!string.IsNullOrEmpty(lastScan)) - { - - } - else - { - - } -
      -
    • -
    • - Note: -
      - @if (!string.IsNullOrEmpty(lastScan)) - { - - } - else - { - - } -
      -
    • -
    -
    - @if (articoloScan != "" && quantitaScan != 0) - { - - - } - else if (articoloScan == "" && quantitaScan != 0) - { -
    Dati mancanti: Codice articolo
    - } - else if (quantitaScan == 0 && articoloScan != "") - { -
    Dati mancanti: Quantità a "0"
    - } - else - { -
    Dati mancanti: Codice articolo e Quantità
    - } -
    +
    Eseguire scansione
    } + + diff --git a/MP.INVE/Components/ProcSuggestion.razor.cs b/MP.INVE/Components/ProcSuggestion.razor.cs index a9d96e13..c8a43ee1 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -26,38 +26,39 @@ namespace MP.INVE.Components { [Inject] private MiDataService MIService { get; set; } = null!; + [Inject] + public IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + public NavigationManager NavManager { get; set; } = null!; + [Parameter] 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] - public NavigationManager NavManager { get; set; } = null!; + private string tipo { get; set; } = ""; private string canMod = "false"; + public string lastScanCheck { get; set; } = ""; - protected List? searchRecordsUDC; - protected List? searchRecordsLottoInterni; - protected List? searchRecordsLottoEsterni; - protected List? elencoScansioni; protected AnagUdcModel? udc; protected AnagLottoModel? lottoInterno; protected AnagLottiArca? lottoEsterno; + protected List? listLottiEsterni; protected ScanDataModel? alreadyScan; protected AnagUdcModel? currUdc; - protected AnagLottoModel? currLotto; + protected AnagLottoModel? currLottoInterno; + protected AnagLottiArca? currLottoEsterno; protected bool alertScan; protected bool isScannedLotto; protected bool firstMsg = false; - protected bool isMod = true; + protected bool isKnown = false; + protected bool canSave = true; + protected string oldArt = ""; protected override async Task OnAfterRenderAsync(bool firstRender) { await Task.Delay(1); @@ -69,34 +70,53 @@ namespace MP.INVE.Components protected override async Task OnParametersSetAsync() { + isKnown = false; + currLottoInterno = null; + currUdc = null; + alreadyScan = null; + // se il valore scansionato è != null... if (string.IsNullOrEmpty(lastScan)) { - await Task.Delay(1); + firstMsg = true; + await Task.Delay(1); } else { + if (lastScan.StartsWith("S")) + { + lastScanCheck = lastScan.Substring(1); + } + else + { + lastScanCheck = lastScan; + } + firstMsg = false; 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(); + int sessIDSearch = 0; - if (exists) + if (lastScanCheck.Contains("MFI") && lastScanCheck.Length == 14) { - if (scansioneClone != null) + sessIDSearch = sessID; + } + var scansioneClone = MIService.ScanByUdcSession(lastScan, sessID); + if (scansioneClone != null) + { + //isScannedLotto = scansioneClone.ScanValue.StartsWith("M2"); + isKnown = false; + if (scansioneClone.IsUnique) { - isScannedLotto = scansioneClone.ScanValue.StartsWith("M2"); - isMod = true; - if (scansioneClone.IsUnique) - { - isMod = false; - } - alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); - currUdc = null; - currLotto = null; - + isKnown = true; + canSave = false; } + alreadyScan = scansioneClone; + lottoScan = alreadyScan.Lotto; + oldArt = alreadyScan.CodArticolo; + articoloScan = alreadyScan.CodArticolo; + quantitaScan = Math.Round(alreadyScan.Qty, 2); + noteScan = alreadyScan.Note; + } else { @@ -105,36 +125,48 @@ namespace MP.INVE.Components canMod = result; } await Task.Delay(1); - searchRecordsUDC = MIService.ElencoUDC(); - udc = searchRecordsUDC.Where(x => x.UDC == lastScan).FirstOrDefault(); + udc = MIService.IsUDC(lastScanCheck); - if (udc != null && !udc.UDC.Contains("MSL")) + if (udc != null) { + var udcString = udc.UDC.Substring(2, 3); + if (udcString == "MFI") + { - currUdc = udc; - tipo = "UDC"; - lottoScan = udc.lottoNav.Lotto; - articoloScan = udc.lottoNav.CodArt; - quantitaScan = udc.Qta; - noteScan = udc.Note; + isKnown = true; + canSave = true; + currUdc = udc; + tipo = "U"; + lottoScan = udc.lottoNav.Lotto; + oldArt = udc.lottoNav.CodArt; + articoloScan = udc.lottoNav.CodArt; + quantitaScan = Math.Round(udc.Qta, 2); + noteScan = udc.Note; + } } else { + if (lastScan.StartsWith("M") && lastScan.Length == 10) { - searchRecordsLottoInterni = MIService.ElencoLotti(); - lottoInterno = searchRecordsLottoInterni.Where(x => (x.Lotto == lastScan) && x.Origine == "INT").FirstOrDefault(); + lottoInterno = MIService.LottoInterno(lastScan); } else { - searchRecordsLottoEsterni = MIService.ListLottiEsterni(articoloScan, lastScan, magID); - lottoEsterno = searchRecordsLottoEsterni.FirstOrDefault(); + listLottiEsterni = MIService.LottoEsterno("", lastScan, magID); + if (listLottiEsterni.Count == 1) + { + lottoEsterno = listLottiEsterni.FirstOrDefault(); + } } + if (lottoInterno != null) { - tipo = "LOTTO"; - currLotto = lottoInterno; + canSave = true; + tipo = "LI"; + currLottoInterno = lottoInterno; lottoScan = lottoInterno.Lotto; + oldArt = lottoInterno.CodArt; articoloScan = lottoInterno.CodArt; quantitaScan = 0; } @@ -142,14 +174,27 @@ namespace MP.INVE.Components { if (lottoEsterno != null) { - tipo = "LOTTO EXT"; + canSave = true; + tipo = "LE"; + currLottoEsterno = lottoEsterno; + if (lottoEsterno.Cd_ARLotto != null) + { + lottoScan = lottoEsterno.Cd_ARLotto; + } + oldArt = lottoEsterno.Cd_AR; + articoloScan = lottoEsterno.Cd_AR; quantitaScan = 0; + noteScan = ""; } else { - currLotto = null; + canSave = true; + tipo = "S"; +#if false + currLottoInterno = null; currUdc = null; - alreadyScan = null; + alreadyScan = null; +#endif lottoScan = lastScan; articoloScan = ""; quantitaScan = 0; @@ -170,86 +215,44 @@ namespace MP.INVE.Components if (artExists != null) { - //var alertInsert = await JSRuntime.InvokeAsync("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?"); - //if (alertInsert) - //{ + var force = false; + if (articoloScan != oldArt) + { + force = true; + } + var lottoSave = lastScan; + var known = false; + var unique = false; if (currUdc != null) { - 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); + lottoSave = currUdc.Lotto; + known = true; + unique = true; } - else if (currLotto != null) + else if (currLottoEsterno != null || currLottoInterno != 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); + + known = true; + unique = false; } - else if (alreadyScan != null) + + ScanDataModel newScan = new ScanDataModel() { - 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); - //} + DtScan = DateTime.Now, + UserScan = userScan, + ScanValue = lastScan, + IsForced = force, + CodArticolo = articoloScan, + Lotto = lottoSave, + RifExt = "", + Qty = quantitaScan, + Note = noteScan, + IsKnown = known, + IsUnique = unique, + InveSessID = sessID + }; + await MIService.InsertNewScansione(newScan); + NavManager.NavigateTo(NavManager.Uri, true); } else { @@ -284,13 +287,13 @@ namespace MP.INVE.Components protected string lottoScan { get => _lotto; - set => _lotto = value; + set => _lotto = value.Trim(); } protected string _articolo = ""; protected string articoloScan { get => _articolo; - set => _articolo = value; + set => _articolo = value.Trim(); } protected decimal _qta = 0; protected decimal quantitaScan @@ -302,7 +305,7 @@ namespace MP.INVE.Components protected string noteScan { get => _note; - set => _note = value; + set => _note = value.Trim(); } protected void cssDisableArt() @@ -313,11 +316,5 @@ namespace MP.INVE.Components { reqQtaMod = ""; } - - - //private void saveSel(AnagUdcModel udcToSend) - //{ - // Task.FromResult(udcSend.InvokeAsync(udcToSend)); - //} } } \ No newline at end of file diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 0b3b581e..94cffed8 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -162,6 +162,7 @@ namespace MP.INVE.Data return result; // aggiungo record al DB } + public async Task deleteSessione(InventorySessionModel session) { bool result = false; @@ -177,6 +178,21 @@ namespace MP.INVE.Data return result; // elimino record dal DB } + public async Task deleteScansione(ScanDataModel scan) + { + bool result = false; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + result = await dbController.deleteScansione(scan); + // elimino cache redis... + RedisValue pattern = new RedisValue($"{redisScanBaseAddr}*"); + bool answ = await ExecFlushRedisPattern(pattern); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"deleteScansione | Id scansione: {scan.ScanID} | Codice scansionato: {scan.ScanValue} | {ts.TotalMilliseconds}ms"); + return result; + // elimino record dal DB + } public async Task InsertNewMag(AnagMagModel newMag) { @@ -298,35 +314,18 @@ namespace MP.INVE.Data } - public List ListLottiEsterni(string codArt, string codLotto, string codMagazzino) + public List LottoEsterno(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(); - } + result = dbController.LottoEsterno(codArt, codLotto, codMagazzino); + source = "DB"; stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ListLottiEsterni Read from {source}: {ts.TotalMilliseconds}ms"); + Log.Debug($"LottoEsterno Read from {source}: {ts.TotalMilliseconds}ms"); return result; } @@ -361,6 +360,52 @@ namespace MP.INVE.Data Log.Debug($"ScanList Read from {source}: {ts.TotalMilliseconds}ms"); return result; } + public List InveSessTotLotList(int sessID) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + result = dbController.InveSessTotLotList(sessID); + source = "DB"; + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"InveSessTotLotList Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + + public ScanDataModel ScanByUdcSession(string udc, int inveSessId) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + ScanDataModel? result = new ScanDataModel(); + result = dbController.ScanByUdcSession(udc, inveSessId); + source = "DB"; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ScanByUdcSession Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + + public List ScanByValueSessionOpr(string scanData, int inveSessId, string Opr) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + result = dbController.ScanByValueSessionOpr(scanData, inveSessId, Opr); + source = "DB"; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ScanByValueSessionOpr Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public List ScanBySession(int idSessione) { string source = ""; @@ -408,6 +453,7 @@ namespace MP.INVE.Data await Task.Delay(1); return dbResult; } + public List ElencoUDC() { string source = ""; @@ -439,6 +485,33 @@ namespace MP.INVE.Data Log.Debug($"ElencoUDC Read from {source}: {ts.TotalMilliseconds}ms"); return result; } + + public AnagUdcModel IsUDC(string udc) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + AnagUdcModel? result = new AnagUdcModel(); + result = dbController.IsUDC(udc); + source = "DB"; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"IsUDC Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public AnagLottoModel LottoInterno(string lotto) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + AnagLottoModel? result = new AnagLottoModel(); + result = dbController.LottoInterno(lotto); + source = "DB"; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"LottoInterno Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } public List ElencoLotti() { string source = ""; @@ -536,14 +609,14 @@ namespace MP.INVE.Data return result; } - public List InventSessHistList(DateTime dtStart, DateTime dtEnd) + public List InventSessHistList() { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); List result = new List(); string source = "DB"; // cerco in redis... - RedisValue rawData = redisDb.StringGet($"{redisSessionHistList}:{dtStart:yyyyMMdd_HHmmss}:{dtEnd:yyyyMMdd_HHmmss}"); + RedisValue rawData = redisDb.StringGet($"{redisSessionHistList}"); if (!string.IsNullOrEmpty($"{rawData}")) { result = JsonConvert.DeserializeObject>($"{rawData}"); @@ -551,7 +624,7 @@ namespace MP.INVE.Data } else { - result = dbController.InventSessHistList(dtStart, dtEnd); + result = dbController.InventSessHistList(); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSetAsync(redisSessionHistList, rawData, getRandTOut(redisLongTimeCache)); @@ -566,6 +639,47 @@ namespace MP.INVE.Data return result; } + public InventorySessionModel InventSessByID(int sessID) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + InventorySessionModel result = new InventorySessionModel(); + string source = "DB"; + result = dbController.InventSessByID(sessID); + if (result == null) + { + result = new InventorySessionModel(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"InventSessByID Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + + public async Task CloseOpenSessione(int sessID, bool flgClose) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + bool result = false; + string source = "DB"; + result = await dbController.CloseOpenSessione(sessID, flgClose); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"CloseOpenSessione Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public async Task TransferSessione(int sessID) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + bool result = false; + string source = "DB"; + result = await dbController.TransferSessione(sessID); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"TransferSessione Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } #endregion Public Methods #region Protected Fields @@ -634,6 +748,7 @@ namespace MP.INVE.Data private const string redisOperatoriBaseAddr = ":Operatore"; private const string redisLottiBaseAddr = ":Lotti"; private const string redisUdcBaseAddr = ":UDC"; + private const string redisTotLottoAddr = ":TotaleLotto"; private const string redisLottiInterni = redisBaseAddr + redisLottiBaseAddr + ":LottiInterni"; private const string redisLottiEsterni = redisBaseAddr + redisLottiBaseAddr + ":LottiEsterni"; private const string redisConfigBaseAddr = ":Config"; diff --git a/MP.INVE/Data/SelectInvioParams.cs b/MP.INVE/Data/SelectInvioParams.cs new file mode 100644 index 00000000..d6257110 --- /dev/null +++ b/MP.INVE/Data/SelectInvioParams.cs @@ -0,0 +1,55 @@ +using MP.Data; + +namespace MP.INVE.Data +{ + public class SelectScanParams + { + #region Public Constructors + + public SelectScanParams() + { } + + #endregion Public Constructors + + #region Public Properties + + public int CurrPage { get; set; } = 1; + public int NumRec { get; set; } = 10; + public int TotCount { get; set; } = 0; + public int MaxRecord { get; set; } = 100; + public string UDC { get; set; } = ""; + + #endregion Public Properties + + #region Public Methods + + public override bool Equals(object obj) + { + if (!(obj is SelectScanParams item)) + return false; + + if (MaxRecord != item.MaxRecord) + return false; + + if (TotCount != item.TotCount) + return false; + + if (NumRec != item.NumRec) + + if (CurrPage != item.CurrPage) + return false; + + if (UDC != item.UDC) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.INVE/Data/SelectScanParams.cs b/MP.INVE/Data/SelectScanParams.cs index d6257110..c5ef148c 100644 --- a/MP.INVE/Data/SelectScanParams.cs +++ b/MP.INVE/Data/SelectScanParams.cs @@ -2,11 +2,11 @@ namespace MP.INVE.Data { - public class SelectScanParams + public class SelectInvioParams { #region Public Constructors - public SelectScanParams() + public SelectInvioParams() { } #endregion Public Constructors @@ -17,7 +17,6 @@ namespace MP.INVE.Data public int NumRec { get; set; } = 10; public int TotCount { get; set; } = 0; public int MaxRecord { get; set; } = 100; - public string UDC { get; set; } = ""; #endregion Public Properties @@ -25,7 +24,7 @@ namespace MP.INVE.Data public override bool Equals(object obj) { - if (!(obj is SelectScanParams item)) + if (!(obj is SelectInvioParams item)) return false; if (MaxRecord != item.MaxRecord) @@ -39,9 +38,6 @@ namespace MP.INVE.Data if (CurrPage != item.CurrPage) return false; - if (UDC != item.UDC) - return false; - return true; } diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 2ebf9ef8..efe90c46 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1218 + 6.16.2212.1610 diff --git a/MP.INVE/Pages/Acquisizione.razor b/MP.INVE/Pages/Acquisizione.razor index 94640064..f2122071 100644 --- a/MP.INVE/Pages/Acquisizione.razor +++ b/MP.INVE/Pages/Acquisizione.razor @@ -1,12 +1,43 @@ @page "/Acquisizione" +@*
    +
    MP.INVE
    +
    + Acquisizione +
    +
    + +
    +
    + +
    +
    +
    Menu
    + +
    + +
    *@ +
    + +
    +
    -
    - Last scan: @rawScan +
    +
    + Last scan: @rawScan +
    +
    + #:@nScansioniTot +
    @@ -23,12 +54,11 @@
    S.@sessionId | @descr
    -
    - #:@nScansioniTot -
    +
    @magInv
    -
    \ No newline at end of file +
    + diff --git a/MP.INVE/Pages/Acquisizione.razor.cs b/MP.INVE/Pages/Acquisizione.razor.cs index 5462ddde..9d9d2a99 100644 --- a/MP.INVE/Pages/Acquisizione.razor.cs +++ b/MP.INVE/Pages/Acquisizione.razor.cs @@ -42,6 +42,7 @@ namespace MP.INVE.Pages protected string descr { get; set; } = ""; protected string magInv { get; set; } = ""; + protected string link { get; set; } = ""; protected List? eleScansioni; //protected AnagUdcModel currUdc{ get; set; } = null!; @@ -59,13 +60,14 @@ namespace MP.INVE.Pages nScansioniTot = eleScansioni.Count(); // recupero dati della sessione di inventario... var currSessions = MIService.InventSessCurrList(); - var currInv = currSessions.Where(x=> x.InveSessID== sessionId).FirstOrDefault(); + var currInv = currSessions.Where(x => x.InveSessID == sessionId).FirstOrDefault(); if (currInv != null) { descr = currInv.Description; magInv = currInv.AnagMagNav.DescMag; } } + link = $"Cancellazione?idOpr={idOpr}&sessID={sessionId}"; } protected void saveScan(string newScan) { diff --git a/MP.INVE/Pages/Cancellazione.razor b/MP.INVE/Pages/Cancellazione.razor new file mode 100644 index 00000000..744564f8 --- /dev/null +++ b/MP.INVE/Pages/Cancellazione.razor @@ -0,0 +1,96 @@ +@page "/Cancellazione" + +@*
    +
    MP.INVE
    +
    + Cancellazione +
    +
    + +
    +
    + +
    +
    +
    Menu
    + +
    +
    + + +
    +
    *@ + +
    + +
    + + +@if (currScan != null) +{ +
    +
    + + Dati ultima scansione + +
    + #:@totScan +
    +
    +
    + +
    +
    +
    + Codice: +
    +
    + @currScan.ScanValue +
    +
    +
    +
    + Lotto: +
    +
    + @currScan.Lotto +
    +
    + +
    +
    + Articolo: +
    +
    + @currScan.CodArticolo +
    +
    +
    +
    + Quantità: +
    +
    + @Math.Round(currScan.Qty, 0) +
    +
    + +
    +
    + +
    + +
    +
    +} +else if (first) +{ +
    Eseguire scansione
    +} +else +{ +
    Nessuna scansione trovata
    +} diff --git a/MP.INVE/Pages/Cancellazione.razor.cs b/MP.INVE/Pages/Cancellazione.razor.cs new file mode 100644 index 00000000..dc501500 --- /dev/null +++ b/MP.INVE/Pages/Cancellazione.razor.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; +using MP.Data.DatabaseModels; +using MP.INVE.Data; +using Microsoft.AspNetCore.WebUtilities; + +namespace MP.INVE.Pages +{ + public partial class Cancellazione + { + [Inject] + MiDataService MIService { get; set; } = null!; + [Inject] + IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + private NavigationManager NavManager { get; set; } = null!; + + protected string rawScan { get; set; } = null!; + + protected ScanDataModel? currScan; + protected List? scanList; + protected bool first { get; set; } = false; + protected override async Task OnInitializedAsync() + { + first = true; + await Task.Delay(1); + var uri = NavManager.ToAbsoluteUri(NavManager.Uri); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("sessID", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOpr", out var _idOpr)) + { + sessID = int.Parse(_inveSessionId); + idOPr = _idOpr; + } + } + + protected int sessID { get; set; } = 0; + protected int totScan { get; set; } = 0; + protected string idOPr { get; set; } = ""; + + protected void saveScan(string newScan) + { + first = false; + if (!string.IsNullOrEmpty(newScan)) + { + rawScan = newScan; + scanList = MIService.ScanByValueSessionOpr(rawScan, sessID, idOPr); + currScan = scanList.FirstOrDefault(); + totScan = scanList.Count; + } + } + + protected async Task deleteScan(ScanDataModel scan) + { + await MIService.deleteScansione(scan); + NavManager.NavigateTo(NavManager.Uri, true); + } + + + private string CodUDC { get; set; } = null!; + } +} \ No newline at end of file diff --git a/MP.INVE/Pages/DeleteScan.razor b/MP.INVE/Pages/DeleteScan.razor new file mode 100644 index 00000000..7cb6eec6 --- /dev/null +++ b/MP.INVE/Pages/DeleteScan.razor @@ -0,0 +1,6 @@ +@page "/DeleteScan" + +

    DeleteScan

    + + + diff --git a/MP.INVE/Pages/DeleteScan.razor.cs b/MP.INVE/Pages/DeleteScan.razor.cs new file mode 100644 index 00000000..88ab056b --- /dev/null +++ b/MP.INVE/Pages/DeleteScan.razor.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; +using MP.Data.DatabaseModels; +using MP.INVE.Data; +using Microsoft.AspNetCore.WebUtilities; + +namespace MP.INVE.Pages +{ + public partial class DeleteScan + { + [Inject] + MiDataService MIService { get; set; } = null!; + [Inject] + NavigationManager NavManager { get; set; } = null!; + protected void saveScan(string newScan) + { + if (!string.IsNullOrEmpty(newScan)) + { + rawScan = newScan; + } + } + protected async Task deleteScan(ScanDataModel scan) + { + await MIService.deleteScansione(scan); + } + protected string rawScan { get; set; } = null!; + protected string idOpr { get; set; } = null!; + protected int sessionId { get; set; } = 0; + protected string magazzinoId { get; set; } = ""; + protected override async Task OnInitializedAsync() + { + await Task.Delay(1); + var uri = NavManager.ToAbsoluteUri(NavManager.Uri); + 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)) + { + idOpr = _matrOpr; + sessionId = int.Parse(_inveSessionId); + magazzinoId = _idMag; + } + } + } +} \ No newline at end of file diff --git a/MP.INVE/Pages/InveSession.razor b/MP.INVE/Pages/InveSession.razor index b3e6dd71..84685ce3 100644 --- a/MP.INVE/Pages/InveSession.razor +++ b/MP.INVE/Pages/InveSession.razor @@ -14,7 +14,7 @@
    - Concluse + Trasferite diff --git a/MP.INVE/Pages/Invio.razor b/MP.INVE/Pages/Invio.razor index c481ef41..972f1022 100644 --- a/MP.INVE/Pages/Invio.razor +++ b/MP.INVE/Pages/Invio.razor @@ -1,5 +1,125 @@ @page "/Invio" -

    Invio

    +@if (isLoading) +{ + +} +else +{ + + @if (sessione != null) + { +
    +
    +
    +

    Invio

    +
    +
    +
    +
    ID magazzino
    + + + + + + + + + + + + + + + + + + + + +
    ID sessioneDescrizioneMagazzinoDescrizione MagDurata
    + @sessione.InveSessID + + @sessione.Description + + @sessione.AnagMagNav.CodMag + + @sessione.AnagMagNav.DescMag + +
    +
    + @sessione.DtStart +
    +
    + >> +
    + @if (sessione.DtEnd != null) + { +
    + @sessione.DtEnd +
    + } + else + { +
    + In corso.. +
    + } +
    +
    +
    + + @if (sessione.DtEnd == null) + { + + } + else + { + + } + @if ((sessione.DtEnd != null) && (!sessione.Transferred)) + { + + + } + else + { + + + } +
    +
    + @if ((sessione.DtEnd == null) && (!sessione.Transferred)) + { +
    +

    Scansiona il codice per connetterti alla sessione @sessID

    +
    +
    +
    +
    + } + @if (mostra) + { + @if (sessID != 0) + { + + } + } + + + @*if (sessID != 0) + { + + }*@ + + } +} + + + diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index 9988e20a..51abbc87 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -17,15 +17,180 @@ using MP.INVE.Components; using Blazored.LocalStorage; using MP.Data.DTO; using MP.Data; +using MP.INVE.Data; +using MP.Data.DatabaseModels; +using Microsoft.AspNetCore.WebUtilities; namespace MP.INVE.Pages { public partial class Invio { - + [Inject] + public MiDataService MIService { get; set; } = null!; + + protected SelectInvioParams invioParams = new SelectInvioParams(); + protected SelectInveSessionParams sessParams = new SelectInveSessionParams(); + + private int totalCount + { + get => invioParams.TotCount; + set + { + if (invioParams.TotCount != value) + { + invioParams.TotCount = value; + } + } + } + private int numRecord + { + get => invioParams.NumRec; + set + { + if (invioParams.NumRec != value) + { + invioParams.NumRec = value; + } + } + } + private int currPage + { + get => invioParams.CurrPage; + set + { + if (invioParams.CurrPage != value) + { + invioParams.CurrPage = value; + } + } + } + private string idOperatore + { + get => sessParams.idOperatore; + set => sessParams.idOperatore = value; + } + private string authKey + { + get => sessParams.authKey; + set => sessParams.authKey = value; + } + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + protected bool mostra = false; + + protected void mostraDati() + { + mostra = true; + } + protected async void chiudiSessione(int sessID) + { + var closed = await MIService.CloseOpenSessione(sessID, true); + if (closed) + { + NavManager.NavigateTo(NavManager.Uri, true); + } + } + + protected async void apriSessione(int sessID) + { + var open = await MIService.CloseOpenSessione(sessID, false); + if (open) + { + NavManager.NavigateTo(NavManager.Uri, true); + } + } + protected async void trasfSessione(int sessID) + { + var trasf = await MIService.TransferSessione(sessID); + if (trasf) + { + NavManager.NavigateTo(NavManager.Uri, true); + } + } protected override async Task OnInitializedAsync() { - + + var uri = NavManager.ToAbsoluteUri(NavManager.Uri); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("sessID", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("codMag", out var _idMag)) + { + sessID = int.Parse(_inveSessionId); + codMag = _idMag; + } + + await reloadData(); + + } + protected async override Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + if (sessione != null) + { + await getId(); + if ((sessione.DtEnd == null) && (!sessione.Transferred)) + { + await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); + await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); + } + } + } + } + + [Inject] + private IConfiguration Configuration { get; set; } = null!; + [Inject] + private IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + private NavigationManager NavManager { get; set; } = null!; + [Inject] + private ILocalStorageService localStorage { get; set; } = null!; + protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; } + + + protected string rawCode + { + get + { + string answ = ""; + answ = $"{BaseUrlTab}IdSessione={sessID}&IdMag={codMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; + return answ; + } + } + + private InventorySessionModel? sessione; + protected bool isLoading = false; + + private async Task reloadData() + { + + sessione = null; + isLoading = true; + sessione = MIService.InventSessByID(sessID); + await Task.Delay(1); + isLoading = false; + } + + protected int sessID { get; set; } = 0; + protected string codMag { get; set; } = ""; + + + protected async Task getId() + { + OperatoreDTO local = new OperatoreDTO(); + local = await localStorage.GetItemAsync("MatrOpr"); + if (local != null) + { + idOperatore = local.MatrOpr.ToString(); + authKey = local.hashAuthKey; + } } } } \ No newline at end of file diff --git a/MP.INVE/Pages/Test.razor b/MP.INVE/Pages/Test.razor index d6e87d93..5ba4e00d 100644 --- a/MP.INVE/Pages/Test.razor +++ b/MP.INVE/Pages/Test.razor @@ -1,5 +1,5 @@ @page "/Test" -
    +@*
    UDC Già presente
    @@ -46,4 +46,50 @@
    -
    +
    *@ + + + + + + + + + + @if (elencoSCAN != null) + { + @foreach (var item in elencoSCAN) + { + + + + + + + } + } + +
    Oggetto
    +
    +
    + Cod: @item.ScanValue +
    +
    + Lotto: @item.Lotto +
    +
    +
    +
    + Art: @item.CodArticolo +
    +
    + Qty: @Math.Round(item.Qty, 0) +
    +
    +
    +
    + +
    +
    diff --git a/MP.INVE/Pages/Test.razor.cs b/MP.INVE/Pages/Test.razor.cs index dd9bd12c..45c98884 100644 --- a/MP.INVE/Pages/Test.razor.cs +++ b/MP.INVE/Pages/Test.razor.cs @@ -26,41 +26,52 @@ namespace MP.INVE.Pages [Inject] IJSRuntime JSRuntime { get; set; } = null!; - List? elencoUDC; - protected override async Task OnInitializedAsync() + protected string rawScan { get; set; } = null!; + + List? elencoSCAN; + protected override async Task OnParametersSetAsync() { await Task.Delay(1); - //elencoUDC = MIService.ElencoUDC().Take(4).ToList(); - - - - //await getId(); + } protected override async Task OnAfterRenderAsync(bool firstRender) { - if (firstRender) + //if (firstRender) + //{ + // await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); + // await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", "20MFI000000001"); + // await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{102}"); + // await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{102}", "20MSL000000002"); + // await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{103}"); + // await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{103}", "21MFI000000017"); + + // await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{104}"); + // await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{104}", "M200000019"); + + // await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{105}"); + // await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{105}", "M210000055"); + + // await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{106}"); + // await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{106}", "027407"); + + // await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{107}"); + // await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{107}", "ABCDE"); + //} + } + + protected void saveScan(string newScan) + { + if (!string.IsNullOrEmpty(newScan)) { - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", "20MFI000000001"); - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{102}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{102}", "20MSL000000002"); - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{103}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{103}", "21MFI000000017"); - - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{104}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{104}", "M200000019"); - - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{105}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{105}", "M210000055"); - - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{106}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{106}", "027407"); - - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{107}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{107}", "ABCDE"); + rawScan = newScan; + elencoSCAN = MIService.ScanList().Where(x => x.ScanValue == newScan).ToList(); } } + protected async Task deleteScan(ScanDataModel scan) + { + await MIService.deleteScansione(scan); + } private string CodUDC { get; set; } = null!; } } \ No newline at end of file diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 73878090..caaf0c73 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

    Versione: 6.16.2212.1218

    +

    Versione: 6.16.2212.1610


    Note di rilascio:
    • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index cf3500a2..31f86dce 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1218 +6.16.2212.1610 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index dea3958d..3e35ff8d 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1218 + 6.16.2212.1610 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.INVE/Shared/MainLayout.razor b/MP.INVE/Shared/MainLayout.razor index fea485f5..77213398 100644 --- a/MP.INVE/Shared/MainLayout.razor +++ b/MP.INVE/Shared/MainLayout.razor @@ -5,10 +5,9 @@ MP.INVE
      -
      + -
      diff --git a/MP.INVE/Shared/MainLayout.razor.css b/MP.INVE/Shared/MainLayout.razor.css index d5884352..fb110ad6 100644 --- a/MP.INVE/Shared/MainLayout.razor.css +++ b/MP.INVE/Shared/MainLayout.razor.css @@ -46,7 +46,9 @@ main { .top-row:not(.auth) { display: none; } - + .menuHide { + display: none; + } .top-row.auth { justify-content: space-between; } diff --git a/MP.INVE/Shared/NavMenu.razor b/MP.INVE/Shared/NavMenu.razor index 3b3f2869..544e4bd0 100644 --- a/MP.INVE/Shared/NavMenu.razor +++ b/MP.INVE/Shared/NavMenu.razor @@ -62,7 +62,7 @@
      *@ - *@ }