Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 63e636cd36 | |||
| 1458a4cf5d | |||
| 6cf7331081 | |||
| 43402a785f | |||
| 88561778ce | |||
| 0d395fca33 | |||
| 09fea8f0e3 | |||
| 42531aac49 | |||
| bbfc3ca64d |
@@ -193,34 +193,45 @@ public static class ThreadsFunctions
|
|||||||
StatReset();
|
StatReset();
|
||||||
NcAdapter ncAdapter = new NcAdapter();
|
NcAdapter ncAdapter = new NcAdapter();
|
||||||
CmsError libraryError = NO_ERROR;
|
CmsError libraryError = NO_ERROR;
|
||||||
// Run loop until NC is connected
|
try
|
||||||
while (!ncAdapter.numericalControl.NC_IsConnected())
|
|
||||||
{
|
{
|
||||||
// Try reconnection
|
// Run loop until NC is connected
|
||||||
libraryError = ncAdapter.Connect();
|
while (!ncAdapter.numericalControl.NC_IsConnected())
|
||||||
if (libraryError.errorCode == CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND || libraryError.errorCode == CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING || libraryError.errorCode == CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND)
|
|
||||||
ManageLibraryError(libraryError);
|
|
||||||
else if (libraryError.errorCode != CMS_ERROR_CODES.OK)
|
|
||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
// Try reconnection
|
||||||
|
libraryError = ncAdapter.Connect();
|
||||||
|
if (libraryError.errorCode == CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND || libraryError.errorCode == CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING || libraryError.errorCode == CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND)
|
||||||
|
ManageLibraryError(libraryError);
|
||||||
|
else if (libraryError.errorCode != CMS_ERROR_CODES.OK)
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send status to UI
|
||||||
|
MessageServices.Current.Publish(SEND_NC_STATUS_UI, null, ncAdapter.numericalControl.NC_IsConnected());
|
||||||
|
// Send status to signalr
|
||||||
|
MessageServices.Current.Publish(SEND_NC_STATUS, null, ncAdapter.numericalControl.NC_IsConnected());
|
||||||
|
|
||||||
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send status to UI
|
if (!libraryError.IsError())
|
||||||
MessageServices.Current.Publish(SEND_NC_STATUS_UI, null, ncAdapter.numericalControl.NC_IsConnected());
|
{
|
||||||
// Send status to signalr
|
if (ServerStartupConfig.AutoOpenCmsClient)
|
||||||
MessageServices.Current.Publish(SEND_NC_STATUS, null, ncAdapter.numericalControl.NC_IsConnected());
|
StartCMSClient();
|
||||||
|
|
||||||
Thread.Sleep(1000);
|
// Start/Restart NC threads
|
||||||
|
ThreadsHandler.StartWorkers();
|
||||||
|
reconnectionIsRunning = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
if (!libraryError.IsError())
|
|
||||||
{
|
{
|
||||||
if (ServerStartupConfig.AutoOpenCmsClient)
|
ncAdapter.Dispose();
|
||||||
StartCMSClient();
|
}
|
||||||
|
finally
|
||||||
// Start/Restart NC threads
|
{
|
||||||
ThreadsHandler.StartWorkers();
|
ncAdapter.Dispose();
|
||||||
reconnectionIsRunning = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,6 +337,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -501,6 +516,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ManageWatchdog()
|
public static void ManageWatchdog()
|
||||||
@@ -547,6 +566,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadAlarms()
|
public static void ReadAlarms()
|
||||||
@@ -591,6 +614,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadAreaData()
|
public static void ReadAreaData()
|
||||||
@@ -633,6 +660,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -686,6 +717,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -735,6 +770,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadEnabledFunctionality()
|
public static void ReadEnabledFunctionality()
|
||||||
@@ -779,6 +818,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadExpiredMaintenances()
|
public static void ReadExpiredMaintenances()
|
||||||
@@ -833,6 +876,11 @@ public static class ThreadsFunctions
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,6 +925,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadM154Data()
|
public static void ReadM154Data()
|
||||||
@@ -1051,6 +1103,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadMComandsData()
|
public static void ReadMComandsData()
|
||||||
@@ -1097,6 +1153,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadModulesData()
|
public static void ReadModulesData()
|
||||||
@@ -1139,6 +1199,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadPowerOnData()
|
public static void ReadPowerOnData()
|
||||||
@@ -1181,6 +1245,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadProcessesPPStatus()
|
public static void ReadProcessesPPStatus()
|
||||||
@@ -1227,6 +1295,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadProdCycleData()
|
public static void ReadProdCycleData()
|
||||||
@@ -1270,6 +1342,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadProdInfoData()
|
public static void ReadProdInfoData()
|
||||||
@@ -1313,6 +1389,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadProdPanelData()
|
public static void ReadProdPanelData()
|
||||||
@@ -1356,6 +1436,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadRecipeData()
|
public static void ReadRecipeData()
|
||||||
@@ -1431,6 +1515,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadScadaData()
|
public static void ReadScadaData()
|
||||||
@@ -1476,6 +1564,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadUserSoftKeysData()
|
public static void ReadUserSoftKeysData()
|
||||||
@@ -1520,6 +1612,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadWarmersData()
|
public static void ReadWarmersData()
|
||||||
@@ -1572,6 +1668,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RestoreConnection()
|
public static void RestoreConnection()
|
||||||
@@ -1665,6 +1765,10 @@ public static class ThreadsFunctions
|
|||||||
{
|
{
|
||||||
ncAdapter.Dispose();
|
ncAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void StartCMSClient()
|
public static void StartCMSClient()
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ namespace Thermo.Active.Database.Controllers
|
|||||||
// Initialize database context
|
// Initialize database context
|
||||||
dbCtx = new DatabaseContext();
|
dbCtx = new DatabaseContext();
|
||||||
}
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Clear database context
|
||||||
|
dbCtx.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion Public Constructors
|
#endregion Public Constructors
|
||||||
|
|
||||||
@@ -80,11 +86,6 @@ namespace Thermo.Active.Database.Controllers
|
|||||||
return prodData;
|
return prodData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
// Clear database context
|
|
||||||
dbCtx.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get record by NumDone
|
/// Get record by NumDone
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ namespace Thermo.Active.Utils
|
|||||||
{
|
{
|
||||||
Log.Info(message);
|
Log.Info(message);
|
||||||
}
|
}
|
||||||
|
public static void LogDebug(string message)
|
||||||
|
{
|
||||||
|
Log.Debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
public static void LogWarning(string message)
|
public static void LogWarning(string message)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Security.Principal;
|
|||||||
using Thermo.Active.Config;
|
using Thermo.Active.Config;
|
||||||
using Thermo.Active.Database.Controllers;
|
using Thermo.Active.Database.Controllers;
|
||||||
using Thermo.Active.Model.DatabaseModels;
|
using Thermo.Active.Model.DatabaseModels;
|
||||||
|
using Thermo.Active.Utils;
|
||||||
using static Thermo.Active.Config.ServerConfig;
|
using static Thermo.Active.Config.ServerConfig;
|
||||||
using static Thermo.Active.Listeners.SignalRStaticObjects;
|
using static Thermo.Active.Listeners.SignalRStaticObjects;
|
||||||
using static Thermo.Active.Model.Constants;
|
using static Thermo.Active.Model.Constants;
|
||||||
@@ -28,7 +29,11 @@ namespace Thermo.Active.Attributes
|
|||||||
// Find user session on this machine
|
// Find user session on this machine
|
||||||
SessionModel session = sessionsController.FindSessionByToken(token);
|
SessionModel session = sessionsController.FindSessionByToken(token);
|
||||||
if (session == null)
|
if (session == null)
|
||||||
|
{
|
||||||
|
ThermoActiveLogger.LogError($"SignalRAuthorizeAttribute | AuthorizeHubConnection | session == null");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.AuthorizeHubConnection(hubDescriptor, request);
|
return base.AuthorizeHubConnection(hubDescriptor, request);
|
||||||
@@ -39,11 +44,16 @@ namespace Thermo.Active.Attributes
|
|||||||
var connectionId = hubIncomingInvokerContext.Hub.Context.ConnectionId;
|
var connectionId = hubIncomingInvokerContext.Hub.Context.ConnectionId;
|
||||||
var request = hubIncomingInvokerContext.Hub.Context.Request;
|
var request = hubIncomingInvokerContext.Hub.Context.Request;
|
||||||
var token = request.QueryString.Get("Authorization");
|
var token = request.QueryString.Get("Authorization");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(token))
|
if (!string.IsNullOrEmpty(token))
|
||||||
{
|
{
|
||||||
// check authorization
|
// check authorization
|
||||||
if (!CheckAuthorization(FunctionAccess, token, out int machineId, out int userId))
|
if (!CheckAuthorization(FunctionAccess, token, out int machineId, out int userId))
|
||||||
|
{
|
||||||
|
ThermoActiveLogger.LogError($"SignalRAuthorizeAttribute | AuthorizeHubMethodInvocation | CheckAuthorization == false");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var claims = new ClaimsIdentity(AUTHENTICATION_TYPE);
|
var claims = new ClaimsIdentity(AUTHENTICATION_TYPE);
|
||||||
claims.AddClaim(new Claim(USER_ID_KEY, userId.ToString()));
|
claims.AddClaim(new Claim(USER_ID_KEY, userId.ToString()));
|
||||||
@@ -66,11 +76,17 @@ namespace Thermo.Active.Attributes
|
|||||||
// Find user session on this machine
|
// Find user session on this machine
|
||||||
SessionModel session = sessionsController.FindSessionByToken(token);
|
SessionModel session = sessionsController.FindSessionByToken(token);
|
||||||
if (session == null)
|
if (session == null)
|
||||||
|
{
|
||||||
|
ThermoActiveLogger.LogError($"SignalRAuthorizeAttribute | CheckAuthorization | session == null");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the machine is the same where the user logged in
|
// Check if the machine is the same where the user logged in
|
||||||
if (session.MachineUser.MachineId != MachineConfig.MachineId)
|
if (session.MachineUser.MachineId != MachineConfig.MachineId)
|
||||||
|
{
|
||||||
|
ThermoActiveLogger.LogError($"SignalRAuthorizeAttribute | CheckAuthorization | session.MachineUser.MachineId != MachineConfig.MachineId | " + session.MachineUser.MachineId + "," + MachineConfig.MachineId);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
machineId = session.MachineUser.MachineId;
|
machineId = session.MachineUser.MachineId;
|
||||||
userId = session.MachineUser.UserId;
|
userId = session.MachineUser.UserId;
|
||||||
@@ -91,12 +107,18 @@ namespace Thermo.Active.Attributes
|
|||||||
if (Action == ACTIONS.READ)
|
if (Action == ACTIONS.READ)
|
||||||
{ // Check read permissions
|
{ // Check read permissions
|
||||||
if (functionAccess.ReadLevelMin > machineUser.Role.Level)
|
if (functionAccess.ReadLevelMin > machineUser.Role.Level)
|
||||||
|
{
|
||||||
|
ThermoActiveLogger.LogError($"SignalRAuthorizeAttribute | CheckAuthorization | functionAccess.ReadLevelMin > machineUser.Role.Level | " + functionAccess.ReadLevelMin + "," + machineUser.Role.Level);
|
||||||
return false; // Not authorized
|
return false; // Not authorized
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Check write permissions
|
{ // Check write permissions
|
||||||
if (functionAccess.WriteLevelMin > machineUser.Role.Level)
|
if (functionAccess.WriteLevelMin > machineUser.Role.Level)
|
||||||
|
{
|
||||||
|
ThermoActiveLogger.LogError($"SignalRAuthorizeAttribute | CheckAuthorization | functionAccess.WriteLevelMin > machineUser.Role.Level | " + functionAccess.WriteLevelMin + "," + machineUser.Role.Level);
|
||||||
return false; // Not authorized
|
return false; // Not authorized
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if PLC bit exists
|
// Check if PLC bit exists
|
||||||
@@ -105,13 +127,21 @@ namespace Thermo.Active.Attributes
|
|||||||
// Check if functionality is enabled by PLC
|
// Check if functionality is enabled by PLC
|
||||||
var functionalityIsEnabled = LastRuntimeFunctionality.Where(x => x.Name == functionName).FirstOrDefault();
|
var functionalityIsEnabled = LastRuntimeFunctionality.Where(x => x.Name == functionName).FirstOrDefault();
|
||||||
if (functionalityIsEnabled == null || functionalityIsEnabled.Enabled == false)
|
if (functionalityIsEnabled == null || functionalityIsEnabled.Enabled == false)
|
||||||
return false;
|
{
|
||||||
|
ThermoActiveLogger.LogError($"SignalRAuthorizeAttribute | CheckAuthorization | functionalityIsEnabled == null || functionalityIsEnabled.Enabled == false | " + functionalityIsEnabled + "," + functionalityIsEnabled.Enabled);
|
||||||
|
return false; // Not authorized
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
ThermoActiveLogger.LogError($"SignalRAuthorizeAttribute | CheckAuthorization | functionAccess != null && ServerConfigController.CheckAreaStatus(functionAccess.Area) | " + functionAccess + "," + functionAccess.Area);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Authorized
|
// Authorized
|
||||||
|
ThermoActiveLogger.LogInfo($"SignalRAuthorizeAttribute | CheckAuthorization | Authorized | ");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,14 @@ using static Thermo.Active.Model.Constants;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/maintenance_manager")]
|
[RoutePrefix("api/maintenance_manager")]
|
||||||
public class ApiMaintenanceController : ApiController
|
public class ApiMaintenanceController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
[Route("maintenances"), HttpGet]
|
[Route("maintenances"), HttpGet]
|
||||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.MAINTENANCE, Action = ACTIONS.READ)]
|
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.MAINTENANCE, Action = ACTIONS.READ)]
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using static Thermo.Active.Model.Constants;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/authorization")]
|
[RoutePrefix("api/authorization")]
|
||||||
public class AuthorizationController : ApiController
|
public class AuthorizationController : ApiController
|
||||||
{
|
{
|
||||||
[Route("functions"), HttpGet]
|
[Route("functions"), HttpGet]
|
||||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.GENERAL, Action = ACTIONS.READ)]
|
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.GENERAL, Action = ACTIONS.READ)]
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ using static Thermo.Active.Model.Constants;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/user_softkey")]
|
[RoutePrefix("api/user_softkey")]
|
||||||
public class FavoriteUserSoftkeyController : ApiController
|
public class FavoriteUserSoftkeyController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
[Route("favorite"), HttpGet]
|
[Route("favorite"), HttpGet]
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ using static Thermo.Active.Utils.LanguageController;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/language")]
|
[RoutePrefix("api/language")]
|
||||||
public class LanguageController : ApiController
|
public class LanguageController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
[Route("languages"), HttpGet]
|
[Route("languages"), HttpGet]
|
||||||
public IHttpActionResult GetLanguageList()
|
public IHttpActionResult GetLanguageList()
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ using Thermo.Active.Utils;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/ModBlock")]
|
[RoutePrefix("api/ModBlock")]
|
||||||
public class ModulesController : ApiController
|
public class ModulesController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
[Route("current"), HttpGet]
|
[Route("current"), HttpGet]
|
||||||
public IHttpActionResult GetCurrentModules()
|
public IHttpActionResult GetCurrentModules()
|
||||||
|
|||||||
@@ -8,13 +8,15 @@ using static Thermo.Active.Model.Constants;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/nc")]
|
[RoutePrefix("api/nc")]
|
||||||
public class NcApiController : ApiController
|
public class NcApiController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
|
||||||
|
#endif
|
||||||
[Route("generic_data"), HttpGet]
|
[Route("generic_data"), HttpGet]
|
||||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.NC_DATA, Action = ACTIONS.READ)]
|
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.NC_DATA, Action = ACTIONS.READ)]
|
||||||
public IHttpActionResult GetNcGenericData()
|
public IHttpActionResult GetNcGenericData()
|
||||||
|
|||||||
@@ -11,13 +11,16 @@ using static Thermo.Active.Model.Constants;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/prod")]
|
[RoutePrefix("api/prod")]
|
||||||
public class ProdController : ApiController
|
public class ProdController : aBaseApiController //ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Request mode SETUP
|
/// Request mode SETUP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -26,12 +26,14 @@ using static Thermo.Active.Model.Constants;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/recipe")]
|
[RoutePrefix("api/recipe")]
|
||||||
public class RecipeController : ApiController
|
public class RecipeController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
[Route("overview"), HttpGet]
|
[Route("overview"), HttpGet]
|
||||||
public IHttpActionResult GetOverview()
|
public IHttpActionResult GetOverview()
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ namespace Thermo.Active.Controllers.WebApi
|
|||||||
{
|
{
|
||||||
|
|
||||||
[RoutePrefix("api/scada")]
|
[RoutePrefix("api/scada")]
|
||||||
public class ScadaController : ApiController
|
public class ScadaController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
[Route("list"), HttpGet]
|
[Route("list"), HttpGet]
|
||||||
public IHttpActionResult GetScadaList()
|
public IHttpActionResult GetScadaList()
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ using Thermo.Active.Utils;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/starred_softkey")]
|
[RoutePrefix("api/starred_softkey")]
|
||||||
public class StarredUserSoftKeyController : ApiController
|
public class StarredUserSoftKeyController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
[Route("get"), HttpGet]
|
[Route("get"), HttpGet]
|
||||||
public IHttpActionResult GetStarredUserSoftkey()
|
public IHttpActionResult GetStarredUserSoftkey()
|
||||||
|
|||||||
@@ -29,12 +29,15 @@ using static Thermo.Active.Model.Constants;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/underthehood")]
|
[RoutePrefix("api/underthehood")]
|
||||||
public class UnderTheHoodController : ApiController
|
public class UnderTheHoodController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
[ResponseType(typeof(DTOCycleLog))]
|
[ResponseType(typeof(DTOCycleLog))]
|
||||||
[Route("CycleLogRefresh"), HttpGet]
|
[Route("CycleLogRefresh"), HttpGet]
|
||||||
|
|||||||
@@ -18,14 +18,16 @@ using System.Linq;
|
|||||||
namespace Thermo.Active.Controllers.WebApi
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
{
|
{
|
||||||
[RoutePrefix("api/warmers")]
|
[RoutePrefix("api/warmers")]
|
||||||
public class WarmersController : ApiController
|
public class WarmersController : aBaseApiController // ApiController
|
||||||
{
|
{
|
||||||
#region Protected Fields
|
#region Protected Fields
|
||||||
|
|
||||||
|
#if false
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oggetto adapter condiviso da WebAPI
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static NcAdapter ncAdapter = new NcAdapter();
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
#endif
|
||||||
|
|
||||||
protected static Dictionary<int, ThermoPoint> MeasurePoints = new Dictionary<int, ThermoPoint>();
|
protected static Dictionary<int, ThermoPoint> MeasurePoints = new Dictionary<int, ThermoPoint>();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Web.Http;
|
||||||
|
using Thermo.Active.NC;
|
||||||
|
|
||||||
|
namespace Thermo.Active.Controllers.WebApi
|
||||||
|
{
|
||||||
|
public class aBaseApiController : ApiController
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Oggetto adapter condiviso da WebAPI
|
||||||
|
/// </summary>
|
||||||
|
protected static NcAdapter ncAdapter = new NcAdapter();
|
||||||
|
|
||||||
|
#if false
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
if (ncAdapter != null)
|
||||||
|
{
|
||||||
|
ncAdapter.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
|
|||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("1.1.185")]
|
[assembly: AssemblyVersion("1.1.186")]
|
||||||
|
|||||||
@@ -222,6 +222,7 @@
|
|||||||
<Compile Include="Attributes\WebApiAuthorizeAttribute.cs" />
|
<Compile Include="Attributes\WebApiAuthorizeAttribute.cs" />
|
||||||
<Compile Include="Attributes\SignalRAuthorizeAttribute.cs" />
|
<Compile Include="Attributes\SignalRAuthorizeAttribute.cs" />
|
||||||
<Compile Include="Controllers\SignalR\NcHub.cs" />
|
<Compile Include="Controllers\SignalR\NcHub.cs" />
|
||||||
|
<Compile Include="Controllers\WebApi\aBaseApiController.cs" />
|
||||||
<Compile Include="Controllers\WebApi\ApiAlarmController.cs" />
|
<Compile Include="Controllers\WebApi\ApiAlarmController.cs" />
|
||||||
<Compile Include="Controllers\WebApi\UnderTheHoodController.cs" />
|
<Compile Include="Controllers\WebApi\UnderTheHoodController.cs" />
|
||||||
<Compile Include="Controllers\WebApi\SchedTaskController.cs" />
|
<Compile Include="Controllers\WebApi\SchedTaskController.cs" />
|
||||||
|
|||||||
@@ -119,6 +119,9 @@ namespace Thermo.Active
|
|||||||
ListenersHandler.Stop();
|
ListenersHandler.Stop();
|
||||||
// Close WinForm
|
// Close WinForm
|
||||||
ServerControlWindow.Stop();
|
ServerControlWindow.Stop();
|
||||||
|
|
||||||
|
// force close
|
||||||
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ValidateAddress(string Addr)
|
private static bool ValidateAddress(string Addr)
|
||||||
|
|||||||
+2
-2
@@ -42,8 +42,8 @@ export default class SVGCaricatore extends Vue{
|
|||||||
minoreuguale:string="<=";
|
minoreuguale:string="<=";
|
||||||
|
|
||||||
getPositionSheet(id,col){
|
getPositionSheet(id,col){
|
||||||
var vent = ((this.larghTelaioSVG + (this.dimVentose*2)) / (this.numVentose +1));
|
var vent = (this.larghTelaioSVG - (this.dimVentose*2)) / (this.numVentose -1);
|
||||||
var posX = (id*vent ) - (this.dimVentose*2);
|
var posX = (id-1)*vent;
|
||||||
if(col == 1)
|
if(col == 1)
|
||||||
return "translate(-630 -147) translate(50 25) translate(580 122) translate(0 70) translate(0 0) translate("+ posX + ")";
|
return "translate(-630 -147) translate(50 25) translate(580 122) translate(0 70) translate(0 0) translate("+ posX + ")";
|
||||||
else if(col == 2)
|
else if(col == 2)
|
||||||
|
|||||||
@@ -20,6 +20,12 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.bitSelect .form.error {
|
||||||
|
outline: 2px #d0021b auto !important;
|
||||||
|
}
|
||||||
|
.bitSelect .form.disabled {
|
||||||
|
background-color: rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
.bitSelect .form i {
|
.bitSelect .form i {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 4px;
|
right: 4px;
|
||||||
|
|||||||
@@ -19,6 +19,16 @@
|
|||||||
padding-right: 25px;
|
padding-right: 25px;
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.error{
|
||||||
|
outline: 2px #d0021b auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disabled{
|
||||||
|
background-color: rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
i {
|
i {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 4px;
|
right: 4px;
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ export default class bitSelect extends Vue {
|
|||||||
this.value.setpointHMI = v;
|
this.value.setpointHMI = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openclose(){
|
||||||
|
if(!this.value || !this.value.status || !this.value.status.enabled)
|
||||||
|
return
|
||||||
|
|
||||||
|
this.opened = !this.opened
|
||||||
|
}
|
||||||
|
|
||||||
get currentValue() {
|
get currentValue() {
|
||||||
let result = []
|
let result = []
|
||||||
for (let index = 0; index < this.bitSize; index++) {
|
for (let index = 0; index < this.bitSize; index++) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="bitSelect">
|
<div class="bitSelect">
|
||||||
<div
|
<div
|
||||||
class="form"
|
class="form"
|
||||||
@click="opened = !opened"
|
@click="openclose"
|
||||||
:class="{'error': value && value.status && value.status.hasError, 'disabled': value && value.status && !value.status.enabled}"
|
:class="{'error': value && value.status && value.status.hasError, 'disabled': value && value.status && !value.status.enabled}"
|
||||||
>
|
>
|
||||||
{{currentValue}}
|
{{currentValue}}
|
||||||
|
|||||||
+2
-2
@@ -27,8 +27,8 @@ export default class outputRow extends Vue {
|
|||||||
async force(value: number) {
|
async force(value: number) {
|
||||||
if(!this.item.isForced && (this.item.forcedValue === undefined || value != this.item.forcedValue))
|
if(!this.item.isForced && (this.item.forcedValue === undefined || value != this.item.forcedValue))
|
||||||
{
|
{
|
||||||
ModalHelper.AskConfirm( this.$options.filters.localize("Richiesta di conferma","modal_confirm_title"),
|
ModalHelper.AskConfirm( this.$options.filters.localize("modal_confirm_title", "Richiesta di conferma"),
|
||||||
this.$options.filters.localize("Confirm?","softkey_confirm"),
|
this.$options.filters.localize("softkey_confirm", "Confirm?"),
|
||||||
async() => {
|
async() => {
|
||||||
await underTheHoodService.forceChannel(this.group, this.item, value);
|
await underTheHoodService.forceChannel(this.group, this.item, value);
|
||||||
}, null, "modal");
|
}, null, "modal");
|
||||||
|
|||||||
Reference in New Issue
Block a user