Aggiunta refresh x update proj da REST a UI
This commit is contained in:
@@ -20,5 +20,12 @@ namespace MagMan.Core
|
|||||||
public const string redisBaseAddr = "MagManUi";
|
public const string redisBaseAddr = "MagManUi";
|
||||||
public const string rKeyConfig = $"{redisBaseAddr}:Cache";
|
public const string rKeyConfig = $"{redisBaseAddr}:Cache";
|
||||||
|
|
||||||
|
// REDIS Channels messaggi x QueueMan
|
||||||
|
public static readonly string Q_MMAN_GEN = $"MagManGeneral";
|
||||||
|
public static readonly string Q_MMAN_ALIAS_MAT = $"MagManAliasMaterial";
|
||||||
|
public static readonly string Q_MMAN_PROJ = $"MagManProj";
|
||||||
|
public static readonly string Q_MMAN_RES = $"MagManRes";
|
||||||
|
public static readonly string Q_MMAN_LOG = $"MagManLog";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
using NLog;
|
||||||
|
using StackExchange.Redis;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MagMan.Core
|
||||||
|
{
|
||||||
|
public class MessagePipe
|
||||||
|
{
|
||||||
|
#region Public Constructors
|
||||||
|
|
||||||
|
public MessagePipe(IConnectionMultiplexer redisConn, string channelName, bool enableLog = false)
|
||||||
|
{
|
||||||
|
_channel = new RedisChannel(channelName, RedisChannel.PatternMode.Literal); ;
|
||||||
|
redis = redisConn;
|
||||||
|
redisDb = redis.GetDatabase();
|
||||||
|
this.enableLog = enableLog;
|
||||||
|
// aggiungo sottoscrittore
|
||||||
|
setupSubscriber();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Constructors
|
||||||
|
|
||||||
|
#region Public Events
|
||||||
|
|
||||||
|
public event EventHandler EA_NewMessage = delegate { };
|
||||||
|
|
||||||
|
#endregion Public Events
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invio messaggio sul canale + salvataggio in cache REDIS
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="memKey">Chiave REDIS x salvare valore</param>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
public bool saveAndSendMessage(string memKey, string message)
|
||||||
|
{
|
||||||
|
bool answ = false;
|
||||||
|
Stopwatch stopWatch = new Stopwatch();
|
||||||
|
stopWatch.Start();
|
||||||
|
|
||||||
|
// invio notifica tramite il canale richiesto
|
||||||
|
answ = sendMessage(message);
|
||||||
|
if (redisDb != null)
|
||||||
|
{
|
||||||
|
redisDb.StringSetAsync(memKey, message);
|
||||||
|
}
|
||||||
|
stopWatch.Stop();
|
||||||
|
TimeSpan ts = stopWatch.Elapsed;
|
||||||
|
if (numSent.ContainsKey(memKey))
|
||||||
|
{
|
||||||
|
numSent[memKey]++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
numSent.Add(memKey, 1);
|
||||||
|
}
|
||||||
|
if (enableLog || numSent[memKey] > 30)
|
||||||
|
{
|
||||||
|
Log.Info($"saveAndSendMessage| mKey {memKey} x {numSent[memKey]} | {message.Length} size | {ts.TotalMilliseconds} ms");
|
||||||
|
|
||||||
|
numSent[memKey] = 0;
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invio messaggio sul canale
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newMess"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool sendMessage(string newMess)
|
||||||
|
{
|
||||||
|
bool answ = false;
|
||||||
|
ISubscriber sub = redis.GetSubscriber();
|
||||||
|
sub.Publish(_channel, newMess);
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
|
|
||||||
|
#region Protected Fields
|
||||||
|
|
||||||
|
protected static Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
#endregion Protected Fields
|
||||||
|
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
|
private bool enableLog = false;
|
||||||
|
private Dictionary<string, int> numSent = new Dictionary<string, int>();
|
||||||
|
private IConnectionMultiplexer redis;
|
||||||
|
private IDatabase? redisDb;
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
|
|
||||||
|
#region Private Properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Canale associato al gestore pipeline messaggi
|
||||||
|
/// </summary>
|
||||||
|
private RedisChannel _channel { get; set; } = new RedisChannel("Default", RedisChannel.PatternMode.Literal);
|
||||||
|
|
||||||
|
#endregion Private Properties
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
private void setupSubscriber()
|
||||||
|
{
|
||||||
|
ISubscriber sub = redis.GetSubscriber();
|
||||||
|
//Subscribe to the channel named messages
|
||||||
|
sub.Subscribe(_channel, (channel, message) =>
|
||||||
|
{
|
||||||
|
Log.Trace($"ch {channel} | {message}");
|
||||||
|
// messaggio
|
||||||
|
PubSubEventArgs mea = new PubSubEventArgs($"{message}");
|
||||||
|
// se qualcuno ascolta sollevo evento nuovo valore...
|
||||||
|
if (EA_NewMessage != null)
|
||||||
|
{
|
||||||
|
EA_NewMessage(this, mea);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Log.Info($"Subscribed {_channel}");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PubSubEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
#region Public Constructors
|
||||||
|
|
||||||
|
public PubSubEventArgs(string messaggio)
|
||||||
|
{
|
||||||
|
this.newMessage = messaggio;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Constructors
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
|
public string newMessage { get; set; } = "";
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Blazored.LocalStorage;
|
using Blazored.LocalStorage;
|
||||||
using Blazored.SessionStorage;
|
using Blazored.SessionStorage;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
using NLog;
|
using NLog;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -19,27 +20,70 @@ namespace MagMan.Core.Services
|
|||||||
// setup componenti REDIS
|
// setup componenti REDIS
|
||||||
redisConn = RedConn;
|
redisConn = RedConn;
|
||||||
redisDb = redisConn.GetDatabase();
|
redisDb = redisConn.GetDatabase();
|
||||||
|
|
||||||
|
// setup canali pub/sub
|
||||||
|
QueUpdGen = new MessagePipe(redisConn, Const.Q_MMAN_GEN);
|
||||||
|
QueUpdAliasMat = new MessagePipe(redisConn, Const.Q_MMAN_ALIAS_MAT);
|
||||||
|
QueUpdProj = new MessagePipe(redisConn, Const.Q_MMAN_PROJ);
|
||||||
|
QueUpdRes = new MessagePipe(redisConn, Const.Q_MMAN_RES);
|
||||||
|
QueUpdLog = new MessagePipe(redisConn, Const.Q_MMAN_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
|
|
||||||
#region Public Events
|
#region Public Events
|
||||||
|
|
||||||
public event Action EA_FilterUpdated = null!;
|
|
||||||
public event Action EA_HideSearch = null!;
|
|
||||||
public event Action EA_PageUpdated = null!;
|
|
||||||
public event Action EA_SearchUpdated = null!;
|
|
||||||
public event Action EA_ShowSearch = null!;
|
|
||||||
public event Action EA_CustomerSel = null!;
|
public event Action EA_CustomerSel = null!;
|
||||||
|
|
||||||
|
public event Action EA_FilterUpdated = null!;
|
||||||
|
|
||||||
|
public event Action EA_HideSearch = null!;
|
||||||
|
|
||||||
public event Action EA_KeySel = null!;
|
public event Action EA_KeySel = null!;
|
||||||
|
|
||||||
|
public event Action EA_PageUpdated = null!;
|
||||||
|
|
||||||
|
public event Action EA_SearchUpdated = null!;
|
||||||
|
|
||||||
public event Action<bool> EA_ShowCustomers = null!;
|
public event Action<bool> EA_ShowCustomers = null!;
|
||||||
|
|
||||||
|
public event Action EA_ShowSearch = null!;
|
||||||
|
|
||||||
#endregion Public Events
|
#endregion Public Events
|
||||||
|
|
||||||
|
|
||||||
#region Public Properties
|
#region Public Properties
|
||||||
|
|
||||||
public string UserName { get; set; } = "NA";
|
public int CustomerID
|
||||||
|
{
|
||||||
|
get => _customerID;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_customerID != value)
|
||||||
|
{
|
||||||
|
_customerID = value;
|
||||||
|
if (EA_CustomerSel != null)
|
||||||
|
{
|
||||||
|
EA_CustomerSel?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int KeyNum
|
||||||
|
{
|
||||||
|
get => _keyNum;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_keyNum != value)
|
||||||
|
{
|
||||||
|
_keyNum = value;
|
||||||
|
if (EA_KeySel != null)
|
||||||
|
{
|
||||||
|
EA_KeySel?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string PageIcon
|
public string PageIcon
|
||||||
{
|
{
|
||||||
@@ -82,41 +126,24 @@ namespace MagMan.Core.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int CustomerID
|
|
||||||
{
|
|
||||||
get => _customerID;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_customerID != value)
|
|
||||||
{
|
|
||||||
_customerID = value;
|
|
||||||
if (EA_CustomerSel != null)
|
|
||||||
{
|
|
||||||
EA_CustomerSel?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int KeyNum
|
|
||||||
{
|
|
||||||
get => _keyNum;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_keyNum != value)
|
|
||||||
{
|
|
||||||
_keyNum = value;
|
|
||||||
if (EA_KeySel != null)
|
|
||||||
{
|
|
||||||
EA_KeySel?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SelOrderCode { get; set; } = "";
|
public string SelOrderCode { get; set; } = "";
|
||||||
|
|
||||||
public string SelPlantId { get; set; } = "0";
|
public string SelPlantId { get; set; } = "0";
|
||||||
|
|
||||||
|
public bool ShowCustomers
|
||||||
|
{
|
||||||
|
get => _showCustomers;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_showCustomers = value;
|
||||||
|
if (EA_ShowCustomers != null)
|
||||||
|
{
|
||||||
|
EA_ShowCustomers?.Invoke(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool ShowSearch
|
public bool ShowSearch
|
||||||
{
|
{
|
||||||
get => _showSearch;
|
get => _showSearch;
|
||||||
@@ -143,18 +170,36 @@ namespace MagMan.Core.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ShowCustomers
|
/// <summary>
|
||||||
{
|
/// Message pipe ricezione dati da EgtBW relativi a info Alias/Materials
|
||||||
get => _showCustomers;
|
/// </summary>
|
||||||
set
|
public MessagePipe QueUpdAliasMat { get; set; } = null!;
|
||||||
{
|
|
||||||
_showCustomers = value;
|
/// <summary>
|
||||||
if (EA_ShowCustomers != null)
|
/// Message pipe ricezione dati da EgtBW (General/Generics)
|
||||||
{
|
/// </summary>
|
||||||
EA_ShowCustomers?.Invoke(value);
|
public MessagePipe QueUpdGen { get; set; } = null!;
|
||||||
}
|
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Message pipe ricezione dati da EgtBW relativi a info LogMachine
|
||||||
|
/// </summary>
|
||||||
|
public MessagePipe QueUpdLog { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Message pipe ricezione dati da EgtBW relativi a info Projects
|
||||||
|
/// </summary>
|
||||||
|
public MessagePipe QueUpdProj { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Message pipe ricezione dati da EgtBW relativi a info Resources
|
||||||
|
/// </summary>
|
||||||
|
public MessagePipe QueUpdRes { get; set; } = null!;
|
||||||
|
|
||||||
|
public string UserName { get; set; } = "NA";
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cliente selezionato (da browser data cache)
|
/// Cliente selezionato (da browser data cache)
|
||||||
@@ -173,28 +218,6 @@ namespace MagMan.Core.Services
|
|||||||
await localStore.SetItemAsync("ClientID", newVal);
|
await localStore.SetItemAsync("ClientID", newVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// KeyNum da cliente selezionato (da browser data cache)
|
|
||||||
/// </summary>
|
|
||||||
public async Task<int> KeyNumGet()
|
|
||||||
{
|
|
||||||
var answ = await localStore.GetItemAsync<int>("KeyNum");
|
|
||||||
return answ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Imposta KeyNum da cliente selezionato (browser data cache)
|
|
||||||
/// </summary>
|
|
||||||
public async Task KeyNumSet(int newVal)
|
|
||||||
{
|
|
||||||
await localStore.SetItemAsync("KeyNum", newVal);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Public Properties
|
|
||||||
|
|
||||||
#region Public Methods
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -220,6 +243,23 @@ namespace MagMan.Core.Services
|
|||||||
return fatto;
|
return fatto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// KeyNum da cliente selezionato (da browser data cache)
|
||||||
|
/// </summary>
|
||||||
|
public async Task<int> KeyNumGet()
|
||||||
|
{
|
||||||
|
var answ = await localStore.GetItemAsync<int>("KeyNum");
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Imposta KeyNum da cliente selezionato (browser data cache)
|
||||||
|
/// </summary>
|
||||||
|
public async Task KeyNumSet(int newVal)
|
||||||
|
{
|
||||||
|
await localStore.SetItemAsync("KeyNum", newVal);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -528,13 +568,13 @@ namespace MagMan.Core.Services
|
|||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
private int _customerID = -1;
|
||||||
|
private int _keyNum = -1;
|
||||||
private string _pageIcon = "";
|
private string _pageIcon = "";
|
||||||
private string _pageName = "";
|
private string _pageName = "";
|
||||||
private string _searchVal = "";
|
private string _searchVal = "";
|
||||||
private int _customerID = -1;
|
|
||||||
private int _keyNum = -1;
|
|
||||||
private bool _showSearch = false;
|
|
||||||
private bool _showCustomers = true;
|
private bool _showCustomers = true;
|
||||||
|
private bool _showSearch = false;
|
||||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using EgwCoreLib.Razor;
|
using EgwCoreLib.Razor;
|
||||||
|
using k8s.Models;
|
||||||
|
using MagMan.Core;
|
||||||
using MagMan.Core.Services;
|
using MagMan.Core.Services;
|
||||||
using MagMan.Data.Admin.DbModels;
|
using MagMan.Data.Admin.DbModels;
|
||||||
using MagMan.Data.Admin.Services;
|
using MagMan.Data.Admin.Services;
|
||||||
@@ -29,6 +31,31 @@ namespace MagMan.UI.Components
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
AppMService.EA_SearchUpdated -= AppMService_EA_SearchUpdated;
|
AppMService.EA_SearchUpdated -= AppMService_EA_SearchUpdated;
|
||||||
|
AppMService.QueUpdProj.EA_NewMessage -= QueUpdProj_EA_NewMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gestione messaggio proj
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
private async void QueUpdProj_EA_NewMessage(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// verifico se il messaggio sia per la mia KEY e nel caso --> refresh!
|
||||||
|
// aggiorno visualizzazione
|
||||||
|
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||||
|
// conversione on-the-fly SVG da mostrare
|
||||||
|
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||||
|
{
|
||||||
|
if (KeyNum > 0 && currArgs.newMessage == $"{KeyNum}")
|
||||||
|
{
|
||||||
|
await ReloadData();
|
||||||
|
//await Task.Run(async () => await InvokeAsync(StateHasChanged));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
@@ -101,6 +128,7 @@ namespace MagMan.UI.Components
|
|||||||
{
|
{
|
||||||
currSearch = "";
|
currSearch = "";
|
||||||
AppMService.EA_SearchUpdated += AppMService_EA_SearchUpdated;
|
AppMService.EA_SearchUpdated += AppMService_EA_SearchUpdated;
|
||||||
|
AppMService.QueUpdProj.EA_NewMessage += QueUpdProj_EA_NewMessage;
|
||||||
yLim = Configuration.GetValue<double>("OptConf:projProgYLim");
|
yLim = Configuration.GetValue<double>("OptConf:projProgYLim");
|
||||||
rLim = Configuration.GetValue<double>("OptConf:projProgRLim");
|
rLim = Configuration.GetValue<double>("OptConf:projProgRLim");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using k8s.Models;
|
using k8s.Models;
|
||||||
using MagMan.Core;
|
using MagMan.Core;
|
||||||
using MagMan.Core.DTO;
|
using MagMan.Core.DTO;
|
||||||
|
using MagMan.Core.Services;
|
||||||
using MagMan.Data.Admin.DbModels;
|
using MagMan.Data.Admin.DbModels;
|
||||||
using MagMan.Data.Admin.Services;
|
using MagMan.Data.Admin.Services;
|
||||||
using MagMan.Data.Tenant.DbModels;
|
using MagMan.Data.Tenant.DbModels;
|
||||||
@@ -20,10 +21,11 @@ namespace MagMan.UI.Controllers
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
public ProjectsController(MTAdminService MTDataService, TenantService TDataService)
|
public ProjectsController(MTAdminService MTDataService, TenantService TDataService, MessageService messageService)
|
||||||
{
|
{
|
||||||
MTAdmService = MTDataService;
|
MTAdmService = MTDataService;
|
||||||
TService = TDataService;
|
TService = TDataService;
|
||||||
|
MService = messageService;
|
||||||
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
|
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
|
||||||
JSSettings = new JsonSerializerSettings()
|
JSSettings = new JsonSerializerSettings()
|
||||||
{
|
{
|
||||||
@@ -162,9 +164,11 @@ namespace MagMan.UI.Controllers
|
|||||||
{
|
{
|
||||||
Log.Error($"ProjectsController.upsert | Errore in fase salvataggio ProjectDTO{Environment.NewLine}{exc}");
|
Log.Error($"ProjectsController.upsert | Errore in fase salvataggio ProjectDTO{Environment.NewLine}{exc}");
|
||||||
}
|
}
|
||||||
|
// resetto cache redis
|
||||||
|
await MTAdmService.FlushRedisCache();
|
||||||
|
// broadcast msg update via redis, indico solo nKey x aggiornare tab principale dato KEY rif
|
||||||
|
MService.QueUpdProj.sendMessage($"{nKey}");
|
||||||
}
|
}
|
||||||
// resetto cache redis
|
|
||||||
await MTAdmService.FlushRedisCache();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return answ;
|
return answ;
|
||||||
@@ -187,6 +191,7 @@ namespace MagMan.UI.Controllers
|
|||||||
|
|
||||||
private MTAdminService MTAdmService { get; set; } = null!;
|
private MTAdminService MTAdmService { get; set; } = null!;
|
||||||
private TenantService TService { get; set; } = null!;
|
private TenantService TService { get; set; } = null!;
|
||||||
|
private MessageService MService { get; set; } = null!;
|
||||||
|
|
||||||
#endregion Private Properties
|
#endregion Private Properties
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>1.0.2406.2913</Version>
|
<Version>1.0.2407.0115</Version>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using k8s.Models;
|
||||||
|
using MagMan.Core;
|
||||||
using MagMan.Core.Services;
|
using MagMan.Core.Services;
|
||||||
using MagMan.Data.Admin.Services;
|
using MagMan.Data.Admin.Services;
|
||||||
using MagMan.Data.Tenant.DbModels;
|
using MagMan.Data.Tenant.DbModels;
|
||||||
@@ -51,6 +53,8 @@ namespace MagMan.UI.Pages
|
|||||||
await ReloadData();
|
await ReloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void SaveProj(ProjModel? newRec)
|
protected void SaveProj(ProjModel? newRec)
|
||||||
{
|
{
|
||||||
ProjSel = newRec;
|
ProjSel = newRec;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"MultiRoleEnab": false,
|
"MultiRoleEnab": false,
|
||||||
"MultiClaimEnab": true,
|
"MultiClaimEnab": true,
|
||||||
"ScanOpDelay": 3000,
|
"ScanOpDelay": 3000,
|
||||||
"projProgRLim": 0.4,
|
"projProgRLim": 0.2,
|
||||||
"projProgYLim": 0.8
|
"projProgYLim": 0.8
|
||||||
},
|
},
|
||||||
"AlarmDest": "samuele.locatelli@egalware.com, ceo@steamware.net",
|
"AlarmDest": "samuele.locatelli@egalware.com, ceo@steamware.net",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<i>MagMan - Wood Warehouse Management System</i>
|
<i>MagMan - Wood Warehouse Management System</i>
|
||||||
<h4>Versione: 1.0.2406.2913</h4>
|
<h4>Versione: 1.0.2407.0115</h4>
|
||||||
<br /> Note di rilascio:
|
<br /> Note di rilascio:
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.0.2406.2913
|
1.0.2407.0115
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<item>
|
<item>
|
||||||
<version>1.0.2406.2913</version>
|
<version>1.0.2407.0115</version>
|
||||||
<url>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip</url>
|
<url>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip</url>
|
||||||
<changelog>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html</changelog>
|
<changelog>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html</changelog>
|
||||||
<mandatory>false</mandatory>
|
<mandatory>false</mandatory>
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ namespace DemoApp
|
|||||||
// controllo ci sia qulcosa da inviare...
|
// controllo ci sia qulcosa da inviare...
|
||||||
if (recList.Count > 0)
|
if (recList.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
// fintanto che ce ne sono procedo...
|
// fintanto che ce ne sono procedo...
|
||||||
while (numSent < num2send)
|
while (numSent < num2send)
|
||||||
{
|
{
|
||||||
@@ -189,6 +188,79 @@ namespace DemoApp
|
|||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Esegue invio info avanzamento di un SINGOLO PROD dato il suo Id + info avanzamento
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="prodId">ID del progetto (locale)</param>
|
||||||
|
/// <param name="procTime">Tempo complessivo di lavorazione</param>
|
||||||
|
/// <param name="valAct">
|
||||||
|
/// Valore attuale a completamento (tipicamente numero barre/num pezzi DA FARE)
|
||||||
|
/// </param>
|
||||||
|
/// <param name="valMax">
|
||||||
|
/// Valore massimo a completamento (tipicamente numero barre/num pezzi DA FARE)
|
||||||
|
/// </param>
|
||||||
|
/// <returns>Risultato sincronizzazione</returns>
|
||||||
|
public SyncResult ProjSendProg(int prodId, double procTime, double valAct, double valMax)
|
||||||
|
{
|
||||||
|
SyncResult answ = SyncResult.ERR_ND;
|
||||||
|
// verifico server ok
|
||||||
|
bool servOk = commLib.CheckRemote();
|
||||||
|
if (!servOk)
|
||||||
|
{
|
||||||
|
answ = SyncResult.ERR_ServerKo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (ProdController dbContr = new ProdController())
|
||||||
|
{
|
||||||
|
// in primis recupero item
|
||||||
|
var currRec = dbContr.FindByProdId(prodId);
|
||||||
|
if (currRec == null)
|
||||||
|
{
|
||||||
|
answ = SyncResult.ERR_ProjIdNotFound;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// verifico ci sia cloud ID...
|
||||||
|
if (currRec.ProjCloudId == 0)
|
||||||
|
{
|
||||||
|
answ = SyncResult.ERR_ProjCloudIdNotFound;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// preparo obj da inviare...
|
||||||
|
ProjectProgrDTO projProgrDTO = new ProjectProgrDTO()
|
||||||
|
{
|
||||||
|
ProjCloudId = currRec.ProjCloudId,
|
||||||
|
ValAct = valAct,
|
||||||
|
ValMax = valMax,
|
||||||
|
ProcTimeReal = procTime
|
||||||
|
};
|
||||||
|
// invio e recupero ID...
|
||||||
|
bool fatto = commLib.ProjectProgrSend(projProgrDTO);
|
||||||
|
// se inviato, faccio upgrade locale...
|
||||||
|
if (!fatto)
|
||||||
|
{
|
||||||
|
answ = SyncResult.ERR_ProjNotSync;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
answ = SyncResult.ALL_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
answ = SyncResult.ERR_ServerKo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Esegue sync di un SINGOLO PROD (cloud proj):
|
/// Esegue sync di un SINGOLO PROD (cloud proj):
|
||||||
/// - legge il progetto locale + upload x sync (verso cloud)
|
/// - legge il progetto locale + upload x sync (verso cloud)
|
||||||
@@ -265,75 +337,6 @@ namespace DemoApp
|
|||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Esegue invio info avanzamento di un SINGOLO PROD dato il suo Id + info avanzamento
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="prodId">ID del progetto (locale)</param>
|
|
||||||
/// <param name="procTime">Tempo complessivo di lavorazione</param>
|
|
||||||
/// <param name="valAct">Valore attuale a completamento (tipicamente numero barre/num pezzi DA FARE)</param>
|
|
||||||
/// <param name="valMax">Valore massimo a completamento (tipicamente numero barre/num pezzi DA FARE)</param>
|
|
||||||
/// <returns>Risultato sincronizzazione</returns>
|
|
||||||
public SyncResult ProjSendProg(int prodId, double procTime, double valAct, double valMax)
|
|
||||||
{
|
|
||||||
SyncResult answ = SyncResult.ERR_ND;
|
|
||||||
// verifico server ok
|
|
||||||
bool servOk = commLib.CheckRemote();
|
|
||||||
if (!servOk)
|
|
||||||
{
|
|
||||||
answ = SyncResult.ERR_ServerKo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
using (ProdController dbContr = new ProdController())
|
|
||||||
{
|
|
||||||
// in primis recupero item
|
|
||||||
var currRec = dbContr.FindByProdId(prodId);
|
|
||||||
if (currRec == null)
|
|
||||||
{
|
|
||||||
answ = SyncResult.ERR_ProjIdNotFound;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// verifico ci sia cloud ID...
|
|
||||||
if (currRec.ProjCloudId == 0)
|
|
||||||
{
|
|
||||||
answ = SyncResult.ERR_ProjCloudIdNotFound;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// preparo obj da inviare...
|
|
||||||
ProjectProgrDTO projProgrDTO = new ProjectProgrDTO()
|
|
||||||
{
|
|
||||||
ProjCloudId = currRec.ProjCloudId,
|
|
||||||
ValAct = valAct,
|
|
||||||
ValMax = valMax,
|
|
||||||
ProcTimeReal = procTime
|
|
||||||
};
|
|
||||||
// invio e recupero ID...
|
|
||||||
bool fatto = commLib.ProjectProgrSend(projProgrDTO);
|
|
||||||
// se inviato, faccio upgrade locale...
|
|
||||||
if (!fatto)
|
|
||||||
{
|
|
||||||
answ = SyncResult.ERR_ProjNotSync;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
answ = SyncResult.ALL_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
answ = SyncResult.ERR_ServerKo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return answ;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|||||||
Reference in New Issue
Block a user