From 4fda312aac7bfca7ba0351d5d01a890f67e5aeb3 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 3 Mar 2026 18:57:46 +0100 Subject: [PATCH] Avanzamento telemetria: - altri metodi tracciati - modifica json x prod - aggiunta Async vari --- GWMS.Data/Controllers/GWMSController.cs | 122 ++--- GWMS.UI/Components/CmpFooter.razor | 2 +- GWMS.UI/Components/CmpFooter.razor.cs | 14 +- GWMS.UI/Components/OrderAdminEditor.razor.cs | 4 +- GWMS.UI/Components/OrderLoad.razor.cs | 2 +- GWMS.UI/Components/OrderSupplierEditor.razor | 2 +- GWMS.UI/Components/OrderTranspEditor.razor | 2 +- GWMS.UI/Components/ParamEditor.razor.cs | 2 +- GWMS.UI/Components/ParamSendEditor.razor.cs | 2 +- GWMS.UI/Components/PlantEditor.razor.cs | 2 +- GWMS.UI/Components/PlantOverview.razor.cs | 2 +- GWMS.UI/Components/WeekPlanEditor.razor | 10 +- GWMS.UI/Controllers/IOBController.cs | 32 +- GWMS.UI/Controllers/PlantDataController.cs | 4 +- GWMS.UI/Controllers/PlantLogController.cs | 6 +- GWMS.UI/Data/GWMSDataService.cs | 469 +++++++++++++------ GWMS.UI/GWMS.UI.csproj | 2 +- GWMS.UI/Pages/AlarmsLog.razor.cs | 4 +- GWMS.UI/Pages/GasStation.razor.cs | 4 +- GWMS.UI/Pages/GasStationLoad.razor.cs | 4 +- GWMS.UI/Pages/Orders.razor.cs | 8 +- GWMS.UI/Pages/PlantAnalisys.razor.cs | 14 +- GWMS.UI/Pages/PlantParameters.razor.cs | 8 +- GWMS.UI/Pages/PlantSetup.razor.cs | 6 +- GWMS.UI/Pages/PlantStatus.razor.cs | 4 +- GWMS.UI/Pages/Suppliers.razor.cs | 8 +- GWMS.UI/Pages/Test.razor.cs | 2 +- GWMS.UI/Pages/Transporters.razor.cs | 8 +- GWMS.UI/Pages/UserAdmin.razor.cs | 14 +- GWMS.UI/Pages/WeekPlan.razor.cs | 8 +- GWMS.UI/appsettings.Production.json | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 34 files changed, 495 insertions(+), 284 deletions(-) diff --git a/GWMS.Data/Controllers/GWMSController.cs b/GWMS.Data/Controllers/GWMSController.cs index 78e830f..c2427bb 100644 --- a/GWMS.Data/Controllers/GWMSController.cs +++ b/GWMS.Data/Controllers/GWMSController.cs @@ -464,17 +464,17 @@ namespace GWMS.Data.Controllers return dbResult; } - public List GetWeekPlan() + public async Task> GetWeekPlanAsync() { List dbResult = new List(); using (GWMSContext localDbCtx = new GWMSContext(_configuration)) { - dbResult = localDbCtx - .DbSetPlantSupplWeekPlan - .Include(p => p.Plant) - .Include(s => s.Supplier) - .Include(t => t.Transporter) - .ToList(); + dbResult = await localDbCtx + .DbSetPlantSupplWeekPlan + .Include(p => p.Plant) + .Include(s => s.Supplier) + .Include(t => t.Transporter) + .ToListAsync(); } return dbResult; } @@ -511,17 +511,17 @@ namespace GWMS.Data.Controllers try { #endif - if (Item2Del != null) - { - var rec2del = await localDbCtx - .DbSetOrders - .Where(x => x.OrderId == Item2Del.OrderId) - .FirstOrDefaultAsync(); - localDbCtx - .DbSetOrders - .Remove(rec2del); - int numDone = await localDbCtx.SaveChangesAsync(); - done = numDone > 0; + if (Item2Del != null) + { + var rec2del = await localDbCtx + .DbSetOrders + .Where(x => x.OrderId == Item2Del.OrderId) + .FirstOrDefaultAsync(); + localDbCtx + .DbSetOrders + .Remove(rec2del); + int numDone = await localDbCtx.SaveChangesAsync(); + done = numDone > 0; } #if false } @@ -530,7 +530,7 @@ namespace GWMS.Data.Controllers Log.Error($"Eccezione in OrderDeleteAsync:{Environment.NewLine}{exc}"); } #endif - } + } return done; } @@ -548,18 +548,18 @@ namespace GWMS.Data.Controllers try { #endif - if (orderId > 0) - { - var rec2del = await localDbCtx - .DbSetOrders - .Where(x => x.OrderId == orderId) - .FirstOrDefaultAsync(); - localDbCtx - .DbSetOrders - .Remove(rec2del); - int numDone = await localDbCtx.SaveChangesAsync(); - done = numDone > 0; - } + if (orderId > 0) + { + var rec2del = await localDbCtx + .DbSetOrders + .Where(x => x.OrderId == orderId) + .FirstOrDefaultAsync(); + localDbCtx + .DbSetOrders + .Remove(rec2del); + int numDone = await localDbCtx.SaveChangesAsync(); + done = numDone > 0; + } #if false } catch (Exception exc) @@ -567,7 +567,7 @@ namespace GWMS.Data.Controllers Log.Error($"Eccezione in OrderDelete:{Environment.NewLine}{exc}"); } #endif - } + } return done; } @@ -1121,52 +1121,60 @@ namespace GWMS.Data.Controllers /// /// /// - public bool PlantUpdate(PlantDTO updItem) + public async Task PlantUpdateAsync(PlantDTO updItem) { bool done = false; using (GWMSContext localDbCtx = new GWMSContext(_configuration)) { +#if false try + { +#endif + PlantDetailModel currData = await localDbCtx + .DbSetPlant + .Where(x => x.PlantId == updItem.PlantId) + .FirstOrDefaultAsync(); + if (currData != null) { - PlantDetailModel currData = localDbCtx - .DbSetPlant - .Where(x => x.PlantId == updItem.PlantId) - .FirstOrDefault(); - if (currData != null) - { - // aggiorno valori - currData.LevelReorder = updItem.LevelReorder; - currData.LevelMax = updItem.LevelMax; - localDbCtx.Entry(currData).State = EntityState.Modified; - localDbCtx.SaveChanges(); - } - done = true; + // aggiorno valori + currData.LevelReorder = updItem.LevelReorder; + currData.LevelMax = updItem.LevelMax; + localDbCtx.Entry(currData).State = EntityState.Modified; + int numDone = await localDbCtx.SaveChangesAsync(); + done = numDone > 0; } +#if false + } catch (Exception exc) { - Log.Error($"Eccezione in PlantUpdate:{Environment.NewLine}{exc}"); - } + Log.Error($"Eccezione in PlantUpdateAsync:{Environment.NewLine}{exc}"); + } +#endif } return done; } - public bool RecordRebootLog(RebootLogModel newItem) + public async Task RecordRebootLogAsync(RebootLogModel newItem) { bool done = false; using (GWMSContext localDbCtx = new GWMSContext(_configuration)) { +#if false try - { - localDbCtx - .DbRebootLog - .Add(newItem); - localDbCtx.SaveChanges(); - done = true; + { +#endif + localDbCtx + .DbRebootLog + .Add(newItem); + int numRec = await localDbCtx.SaveChangesAsync(); + done = numRec > 0; +#if false } catch (Exception exc) { - Log.Error($"Eccezione durante RecordRebootLog{Environment.NewLine}{exc}"); - } + Log.Error($"Eccezione durante RecordRebootLogAsync{Environment.NewLine}{exc}"); + } +#endif } return done; } diff --git a/GWMS.UI/Components/CmpFooter.razor b/GWMS.UI/Components/CmpFooter.razor index 3c67a77..75e8b16 100644 --- a/GWMS.UI/Components/CmpFooter.razor +++ b/GWMS.UI/Components/CmpFooter.razor @@ -1,6 +1,6 @@ 
- GWMS v.@version + GWMS v.@version | Srv: @nodeId
@adesso diff --git a/GWMS.UI/Components/CmpFooter.razor.cs b/GWMS.UI/Components/CmpFooter.razor.cs index 37a22c6..91f194b 100644 --- a/GWMS.UI/Components/CmpFooter.razor.cs +++ b/GWMS.UI/Components/CmpFooter.razor.cs @@ -49,6 +49,8 @@ namespace GWMS.UI.Components protected DateTime adesso = DateTime.Now; + private string nodeId = Environment.MachineName; + #endregion Protected Fields #region Protected Methods @@ -57,10 +59,20 @@ namespace GWMS.UI.Components { var rawVers = typeof(Program).Assembly.GetName().Version; version = rawVers != null ? rawVers : new Version("0.0.0.0"); + nodeId = Environment.MachineName; +#if DEBUG + // nome completo... +#else + //Se non fosse develop --> prende gli ultimi 2 caratteri(es. "01") + if (nodeId.Length > 2) + { + nodeId = nodeId.Substring(nodeId.Length - 2); + } +#endif StartTimer(); } - #endregion Protected Methods +#endregion Protected Methods #region Private Fields diff --git a/GWMS.UI/Components/OrderAdminEditor.razor.cs b/GWMS.UI/Components/OrderAdminEditor.razor.cs index e15dcec..bff171c 100644 --- a/GWMS.UI/Components/OrderAdminEditor.razor.cs +++ b/GWMS.UI/Components/OrderAdminEditor.razor.cs @@ -95,8 +95,8 @@ namespace GWMS.UI.Components protected async Task ReloadAllData() { - suppList = await DataService.SuppliersGetAll(); - transpList = await DataService.TransportersGetAll(); + suppList = await DataService.SuppliersGetAllAsync(); + transpList = await DataService.TransportersGetAllAsync(); // vedere anche https://www.mikesdotnetting.com/article/340/working-with-query-strings-in-blazor var uri = NavManager.ToAbsoluteUri(NavManager.Uri); diff --git a/GWMS.UI/Components/OrderLoad.razor.cs b/GWMS.UI/Components/OrderLoad.razor.cs index de661b4..56fd7b8 100644 --- a/GWMS.UI/Components/OrderLoad.razor.cs +++ b/GWMS.UI/Components/OrderLoad.razor.cs @@ -205,7 +205,7 @@ namespace GWMS.UI.Components private async Task ReloadData() { - plantsData = await DataService.PlantDtoGetAll(); + plantsData = await DataService.PlantDtoGetAllAsync(); // recupero dato del plant corrente currPlantData = plantsData.Where(x => x.PlantId == PlantId).FirstOrDefault(); // solo se ho valore QR selezionato diff --git a/GWMS.UI/Components/OrderSupplierEditor.razor b/GWMS.UI/Components/OrderSupplierEditor.razor index 662f02f..abd15e5 100644 --- a/GWMS.UI/Components/OrderSupplierEditor.razor +++ b/GWMS.UI/Components/OrderSupplierEditor.razor @@ -158,7 +158,7 @@ protected async Task ReloadAllData() { - transpList = await DataService.TransportersGetAll(); + transpList = await DataService.TransportersGetAllAsync(); } } \ No newline at end of file diff --git a/GWMS.UI/Components/OrderTranspEditor.razor b/GWMS.UI/Components/OrderTranspEditor.razor index c84ba1e..1e6116f 100644 --- a/GWMS.UI/Components/OrderTranspEditor.razor +++ b/GWMS.UI/Components/OrderTranspEditor.razor @@ -111,7 +111,7 @@ protected async Task ReloadAllData() { - transpList = await DataService.TransportersGetAll(); + transpList = await DataService.TransportersGetAllAsync(); } } \ No newline at end of file diff --git a/GWMS.UI/Components/ParamEditor.razor.cs b/GWMS.UI/Components/ParamEditor.razor.cs index f69cf5e..bcda7ff 100644 --- a/GWMS.UI/Components/ParamEditor.razor.cs +++ b/GWMS.UI/Components/ParamEditor.razor.cs @@ -166,7 +166,7 @@ namespace GWMS.UI.Components if (_currItem != null) { - await DataService.updateMachineParameter(IdxMacchina, _currItem.uid, _currItem.reqValue); + await DataService.UpdateMachineParameterAsync(IdxMacchina, _currItem.uid, _currItem.reqValue); await DataUpdated.InvokeAsync(0); } else diff --git a/GWMS.UI/Components/ParamSendEditor.razor.cs b/GWMS.UI/Components/ParamSendEditor.razor.cs index e524c3a..95adbdd 100644 --- a/GWMS.UI/Components/ParamSendEditor.razor.cs +++ b/GWMS.UI/Components/ParamSendEditor.razor.cs @@ -57,7 +57,7 @@ namespace GWMS.UI.Components if (value) { // test set parametri + invio... - await DataService.ParamsSendCheck(); + await DataService.ParamsSendCheckAsync(); paramSent = true; } await ReloadData(); diff --git a/GWMS.UI/Components/PlantEditor.razor.cs b/GWMS.UI/Components/PlantEditor.razor.cs index 38ee567..6d81112 100644 --- a/GWMS.UI/Components/PlantEditor.razor.cs +++ b/GWMS.UI/Components/PlantEditor.razor.cs @@ -94,7 +94,7 @@ namespace GWMS.UI.Components { if (_currItem != null) { - await DataService.PlantUpdate(_currItem); + await DataService.PlantUpdateAsync(_currItem); await DataUpdated.InvokeAsync(0); } else diff --git a/GWMS.UI/Components/PlantOverview.razor.cs b/GWMS.UI/Components/PlantOverview.razor.cs index 1fe927f..9221d52 100644 --- a/GWMS.UI/Components/PlantOverview.razor.cs +++ b/GWMS.UI/Components/PlantOverview.razor.cs @@ -38,7 +38,7 @@ namespace GWMS.UI.Components DateStart = DateTime.Today.AddDays(-1), ShowClosed = false }; - PlantLevelDto = await DataService.PlantsAnalisysByFilt(plantLevFilt); + PlantLevelDto = await DataService.PlantsAnalisysByFiltAsync(plantLevFilt); // aggiunta delay o non riesce a disegnare int ChartWaitDelay = 150; diff --git a/GWMS.UI/Components/WeekPlanEditor.razor b/GWMS.UI/Components/WeekPlanEditor.razor index c149aa0..c9023f9 100644 --- a/GWMS.UI/Components/WeekPlanEditor.razor +++ b/GWMS.UI/Components/WeekPlanEditor.razor @@ -195,7 +195,7 @@ { if (_currItem != null) { - DataService.WeekPlanUpdate(_currItem); + DataService.WeekPlanUpdateAsync(_currItem); await DataUpdated.InvokeAsync(1); } else @@ -211,7 +211,7 @@ if (_currItem != null) { - DataService.WeekPlanDelete(_currItem); + DataService.WeekPlanDeleteAsync(_currItem); await DataUpdated.InvokeAsync(1); } else @@ -232,9 +232,9 @@ protected async Task ReloadAllData() { - PlantsList = await DataService.PlantsList(); - SuppliersList = await DataService.SuppliersGetAll(); - TransportersList = await DataService.TransportersGetAll(); + PlantsList = await DataService.PlantsListAsync(); + SuppliersList = await DataService.SuppliersGetAllAsync(); + TransportersList = await DataService.TransportersGetAllAsync(); } } \ No newline at end of file diff --git a/GWMS.UI/Controllers/IOBController.cs b/GWMS.UI/Controllers/IOBController.cs index 5016a89..c3e72f1 100644 --- a/GWMS.UI/Controllers/IOBController.cs +++ b/GWMS.UI/Controllers/IOBController.cs @@ -175,7 +175,7 @@ namespace GWMS.UI.Controllers } else { - var currPlant = await _DataService.PlantsGetByCode(id); + var currPlant = await _DataService.PlantsGetByCodeAsync(id); answ = (currPlant != null && currPlant.PlantId > 0) ? "OK" : "NO"; } return answ; @@ -292,7 +292,7 @@ namespace GWMS.UI.Controllers } // recupero plant! - var currPlant = await _DataService.PlantsGetByCode(id); + var currPlant = await _DataService.PlantsGetByCodeAsync(id); if (currPlant != null && currPlant.PlantId > 0) { // converto in plantLogModel... @@ -308,7 +308,7 @@ namespace GWMS.UI.Controllers List newData = new List(); newData.Add(newItem); // insert! - fatto = await _DataService.PlantLogInsert(newData); + fatto = await _DataService.PlantLogInsertAsync(newData); // effettuo SEMPRE verifica per ricalcolo ordini... await _DataService.checkLevels(); @@ -345,15 +345,15 @@ namespace GWMS.UI.Controllers if (rawData != null && !string.IsNullOrEmpty(id)) { // recupero plant! - var currPlant = await _DataService.PlantsGetByCode(id); + var currPlant = await _DataService.PlantsGetByCodeAsync(id); if (currPlant != null && currPlant.PlantId > 0) { // conversione dati List plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList(); Log.Debug($"flogJson | {id} | Convertiti {plData.Count} record"); // insert! - fatto = await _DataService.PlantLogInsert(plData); - Log.Debug($"flogJson | {id} | PlantLogInsert --> esito: {fatto}"); + fatto = await _DataService.PlantLogInsertAsync(plData); + Log.Debug($"flogJson | {id} | PlantLogInsertAsync --> esito: {fatto}"); // effettuo SEMPRE verifica per ricalcolo ordini... await _DataService.checkLevels(); @@ -378,7 +378,7 @@ namespace GWMS.UI.Controllers if (trovato.writable && string.IsNullOrEmpty(item.valore)) { taskType currTask = (taskType)Enum.Parse(typeof(taskType), trovato.uid); - await _DataService.addCheckTask4Machine(id, currTask, item.valore); + await _DataService.AddCheckTask4MachineAsync(id, currTask, item.valore); } } // altrimenti AGGIUNGO (READ ONLY)... @@ -398,10 +398,10 @@ namespace GWMS.UI.Controllers fatto = true; } // faccio upsert innovations! - await _DataService.upsertCurrObjItems(id, innovazioni); + await _DataService.UpsertCurrObjItemsAsync(id, innovazioni); // ultimo step: controllo invio quotidiano parametri gestiti (compreso validità parametri setup) - await _DataService.ParamsSendCheck(); + await _DataService.ParamsSendCheckAsync(); } catch (Exception exc) { @@ -805,7 +805,7 @@ namespace GWMS.UI.Controllers bool fatto = Enum.TryParse(taskName, out tName); if (fatto) { - await _DataService.remTask4Machine(id, tName); + await _DataService.RemTask4MachineAsync(id, tName); } else { @@ -852,7 +852,7 @@ namespace GWMS.UI.Controllers // se != null --> salvo! if (currMemMap != null) { - await _DataService.saveMemMap(id, currMemMap); + await _DataService.SaveMemMapAsync(id, currMemMap); answ = "OK"; } } @@ -880,7 +880,7 @@ namespace GWMS.UI.Controllers else { // recupero plant... - var currPlant = await _DataService.PlantsGetByCode(id); + var currPlant = await _DataService.PlantsGetByCodeAsync(id); string alarmDecoded = "-"; if (ActiveAlarms != null && ActiveAlarms.Count > 0) { @@ -907,7 +907,7 @@ namespace GWMS.UI.Controllers /// IP del Gateway /// [HttpGet("sendReboot")] - public string sendReboot(string idxMacchina, string mac) + public async Task sendReboot(string idxMacchina, string mac) { Log.Warn($"sendReboot | {idxMacchina} | {mac}"); string answ = ""; @@ -920,7 +920,7 @@ namespace GWMS.UI.Controllers Item = idxMacchina, Payload = mac }; - _DataService.RebootLogInsert(newItem); + await _DataService.RebootLogInsertAsync(newItem); answ = "OK"; } catch @@ -948,7 +948,7 @@ namespace GWMS.UI.Controllers // se != null --> salvo! if (currParams != null) { - await _DataService.setCurrObjItems(id, currParams); + await _DataService.SetCurrObjItemsAsync(id, currParams); answ = "OK"; } } @@ -1023,7 +1023,7 @@ namespace GWMS.UI.Controllers if (innovazioni != null) { // salvo - await _DataService.upsertCurrObjItems(id, innovazioni); + await _DataService.UpsertCurrObjItemsAsync(id, innovazioni); answ = "OK"; } } diff --git a/GWMS.UI/Controllers/PlantDataController.cs b/GWMS.UI/Controllers/PlantDataController.cs index cb21d37..5218180 100644 --- a/GWMS.UI/Controllers/PlantDataController.cs +++ b/GWMS.UI/Controllers/PlantDataController.cs @@ -56,7 +56,7 @@ namespace GWMS.UI.Controllers { Log.Debug("PlantData: Chiamata Get"); // serializzo i dati di PlantDTO dell'impianto richiesto - List ListRecords = await _DataService.PlantDtoGetAll(); + List ListRecords = await _DataService.PlantDtoGetAllAsync(); return ListRecords; } @@ -66,7 +66,7 @@ namespace GWMS.UI.Controllers { Log.Debug($"PlantData: Chiamata Get | id: {id}"); // serializzo i dati di PlantDTO dell'impianto richiesto - var ListRecords = await _DataService.PlantDtoGetAll(); + var ListRecords = await _DataService.PlantDtoGetAllAsync(); //seleziono plant... var SelRecords = ListRecords.Where(X => X.PlantId == id).FirstOrDefault(); return SelRecords; diff --git a/GWMS.UI/Controllers/PlantLogController.cs b/GWMS.UI/Controllers/PlantLogController.cs index 63af9fb..aaefff4 100644 --- a/GWMS.UI/Controllers/PlantLogController.cs +++ b/GWMS.UI/Controllers/PlantLogController.cs @@ -62,7 +62,7 @@ namespace GWMS.UI.Controllers DateTime limite = DateTime.Today.AddHours(dayHour).AddMinutes(dayMin); // serializzo i dati di PlantDTO dell'impianto richiesto - var ListRecords = await _DataService.PlantLogGetFilt(0, limite, 100); + var ListRecords = await _DataService.PlantLogGetFiltAsync(0, limite, 100); return ListRecords; } @@ -78,7 +78,7 @@ namespace GWMS.UI.Controllers DateTime limite = DateTime.Today.AddHours(dayHour).AddMinutes(dayMin); // serializzo i dati di PlantDTO dell'impianto richiesto - var ListRecords = await _DataService.PlantLogGetFilt(id, limite, 100); + var ListRecords = await _DataService.PlantLogGetFiltAsync(id, limite, 100); return ListRecords; } @@ -91,7 +91,7 @@ namespace GWMS.UI.Controllers // verifico ci sia valore if (newItems != null) { - fatto = await _DataService.PlantLogInsert(newItems); + fatto = await _DataService.PlantLogInsertAsync(newItems); } if (fatto) { diff --git a/GWMS.UI/Data/GWMSDataService.cs b/GWMS.UI/Data/GWMSDataService.cs index 8a1abc9..1400522 100644 --- a/GWMS.UI/Data/GWMSDataService.cs +++ b/GWMS.UI/Data/GWMSDataService.cs @@ -91,14 +91,14 @@ namespace GWMS.UI.Data /// /// /// - public async Task addCheckTask4Machine(string idxMacchina, taskType taskKey, string taskVal) + public async Task AddCheckTask4MachineAsync(string idxMacchina, taskType taskKey, string taskVal) { bool answ = false; - using var activity = ActivitySource.StartActivity("addCheckTask4Machine"); + using var activity = ActivitySource.StartActivity("AddCheckTask4MachineAsync"); activity?.SetTag("iob.code", idxMacchina); activity?.SetTag("iob.task", $"{taskKey}"); string currHash = exeTaskHash(idxMacchina); - Log.Info($"addCheckTask4Machine idxMacchina: {idxMacchina} | taskKey: {taskKey} | taskVal: {taskVal}"); + Log.Info($"AddCheckTask4MachineAsync idxMacchina: {idxMacchina} | taskKey: {taskKey} | taskVal: {taskVal}"); try { Dictionary savedTask = await mSavedTaskMacchina(idxMacchina); @@ -122,7 +122,7 @@ namespace GWMS.UI.Data } catch (Exception exc) { - string exMsg = $"Errore in addCheckTask4Machine | idxMacchina: {idxMacchina} | taskKey: {taskKey} | taskVal: {taskVal}"; + string exMsg = $"Eccezione in AddCheckTask4MachineAsync | idxMacchina: {idxMacchina} | taskKey: {taskKey} | taskVal: {taskVal}"; Log.Error($"{exMsg}{Environment.NewLine}{exc}"); // traccio errore activity?.SetStatus(ActivityStatusCode.Error, exc.Message); @@ -257,7 +257,7 @@ namespace GWMS.UI.Data string emailBody = ""; StringBuilder sb = new StringBuilder(); - List allPlants = await PlantDtoGetAll(); + List allPlants = await PlantDtoGetAllAsync(); var currPlant = allPlants.Where(x => x.PlantId == newItem.PlantId).FirstOrDefault(); // inizio a comporre email @@ -278,11 +278,11 @@ namespace GWMS.UI.Data System.Security.Claims.Claim suppClaim = new System.Security.Claims.Claim("PlantId", $"{newItem.PlantId}"); // recupero elenco users associati al PLANT.... - var rawUserList = UserDataGetFilt("").Result; + var rawUserList = UserDataGetFiltAsync("").Result; var plantUserList = rawUserList .Where(x => x.Roles.Contains("User")) .ToList(); - //var plantList = await PlantDtoGetAll(); + //var plantList = await PlantDtoGetAllAsync(); var userListSupp = plantUserList .Where(x => x.Claims.Where(c => c.Type == "PlantId" && c.Value == $"{newItem.PlantId}").Count() > 0) .ToList(); @@ -790,22 +790,22 @@ namespace GWMS.UI.Data return result; } - public async Task OrderGetById(int OrderId) + public async Task OrderGetByIdAsync(int OrderId) { - using var activity = ActivitySource.StartActivity("OrderGetById"); + using var activity = ActivitySource.StartActivity("OrderGetByIdAsync"); activity?.SetTag("order.ID", OrderId); string source = "DB"; OrderModel result = new OrderModel(); result = await dbController.GetOrderByIdAsync(OrderId); activity?.SetTag("data.source", source); activity?.Stop(); - LogTrace($"OrderGetById | {source} | {activity?.Duration.TotalMilliseconds} ms"); + LogTrace($"OrderGetByIdAsync | {source} | {activity?.Duration.TotalMilliseconds} ms"); return result; } - public async Task> OrdersGetFilt(SelectOrderData CurrFilter) + public async Task> OrdersGetFiltAsync(SelectOrderData CurrFilter) { - using var activity = ActivitySource.StartActivity("OrdersGetFilt"); + using var activity = ActivitySource.StartActivity("OrdersGetFiltAsync"); activity?.SetTag("param.dtStart", CurrFilter.DateStart); activity?.SetTag("param.dtEnd", CurrFilter.DateEnd); activity?.SetTag("param.closed", CurrFilter.ShowClosed); @@ -816,7 +816,7 @@ namespace GWMS.UI.Data activity?.SetTag("data.source", source); activity?.SetTag("result.count", result.Count); activity?.Stop(); - LogTrace($"OrdersGetFilt | {source} | {activity?.Duration.TotalMilliseconds} ms"); + LogTrace($"OrdersGetFiltAsync | {source} | {activity?.Duration.TotalMilliseconds} ms"); return await Task.FromResult(result); } @@ -825,9 +825,9 @@ namespace GWMS.UI.Data /// /// /// - public async Task> OrdersGetOpen(int PlantId) + public async Task> OrdersGetOpenAsync(int PlantId) { - using var activity = ActivitySource.StartActivity("OrdersGetOpen"); + using var activity = ActivitySource.StartActivity("OrdersGetOpenAsync"); activity?.SetTag("param.PlantId", PlantId); string source = "DB"; List result = new List(); @@ -835,7 +835,7 @@ namespace GWMS.UI.Data activity?.SetTag("data.source", source); activity?.SetTag("result.count", result.Count); activity?.Stop(); - LogTrace($"OrdersGetOpen | {source} | {activity?.Duration.TotalMilliseconds} ms"); + LogTrace($"OrdersGetOpenAsync | {source} | {activity?.Duration.TotalMilliseconds} ms"); return result; } @@ -1104,6 +1104,9 @@ namespace GWMS.UI.Data })); } } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"ParamSetUpdateAsync | {source} | {activity?.Duration.TotalMilliseconds} ms"); return done; } @@ -1111,9 +1114,11 @@ namespace GWMS.UI.Data /// Effettua verifica parametri da inviare ed eventualmente invia /// /// - public async Task ParamsSendCheck() + public async Task ParamsSendCheckAsync() { bool answ = false; + using var activity = ActivitySource.StartActivity("ParamsSendCheckAsync"); + string source = "REDIS"; string cacheKey = mHash("ParamSend:List"); // prima di tutto invalido cache dei parametri... await ExecFlushRedisPattern(cacheKey); @@ -1127,11 +1132,11 @@ namespace GWMS.UI.Data { foreach (var item in activeParams) { - await ParamsSetCheck(item.PlantId, item.ParamUid); + await ParamsSetCheckAsync(item.PlantId, item.ParamUid); // recupero valore... var newVal = await ParamSetCalcValAsync(item.PlantId, item.ParamUid); // registro richiesta - bool fatto = await updateMachineParameter(item.PlantId, item.ParamUid, $"{newVal:N3}"); + bool fatto = await UpdateMachineParameterAsync(item.PlantId, item.ParamUid, $"{newVal:N3}"); // registro nuovo veto if (fatto) { @@ -1148,6 +1153,9 @@ namespace GWMS.UI.Data // alla fine di nuovo invalido cache dei parametri... await ExecFlushRedisPattern(cacheKey); + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"ParamsSendCheckAsync | {source} | {activity?.Duration.TotalMilliseconds} ms"); return answ; } @@ -1156,9 +1164,13 @@ namespace GWMS.UI.Data /// ed 1 passato x interpolare) /// /// - public async Task ParamsSetCheck(int PlantId, string ParamUid) + public async Task ParamsSetCheckAsync(int PlantId, string ParamUid) { bool answ = false; + using var activity = ActivitySource.StartActivity("ParamsSetCheckAsync"); + string source = "REDIS"; + activity?.SetTag("param.PlantId", PlantId); + activity?.SetTag("param.ParamUid", ParamUid); // elenco parametri set... List ListRecords = await ParamSetGetFiltAsync(PlantId, ParamUid); // per invecchiare DEVONO essere almeno 2 @@ -1177,12 +1189,16 @@ namespace GWMS.UI.Data } answ = true; } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"ParamsSetCheckAsync | {source} | {activity?.Duration.TotalMilliseconds} ms"); return answ; } - public async Task> PlantDtoGetAll() + public async Task> PlantDtoGetAllAsync() { - using var activity = ActivitySource.StartActivity("PlantDtoGetAll"); + using var activity = ActivitySource.StartActivity("PlantDtoGetAllAsync"); + string source = "DB"; List result = new List(); string cacheVetoKey = mHash("PLANTS:VetoReadDto"); string rawData; @@ -1202,7 +1218,7 @@ namespace GWMS.UI.Data } else { - Log.Debug($"Veto attivo per PlantDtoGetAll: salto!"); + Log.Debug($"Veto attivo per PlantDtoGetAllAsync: salto!"); // controllo se ci sia semaforo lettura rawData = await redisDb.StringGetAsync(cacheVetoKey); // attesa random 1...5 sec @@ -1219,7 +1235,6 @@ namespace GWMS.UI.Data Stopwatch sw = new Stopwatch(); sw.Start(); #endif - string source = "DB"; rawData = await redisDb.StringGetAsync(cacheKey); if (!string.IsNullOrEmpty(rawData)) { @@ -1243,29 +1258,34 @@ namespace GWMS.UI.Data activity?.SetTag("data.source", source); activity?.SetTag("result.count", result.Count); activity?.Stop(); - LogTrace($"PlantDtoGetAll | {source} | {activity?.Duration.TotalMilliseconds}ms"); + LogTrace($"PlantDtoGetAllAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return result; } - public async Task PlantDtoGetByCode(string PlantCode) + public async Task PlantDtoGetByCodeAsync(string PlantCode) { + using var activity = ActivitySource.StartActivity("PlantDtoGetByCodeAsync"); + string source = "REDIS"; + activity?.SetTag("param.PlantCode", PlantCode); PlantDTO answ = new PlantDTO(); - var ListRecords = await PlantDtoGetAll(); + var ListRecords = await PlantDtoGetAllAsync(); var found = ListRecords.Where(x => x.PlantCode == PlantCode).FirstOrDefault(); if (found != null) { answ = found; } - return await Task.FromResult(answ); + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"PlantDtoGetByCodeAsync | {source} | {activity?.Duration.TotalMilliseconds} ms"); + return answ; } - public async Task> PlantLogGetFilt(int PlantId, DateTime DtMaxDate, int numRec) + public async Task> PlantLogGetFiltAsync(int PlantId, DateTime DtMaxDate, int numRec) { + using var activity = ActivitySource.StartActivity("PlantLogGetFiltAsync"); string source = "DB"; - List dbResult = new List(); + List result = new List(); string cacheKey = mHash($"PLANTS:LOGS:{PlantId}:{DtMaxDate:yyyyMMddHHmm}:{numRec}"); - Stopwatch sw = new Stopwatch(); - sw.Start(); string rawData = ""; rawData = await redisDb.StringGetAsync(cacheKey); if (!string.IsNullOrEmpty(rawData)) @@ -1274,26 +1294,30 @@ namespace GWMS.UI.Data var tempResult = JsonConvert.DeserializeObject>(rawData); if (tempResult == null) { - dbResult = new List(); + result = new List(); } else { - dbResult = tempResult; + result = tempResult; } } else { - dbResult = dbController.GetPlantLog(PlantId, DtMaxDate, numRec); - rawData = JsonConvert.SerializeObject(dbResult); + result = dbController.GetPlantLog(PlantId, DtMaxDate, numRec); + rawData = JsonConvert.SerializeObject(result); await redisDb.StringSetAsync(cacheKey, rawData, LongCache); } - sw.Stop(); - Log.Debug($"PlantLogGetFilt | {source} | {sw.ElapsedMilliseconds} ms"); - return dbResult; + activity?.SetTag("data.source", source); + activity?.SetTag("result.count", result.Count); + activity?.Stop(); + LogTrace($"PlantLogGetFiltAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return result; } - public async Task PlantLogInsert(List newItems) + public async Task PlantLogInsertAsync(List newItems) { + using var activity = ActivitySource.StartActivity("PlantLogInsertAsync"); + string source = "DB+REDIS"; bool fatto = false; // init valori int IntervalMin = 60; @@ -1348,77 +1372,92 @@ namespace GWMS.UI.Data // invalido i vari valori in cache await ExecFlushRedisPattern(mHash($"PLANTS:LastFlux:{PlantId}")); await ExecFlushRedisPattern(mHash("PLANTS:ListDTO")); - Log.Debug($"PlantLogInsert | PlantId: {PlantId} | Completato insert {item2insert.Count} rec"); + Log.Debug($"PlantLogInsertAsync | PlantId: {PlantId} | Completato insert {item2insert.Count} rec"); } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"PlantLogInsertAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); // restituisco return fatto; } - public async Task> PlantsAnalisysByFilt(SelectOrderData CurrFilter) + public async Task> PlantsAnalisysByFiltAsync(SelectOrderData CurrFilter) { - List dbResult = new List(); + using var activity = ActivitySource.StartActivity("PlantsAnalisysByFiltAsync"); + string source = "DB"; + activity?.SetTag("param.PlantId", CurrFilter.PlantId); + activity?.SetTag("param.DateStart", CurrFilter.DateStart); + activity?.SetTag("param.DateEnd", CurrFilter.DateEnd); + activity?.SetTag("param.Closed", CurrFilter.ShowClosed); + List result = new List(); string cacheKey = mHash($"PLANTS:LevelSum:{CurrFilter.PlantId}:{CurrFilter.DateStart:yyMMdd}:{CurrFilter.DateEnd:yyMMdd}"); string rawData; - Stopwatch sw = new Stopwatch(); - sw.Start(); - string readSource = "DB"; rawData = await redisDb.StringGetAsync(cacheKey); if (!string.IsNullOrEmpty(rawData)) { - readSource = "REDIS"; + source = "REDIS"; var tempResult = JsonConvert.DeserializeObject>(rawData); if (tempResult == null) { - dbResult = new List(); + result = new List(); } else { - dbResult = tempResult; + result = tempResult; } } else { - dbResult = dbController.GetPlantLevSumDto(CurrFilter.PlantId, CurrFilter.DateStart, CurrFilter.DateEnd); - rawData = JsonConvert.SerializeObject(dbResult); + result = dbController.GetPlantLevSumDto(CurrFilter.PlantId, CurrFilter.DateStart, CurrFilter.DateEnd); + rawData = JsonConvert.SerializeObject(result); await redisDb.StringSetAsync(cacheKey, rawData, UltraLongCache); } - sw.Stop(); - Log.Debug($"PlantsAnalisysByFilt | {readSource} | {sw.ElapsedMilliseconds} ms"); - return await Task.FromResult(dbResult); + activity?.SetTag("data.source", source); + activity?.SetTag("result.count", result.Count); + activity?.Stop(); + LogTrace($"PlantsAnalisysByFiltAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return result; } - public async Task PlantsAnalisysReset(SelectOrderData CurrFilter) + public async Task PlantsAnalisysResetAsync(SelectOrderData CurrFilter) { + using var activity = ActivitySource.StartActivity("PlantsAnalisysResetAsync"); + string source = "REDIS"; bool answ = false; string cacheKey = mHash($"PLANTS:LevelSum:{CurrFilter.PlantId}:{CurrFilter.DateStart:yyMMdd}:{CurrFilter.DateEnd:yyMMdd}"); await ExecFlushRedisPattern(cacheKey); answ = true; - return await Task.FromResult(answ); + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"PlantsAnalisysResetAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return answ; } - public async Task PlantsGetByCode(string PlantCode) + public async Task PlantsGetByCodeAsync(string PlantCode) { + using var activity = ActivitySource.StartActivity("PlantsGetByCodeAsync"); + activity?.SetTag("param.PlantCode", PlantCode); + string source = "REDIS"; PlantDetailModel answ = new PlantDetailModel(); - var ListRecords = await PlantsList(); + var ListRecords = await PlantsListAsync(); var found = ListRecords.Where(x => x.PlantCode == PlantCode).FirstOrDefault(); if (found != null) { answ = found; } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"PlantsGetByCodeAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return await Task.FromResult(answ); } - public async Task> PlantsList() + public async Task> PlantsListAsync() { - using var activity = ActivitySource.StartActivity("PlantsList"); - string source = "DB"; + using var activity = ActivitySource.StartActivity("PlantsListAsync"); + string source = "REDIS"; List result = new List(); string cacheKey = mHash("PLANTS:ListModel"); -#if false - Stopwatch sw = new Stopwatch(); - sw.Start(); -#endif string rawData; rawData = await redisDb.StringGetAsync(cacheKey); if (!string.IsNullOrEmpty(rawData)) @@ -1440,40 +1479,69 @@ namespace GWMS.UI.Data rawData = JsonConvert.SerializeObject(result); await redisDb.StringSetAsync(cacheKey, rawData, UltraLongCache); } -#if false - sw.Stop(); - Log.Debug($"PlantsList | {source} | {sw.ElapsedMilliseconds} ms"); -#endif activity?.SetTag("data.source", source); activity?.SetTag("result.count", result.Count); activity?.Stop(); - LogTrace($"PlantsList | {source} | {activity?.Duration.TotalMilliseconds}ms"); + LogTrace($"PlantsListAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return await Task.FromResult(result); } - public async Task PlantUpdate(PlantDTO currItem) + public async Task PlantUpdateAsync(PlantDTO currItem) { + using var activity = ActivitySource.StartActivity("PlantUpdateAsync"); + activity?.SetTag("param.PlantId", currItem.PlantId); + activity?.SetTag("param.PlantCode", currItem.PlantCode); + string source = "DB+REDIS"; bool done = false; try { - done = dbController.PlantUpdate(currItem); + done = await dbController.PlantUpdateAsync(currItem); await FlushRedisCache(); } catch (Exception exc) { - Log.Error($"Eccezione in PlantUpdate:{Environment.NewLine}{exc}"); + string exMsg = $"Eccezione in PlantUpdateAsync | PlantId: {currItem.PlantId} | PlantCode: {currItem.PlantCode} | LevelAct: {currItem.LevelAct}"; + Log.Error($"{exMsg}{Environment.NewLine}{exc}"); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } - return await Task.FromResult(done); + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"PlantUpdateAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return done; } - public void RebootLogInsert(RebootLogModel newItem) + public async Task RebootLogInsertAsync(RebootLogModel newItem) { + bool done = false; + using var activity = ActivitySource.StartActivity("RebootLogInsertAsync"); + string source = "DB"; + activity?.SetTag("param.Item", newItem.Item); try { - dbController.RecordRebootLog(newItem); + done= await dbController.RecordRebootLogAsync(newItem); } - catch - { } + catch (Exception exc) + { + string exMsg = $"Eccezione in RebootLogInsertAsync"; + Log.Error($"{exMsg}{Environment.NewLine}{exc}"); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); + } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"RebootLogInsertAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return done; } /// @@ -1482,9 +1550,13 @@ namespace GWMS.UI.Data /// /// /// - public async Task remObjItem(string idxMacchina, objItem item2rem) + public async Task RemObjItemAsync(string idxMacchina, objItem item2rem) { bool answ = false; + using var activity = ActivitySource.StartActivity("RemObjItemAsync"); + string source = "REDIS"; + activity?.SetTag("param.idxMacchina", idxMacchina); + activity?.SetTag("param.obj", item2rem.name); if (item2rem != null) { string cacheKey = currParametersHash(idxMacchina); @@ -1506,6 +1578,9 @@ namespace GWMS.UI.Data await redisDb.StringSetAsync(cacheKey, rawData); } } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"RemObjItemAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return answ; } @@ -1515,9 +1590,13 @@ namespace GWMS.UI.Data /// /// /// - public async Task remOptPar4Machine(string idxMacchina, string taskKey) + public async Task RemOptPar4MachineAsync(string idxMacchina, string taskKey) { bool answ = false; + using var activity = ActivitySource.StartActivity("RemOptPar4MachineAsync"); + string source = "REDIS"; + activity?.SetTag("param.idxMacchina", idxMacchina); + activity?.SetTag("param.taskKey", taskKey); string currHash = optParHash(idxMacchina); try { @@ -1530,8 +1609,19 @@ namespace GWMS.UI.Data } catch (Exception exc) { - Log.Error($"Errore in remOptPar4Machine | idxMacchina: {idxMacchina} | taskKey: {taskKey}{Environment.NewLine}{exc}"); + string exMsg = $"Eccezione in RemOptPar4MachineAsync | idxMacchina: {idxMacchina} | taskKey: {taskKey}"; + Log.Error($"{exMsg}{Environment.NewLine}{exc}"); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"RemOptPar4MachineAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return answ; } @@ -1541,9 +1631,13 @@ namespace GWMS.UI.Data /// /// /// - public async Task remTask4Machine(string idxMacchina, taskType taskKey) + public async Task RemTask4MachineAsync(string idxMacchina, taskType taskKey) { bool answ = false; + using var activity = ActivitySource.StartActivity("RemTask4MachineAsync"); + string source = "REDIS"; + activity?.SetTag("param.idxMacchina", idxMacchina); + activity?.SetTag("param.taskKey", taskKey); string currHash = exeTaskHash(idxMacchina); try { @@ -1561,8 +1655,19 @@ namespace GWMS.UI.Data } catch (Exception exc) { - Log.Error($"Errore in remTask4Machine | idxMacchina: {idxMacchina} | taskKey: {taskKey}{Environment.NewLine}{exc}"); + string exMsg = $"Eccezione in RemOptPar4MachineAsync | idxMacchina: {idxMacchina} | taskKey: {taskKey}"; + Log.Error($"{exMsg}{Environment.NewLine}{exc}"); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"RemTask4MachineAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return answ; } @@ -1572,14 +1677,17 @@ namespace GWMS.UI.Data } /// - /// salva la conf di memoria della amcchina in redis + /// salva la conf di memoria della macchina in redis /// /// /// /// - public async Task saveMemMap(string idxMacchina, plcMemMap currMap) + public async Task SaveMemMapAsync(string idxMacchina, plcMemMap currMap) { bool answ = false; + using var activity = ActivitySource.StartActivity("SaveMemMapAsync"); + string source = "REDIS"; + activity?.SetTag("param.idxMacchina", idxMacchina); if (currMap != null) { string currHash = currMamMapHash(idxMacchina); @@ -1588,6 +1696,9 @@ namespace GWMS.UI.Data await redisDb.StringSetAsync(currHash, rawData); answ = true; } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"SaveMemMapAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return answ; } @@ -1597,9 +1708,13 @@ namespace GWMS.UI.Data /// /// /// - public async Task setCurrObjItems(string idxMacchina, List currValues) + public async Task SetCurrObjItemsAsync(string idxMacchina, List currValues) { bool answ = false; + using var activity = ActivitySource.StartActivity("SetCurrObjItemsAsync"); + string source = "REDIS"; + activity?.SetTag("param.idxMacchina", idxMacchina); + activity?.SetTag("param.numRec", currValues.Count); taskType currTask = taskType.nihil; if (currValues != null) { @@ -1620,62 +1735,79 @@ namespace GWMS.UI.Data if (Enum.IsDefined(typeof(taskType), currTask)) { currTask = (taskType)Enum.Parse(typeof(taskType), item.uid); - await addCheckTask4Machine(idxMacchina, currTask, item.value); + await AddCheckTask4MachineAsync(idxMacchina, currTask, item.value); } } } } answ = true; } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"SetCurrObjItemsAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return answ; } - public async Task> SuppliersGetAll() + public async Task> SuppliersGetAllAsync() { + using var activity = ActivitySource.StartActivity("SuppliersGetAllAsync"); string source = "DB"; - List dbResult = new List(); + List result = new List(); string cacheKey = mHash("SUPPL:List"); - Stopwatch sw = new Stopwatch(); - sw.Start(); string rawData; rawData = await redisDb.StringGetAsync(cacheKey); if (!string.IsNullOrEmpty(rawData)) { source = "REDIS"; - dbResult = JsonConvert.DeserializeObject>(rawData); + result = JsonConvert.DeserializeObject>(rawData); } else { - dbResult = dbController.GetSuppliers(); - rawData = JsonConvert.SerializeObject(dbResult); + result = dbController.GetSuppliers(); + rawData = JsonConvert.SerializeObject(result); await redisDb.StringSetAsync(cacheKey, rawData, UltraLongCache); } - sw.Stop(); - Log.Debug($"SuppliersGetAll | {source} | {sw.ElapsedMilliseconds} ms"); - return dbResult; + activity?.SetTag("data.source", source); + activity?.SetTag("result.count", result.Count); + activity?.Stop(); + LogTrace($"SuppliersGetAllAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return result; } - public async Task TestSendEmail(string destEmail, string oggetto, string corpo) + public async Task TestSendEmailAsync(string destEmail, string oggetto, string corpo) { bool answ = false; + using var activity = ActivitySource.StartActivity("TestSendEmailAsync"); + string source = "SMTP"; try { await _emailSender.SendEmailAsync(destEmail, oggetto, corpo); answ = true; } - catch - { } - + catch (Exception exc) + { + string exMsg = $"Eccezione in TestSendEmailAsync | destEmail: {destEmail} | oggetto: {oggetto}"; + Log.Error($"{exMsg}{Environment.NewLine}{exc}"); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); + } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"TestSendEmailAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return answ; } - public async Task> TransportersGetAll() + public async Task> TransportersGetAllAsync() { + using var activity = ActivitySource.StartActivity("TransportersGetAllAsync"); string source = "DB"; - List dbResult = new List(); + List result = new List(); string cacheKey = mHash($"TRANSP:List"); - Stopwatch sw = new Stopwatch(); - sw.Start(); string rawData; rawData = await redisDb.StringGetAsync(cacheKey); if (!string.IsNullOrEmpty(rawData)) @@ -1684,22 +1816,24 @@ namespace GWMS.UI.Data var tempResult = JsonConvert.DeserializeObject>(rawData); if (tempResult == null) { - dbResult = new List(); + result = new List(); } else { - dbResult = tempResult; + result = tempResult; } } else { - dbResult = dbController.GetTransporters(); - rawData = JsonConvert.SerializeObject(dbResult); + result = dbController.GetTransporters(); + rawData = JsonConvert.SerializeObject(result); await redisDb.StringSetAsync(cacheKey, rawData, UltraLongCache); } - sw.Stop(); - Log.Debug($"TransportersGetAll | {source} | {sw.ElapsedMilliseconds} ms"); - return dbResult; + activity?.SetTag("data.source", source); + activity?.SetTag("result.count", result.Count); + activity?.Stop(); + LogTrace($"TransportersGetAllAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return result; } /// @@ -1709,17 +1843,24 @@ namespace GWMS.UI.Data /// Parametro macchina come definito in file json /// /// - public async Task updateMachineParameter(int PlantId, string Original_uid, string reqValue) + public async Task UpdateMachineParameterAsync(int PlantId, string Original_uid, string reqValue) { bool fatto = false; - var plantList = await PlantDtoGetAll(); + using var activity = ActivitySource.StartActivity("UpdateMachineParameterAsync"); + activity?.SetTag("param.PlantId", PlantId); + activity?.SetTag("param.Original_uid", Original_uid); + string source = "SRV"; + var plantList = await PlantDtoGetAllAsync(); var currPlant = plantList .Where(x => x.PlantId == PlantId) .FirstOrDefault(); if (currPlant != null) { - fatto = await updateMachineParameter(currPlant.PlantCode, Original_uid, reqValue); + fatto = await UpdateMachineParameterAsync(currPlant.PlantCode, Original_uid, reqValue); } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"UpdateMachineParameterAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return fatto; } @@ -1730,9 +1871,13 @@ namespace GWMS.UI.Data /// Parametro macchina come definito in file json /// /// - public async Task updateMachineParameter(string idxMacchina, string Original_uid, string reqValue) + public async Task UpdateMachineParameterAsync(string idxMacchina, string Original_uid, string reqValue) { bool answ = false; + using var activity = ActivitySource.StartActivity("UpdateMachineParameterAsync"); + activity?.SetTag("param.idxMacchina", idxMacchina); + activity?.SetTag("param.Original_uid", Original_uid); + string source = "SRV"; // recupero items... List dcList = await getCurrObjItems(idxMacchina); List list2Update = new List(); @@ -1752,7 +1897,7 @@ namespace GWMS.UI.Data trovato.reqValue = reqValue; trovato.lastRequest = DateTime.Now; list2Update.Add(trovato); - await upsertCurrObjItems(idxMacchina, list2Update); + await UpsertCurrObjItemsAsync(idxMacchina, list2Update); // accodo in Task2Exe la richiesta di processing await addTask4Machine(idxMacchina, taskType.setParameter, trovato.uid); @@ -1765,6 +1910,9 @@ namespace GWMS.UI.Data answ = true; } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"UpdateMachineParameterAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return answ; } @@ -1774,9 +1922,13 @@ namespace GWMS.UI.Data /// /// /// - public async Task upsertCurrObjItems(string idxMacchina, List innovations) + public async Task UpsertCurrObjItemsAsync(string idxMacchina, List innovations) { bool answ = false; + using var activity = ActivitySource.StartActivity("UpsertCurrObjItemsAsync"); + activity?.SetTag("param.idxMacchina", idxMacchina); + activity?.SetTag("param.numInnov", innovations.Count); + string source = "REDIS"; if (innovations != null) { string currHash = currParametersHash(idxMacchina); @@ -1789,11 +1941,17 @@ namespace GWMS.UI.Data string rawData = JsonConvert.SerializeObject(innovations); await redisDb.StringSetAsync(currHash, rawData); } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"UpsertCurrObjItemsAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return answ; } - public async Task> UserDataGetFilt(string searchVal) + public async Task> UserDataGetFiltAsync(string searchVal) { + using var activity = ActivitySource.StartActivity("UserDataGetFiltAsync"); + activity?.SetTag("param.searchVal", searchVal); + string source = "USR"; // Collezione utenti List RawList = new List(); List UsersList = new List(); @@ -1830,11 +1988,18 @@ namespace GWMS.UI.Data }; UsersList.Add(newItem); } - return await Task.FromResult(UsersList); + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"UserDataGetFiltAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return UsersList; } - public async void WeekPlanDelete(WeekPlanModel currItem) + public async void WeekPlanDeleteAsync(WeekPlanModel currItem) { + using var activity = ActivitySource.StartActivity("WeekPlanDeleteAsync"); + activity?.SetTag("param.PlantId", currItem.PlantId); + activity?.SetTag("param.WeekPlanId", currItem.WeekPlanId); + string source = "DB+REDIS"; try { //dbController.ResetController(); @@ -1842,26 +2007,40 @@ namespace GWMS.UI.Data string cacheKey = mHash($"WEEKPLAN:List"); await ExecFlushRedisPattern(cacheKey); } - catch + catch (Exception exc) { + string exMsg = $"Eccezione in WeekPlanDeleteAsync | PlantId: {currItem.PlantId} | WeekPlanId: {currItem.WeekPlanId}"; + Log.Error($"{exMsg}{Environment.NewLine}{exc}"); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"WeekPlanDeleteAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); } - public async Task> WeekPlanGet() + public async Task> WeekPlanGetAsync() { - List dbResult = new List(); - - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - dbResult = dbController.GetWeekPlan(); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms"); - return await Task.FromResult(dbResult); + using var activity = ActivitySource.StartActivity("WeekPlanGetAsync"); + string source = "DB"; + List result = new List(); + result = await dbController.GetWeekPlanAsync(); + activity?.SetTag("data.source", source); + activity?.SetTag("result.count", result.Count); + activity?.Stop(); + LogTrace($"WeekPlanGetAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); + return result; } - public async void WeekPlanUpdate(WeekPlanModel currItem) + public async void WeekPlanUpdateAsync(WeekPlanModel currItem) { + using var activity = ActivitySource.StartActivity("WeekPlanUpdateAsync"); + string source = "DB+REDIS"; try { //dbController.ResetController(); @@ -1869,9 +2048,21 @@ namespace GWMS.UI.Data string cacheKey = $"WEEKPLAN:List"; await ExecFlushRedisPattern(cacheKey); } - catch + catch (Exception exc) { + string exMsg = $"Eccezione in WeekPlanUpdateAsync | PlantId: {currItem.PlantId} | WeekPlanId: {currItem.WeekPlanId}"; + Log.Error($"{exMsg}{Environment.NewLine}{exc}"); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } + activity?.SetTag("data.source", source); + activity?.Stop(); + LogTrace($"WeekPlanUpdateAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); } #endregion Public Methods @@ -1909,12 +2100,12 @@ namespace GWMS.UI.Data int transporterId = 1; double qtyOrd = 0; // faccio ciclo x tutti gli impianti - List currPlantData = await PlantDtoGetAll(); - List fullWeekPlan = WeekPlanGet().Result; + List currPlantData = await PlantDtoGetAllAsync(); + List fullWeekPlan = WeekPlanGetAsync().Result; foreach (var item in currPlantData) { // recupero ordini x il plant - var listOrderOpen = await OrdersGetOpen(item.PlantId); + var listOrderOpen = await OrdersGetOpenAsync(item.PlantId); // verifico NON ci siano duplicati, var list2del = listOrderOpen @@ -1964,7 +2155,7 @@ namespace GWMS.UI.Data dbController.OrderInsert(NewOrders); // recupero elenco users associati al FORNITORE.... - var rawUserList = UserDataGetFilt("").Result; + var rawUserList = UserDataGetFiltAsync("").Result; var supplList = rawUserList .Where(x => x.Roles.Contains("ExtUser")) .ToList(); @@ -1975,7 +2166,7 @@ namespace GWMS.UI.Data // recupero NUOVI ordini x plant... foreach (var plant in currPlantData) { - var newOrderOpen = await OrdersGetOpen(plant.PlantId); + var newOrderOpen = await OrdersGetOpenAsync(plant.PlantId); string emailDest = ""; string emailSubj = ""; string emailBody = ""; diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index bf047a4..0531fa7 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2603.0315 + 1.0.2603.0318 95c9f021-52d1-4390-a670-5810b7b777b0 true true diff --git a/GWMS.UI/Pages/AlarmsLog.razor.cs b/GWMS.UI/Pages/AlarmsLog.razor.cs index a281015..20b846e 100644 --- a/GWMS.UI/Pages/AlarmsLog.razor.cs +++ b/GWMS.UI/Pages/AlarmsLog.razor.cs @@ -229,11 +229,11 @@ namespace GWMS.UI.Pages // se ho un plantId valido --> altrimenti non abilitato if (ClaimPlantId == 0) { - PlantsList = await DataService.PlantDtoGetAll(); + PlantsList = await DataService.PlantDtoGetAllAsync(); } else if (ClaimPlantId > 0) { - var rawData = await DataService.PlantDtoGetAll(); + var rawData = await DataService.PlantDtoGetAllAsync(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); SelPlantId = ClaimPlantId; } diff --git a/GWMS.UI/Pages/GasStation.razor.cs b/GWMS.UI/Pages/GasStation.razor.cs index 1ba11a2..a099bc4 100644 --- a/GWMS.UI/Pages/GasStation.razor.cs +++ b/GWMS.UI/Pages/GasStation.razor.cs @@ -279,11 +279,11 @@ namespace GWMS.UI.Pages // se ho un plantId valido --> altrimenti non abilitato if (ClaimPlantId == 0) { - PlantsList = await DataService.PlantsList(); + PlantsList = await DataService.PlantsListAsync(); } else if (ClaimPlantId > 0) { - var rawData = await DataService.PlantsList(); + var rawData = await DataService.PlantsListAsync(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); SelPlantId = ClaimPlantId; } diff --git a/GWMS.UI/Pages/GasStationLoad.razor.cs b/GWMS.UI/Pages/GasStationLoad.razor.cs index c3d1dec..e59bee0 100644 --- a/GWMS.UI/Pages/GasStationLoad.razor.cs +++ b/GWMS.UI/Pages/GasStationLoad.razor.cs @@ -179,11 +179,11 @@ namespace GWMS.UI.Pages // se ho un plantId valido --> altrimenti non abilitato if (ClaimPlantId == 0) { - PlantsList = await DataService.PlantsList(); + PlantsList = await DataService.PlantsListAsync(); } else if (ClaimPlantId > 0) { - var rawData = await DataService.PlantsList(); + var rawData = await DataService.PlantsListAsync(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); SelPlantId = ClaimPlantId; } diff --git a/GWMS.UI/Pages/Orders.razor.cs b/GWMS.UI/Pages/Orders.razor.cs index e95aca2..b5c651c 100644 --- a/GWMS.UI/Pages/Orders.razor.cs +++ b/GWMS.UI/Pages/Orders.razor.cs @@ -268,7 +268,7 @@ namespace GWMS.UI.Pages private async Task ReloadData() { isLoading = true; - SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter); + SearchRecords = await DataService.OrdersGetFiltAsync(AppMService.Order_Filter); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); isLoading = false; } @@ -334,17 +334,17 @@ namespace GWMS.UI.Pages protected async Task ReloadAllData() { isLoading = true; - SuppliersList = await DataService.SuppliersGetAll(); + SuppliersList = await DataService.SuppliersGetAllAsync(); PlantsList = null; await GetClaimsData(); // se ho un plantId valido --> altrimenti non abilitato if (ClaimPlantId == 0) { - PlantsList = await DataService.PlantsList(); + PlantsList = await DataService.PlantsListAsync(); } else if (ClaimPlantId > 0) { - var rawData = await DataService.PlantsList(); + var rawData = await DataService.PlantsListAsync(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); SelPlantId = ClaimPlantId; } diff --git a/GWMS.UI/Pages/PlantAnalisys.razor.cs b/GWMS.UI/Pages/PlantAnalisys.razor.cs index ec93e96..40946be 100644 --- a/GWMS.UI/Pages/PlantAnalisys.razor.cs +++ b/GWMS.UI/Pages/PlantAnalisys.razor.cs @@ -269,7 +269,7 @@ namespace GWMS.UI.Pages ListRecords = null; try { - SearchRecords = await DataService.PlantsAnalisysByFilt(AppMService.Order_Filter); + SearchRecords = await DataService.PlantsAnalisysByFiltAsync(AppMService.Order_Filter); SearchRecords = SearchRecords.Where(x => x.HasRefill || !_ShowOnlyRefill).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); } @@ -321,7 +321,7 @@ namespace GWMS.UI.Pages // rileggo dal DB il record corrente... var pUpd = Task.Run(async () => { - currRecord = await DataService.OrderGetById(selRecord.OrdersIds.FirstOrDefault()); + currRecord = await DataService.OrderGetByIdAsync(selRecord.OrdersIds.FirstOrDefault()); }); pUpd.Wait(); } @@ -348,17 +348,17 @@ namespace GWMS.UI.Pages protected async Task ReloadAllData() { isLoading = true; - SuppliersList = await DataService.SuppliersGetAll(); + SuppliersList = await DataService.SuppliersGetAllAsync(); PlantsList = null; await GetClaimsData(); // se ho un plantId valido --> altrimenti non abilitato if (ClaimPlantId == 0) { - PlantsList = await DataService.PlantDtoGetAll(); + PlantsList = await DataService.PlantDtoGetAllAsync(); } else if (ClaimPlantId > 0) { - var rawData = await DataService.PlantDtoGetAll(); + var rawData = await DataService.PlantDtoGetAllAsync(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); SelPlantId = ClaimPlantId; } @@ -383,7 +383,7 @@ namespace GWMS.UI.Pages SearchRecords = null; ListRecords = null; AppMService.Order_Filter = SelectOrderData.Init(5, 10); - await DataService.PlantsAnalisysReset(AppMService.Order_Filter); + await DataService.PlantsAnalisysResetAsync(AppMService.Order_Filter); await ReloadAllData(); } @@ -396,7 +396,7 @@ namespace GWMS.UI.Pages protected async Task UpdateData() { currRecord = null; - await DataService.PlantsAnalisysReset(AppMService.Order_Filter); + await DataService.PlantsAnalisysResetAsync(AppMService.Order_Filter); await ReloadData(); } diff --git a/GWMS.UI/Pages/PlantParameters.razor.cs b/GWMS.UI/Pages/PlantParameters.razor.cs index 52f4442..bb230ee 100644 --- a/GWMS.UI/Pages/PlantParameters.razor.cs +++ b/GWMS.UI/Pages/PlantParameters.razor.cs @@ -256,11 +256,11 @@ namespace GWMS.UI.Pages // se ho un plantId valido --> altrimenti non abilitato if (ClaimPlantId == 0) { - PlantsList = await DataService.PlantsList(); + PlantsList = await DataService.PlantsListAsync(); } else if (ClaimPlantId > 0) { - var rawData = await DataService.PlantsList(); + var rawData = await DataService.PlantsListAsync(); PlantsList = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); SelPlantId = ClaimPlantId; } @@ -279,7 +279,7 @@ namespace GWMS.UI.Pages if (selRecord != null) { - await DataService.remObjItem(SelPlantCode, selRecord); + await DataService.RemObjItemAsync(SelPlantCode, selRecord); } await ReloadAllData(); } @@ -299,7 +299,7 @@ namespace GWMS.UI.Pages protected async Task UpdateData() { currRecord = null; - await DataService.PlantsAnalisysReset(AppMService.Order_Filter); + await DataService.PlantsAnalisysResetAsync(AppMService.Order_Filter); await ReloadData(); } diff --git a/GWMS.UI/Pages/PlantSetup.razor.cs b/GWMS.UI/Pages/PlantSetup.razor.cs index 990a8a2..ee31142 100644 --- a/GWMS.UI/Pages/PlantSetup.razor.cs +++ b/GWMS.UI/Pages/PlantSetup.razor.cs @@ -84,7 +84,7 @@ namespace GWMS.UI.Pages protected void Edit(PlantDTO selRecord) { // rileggo dal DB il record corrente... - var pUpd = Task.Run(async () => currRecord = await DataService.PlantDtoGetByCode(selRecord.PlantCode)); + var pUpd = Task.Run(async () => currRecord = await DataService.PlantDtoGetByCodeAsync(selRecord.PlantCode)); pUpd.Wait(); } @@ -152,11 +152,11 @@ namespace GWMS.UI.Pages // se ho un plantId valido --> altrimenti non abilitato if (ClaimPlantId == 0) { - ListRecords = await DataService.PlantDtoGetAll(); + ListRecords = await DataService.PlantDtoGetAllAsync(); } else if (ClaimPlantId > 0) { - var rawData = await DataService.PlantDtoGetAll(); + var rawData = await DataService.PlantDtoGetAllAsync(); ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); } else diff --git a/GWMS.UI/Pages/PlantStatus.razor.cs b/GWMS.UI/Pages/PlantStatus.razor.cs index fdfd185..5b867b9 100644 --- a/GWMS.UI/Pages/PlantStatus.razor.cs +++ b/GWMS.UI/Pages/PlantStatus.razor.cs @@ -110,11 +110,11 @@ namespace GWMS.UI.Pages // se ho un plantId valido --> altrimenti non abilitato if (ClaimPlantId == 0) { - ListRecords = await DataService.PlantDtoGetAll(); + ListRecords = await DataService.PlantDtoGetAllAsync(); } else if (ClaimPlantId > 0) { - var rawData = await DataService.PlantDtoGetAll(); + var rawData = await DataService.PlantDtoGetAllAsync(); ListRecords = rawData.Where(x => x.PlantId == ClaimPlantId).ToList(); } else diff --git a/GWMS.UI/Pages/Suppliers.razor.cs b/GWMS.UI/Pages/Suppliers.razor.cs index 35aa262..ae8fab6 100644 --- a/GWMS.UI/Pages/Suppliers.razor.cs +++ b/GWMS.UI/Pages/Suppliers.razor.cs @@ -173,18 +173,18 @@ namespace GWMS.UI.Pages protected async Task ReloadAllData() { isLoading = true; - PlantsList = await DataService.PlantsList(); + PlantsList = await DataService.PlantsListAsync(); SelSupplierId = 0; SuppliersList = null; await GetClaimsData(); // se ho un plantId valido --> altrimenti non abilitato if (ClaimSupplierId == 0) { - SuppliersList = await DataService.SuppliersGetAll(); + SuppliersList = await DataService.SuppliersGetAllAsync(); } else if (ClaimSupplierId > 0) { - var rawData = await DataService.SuppliersGetAll(); + var rawData = await DataService.SuppliersGetAllAsync(); SuppliersList = rawData.Where(x => x.SupplierId == ClaimSupplierId).ToList(); SelSupplierId = ClaimSupplierId; } @@ -379,7 +379,7 @@ namespace GWMS.UI.Pages private async Task ReloadData() { isLoading = true; - SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter); + SearchRecords = await DataService.OrdersGetFiltAsync(AppMService.Order_Filter); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); isLoading = false; } diff --git a/GWMS.UI/Pages/Test.razor.cs b/GWMS.UI/Pages/Test.razor.cs index ffb2430..573ae01 100644 --- a/GWMS.UI/Pages/Test.razor.cs +++ b/GWMS.UI/Pages/Test.razor.cs @@ -90,7 +90,7 @@ namespace GWMS.UI.Pages protected async Task SendEmail() { - await DataService.TestSendEmail(emailDest, emailOggetto, emailCorpo); + await DataService.TestSendEmailAsync(emailDest, emailOggetto, emailCorpo); } #endregion Protected Methods diff --git a/GWMS.UI/Pages/Transporters.razor.cs b/GWMS.UI/Pages/Transporters.razor.cs index df3bf72..c10c786 100644 --- a/GWMS.UI/Pages/Transporters.razor.cs +++ b/GWMS.UI/Pages/Transporters.razor.cs @@ -171,18 +171,18 @@ namespace GWMS.UI.Pages protected async Task ReloadAllData() { isLoading = true; - PlantsList = await DataService.PlantsList(); + PlantsList = await DataService.PlantsListAsync(); SelTranspId = 0; TransportersList = null; await GetClaimsData(); // se ho un plantId valido --> altrimenti non abilitato if (ClaimTransporterId == 0) { - TransportersList = await DataService.TransportersGetAll(); + TransportersList = await DataService.TransportersGetAllAsync(); } else if (ClaimTransporterId > 0) { - var rawData = await DataService.TransportersGetAll(); + var rawData = await DataService.TransportersGetAllAsync(); TransportersList = rawData.Where(x => x.TransporterId == ClaimTransporterId).ToList(); SelTranspId = ClaimTransporterId; } @@ -419,7 +419,7 @@ namespace GWMS.UI.Pages private async Task ReloadData() { isLoading = true; - SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter); + SearchRecords = await DataService.OrdersGetFiltAsync(AppMService.Order_Filter); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); isLoading = false; } diff --git a/GWMS.UI/Pages/UserAdmin.razor.cs b/GWMS.UI/Pages/UserAdmin.razor.cs index 82e22b0..6c566a1 100644 --- a/GWMS.UI/Pages/UserAdmin.razor.cs +++ b/GWMS.UI/Pages/UserAdmin.razor.cs @@ -137,7 +137,7 @@ namespace GWMS.UI.Pages // clear any error messages strError = ""; - UsersAll = await DataService.UserDataGetFilt(searchVal); + UsersAll = await DataService.UserDataGetFiltAsync(searchVal); // filtro visualizzazione x tipo SE richeisto if (FiltUserRole != "0") @@ -524,7 +524,7 @@ namespace GWMS.UI.Pages { case "PlantId": // elenco plant --> to dictionary! - var plantList = await DataService.PlantsList(); + var plantList = await DataService.PlantsListAsync(); if (plantList != null) { ClaimValList = plantList @@ -534,7 +534,7 @@ namespace GWMS.UI.Pages case "SupplierId": // elenco plant --> to dictionary! - var suppList = await DataService.SuppliersGetAll(); + var suppList = await DataService.SuppliersGetAllAsync(); if (suppList != null) { ClaimValList = suppList @@ -544,7 +544,7 @@ namespace GWMS.UI.Pages case "TransporterId": // elenco plant --> to dictionary! - var transpList = await DataService.TransportersGetAll(); + var transpList = await DataService.TransportersGetAllAsync(); if (transpList != null) { ClaimValList = transpList @@ -563,15 +563,15 @@ namespace GWMS.UI.Pages // effettuo refresh valori cache plants/suppliers/transp if (plantList == null) { - plantList = await DataService.PlantsList(); + plantList = await DataService.PlantsListAsync(); } if (suppList == null) { - suppList = await DataService.SuppliersGetAll(); + suppList = await DataService.SuppliersGetAllAsync(); } if (transpList == null) { - transpList = await DataService.TransportersGetAll(); + transpList = await DataService.TransportersGetAllAsync(); } } diff --git a/GWMS.UI/Pages/WeekPlan.razor.cs b/GWMS.UI/Pages/WeekPlan.razor.cs index 9e699fc..59ceb62 100644 --- a/GWMS.UI/Pages/WeekPlan.razor.cs +++ b/GWMS.UI/Pages/WeekPlan.razor.cs @@ -206,7 +206,7 @@ namespace GWMS.UI.Pages private async Task ReloadData() { isLoading = true; - ListRecords = await DataService.WeekPlanGet(); + ListRecords = await DataService.WeekPlanGetAsync(); // calcolo min/max... checkHourRange(); isLoading = false; @@ -252,9 +252,9 @@ namespace GWMS.UI.Pages protected async Task ReloadAllData() { - PlantsList = await DataService.PlantsList(); - SuppliersList = await DataService.SuppliersGetAll(); - TransportersList = await DataService.TransportersGetAll(); + PlantsList = await DataService.PlantsListAsync(); + SuppliersList = await DataService.SuppliersGetAllAsync(); + TransportersList = await DataService.TransportersGetAllAsync(); await ReloadData(); } diff --git a/GWMS.UI/appsettings.Production.json b/GWMS.UI/appsettings.Production.json index 072e73c..07a5b6b 100644 --- a/GWMS.UI/appsettings.Production.json +++ b/GWMS.UI/appsettings.Production.json @@ -8,7 +8,7 @@ }, "Otel": { "EnableTracing": true, - "Endpoint": "", + "Endpoint": "http://localhost:4317", "Dsn": "" }, "ConnectionStrings": { diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index a5e3cfe..4866941 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

Versione: 1.0.2603.0315

+

Versione: 1.0.2603.0318


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 0b78b89..a4e535e 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2603.0315 +1.0.2603.0318 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 9b032a7..c689305 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2603.0315 + 1.0.2603.0318 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false