diff --git a/GWMS.Data/Controllers/GWMSController.cs b/GWMS.Data/Controllers/GWMSController.cs index fa12bd3..281044f 100644 --- a/GWMS.Data/Controllers/GWMSController.cs +++ b/GWMS.Data/Controllers/GWMSController.cs @@ -227,13 +227,17 @@ namespace GWMS.Data.Controllers public List GetPlantsDTO(int maxRecords) { - var plantList = dbCtx - .DbSetPlant - .ToList(); + List dbResult = new List(); + using (GWMSContext dbCtxMult = new GWMSContext(_configuration)) + { + var plantList = dbCtxMult + .DbSetPlant + .ToList(); - var dbResult = plantList + dbResult = plantList .Select(x => PlantDTO(x.PlantId, maxRecords)) .ToList(); + } return dbResult; } @@ -353,7 +357,7 @@ namespace GWMS.Data.Controllers public PlantDTO PlantDTO(int PlantId, int maxRecords) { var currPlant = GetPlant(PlantId); - + PlantDTO answ = new PlantDTO(); List LevelTS = new List(); Dictionary PressAct = new Dictionary(); Dictionary> PressTS = new Dictionary>(); @@ -361,82 +365,87 @@ namespace GWMS.Data.Controllers List PressBHTS = new List(); List PressBLTS = new List(); List OrderTS = new List(); - // recupero dal DB - var rawLevelData = dbCtx + + using (GWMSContext dbCtxMult = new GWMSContext(_configuration)) + { + // recupero dal DB + var rawLevelData = dbCtxMult .DbSetPlantLog .Where(x => x.FluxType == "Level" && x.PlantId == PlantId) .OrderBy(x => x.DtEvent) .Take(maxRecords) .ToList(); - var rawMainPressData = dbCtx - .DbSetPlantLog - .Where(x => x.FluxType == "MainPress" && x.PlantId == PlantId) - .OrderBy(x => x.DtEvent) - .Take(maxRecords) - .ToList(); + var rawMainPressData = dbCtxMult + .DbSetPlantLog + .Where(x => x.FluxType == "MainPress" && x.PlantId == PlantId) + .OrderBy(x => x.DtEvent) + .Take(maxRecords) + .ToList(); - var rawBHPressData = dbCtx - .DbSetPlantLog - .Where(x => x.FluxType == "PressBH" && x.PlantId == PlantId) - .OrderBy(x => x.DtEvent) - .Take(maxRecords) - .ToList(); + var rawBHPressData = dbCtxMult + .DbSetPlantLog + .Where(x => x.FluxType == "PressBH" && x.PlantId == PlantId) + .OrderBy(x => x.DtEvent) + .Take(maxRecords) + .ToList(); - var rawBLPressData = dbCtx - .DbSetPlantLog - .Where(x => x.FluxType == "PressBL" && x.PlantId == PlantId) - .OrderBy(x => x.DtEvent) - .Take(maxRecords) - .ToList(); + var rawBLPressData = dbCtxMult + .DbSetPlantLog + .Where(x => x.FluxType == "PressBL" && x.PlantId == PlantId) + .OrderBy(x => x.DtEvent) + .Take(maxRecords) + .ToList(); - var rawOrderData = dbCtx - .DbSetOrders - .Where(x => x.PlantId == PlantId) - .OrderBy(x => x.DtOrder) - .Take(maxRecords) - .ToList(); + var rawOrderData = dbCtxMult + .DbSetOrders + .Where(x => x.PlantId == PlantId) + .OrderBy(x => x.DtOrder) + .Take(maxRecords) + .ToList(); - LevelTS = rawLevelData - .Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); + LevelTS = rawLevelData + .Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); - OrderTS = rawOrderData - .Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.OrderQty }).ToList(); + OrderTS = rawOrderData + .Select(x => new TSData() { DtEvent = x.DtOrder, ValDouble = x.OrderQty }).ToList(); - PressMainTS = rawMainPressData - .Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); + PressMainTS = rawMainPressData + .Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); - PressBHTS = rawBHPressData - .Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); + PressBHTS = rawBHPressData + .Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); - PressBLTS = rawBLPressData - .Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); + PressBLTS = rawBLPressData + .Select(x => new TSData() { DtEvent = x.DtEvent, ValDouble = x.ValNumber }).ToList(); - PressTS.Add("Main", PressMainTS); - PressTS.Add("BH", PressBHTS); - PressTS.Add("BL", PressBLTS); + PressTS.Add("Main", PressMainTS); + PressTS.Add("BH", PressBHTS); + PressTS.Add("BL", PressBLTS); - double actLevel = LevelTS.Count > 0 ? LevelTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0; - double valMain = PressMainTS.Count > 0 ? PressMainTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0; - double valBH = PressBHTS.Count > 0 ? PressBHTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0; - double valBL = PressBLTS.Count > 0 ? PressBLTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0; + double actLevel = LevelTS.Count > 0 ? LevelTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0; + double valMain = PressMainTS.Count > 0 ? PressMainTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0; + double valBH = PressBHTS.Count > 0 ? PressBHTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0; + double valBL = PressBLTS.Count > 0 ? PressBLTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0; - PressAct.Add("Main", valMain); - PressAct.Add("BH", valBH); - PressAct.Add("BL", valBL); + PressAct.Add("Main", valMain); + PressAct.Add("BH", valBH); + PressAct.Add("BL", valBL); - PlantDTO answ = new PlantDTO() - { - PlantId = PlantId, - PlantCode = currPlant.PlantCode, - PlantDesc = currPlant.PlantDesc, - LevelAct = actLevel, - LevelMax = currPlant.LevelMax, - PressAct = PressAct, - LevelTS = LevelTS, - PressTS = PressTS, - OrderTS = OrderTS - }; + // popolo valolri + answ = new PlantDTO() + { + PlantId = PlantId, + PlantCode = currPlant.PlantCode, + PlantDesc = currPlant.PlantDesc, + LevelAct = actLevel, + LevelMax = currPlant.LevelMax, + PressAct = PressAct, + LevelTS = LevelTS, + PressTS = PressTS, + OrderTS = OrderTS + }; + } return answ; } diff --git a/GWMS.Data/ModelBuilderExtensions.cs b/GWMS.Data/ModelBuilderExtensions.cs index e82c444..8399ed5 100644 --- a/GWMS.Data/ModelBuilderExtensions.cs +++ b/GWMS.Data/ModelBuilderExtensions.cs @@ -40,7 +40,7 @@ namespace GWMS.Data new PlantDetailModel { PlantId = 1, PlantCode = "PIZ03", PlantDesc = "Collecchio", LevelMax = 26000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 }, new PlantDetailModel { PlantId = 2, PlantCode = "PIZ04", PlantDesc = "Noceto", LevelMax = 28000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 }, new PlantDetailModel { PlantId = 3, PlantCode = "PIZ05", PlantDesc = "Baganzola", LevelMax = 24000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 }, - new PlantDetailModel { PlantId = 4, PlantCode = "PIZ08", PlantDesc = "Pilastrello", LevelMax = 25500, PressMax = 19, PressBHMax = 270, PressBLMax = 270 } + new PlantDetailModel { PlantId = 4, PlantCode = "PIZ08", PlantDesc = "Pilastrello", LevelMax = 26000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 } ); // inizializzazione dei valori di default x Fornitori diff --git a/GWMS.UI/Data/GWMSDataService.cs b/GWMS.UI/Data/GWMSDataService.cs index 8d101a1..84137ee 100644 --- a/GWMS.UI/Data/GWMSDataService.cs +++ b/GWMS.UI/Data/GWMSDataService.cs @@ -394,6 +394,7 @@ namespace GWMS.UI.Data public async Task PlantLogInsert(List newItems) { + bool fatto = false; // init valori int IntervalMin = 60; int.TryParse(_configuration["IntervalMin"], out IntervalMin); @@ -435,8 +436,19 @@ namespace GWMS.UI.Data } } - // faccio vero insert - return await Task.FromResult(dbController.PlantLogInsertNew(item2insert)); + // se ho record da inserire... + if (item2insert.Count > 0) + { + // faccio vero insert + fatto = dbController.PlantLogInsertNew(item2insert); + + // invalido i vari valori in cache + await distributedCache.RemoveAsync($"DATA:PLANTS:LastFlux:{PlantId}"); + await distributedCache.RemoveAsync($"DATA:PLANTS:ListDTO"); + } + + // restituisco + return await Task.FromResult(fatto); } public async Task> PlantsGetAll() diff --git a/GWMS.UI/Data/MessageService.cs b/GWMS.UI/Data/MessageService.cs index 0c2dab6..4d9f0da 100644 --- a/GWMS.UI/Data/MessageService.cs +++ b/GWMS.UI/Data/MessageService.cs @@ -9,7 +9,7 @@ namespace GWMS.UI.Data { #region Private Fields - private SelectData _detailFilter = SelectData.Init(5, 7); + private SelectData _detailFilter = SelectData.Init(5, 15); private string _pageIcon; private string _pageName; private string _searchVal; @@ -33,8 +33,6 @@ namespace GWMS.UI.Data #region Public Properties - public SelectData DDB_Filter { get; set; } = SelectData.Init(5, 3); - public SelectData DetailFilter { get => _detailFilter; @@ -52,10 +50,7 @@ namespace GWMS.UI.Data } } - public SelectData KRE_Filter { get; set; } = SelectData.Init(5, 7); - public SelectData ODL_Filter { get; set; } = SelectData.Init(5, 7); - public SelectData OEE_Filter { get; set; } = SelectData.Init(5, 7); - public SelectOrderData Order_Filter { get; set; } = SelectOrderData.Init(5, 7); + public SelectOrderData Order_Filter { get; set; } = SelectOrderData.Init(5, 30); public string PageIcon { diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 23bf6ec..8d340b4 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net5.0 - 1.0.2108.0518 + 1.0.2108.0612 95c9f021-52d1-4390-a670-5810b7b777b0 diff --git a/GWMS.UI/Pages/Parameters.razor b/GWMS.UI/Pages/Parameters.razor index 3c7a791..55914f7 100644 --- a/GWMS.UI/Pages/Parameters.razor +++ b/GWMS.UI/Pages/Parameters.razor @@ -20,41 +20,7 @@ }
- @*
-
-

Simulazione

-
-
-
-
- giorni -
- -
-
-
-
-
- step -
- -
-
-
-
-
- cons orario max -
- -
-
-
- -
-
*@ - + @**@
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 079cbdd..d77176f 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

Versione: 1.0.2108.0518

+

Versione: 1.0.2108.0612


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index a482638..2a65a1d 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2108.0518 +1.0.2108.0612 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index a4fb8c9..8c31316 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2108.0518 + 1.0.2108.0612 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false