diff --git a/GWMS.UI/Controllers/IOBController.cs b/GWMS.UI/Controllers/IOBController.cs index 1fa1a22..4093267 100644 --- a/GWMS.UI/Controllers/IOBController.cs +++ b/GWMS.UI/Controllers/IOBController.cs @@ -364,7 +364,7 @@ namespace GWMS.UI.Controllers try { List currParams = await _DataService.getCurrObjItems(id); - // ora per ogni valore RICEVUTO costruisco un oggetto in innnovazioni da inviare...x salvare in stato parametri... + // ora per ogni valore RICEVUTO costruisco un oggetto in innovazioni da inviare...x salvare in stato parametri... List innovazioni = new List(); foreach (var item in rawData.fluxData) { diff --git a/GWMS.UI/Data/GWMSDataService.cs b/GWMS.UI/Data/GWMSDataService.cs index 4fc771a..3269f51 100644 --- a/GWMS.UI/Data/GWMSDataService.cs +++ b/GWMS.UI/Data/GWMSDataService.cs @@ -624,7 +624,6 @@ namespace GWMS.UI.Data .OrderByDescending(x => x.writable) .ThenBy(x => x.name) .ToList(); - //answ.Sort((a, b) => (a.name.CompareTo(b.name))); } } catch (Exception exc) @@ -1083,6 +1082,40 @@ namespace GWMS.UI.Data { } } + /// + /// Rimuove un item da parametri correnti x IOB + /// + /// + /// + /// + public async Task remObjItem(string idxMacchina, objItem item2rem) + { + bool answ = false; + if (item2rem != null) + { + string cacheKey = currParametersHash(idxMacchina); + string rawData; + var redisDataList = await distributedCache.GetAsync(cacheKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + var actValues = JsonConvert.DeserializeObject>(rawData); + // cerco e rimuovo + var remCand = actValues + .Where(x => x.uid == item2rem.uid) + .FirstOrDefault(); + if (remCand != null) + { + actValues.Remove(remCand); + } + // salvo! + rawData = JsonConvert.SerializeObject(actValues); + await distributedCache.SetAsync(cacheKey, Encoding.UTF8.GetBytes(rawData)); + } + } + return answ; + } + /// /// RIMUOVE un PARAMETRO OPZIONALE dall'elenco di quelli salvati /// diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index dabfe24..4d767f8 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net5.0 - 1.0.2110.2510 + 1.0.2110.2516 95c9f021-52d1-4390-a670-5810b7b777b0 true true diff --git a/GWMS.UI/Pages/PlantParameters.razor b/GWMS.UI/Pages/PlantParameters.razor index c61fc50..d5546c8 100644 --- a/GWMS.UI/Pages/PlantParameters.razor +++ b/GWMS.UI/Pages/PlantParameters.razor @@ -13,7 +13,7 @@
- +
@@ -66,6 +66,7 @@ Valore attuale/richiesto Update Last message + @*Carico Ordine *@ @@ -104,11 +105,19 @@ @record.reqValue } - @record.lastRead.ToString("yyyy.MM.dd hh:mm:ss") + @record.lastRead.ToString("yyyy.MM.dd HH:mm:ss")
@record.lastMessage
@record.lastRequest
+ + @if (editAll) + { + + } + } diff --git a/GWMS.UI/Pages/PlantParameters.razor.cs b/GWMS.UI/Pages/PlantParameters.razor.cs index ea54494..ac129da 100644 --- a/GWMS.UI/Pages/PlantParameters.razor.cs +++ b/GWMS.UI/Pages/PlantParameters.razor.cs @@ -39,6 +39,23 @@ namespace GWMS.UI.Pages private bool isLoading { get; set; } = false; + private string SelPlantCode + { + get + { + string answ = ""; + // cerco in elenco + var currPlant = PlantsList + .Where(x => x.PlantId == SelPlantId) + .FirstOrDefault(); + if (currPlant != null) + { + answ = currPlant.PlantCode; + } + return answ; + } + } + private int SelPlantId { get @@ -61,24 +78,6 @@ namespace GWMS.UI.Pages } } - private string SelPlantCode - { - get - { - string answ = ""; - // cerco in elenco - var currPlant = PlantsList - .Where(x => x.PlantId == SelPlantId) - .FirstOrDefault(); - if (currPlant != null) - { - answ = currPlant.PlantCode; - } - return answ; - } - } - - #endregion Private Properties #region Protected Properties @@ -136,6 +135,20 @@ namespace GWMS.UI.Pages } } + protected bool editAll + { + get + { + bool answ = false; + var currMode = GetQueryParm("currMode"); + if (!string.IsNullOrEmpty(currMode)) + { + answ = currMode.Equals("debug"); + } + return answ; + } + } + [Inject] protected IJSRuntime JSRuntime { get; set; } @@ -157,11 +170,6 @@ namespace GWMS.UI.Pages #endregion Protected Properties - #region Public Properties - - - #endregion Public Properties - #region Private Methods /// @@ -217,46 +225,23 @@ namespace GWMS.UI.Pages #region Protected Methods -#if false - /// - /// Creazione nuovo record Ordine - /// - protected void CreateNew(PlantLevSumDTO currItem) - { - var currPlant = PlantsList.Where(x => x.PlantId == SelPlantId).FirstOrDefault(); - if (currPlant != null) - { - DateTime ordDate = currItem.DataRif.AddDays(-1); - // creo un nuovo record - currRecord = new OrderModel() - { - DtOrder = ordDate, - PlantId = SelPlantId, - SupplierId = SelSupplierId, - OrderDesc = $"Ord Man {currPlant.PlantDesc} - {ordDate}", - TransporterId = 1, - OrderCode = $"O{currPlant.PlantCode}{ordDate:yyMMddHHmm}", - LevelStart = Math.Round(currItem.LevelMin), - LevelEnd = Math.Round(currItem.LevelMax), - DtExecStart = currItem.FillStart, - DtExecEnd = currItem.FillEnd, - ExecutionQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / currItem.DeltaMin) * currItem.DeltaMin, - OrderQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / 2000) * 2000 - }; - } - } -#endif - protected void Edit(objItem selRecord) { - // rileggo dal DB il record corrente... - var pUpd = Task.Run(async () => - { - currRecord = selRecord; - }); - pUpd.Wait(); + currRecord = selRecord; } + protected async Task ForceReload() + { + await ReloadAllData(); + } + + // Blazor: get query parm from the URL + protected string GetQueryParm(string parmName) + { + var uriBuilder = new UriBuilder(NavManager.Uri); + var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query); + return q[parmName] ?? ""; + } protected override async Task OnInitializedAsync() { @@ -291,22 +276,24 @@ namespace GWMS.UI.Pages await ReloadData(); } + protected async Task RemoveItem(objItem selRecord) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler rimuovere il parametro {selRecord.uid} ({selRecord.name})?")) + return; + + if (selRecord != null) + { + await DataService.remObjItem(SelPlantCode, selRecord); + } + await ReloadAllData(); + } + protected void ResetData() { DataService.rollBackEdit(currRecord); currRecord = null; } - protected async Task ResetFilter() - { - SelPlantId = 0; - currRecord = null; - ListRecords = null; - AppMService.Order_Filter = SelectOrderData.Init(5, 10); - await DataService.PlantsAnalisysReset(AppMService.Order_Filter); - await ReloadAllData(); - } - protected void Select(objItem selRecord) { // applico filtro da selezione @@ -352,4 +339,4 @@ namespace GWMS.UI.Pages #endregion Public Methods } -} +} \ No newline at end of file diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 8f9a319..9cb260b 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

Versione: 1.0.2110.2510

+

Versione: 1.0.2110.2516


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index d368be6..6c08bce 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2110.2510 +1.0.2110.2516 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 99b9b5d..e4c1c4b 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2110.2510 + 1.0.2110.2516 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false