diff --git a/MP-TAB-SERV/Components/MachSel.razor b/MP-TAB-SERV/Components/MachSel.razor index f046721a..f24c8ec4 100644 --- a/MP-TAB-SERV/Components/MachSel.razor +++ b/MP-TAB-SERV/Components/MachSel.razor @@ -1,5 +1,10 @@ -

MachSel

- -@code { - +@if (false) +{ +

MachSel

+ + + + + + } diff --git a/MP-TAB-SERV/Components/MachSel.razor.cs b/MP-TAB-SERV/Components/MachSel.razor.cs new file mode 100644 index 00000000..09cbc1a8 --- /dev/null +++ b/MP-TAB-SERV/Components/MachSel.razor.cs @@ -0,0 +1,27 @@ +using global::Microsoft.AspNetCore.Components; +using MP.Data.DatabaseModels; + +namespace MP_TAB_SERV.Components +{ + public partial class MachSel + { + #region Public Properties + + [Parameter] + public MappaStatoExpl? RecMSE { get; set; } = null; + + [Parameter] + public EventCallback E_MachSel { get; set; } + + protected override async Task OnInitializedAsync() + { + // inizilamente riporto machcina corrente da MSE + if (RecMSE != null) + { + await E_MachSel.InvokeAsync(RecMSE?.IdxMacchina); + } + } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/PrintMag.razor.cs b/MP-TAB-SERV/Components/PrintMag.razor.cs index 5eed2454..2d7321d7 100644 --- a/MP-TAB-SERV/Components/PrintMag.razor.cs +++ b/MP-TAB-SERV/Components/PrintMag.razor.cs @@ -25,6 +25,17 @@ namespace MP_TAB_SERV.Components protected NavigationManager NavMan { get; set; } = null!; protected int QtaUdc { get; set; } = 0; + + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + + [Inject] + protected TabDataService TabDServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + protected async Task FixQtyUdc() { int answ = 1; @@ -44,16 +55,6 @@ namespace MP_TAB_SERV.Components QtaUdc = answ; } - [Inject] - protected SharedMemService SMServ { get; set; } = null!; - - [Inject] - protected TabDataService TabDServ { get; set; } = null!; - - #endregion Protected Properties - - #region Protected Methods - protected override async Task OnInitializedAsync() { await FixQtyUdc(); diff --git a/MP-TAB-SERV/Components/ProdConfirm.razor b/MP-TAB-SERV/Components/ProdConfirm.razor index 20285dcc..7810d6fb 100644 --- a/MP-TAB-SERV/Components/ProdConfirm.razor +++ b/MP-TAB-SERV/Components/ProdConfirm.razor @@ -1,93 +1,105 @@ -

ProdConfirm

- - +
-
-
-
- - MOSTRA Conferma - - MANCA ODL: conferma NON permessa - - - - +
+ @if (odlOk) + { +
+
+ +
+
-
- - - - - - + } + else + { +
MANCA ODL: conferma NON permessa
+ } + + +
+
+ @if (showInnov) + { +
+
+ Dati Incrementali +
+
+ + ultima conferma --> @dtReqUpdate.ToString() + +
+
+ + +
+
+
+
+ Pz Scarto + + + Pz Buoni +
+
+
+
+
+ @lblPz2RecScarto + + + @lblPz2RecBuoni +
+
+
+
+
+ @if (enablePzProdLasciati) + { + + + } + else + { + + } +
+
+ @if (showConfirm) + { + + } +
+
+ } +
+
+@if (isProcessing) +{ +
+
+
+   + ELABORAZIONE IN CORSO +   +
+
+
-
-
-
- Dati Incrementali -
-
- ultima conferma --> - -
-
- - -
-
-
- - + - -
-
- [B2] - + - [C2] -
-
-
- - -   -
-
- CONFERMA - USER INPUT -
-
-
-
-
-
- - -
-
-
-   - ELABORAZIONE IN CORSO -   -
-
-
-
-
-
-
-
+}
Dati Globali ODL
- Periodo ODL calcolato: - [dtInizio] + + Periodo ODL calcolato: + [dtInizio] - - [dtFine] + [dtFine] +
diff --git a/MP-TAB-SERV/Components/ProdConfirm.razor.cs b/MP-TAB-SERV/Components/ProdConfirm.razor.cs index 7f65c633..6288e2b0 100644 --- a/MP-TAB-SERV/Components/ProdConfirm.razor.cs +++ b/MP-TAB-SERV/Components/ProdConfirm.razor.cs @@ -1,5 +1,6 @@ using global::Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; +using MP.Data.Services; namespace MP_TAB_SERV.Components { @@ -7,26 +8,146 @@ namespace MP_TAB_SERV.Components { #region Public Properties + /// + /// Verifica ODL OK (ovvero caricato x macchina...) + /// + public bool odlOk + { + get => (RecMSE != null && RecMSE.IdxOdl > 0); + } + [Parameter] public MappaStatoExpl? RecMSE { get; set; } = null; #endregion Public Properties + #region Public Methods + /// + /// Aggiorno valori produzione alla data richiesta... + /// + /// + public async Task doUpdate() + { + datiProdAct = await TabDServ.StatoProdMacchina(IdxMaccSel, dtReqUpdate); + // aggiorno visualizzazione... + numPzProdotti = datiProdAct.PzTotODL; + numPz2Rec = datiProdAct.Pz2RecTot; + numPzScaConf = datiProdAct.PzConfScarto; + numPzBuoniConf = datiProdAct.PzConfBuoni; + numPzProdotti2Rec = datiProdAct.Pz2RecTot; + numPzScarto2Rec = datiProdAct.Pz2RecScarto; + dtInizio = RecMSE?.DataInizioOdl ?? DateTime.Today.AddMonths(-2); ; + dtFine = dtReqUpdate; + //reportUpdate(); + } + #endregion Public Methods -#if false + #region Protected Properties - #region Public Fields + protected string ConfTitle + { + get => showInnov ? "Nascondi Conferma" : "Mostra Conferma"; + } /// /// Dati produzioen rilevati /// - public DS_ProdTempi.StatoProdRow datiProdAct; + protected StatoProdModel? datiProdAct { get; set; } = null; - #endregion Public Fields + protected DateTime dtFine { get; set; } = DateTime.Today.AddMonths(-1); - #region Public Events + protected DateTime dtInizio { get; set; } = DateTime.Today.AddMonths(-2); + + protected int lblPz2RecBuoni + { + get => numPzProdotti2Rec - numPzScarto2Rec - numPzProdottiLasciati; + } + + //protected int lblPzBuo2Rec { get; set; } = 0; + protected int lblPz2RecScarto + { + get => numPzScarto2Rec; + } + + protected int numPz2Rec { get; set; } = 0; + + protected int numPzBuoniConf { get; set; } = 0; + + protected int numPzProdotti { get; set; } = 0; + + protected int numPzProdotti2Rec { get; set; } = 0; + + protected int numPzProdottiLasciati { get; set; } = 0; + + protected int numPzScaConf { get; set; } = 0; + + protected int numPzScarto2Rec { get; set; } = 0; + + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + + [Inject] + protected TabDataService TabDServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected override async Task OnInitializedAsync() + { + if (RecMSE != null) + { + IdxMaccSel = RecMSE.IdxMacchina; + enablePzProdLasciati = SMServ.GetConfBool("enablePzProdLasciati"); + await doUpdate(); + } + } + + protected async Task SalvaConfPz() + { + await Task.Delay(1); + } + + protected void setConfirmBtn(bool newVal) + { + showConfirm = newVal; + } + + protected void SetMacc(string selIdxMacc) + { + IdxMaccSel = selIdxMacc; + } + + /// + /// Cambio stato visibilità pannello e testo button + /// + protected void ToggleConfProd() + { + showInnov = !showInnov; + dtReqUpdate = DateTime.Now; + } + + #endregion Protected Methods + + #region Private Fields + + private bool enablePzProdLasciati = false; + + #endregion Private Fields + + #region Private Properties + + private DateTime dtReqUpdate { get; set; } = DateTime.Now; + private string IdxMaccSel { get; set; } = ""; + private bool isProcessing { get; set; } = false; + private bool showConfirm { get; set; } = true; + private bool showInnov { get; set; } = false; + + #endregion Private Properties + +#if false /// /// registrato nuovo valore @@ -43,10 +164,6 @@ namespace MP_TAB_SERV.Components /// public event EventHandler eh_reset; - #endregion Public Events - - #region Public Properties - /// /// restituisce css disabled SE odl NON OK... /// @@ -75,47 +192,6 @@ namespace MP_TAB_SERV.Components } } - /// - /// Verifica ODL OK (ovvero caricato x macchina...) - /// - public bool odlOk - { - get - { - bool answ = true; - // se ODL > 0 è ok!!! - answ = (idxOdl > 0); - return answ; - } - } - - #endregion Public Properties - - #region Public Methods - - /// - /// Aggiorno valori produzione alla data richiesta... - /// - /// - public void doUpdate() - { - datiProdAct = DataLayerObj.taStatoProd.GetData(idxMacchinaSel, dtReqUpdate)[0]; - // aggiorno visualizzazione... - numPzProdotti = datiProdAct.PzTotODL; - numPz2Rec = datiProdAct.Pz2RecTot; - numPzScaConf = datiProdAct.PzConfScarto; - numPzBuoniConf = datiProdAct.PzConfBuoni; - numPzProdotti2Rec = datiProdAct.Pz2RecTot; - numPzScarto2Rec = datiProdAct.Pz2RecScarto; - dtInizio = inizioOdl; - dtFine = dtReqUpdate; - reportUpdate(); - } - - #endregion Public Methods - - #region Protected Properties - protected DateTime dtFine { set @@ -258,22 +334,6 @@ namespace MP_TAB_SERV.Components } } - protected bool showInnov - { - get - { - return divInnovazioni.Visible; - } - set - { - divInnovazioni.Visible = value; - } - } - - #endregion Protected Properties - - #region Protected Methods - protected void ddlSubMacc_DataBound(object sender, EventArgs e) { // se ho in memoria un valore LO REIMPOSTO... @@ -331,17 +391,6 @@ namespace MP_TAB_SERV.Components doUpdate(); } - /// - /// cambio stato visibilità pannello e testo button - /// - /// - /// - protected void lbtShowConfProd_Click(object sender, EventArgs e) - { - showInnov = !showInnov; - switchBtnConferma(showInnov); - } - /// /// caricamento pagina /// @@ -400,10 +449,6 @@ namespace MP_TAB_SERV.Components idxOdl = answ; } - #endregion Protected Methods - - #region Private Methods - private void checkAll() { updateOdl(); @@ -556,8 +601,6 @@ namespace MP_TAB_SERV.Components lblDtRec.Text = dtReqUpdate.ToString(); } - #endregion Private Methods #endif - } } \ No newline at end of file diff --git a/MP-TAB-SERV/Pages/MachineDetail.razor.cs b/MP-TAB-SERV/Pages/MachineDetail.razor.cs index 97f26115..0db82aaf 100644 --- a/MP-TAB-SERV/Pages/MachineDetail.razor.cs +++ b/MP-TAB-SERV/Pages/MachineDetail.razor.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; using MP.Data.Services; +using NLog; namespace MP_TAB_SERV.Pages { @@ -36,6 +37,7 @@ namespace MP_TAB_SERV.Pages #region Private Fields + private static Logger Log = LogManager.GetCurrentClassLogger(); private List? CurrConfig = null; private bool enableSchedaTecnica = false; @@ -72,11 +74,18 @@ namespace MP_TAB_SERV.Pages { if (string.IsNullOrEmpty(IdxMacc)) { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) + try { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + IdxMacc = await MsgServ.IdxMaccGet(); + // recupero MSE macchina.... + if (!string.IsNullOrEmpty(IdxMacc)) + { + CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in ReloadData{Environment.NewLine}{exc}"); } } // recupero parametri configurazione... diff --git a/MP.Data/Controllers/MpIocController.cs b/MP.Data/Controllers/MpIocController.cs index 9b52a93a..3d5d48a8 100644 --- a/MP.Data/Controllers/MpIocController.cs +++ b/MP.Data/Controllers/MpIocController.cs @@ -324,14 +324,14 @@ namespace MP.Data.Controllers /// /// /// - public StatoProdModel StatoProdMacchina(string idxMacchina) + public PzProdModel PezziProdMacchina(string idxMacchina) { - StatoProdModel dbResult = new StatoProdModel(); + PzProdModel dbResult = new PzProdModel(); using (var dbCtx = new MoonProContext(_configuration)) { var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); dbResult = dbCtx - .DbSetStatoProd + .DbSetPzProd .FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina) .AsNoTracking() .FirstOrDefault(); diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 026de8ee..2084c785 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -1349,14 +1349,14 @@ namespace MP.Data.Controllers /// /// /// - public StatoProdModel StatoProdMacchina(string idxMacchina) + public PzProdModel PezziProdMacchina(string idxMacchina) { - StatoProdModel dbResult = new StatoProdModel(); + PzProdModel dbResult = new PzProdModel(); using (var dbCtx = new MoonProContext(_configuration)) { var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); dbResult = dbCtx - .DbSetStatoProd + .DbSetPzProd .FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina) .AsNoTracking() .FirstOrDefault(); diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index 51f78bb2..269337a1 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -113,6 +113,31 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Stato prod macchina (completo) + /// + /// + /// + /// + public StatoProdModel StatoProdMacchina(string idxMacchina, DateTime dtReq) + { + StatoProdModel dbResult = new StatoProdModel(); + using (var dbCtx = new MoonProContext(_configuration)) + { + var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); + var DataOra = new SqlParameter("@DataOra ", dtReq); + var rawData = dbCtx + .DbSetStatoProd + .FromSqlRaw("EXEC stp_StatoProd_getByMacchina @IdxMacchina, @DataOra ", IdxMacchina, DataOra) + .AsNoTracking() + .AsEnumerable() + .ToList(); + dbResult = rawData + .FirstOrDefault(); + } + return dbResult; + } + #endregion Public Methods #region Private Fields diff --git a/MP.Data/DatabaseModels/PzProdModel.cs b/MP.Data/DatabaseModels/PzProdModel.cs new file mode 100644 index 00000000..6904d7e5 --- /dev/null +++ b/MP.Data/DatabaseModels/PzProdModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Data.DatabaseModels +{ + public partial class PzProdModel + { + [Key] + public string idxMacchina { get; set; } = "NA"; + public int pezziNonConfermati { get; set; } = 0; + public DateTime DataFrom { get; set; } = DateTime.Now; + public DateTime DataTo { get; set; } = DateTime.Now; + } +} diff --git a/MP.Data/DatabaseModels/StatoProdModel.cs b/MP.Data/DatabaseModels/StatoProdModel.cs index 4072485e..18d6a72d 100644 --- a/MP.Data/DatabaseModels/StatoProdModel.cs +++ b/MP.Data/DatabaseModels/StatoProdModel.cs @@ -13,7 +13,13 @@ namespace MP.Data.DatabaseModels { [Key] public string idxMacchina { get; set; } = "NA"; - public int pezziNonConfermati { get; set; } = 0; + public int IdxOdl { get; set; } = 0; + public int PzTotODL { get; set; } = 0; + public int PzConfScarto { get; set; } = 0; + public int PzConfBuoni { get; set; } = 0; + public int PzRichODL { get; set; } = 0; + public int Pz2RecTot { get; set; } = 0; + public int Pz2RecScarto { get; set; } = 0; public DateTime DataFrom { get; set; } = DateTime.Now; public DateTime DataTo { get; set; } = DateTime.Now; } diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs index d1eae27d..76b41cff 100644 --- a/MP.Data/MoonProContext.cs +++ b/MP.Data/MoonProContext.cs @@ -52,7 +52,7 @@ namespace MP.Data public virtual DbSet DbSetFluxLog { get; set; } public virtual DbSet DbSetDossiers { get; set; } public virtual DbSet DbSetStatOdl { get; set; } - public virtual DbSet DbSetStatoProd { get; set; } + public virtual DbSet DbSetPzProd { get; set; } public virtual DbSet DbSetEvList { get; set; } public virtual DbSet DbSetVocabolario { get; set; } public virtual DbSet DbOperatori { get; set; } @@ -63,6 +63,7 @@ namespace MP.Data public virtual DbSet DbSetM2S { get; set; } public virtual DbSet DbSetSMI { get; set; } public virtual DbSet DbSetKeepAlive { get; set; } + public virtual DbSet DbSetStatoProd { get; set; } public virtual DbSet DbSetStAct { get; set; } public virtual DbSet DbSetStActRow { get; set; } @@ -72,6 +73,8 @@ namespace MP.Data public virtual DbSet DbSetStTemplate { get; set; } public virtual DbSet DbSetStTemplateRows { get; set; } + + #endregion Public Properties #region Private Methods diff --git a/MP.Data/Services/SharedMemService.cs b/MP.Data/Services/SharedMemService.cs index 75a69513..c94ce18d 100644 --- a/MP.Data/Services/SharedMemService.cs +++ b/MP.Data/Services/SharedMemService.cs @@ -122,6 +122,18 @@ namespace MP.Data.Services } return answ; } + public int GetConfInt(string chiave) + { + int answ = 0; + int.TryParse(GetConf(chiave), out answ); + return answ; + } + public bool GetConfBool(string chiave) + { + bool answ = false; + bool.TryParse(GetConf(chiave), out answ); + return answ; + } diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 233c01b0..463dedec 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -195,6 +195,44 @@ namespace MP.Data.Services return result; } + + /// + /// Stato prod macchina (completo) + /// + /// + /// + /// + public async Task StatoProdMacchina(string idxMacchina, DateTime dtReq) + { + // setup parametri costanti + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + StatoProdModel? result = new StatoProdModel(); + // cerco in redis... + string currKey = $"{redisBaseKey}:StatoProd:{idxMacchina}:{dtReq:HHmmss}"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject($"{rawData}"); + source = "REDIS"; + } + else + { + result = dbController.StatoProdMacchina(idxMacchina, dtReq); + // serializzp e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(currKey, rawData, UltraFastCache); + } + if (result == null) + { + result = new StatoProdModel(); + } + sw.Stop(); + Log.Debug($"StatoProdMacchina | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + #endregion Public Methods #region Protected Fields diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html index 820b80de..46297c1a 100644 --- a/MP.IOC/Resources/ChangeLog.html +++ b/MP.IOC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MP-IOC -

Versione: 6.16.2306.915

+

Versione: 6.16.2310.411


Note di rilascio:
  • diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt index ee06ffa8..e1d45667 100644 --- a/MP.IOC/Resources/VersNum.txt +++ b/MP.IOC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2306.915 +6.16.2310.411 diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml index 948afb34..b9a0b9da 100644 --- a/MP.IOC/Resources/manifest.xml +++ b/MP.IOC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2306.915 + 6.16.2310.411 https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html false diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index a0d77a0f..5c7a8ef1 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2310.308 + 6.16.2310.411 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 34b24383..9d10fe0a 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

    Versione: 6.16.2310.308

    +

    Versione: 6.16.2310.411


    Note di rilascio:
    • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index f08bb28c..e1d45667 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2310.308 +6.16.2310.411 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 812e04ab..e89e8d38 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2310.308 + 6.16.2310.411 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