From 77e7e39985f32835e1ecbd2912fae1adc19c2173 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 18 Oct 2022 08:41:12 +0200 Subject: [PATCH] Aggiornamento modifiche x chiudere ODL e creare nuovo --- MP.Data/Controllers/MpSpecController.cs | 436 +++++++++++++---------- MP.Data/DatabaseModels/EventListModel.cs | 47 +++ MP.Data/MoonProContext.cs | 7 + MP.SPEC/Components/ListPODL.razor.cs | 199 +++++------ MP.SPEC/Data/MpDataService.cs | 41 ++- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 9 files changed, 427 insertions(+), 311 deletions(-) create mode 100644 MP.Data/DatabaseModels/EventListModel.cs diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index eccef8b9..2e9cd40a 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -6,7 +6,6 @@ using NLog; using System; using System.Collections.Generic; using System.Linq; -using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; namespace MP.Data.Controllers @@ -99,6 +98,25 @@ namespace MP.Data.Controllers return ListValuesFilt("AnagArticoli", "Tipo"); } + /// + /// Elenco codice articoli che abbiano dati Dossier + /// + /// + public List ArticleWithDossier() + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetDossiers + .AsNoTracking() + .Select(i => i.OdlNav.CodArticolo) + .Distinct() + .ToList(); + } + return dbResult; + } + /// /// Eliminazione Record /// @@ -192,29 +210,6 @@ namespace MP.Data.Controllers return dbResult; } - /// - /// Statistiche ODL calcolate (da stored stp_STAT_ODL) - /// - /// - public async Task> StatOdl(int IdxOdl) - { - List dbResult = new List(); - if (IdxOdl > 0) - { - using (var dbCtx = new MoonProContext(_configuration)) - { - var IdxODL = new SqlParameter("@IdxODL", IdxOdl); - - dbResult = await dbCtx - .DbSetStatOdl - .FromSqlRaw("EXEC stp_STAT_ODL @IdxODL", IdxODL) - .AsNoTracking() - .ToListAsync(); - } - } - return dbResult; - } - /// /// Update Record /// @@ -443,6 +438,7 @@ namespace MP.Data.Controllers } return fatto; } + /// /// Elenco valori link (x home e navMenu laterale) /// @@ -452,6 +448,32 @@ namespace MP.Data.Controllers return ListLinkFilt("SpecLink"); } + /// + /// Aggiunta record EventList + /// + /// + /// + public async Task EvListInsert(EventListModel newRec) + { + bool fatto = false; + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + var currRec = dbCtx + .DbSetEvList + .Add(newRec); + await dbCtx.SaveChangesAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante EvListInsert{Environment.NewLine}{exc}"); + } + } + await Task.Delay(1); + return fatto; + } + /// /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione) /// @@ -598,25 +620,6 @@ namespace MP.Data.Controllers return dbResult; } - /// - /// Elenco codice articoli che abbiano dati Dossier - /// - /// - public List ArticleWithDossier() - { - List dbResult = new List(); - using (var dbCtx = new MoonProContext(_configuration)) - { - dbResult = dbCtx - .DbSetDossiers - .AsNoTracking() - .Select(i => i.OdlNav.CodArticolo) - .Distinct() - .ToList(); - } - return dbResult; - } - /// /// Elenco da tabella MappaStatoExpl /// @@ -637,6 +640,107 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Chiusura ODL con eventuale conferma pezzi + /// + /// idx odl da chiudere + /// idx macchina + /// matricola operatore + /// indica se confermare i pezzi prima di chiudere ODL + /// Conferma con rettifica (ev 121) x pezzi lasciati in macchina + /// Modo conferma produzione (0=periodo, 1=giorno, 2=turno) + /// + public async Task ODLClose(int idxOdl, string idxMacchina, int matrOpr, bool confPezzi, bool confRett, int modoConfProd) + { + bool fatto = false; + if (idxOdl > 0) + { + using (var dbCtx = new MoonProContext(_configuration)) + { + DateTime adesso = DateTime.Now; + // preparo i parametri + var IdxODL = new SqlParameter("@IdxODL", idxOdl); + var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); + + // FARE FIXME TODO !!! da valutare casi setup/autoconferma... +#if false + // controllo se HO pezzi da confermare... + var statoProd = StatoProdMacchina(idxMacchina); + if (statoProd.pezziNonConfermati < 1) + { } +#endif + + // se richiesto confermo produzione + if (confPezzi) + { + var MatrApp = new SqlParameter("@MatrApp", idxMacchina); + + /* ---------------------------------- + * CONFERMA PEZZI + * + * condizioni da verificare: + * - gestione rettifica (ev121) / pezzi da LASCIARE in macchina + * - conferma a zero pezzi (setup) oppure con i pezzi fatti e non ancora confermati + * + * + * + * */ + + // recupero i dati dei pezzi da confermare... con DbSetPzProd + exec + // stp_PzProd_getByMacchina 'SIMUL_01' + + // stp_ConfermaProduzCompletaFull + /* + * @idxMacchina NVARCHAR(50), + @MatrApp INT, + @dataFrom DATETIME, + @dataTo DATETIME, + @pezziConf INT, + @pezziLasciati INT, -- pezzi lasciati = evento 121 (-) pre conferma e (+) dopo --> da lasciare in macchina post conferma + @pezziScar INT = 0, -- pezzi scartati (registrati da 2016.11.20) DA INDICARE COME VALORE > 0!!! sennò faccio ABS... + @TipoConf INT = 0, -- Tipo intervallo conferma: 0 = periodo intero, 1 = per giorni, 2 = per turni + @DataOraApp DATETIME = NULL, -- di norma GETDATE() nel programma - serve per ricalcolo + @TestConferma BIT = 1 -- TestConferma : 1 = verifica conf. duplicata e inserisci in ElencoConfermeProd, 0 = nessuna verifica e inserimento ( per ricalcolo ) + */ + } + + // ora chiudo ODL + try + { + var dbResult = await dbCtx + .DbSetStatOdl + .FromSqlRaw("EXEC stp_ODL_fineProd @IdxODL, @IdxMacchina", IdxODL, IdxMacchina) + .AsNoTracking() + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ODLClose{Environment.NewLine}{exc}"); + } + } + } + return fatto; + } + + /// + /// Recupero odl data chiave + /// + /// + /// + /// + public ODLModel OdlGetByKey(int idxOdl) + { + ODLModel dbResult = new ODLModel(); + + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetODL + .FirstOrDefault(x => x.IdxOdl == idxOdl); + } + return dbResult; + } + /// /// Elenco parametri validi x una data macchina /// @@ -658,6 +762,55 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Avvio setup ODL da PODL + /// + /// + /// + /// + /// + /// + /// + public async Task PODL_startSetup(PODLModel editRec, int matrOpr, double tcRich, int pzPallet, string note) + { + ODLModel dbResult = new ODLModel(); + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + var currRec = dbCtx + .DbSetPODL + .Where(x => x.IdxPromessa == editRec.IdxPromessa) + .FirstOrDefault(); + if (currRec != null) + { + // eseguo stored attrezzaggio + var IdxPromessa = new SqlParameter("@idxPromessa", editRec.IdxPromessa); + var MatrOpr = new SqlParameter("@MatrOpr", matrOpr); + var IdxMacchina = new SqlParameter("@IdxMacchina", editRec.IdxMacchina); + var TCRichAttr = new SqlParameter("@TCRichAttr", tcRich); + var PzPallet = new SqlParameter("@PzPallet", pzPallet); + var Note = new SqlParameter("@Note", note); + var callResult = await dbCtx + .Database + .ExecuteSqlRawAsync("EXEC stp_ODL_inizioSetupPromessa @idxPromessa, @MatrOpr, @IdxMacchina @TCRichAttr, @PzPallet, @Note", IdxPromessa, MatrOpr, IdxMacchina, TCRichAttr, PzPallet, Note); + + // recupero info su ODL corrente + dbResult = await dbCtx + .DbSetODL + .Where(x => x.IdxMacchina == editRec.IdxMacchina && x.DataInizio != null && x.DataFine == null) + .FirstOrDefaultAsync(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante PODL_doSetup{Environment.NewLine}{exc}"); + } + } + await Task.Delay(1); + return dbResult; + } + /// /// Eliminazione Record /// @@ -733,160 +886,6 @@ namespace MP.Data.Controllers return fatto; } - - /// - /// Stato prod macchina - /// - /// - /// - public StatoProdModel StatoProdMacchina(string idxMacchina) - { - StatoProdModel dbResult = new StatoProdModel(); - using (var dbCtx = new MoonProContext(_configuration)) - { - var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); - dbResult = dbCtx - .DbSetStatoProd - .FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina) - .AsNoTracking() - .FirstOrDefault(); - } - return dbResult; - } - - - /// - /// Avvio setup ODL da PODL - /// - /// - /// - /// - /// - /// - /// - public async Task PODL_startSetup(PODLModel editRec, int matrOpr, double tcRich, int pzPallet, string note) - { - ODLModel dbResult = new ODLModel(); - using (var dbCtx = new MoonProContext(_configuration)) - { - try - { - var currRec = dbCtx - .DbSetPODL - .Where(x => x.IdxPromessa == editRec.IdxPromessa) - .FirstOrDefault(); - if (currRec != null) - { - // eseguo stored attrezzaggio - var IdxPromessa = new SqlParameter("@idxPromessa", editRec.IdxPromessa); - var MatrOpr = new SqlParameter("@MatrOpr", matrOpr); - var IdxMacchina = new SqlParameter("@IdxMacchina", editRec.IdxMacchina); - var TCRichAttr = new SqlParameter("@TCRichAttr", tcRich); - var PzPallet = new SqlParameter("@PzPallet", pzPallet); - var Note = new SqlParameter("@Note", note); - var callResult = await dbCtx - .Database - .ExecuteSqlRawAsync("EXEC stp_ODL_inizioSetupPromessa @idxPromessa, @MatrOpr, @IdxMacchina @TCRichAttr, @PzPallet, @Note", IdxPromessa, MatrOpr, IdxMacchina, TCRichAttr, PzPallet, Note); - - // recupero info su ODL corrente - dbResult = await dbCtx - .DbSetODL - .Where(x => x.IdxMacchina == editRec.IdxMacchina && x.DataInizio != null && x.DataFine == null) - .FirstOrDefaultAsync(); - } - } - catch (Exception exc) - { - Log.Error($"Eccezione durante PODL_doSetup{Environment.NewLine}{exc}"); - } - } - await Task.Delay(1); - return dbResult; - } - - /// - /// Chiusura ODL con eventuale conferma pezzi - /// - /// idx odl da chiudere - /// idx macchina - /// matricola operatore - /// indica se confermare i pezzi prima di chiudere ODL - /// Conferma con rettifica (ev 121) x pezzi lasciati in macchina - /// Modo conferma produzione (0=periodo, 1=giorno, 2=turno) - /// - public async Task ODLClose(int idxOdl, string idxMacchina, int matrOpr, bool confPezzi, bool confRett, int modoConfProd) - { - bool fatto = false; - if (idxOdl > 0) - { - using (var dbCtx = new MoonProContext(_configuration)) - { - DateTime adesso = DateTime.Now; - // preparo i parametri - var IdxODL = new SqlParameter("@IdxODL", idxOdl); - var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); - - // FARE FIXME TODO !!! - // da valutare casi setup/autoconferma... -#if false - // controllo se HO pezzi da confermare... - var statoProd = StatoProdMacchina(idxMacchina); - if (statoProd.pezziNonConfermati < 1) - { } -#endif - - // se richiesto confermo produzione - if (confPezzi) - { - var MatrApp = new SqlParameter("@MatrApp", idxMacchina); - - /* ---------------------------------- - * CONFERMA PEZZI - * - * condizioni da verificare: - * - gestione rettifica (ev121) / pezzi da LASCIARE in macchina - * - conferma a zero pezzi (setup) oppure con i pezzi fatti e non ancora confermati - * - * - * - * */ - - // recupero i dati dei pezzi da confermare... con DbSetPzProd + exec stp_PzProd_getByMacchina 'SIMUL_01' - - // stp_ConfermaProduzCompletaFull - /* - * @idxMacchina NVARCHAR(50), - @MatrApp INT, - @dataFrom DATETIME, - @dataTo DATETIME, - @pezziConf INT, - @pezziLasciati INT, -- pezzi lasciati = evento 121 (-) pre conferma e (+) dopo --> da lasciare in macchina post conferma - @pezziScar INT = 0, -- pezzi scartati (registrati da 2016.11.20) DA INDICARE COME VALORE > 0!!! sennò faccio ABS... - @TipoConf INT = 0, -- Tipo intervallo conferma: 0 = periodo intero, 1 = per giorni, 2 = per turni - @DataOraApp DATETIME = NULL, -- di norma GETDATE() nel programma - serve per ricalcolo - @TestConferma BIT = 1 -- TestConferma : 1 = verifica conf. duplicata e inserisci in ElencoConfermeProd, 0 = nessuna verifica e inserimento ( per ricalcolo ) - */ - } - - // ora chiudo ODL - try - { - var dbResult = await dbCtx - .DbSetStatOdl - .FromSqlRaw("EXEC stp_ODL_fineProd @IdxODL, @IdxMacchina", IdxODL, IdxMacchina) - .AsNoTracking() - .ToListAsync(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante ODLClose{Environment.NewLine}{exc}"); - } - } - } - return fatto; - } - - /// /// Annulla modifiche su una specifica entity (cancel update) /// @@ -912,6 +911,49 @@ namespace MP.Data.Controllers return answ; } + /// + /// Statistiche ODL calcolate (da stored stp_STAT_ODL) + /// + /// + public async Task> StatOdl(int IdxOdl) + { + List dbResult = new List(); + if (IdxOdl > 0) + { + using (var dbCtx = new MoonProContext(_configuration)) + { + var IdxODL = new SqlParameter("@IdxODL", IdxOdl); + + dbResult = await dbCtx + .DbSetStatOdl + .FromSqlRaw("EXEC stp_STAT_ODL @IdxODL", IdxODL) + .AsNoTracking() + .ToListAsync(); + } + } + return dbResult; + } + + /// + /// Stato prod macchina + /// + /// + /// + public StatoProdModel StatoProdMacchina(string idxMacchina) + { + StatoProdModel dbResult = new StatoProdModel(); + using (var dbCtx = new MoonProContext(_configuration)) + { + var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); + dbResult = dbCtx + .DbSetStatoProd + .FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina) + .AsNoTracking() + .FirstOrDefault(); + } + return dbResult; + } + #endregion Public Methods #region Private Fields diff --git a/MP.Data/DatabaseModels/EventListModel.cs b/MP.Data/DatabaseModels/EventListModel.cs new file mode 100644 index 00000000..fc9e4558 --- /dev/null +++ b/MP.Data/DatabaseModels/EventListModel.cs @@ -0,0 +1,47 @@ +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 +{ + [Table("EventList")] + public partial class EventListModel + { + #region Public Properties + + [MaxLength(50)] + public string IdxMacchina { get; set; } = "NA"; + public DateTime? InizioStato { get; set; } = DateTime.Now; + public int IdxTipo { get; set; } = 0; + + [MaxLength(50)] + public string CodArticolo { get; set; } = ""; + + [MaxLength(250)] + public string Value { get; set; } = ""; + + public int MatrOpr { get; set; } = 0; + + [MaxLength(20)] + public string pallet { get; set; } = ""; + + /// + /// Navigazione oggetto Machine + /// + [ForeignKey("IdxMacchina")] + public virtual Macchine MachineNav { get; set; } = null!; + /// + /// Navigazione oggetto Articolo + /// + [ForeignKey("CodArticolo")] + public virtual AnagArticoli ArticoloNav { get; set; } = null!; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs index 163b7600..99ddb37e 100644 --- a/MP.Data/MoonProContext.cs +++ b/MP.Data/MoonProContext.cs @@ -50,6 +50,7 @@ namespace MP.Data public virtual DbSet DbSetDossiers { get; set; } public virtual DbSet DbSetStatOdl { get; set; } public virtual DbSet DbSetStatoProd { get; set; } + public virtual DbSet DbSetEvList { get; set; } #endregion Public Properties @@ -300,6 +301,12 @@ namespace MP.Data }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.IdxMacchina, e.InizioStato, e.IdxTipo}); + + }); + OnModelCreatingPartial(modelBuilder); } diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index f30db27f..c6c46400 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -3,8 +3,6 @@ using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.SPEC.Data; using MP.SPEC.Services; -using System.Reflection.PortableExecutable; -using System.Text; namespace MP.SPEC.Components { @@ -86,83 +84,6 @@ namespace MP.SPEC.Components await RecordSel.InvokeAsync(newRec); } - protected async Task startOdl(PODLModel selRec) - { - if (selRec != null) - { - int idxEvento = 0; - string evMess = ""; - // verifico ancora NON ci sia ODL corrente/aperto - if (canStartOdl(selRec.IdxMacchina)) - { - await callStartSetup(selRec.IdxMacchina); - await Task.Delay(1); - // chiamo stored stp_ODL_inizioSetupPromessa e recupero ODL corrente - var newOdl = await MDService.POdlDoSetup(selRec); - if (newOdl != null) - { - // registro evento... - idxEvento = 2; - evMess = $"Registrata inizio produzione | PODL {selRec.IdxPromessa} | ODL {newOdl.IdxOdl}"; - processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl); - - - //aspetto 1 sec - - - // idxEv = 1 - - //// processo chiusura setup - //string evText = "Registrata inizio produzione per ODL {0}"; - //StringBuilder sb = new StringBuilder(); - //sb.AppendLine(String.Format(evText, idxODLStart)); - //processaEvento(idxMacchinaFix, idxEvento, sb.ToString(), idxODLStart); - - - - - // richiedo refresh su IOB-WIN: - // DataLayerObj.addTask4Machine(machine.IdxMacchinaSlave, taskType.setParameter, "ForceUpdate"); - - await callForceUpdate(selRec.IdxMacchina); - await Task.Delay(1); - await callForceUpdate(selRec.IdxMacchina); - await Task.Delay(1); - await callSyncDb(selRec.IdxMacchina); - await Task.Delay(1); - } - } - } - } - - - /// - /// processa evento richiesto - /// - /// - /// - /// - /// - private void processaEvento(string idxMacc, int idxEvento, string userMsg, int idxODL) - { - - // scrivo evento scriviRigaEventoBarcode - - // fixme todo !!! FARE - } - - /// - /// verifica se sia avviabile ODL x macchina - /// - /// - /// - private bool canStartOdl(string idxMacchina) - { - // fare!!! - bool answ = idxMacchina.Contains("BAG"); - return answ; - } - /// /// Eliminazione record selezionato (previa conferma) /// @@ -221,6 +142,46 @@ namespace MP.SPEC.Components await RecordSel.InvokeAsync(selRec); } + protected async Task startOdl(PODLModel selRec) + { + if (selRec != null) + { + int idxEvento = 0; + string evMess = ""; + // verifico ancora NON ci sia ODL corrente/aperto + if (canStartOdl(selRec.IdxMacchina)) + { + await callStartSetup(selRec.IdxMacchina); + await Task.Delay(1); + // chiamo stored stp_ODL_inizioSetupPromessa e recupero ODL corrente + var newOdl = await MDService.POdlDoSetup(selRec); + if (newOdl != null) + { + // registro evento... + idxEvento = 2; + evMess = $"Inizio Setup | PODL {selRec.IdxPromessa}"; + processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo); + + // aspetto 1 sec + await Task.Delay(1000); + + // registro inizio produzione + idxEvento = 2; + evMess = $"Registrata inizio Produzione | PODL {selRec.IdxPromessa} | ODL {newOdl.IdxOdl} | ART {newOdl.CodArticolo}"; + processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo); + + // chiamo task x IOB + await callForceUpdate(selRec.IdxMacchina); + await Task.Delay(1); + await callForceUpdate(selRec.IdxMacchina); + await Task.Delay(1); + await callSyncDb(selRec.IdxMacchina); + await Task.Delay(1); + } + } + } + } + protected async Task UpdateData() { currRecord = null; @@ -274,7 +235,6 @@ namespace MP.SPEC.Components #region Private Methods - /// /// Chiama metodo x chiedere sync DB /// @@ -287,26 +247,6 @@ namespace MP.SPEC.Components var response = await MpIoApiCall.callMpIoUrlGet(restUrl); } - - /// - /// Chiama metodo x chiedere sync DB - /// - /// - /// - private async Task callSyncDb(string IdxMacc) - { - // chiamo aggiunta task SyncDb... - await addTask2Exe(IdxMacc, "syncDbData", ""); -#if false - string idxMacc = selRec.IdxMacchina; - string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName=syncDbData&taskVal="; - var response = await MpIoApiCall.callMpIoUrlGet(restUrl); -#endif - } - - - - /// /// Chiama metodo x chiedere force Update /// @@ -329,6 +269,34 @@ namespace MP.SPEC.Components await addTask2Exe(IdxMacc, "startSetup", $"SPEC|TS:{DateTime.Now:yyMMddHHmmss}"); } + /// + /// Chiama metodo x chiedere sync DB + /// + /// + /// + private async Task callSyncDb(string IdxMacc) + { + // chiamo aggiunta task SyncDb... + await addTask2Exe(IdxMacc, "syncDbData", ""); +#if false + string idxMacc = selRec.IdxMacchina; + string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName=syncDbData&taskVal="; + var response = await MpIoApiCall.callMpIoUrlGet(restUrl); +#endif + } + + /// + /// verifica se sia avviabile ODL x macchina + /// + /// + /// + private bool canStartOdl(string idxMacchina) + { + // fare!!! + bool answ = idxMacchina.Contains("BAG"); + return answ; + } + private async void MessageService_EA_PageUpdated() { await reloadData(); @@ -345,6 +313,37 @@ namespace MP.SPEC.Components }); } + /// + /// processa evento richiesto + /// + /// + /// + /// + /// + private async void processaEvento(string idxMacc, int idxEvento, string userMsg, int idxODL, string codArticolo) + { + // se manca codart calcolo... + if (string.IsNullOrEmpty(codArticolo)) + { + var currOdl = await MDService.OdlGetByKey(idxODL); + codArticolo = currOdl.CodArticolo; + } + + // scrivo evento scriviRigaEventoBarcode + EventListModel newRec = new EventListModel() + { + IdxMacchina = idxMacc, + InizioStato = DateTime.Now, + IdxTipo = idxEvento, + CodArticolo = codArticolo, + MatrOpr = 0, + pallet = "", + Value = userMsg + }; + + await MDService.EvListInsert(newRec); + } + private async Task reloadData() { isLoading = true; diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index f110fcc0..75c9ce78 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -440,6 +440,16 @@ namespace MP.SPEC.Data return Task.FromResult(dbController.ElencoLink()); } + /// + /// Aggiunta record EventList + /// + /// + /// + public async Task EvListInsert(EventListModel newRec) + { + return await dbController.EvListInsert(newRec); + } + public async Task FlushRedisCache() { await Task.Delay(1); @@ -643,6 +653,17 @@ namespace MP.SPEC.Data return fatto; } + /// + /// Record ODL da chaive + /// + /// + public async Task OdlGetByKey(int IdxOdl) + { + await Task.Delay(1); + var dbResult = dbController.OdlGetByKey(IdxOdl); + return dbResult; + } + /// /// Elenco di tutti i parametri filtrati x macchina /// @@ -689,6 +710,16 @@ namespace MP.SPEC.Data return await dbController.PODLDeleteRecord(currRec); } + /// + /// Avvio fase setup per il record selezionato + /// + /// + /// + public async Task POdlDoSetup(PODLModel currRec) + { + return await dbController.PODL_startSetup(currRec, 0, 1, 1, ""); + } + /// /// Aggiornamento record selezionato /// @@ -699,16 +730,6 @@ namespace MP.SPEC.Data return await dbController.PODLUpdateRecord(currRec); } - /// - /// Avvio fase setup per il record selezionato - /// - /// - /// - public async Task POdlDoSetup(PODLModel currRec) - { - return await dbController.PODL_startSetup(currRec, 0, 1, 1, ""); ; - } - /// /// Statistiche ODL calcolate (da stored stp_STAT_ODL) /// diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 180e6d8f..dff9d1e3 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2210.1720 + 6.16.2210.1808 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 60b20b12..6223fb6c 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2210.1720

+

Versione: 6.16.2210.1808


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index fa8114d3..96c69795 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2210.1720 +6.16.2210.1808 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 49aabde3..c877fcf2 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2210.1720 + 6.16.2210.1808 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