diff --git a/Thermo.Active.Config/Config/userSoftKeyConfig.xml b/Thermo.Active.Config/Config/userSoftKeyConfig.xml
index 6ba43874..b7f89126 100644
--- a/Thermo.Active.Config/Config/userSoftKeyConfig.xml
+++ b/Thermo.Active.Config/Config/userSoftKeyConfig.xml
@@ -1,367 +1,368 @@
-
- true
- 1
- false
- 1
-
- Reset
- Reset
-
- true
-
-
-
- true
- 2
- false
- 2
-
- Refresh alarms
- Refresh allarmi
-
- true
-
-
-
- true
- 3
- false
- 3
-
- Termoregulator
- Termoregolatori
-
- true
-
-
-
- true
- 4
- false
- 4
-
- Front gate
- Portellone frontale
-
- true
-
-
-
- false
- 5
- false
- 5
-
- Pause cycle
- Pausa ciclo
-
- true
-
+
+ true
+ 1
+ false
+ 1
+
+ Reset
+ Reset
+
+ true
+
+
+
+ true
+ 2
+ false
+ 2
+
+ Refresh alarms
+ Refresh allarmi
+
+ true
+
+
+
+ true
+ 3
+ false
+ 3
+
+ Termoregulator
+ Termoregolatori
+
+ true
+ true
+
+
+
+ true
+ 4
+ false
+ 4
+
+ Front gate
+ Portellone frontale
+
+ true
+
-
- true
- 7
- false
- 7
-
- Heaters
- Riflettori
-
- true
-
-
- true
- 1
- false
- 9
-
- Vacuum pumps
- Pompe vuoto
-
- true
-
-
-
- true
- 1
- true
- 12
-
- Reset hours pump 1
- Reset contaore pompa 1
-
- true
-
+ false
+ 5
+ false
+ 5
+
+ Pause cycle
+ Pausa ciclo
+
+ true
+
-
- true
- 1
- true
- 13
-
- Reset hours pump 2
- Reset contaore pompa 2
-
- true
-
+
+ true
+ 7
+ false
+ 7
+
+ Heaters
+ Riflettori
+
+ true
+
-
- true
- 1
- false
- 14
-
- Reset hours pump 3
- Reset contaore pompa 3
-
- true
-
-
-
- true
- 1
- false
- 15
-
- Extra 10s upper heater
- Extra 10s riscaldo superiore
-
- true
-
-
-
- true
- 1
- false
- 16
-
- Extra 10s lower heater
- Extra 10s riscaldo inferiore
-
- true
-
-
-
- true
- 4
- false
- 17
-
- Open/Close pliers
- Apertura/chiusura pinze
-
- true
-
-
-
- true
- 4
- false
- 18
-
- Loader forward
- Carrello avanti
-
- true
-
+
+ true
+ 1
+ false
+ 9
+
+ Vacuum pumps
+ Pompe vuoto
+
+ true
+
-
- true
- 7
- false
- 19
-
- Loader backward
- Carrello indietro
-
- true
-
-
-
- true
- 7
- false
- 20
-
- Suckers up
- Ventose su
-
- true
-
-
-
- true
- 7
- false
- 21
-
- Suckers down
- Ventose giu
-
- true
-
-
-
- true
- 7
- false
- 22
-
- Suckers setup
- Ventose setup
-
- true
-
-
-
- true
- 7
- false
- 23
-
- Suckers park
- Ventose parcheggio
-
- true
-
-
-
- true
- 7
- false
- 24
-
- Ejection
- Espulsione
-
- true
-
-
-
- true
- 7
- false
- 25
-
- Suckers lock/unlock
- Blocco/sblocco telaio ventose
-
- true
-
-
-
- true
- 7
- false
- 26
-
- Suckers vacuum
- Vuoto ventose
-
- true
-
-
-
- true
- 7
- false
- 27
-
- Suckers air
- Aria ventose
-
- true
-
-
-
- true
- 7
- false
- 28
-
- Mould unload
- Scarico stampo
-
- true
-
-
-
- true
- 7
- false
- 29
-
- Upperplate lock/unlock
- Blocco/sblocco controstampo
-
- true
-
-
-
- true
- 7
- false
- 30
-
- Frame X
- Apertura cornice
-
- true
-
-
-
- true
- 7
- false
- 31
-
- Frame Y
- Profondità cornice
-
- true
-
-
-
- true
- 7
- false
- 32
-
- Windowplate X
- Larghezza piastrafinestra
-
- true
-
-
-
- true
- 7
- false
- 33
-
- Windowplate Y
- Profondità piastrafinestra
-
- true
-
-
-
- true
- 7
- false
- 34
-
- Preheating cycles
- Cicli di preriscaldo
-
- true
-
+
+ true
+ 1
+ true
+ 12
+
+ Reset hours pump 1
+ Reset contaore pompa 1
+
+ true
+
-
-
+
\ No newline at end of file
diff --git a/Thermo.Active.Config/Config/userSoftKeyConfigValidator.xsd b/Thermo.Active.Config/Config/userSoftKeyConfigValidator.xsd
index d96b4068..a57f9bec 100644
--- a/Thermo.Active.Config/Config/userSoftKeyConfigValidator.xsd
+++ b/Thermo.Active.Config/Config/userSoftKeyConfigValidator.xsd
@@ -1,99 +1,101 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs
index 18dc9845..6b8361b2 100644
--- a/Thermo.Active.Config/ServerConfigController.cs
+++ b/Thermo.Active.Config/ServerConfigController.cs
@@ -517,6 +517,7 @@ namespace Thermo.Active.Config
PlcId = Convert.ToInt32(x.Element("plcId")?.Value), // If exists
IsActive = Convert.ToBoolean(x.Element("active").Value),
IsVisible = Convert.ToBoolean(x.Element("visible").Value),
+ IsStarred = x.Element("starred") != null ? Convert.ToBoolean(x.Element("starred").Value) : false,
Category = Convert.ToInt32(x.Element("category").Value),
LocalizedNames = x.Element("localizedNames").Elements().ToDictionary( // Read localized names and convert into a dictionary
y => y.Attribute("langKey").Value, y => y.Value
diff --git a/Thermo.Active.Core/ThreadsFunctions.cs b/Thermo.Active.Core/ThreadsFunctions.cs
index 5b097c2a..cd76ced8 100644
--- a/Thermo.Active.Core/ThreadsFunctions.cs
+++ b/Thermo.Active.Core/ThreadsFunctions.cs
@@ -210,7 +210,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
-
public static void ReadAlarms()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -254,7 +253,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
-
public static void ReadPowerOnData()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -296,7 +294,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
-
public static void ReadProcessesPPStatus()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -350,7 +347,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
-
public static void ReadEnabledFunctionality()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -394,7 +390,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
-
public static void ReadExpiredMaintenances()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -450,7 +445,6 @@ public static class ThreadsFunctions
}
}
-
public static void ReadUserSoftKeysData()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -494,7 +488,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
-
public static void ReadAxesNamesData()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -538,7 +531,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
-
public static void ReadAxesPositionsData()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -582,7 +574,6 @@ public static class ThreadsFunctions
ncAdapter.Dispose();
}
}
-
public static void ReadScadaData()
{
NcAdapter ncAdapter = new NcAdapter();
@@ -1256,7 +1247,6 @@ public static class ThreadsFunctions
reconnectionIsRunning = false;
}
}
-
public static void RestoreConnection()
{
if (reconnectionIsRunning == false)
@@ -1271,13 +1261,11 @@ public static class ThreadsFunctions
ConnThread.Start();
}
}
-
public static void AbortNcConnection()
{
if (ConnThread != null && ConnThread.IsAlive)
ConnThread.Abort();
}
-
public static void ManageLibraryError(CmsError libraryError)
{
switch (libraryError.errorCode)
@@ -1309,7 +1297,6 @@ public static class ThreadsFunctions
break;
}
}
-
internal static void UpdateStat(string functionName, long timer)
{
if (!Timers.ContainsKey(functionName))
@@ -1323,7 +1310,6 @@ public static class ThreadsFunctions
else
Counter[functionName]++;
}
-
internal static void StatThread()
{
while (true)
@@ -1343,7 +1329,6 @@ public static class ThreadsFunctions
Thread.Sleep(2000);
}
}
-
private static void StatReset()
{
foreach (var value in Counter)
@@ -1352,7 +1337,6 @@ public static class ThreadsFunctions
Counter[value.Key] = 0;
}
}
-
private static int CalcSleepTime(int maxSleep, int execTime)
{
int sleep = 0;
@@ -1378,7 +1362,6 @@ public static class ThreadsFunctions
ThreadsHandler.StartClient.Start();
}
}
-
private static void clientProcess()
{
string CMSClientPath = "";
@@ -1399,7 +1382,6 @@ public static class ThreadsFunctions
}
}
}
-
private static bool ClientIsRunning()
{
Process[] p = Process.GetProcessesByName(CLIENT_EXE_NAME_NOEXT);
@@ -1414,7 +1396,6 @@ public static class ThreadsFunctions
}
return false;
}
-
private static Dictionary GetPlcAlarmsTranslations(string language)
{
using (NcAdapter ncAdapter = new NcAdapter())
diff --git a/Thermo.Active.Database/Migrations/Configuration.cs b/Thermo.Active.Database/Migrations/Configuration.cs
index fb926f21..c0c193b7 100644
--- a/Thermo.Active.Database/Migrations/Configuration.cs
+++ b/Thermo.Active.Database/Migrations/Configuration.cs
@@ -53,7 +53,8 @@ namespace Thermo.Active.Database.Migrations
new FunctionAccessModel() { Name = "scadaArea", Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = "usersArea", Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 30, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = "jobeditorArea", Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 20, ReadLevelMin = 1, PlcId = 0 },
- new FunctionAccessModel() { Name = "utilitiesArea", Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 }
+ new FunctionAccessModel() { Name = "utilitiesArea", Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 },
+ new FunctionAccessModel() { Name = RECIPE_MANAGER, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 }
);
context.SaveChanges();
diff --git a/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs b/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs
index c3f1713f..bf84c04b 100644
--- a/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs
+++ b/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs
@@ -10,6 +10,7 @@ namespace Thermo.Active.Model.ConfigModels
public int Category { get; set; }
public bool IsActive { get; set; }
public bool IsVisible { get; set; }
+ public bool IsStarred { get; set; } = false;
public bool OperatorConfirmationNeeded { get; set; }
public List SubKeys { get; set; }
public int PlcId { get; set; }
diff --git a/Thermo.Active.Model/Constants.cs b/Thermo.Active.Model/Constants.cs
index 7c5ff9df..bf6fa060 100644
--- a/Thermo.Active.Model/Constants.cs
+++ b/Thermo.Active.Model/Constants.cs
@@ -347,6 +347,7 @@ namespace Thermo.Active.Model
public const string AXES_SELECTION = "axesSoftkeys";
public const string THERMO_MANAGER = "thermoManager";
public const string RISC_MANAGER = "riscManager";
+ public const string RECIPE_MANAGER = "thermoRecipeManager";
}
public static class API_ERROR_KEYS
diff --git a/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs b/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs
index 1fe00640..3348e440 100644
--- a/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs
+++ b/Thermo.Active.Model/DTOModels/DTOUserSoftKeyModel.cs
@@ -18,6 +18,7 @@ namespace Thermo.Active.Model.DTOModels
public int Category { get; set; }
public bool Active { get; set; }
public bool Visible { get; set; }
+ public bool Starred { get; set; } = false;
public bool Value { get; set; }
public override bool Equals(object obj)
diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs
index 6c3366fb..e4d4a6ef 100644
--- a/Thermo.Active.NC/NcAdapter.cs
+++ b/Thermo.Active.NC/NcAdapter.cs
@@ -1009,6 +1009,7 @@ namespace Thermo.Active.NC
{
Id = subkey.Id,
Active = plcSoftKey.Active,
+ Starred = softKey.IsStarred,
Category = softKey.Category,
Value = plcSoftKey.Value
});
@@ -1029,6 +1030,38 @@ namespace Thermo.Active.NC
{
Id = softKey.Id,
Active = plcSoftKey.Active,
+ Starred = softKey.IsStarred,
+ Category = softKey.Category,
+ Visible = softKey.IsVisible,
+ Value = plcSoftKey.Value
+ });
+ }
+ }
+
+ return libraryError;
+ }
+
+ public CmsError GetStarredUserSoftKeys(out List softKeys)
+ {
+ softKeys = new List();
+ List plcSoftKeys = new List();
+
+ // Get softkeys data from PLC
+ CmsError libraryError = numericalControl.PLC_RUserSoftKeys(ref plcSoftKeys);
+ if (libraryError.IsError() || plcSoftKeys.Count == 0)
+ return libraryError;
+
+ foreach (var softKey in SoftKeysConfig)
+ {
+ // Find the plc matching data
+ var plcSoftKey = plcSoftKeys.Find(x => x.Id == softKey.PlcId);
+ if (softKey.IsStarred)
+ {
+ softKeys.Add(new DTOUserSoftKeyModel()
+ {
+ Id = softKey.Id,
+ Active = plcSoftKey.Active,
+ Starred = softKey.IsStarred,
Category = softKey.Category,
Visible = softKey.IsVisible,
Value = plcSoftKey.Value
diff --git a/Thermo.Active/Controllers/WebApi/FavoriteUserSoftKeyController.cs b/Thermo.Active/Controllers/WebApi/FavoriteUserSoftKeyController.cs
index bb565f86..88c15662 100644
--- a/Thermo.Active/Controllers/WebApi/FavoriteUserSoftKeyController.cs
+++ b/Thermo.Active/Controllers/WebApi/FavoriteUserSoftKeyController.cs
@@ -50,5 +50,6 @@ namespace Thermo.Active.Controllers.WebApi
return Ok(favorite);
}
}
+
}
}
diff --git a/Thermo.Active/Controllers/WebApi/RecipeController.cs b/Thermo.Active/Controllers/WebApi/RecipeController.cs
index 1a98d457..8c984eef 100644
--- a/Thermo.Active/Controllers/WebApi/RecipeController.cs
+++ b/Thermo.Active/Controllers/WebApi/RecipeController.cs
@@ -314,24 +314,21 @@ namespace Thermo.Active.Controllers.WebApi
///
///
[Route("save"), HttpPut]
- //[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
+ [WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)]
public IHttpActionResult Save()
{
-#if false
// recupero dati utente loggato
var identity = User.Identity as ClaimsIdentity;
// Find user id from the bearer token
var userId = identity.Claims.FirstOrDefault(c => c.Type == USER_ID_KEY);
if (userId == null)
return Unauthorized();
-
+ // salvo utente!
using (UsersController usersController = new UsersController())
{
var userData = usersController.GetUserInfo(Convert.ToInt32(userId.Value));
+ NcFileAdapter.RecipeLiveData.UserSave = userData.Id.ToString();
}
-#endif
-
-
// recupero i dati LIVE dei parametri HMI della ricetta...
CmsError libraryError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe);
@@ -355,8 +352,22 @@ namespace Thermo.Active.Controllers.WebApi
///
///
[Route("saveAs"), HttpPut]
+ [WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)]
public IHttpActionResult SaveAs(string newName)
{
+ // recupero dati utente loggato
+ var identity = User.Identity as ClaimsIdentity;
+ // Find user id from the bearer token
+ var userId = identity.Claims.FirstOrDefault(c => c.Type == USER_ID_KEY);
+ if (userId == null)
+ return Unauthorized();
+ // salvo utente!
+ using (UsersController usersController = new UsersController())
+ {
+ var userData = usersController.GetUserInfo(Convert.ToInt32(userId.Value));
+ NcFileAdapter.RecipeLiveData.UserSave = userData.Id.ToString();
+ }
+
// recupero i dati LIVE dei parametri HMI della ricetta...
CmsError libraryError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe);
if (libraryError.IsError())
@@ -458,8 +469,22 @@ namespace Thermo.Active.Controllers.WebApi
[Route("saveAll"), HttpPost]
+ [WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)]
public async Task SaveAll(string newName, double estimTimeSec)
{
+ // recupero dati utente loggato
+ var identity = User.Identity as ClaimsIdentity;
+ // Find user id from the bearer token
+ var userId = identity.Claims.FirstOrDefault(c => c.Type == USER_ID_KEY);
+ if (userId == null)
+ return Unauthorized();
+ // salvo utente!
+ using (UsersController usersController = new UsersController())
+ {
+ var userData = usersController.GetUserInfo(Convert.ToInt32(userId.Value));
+ NcFileAdapter.RecipeLiveData.UserSave = userData.Id.ToString();
+ }
+
bool imageUploaded = false;
if (!Request.Content.IsMimeMultipartContent())
@@ -510,7 +535,6 @@ namespace Thermo.Active.Controllers.WebApi
return Ok();
}
-
///
/// Do actual recipe parameters FileSave
///
diff --git a/Thermo.Active/Controllers/WebApi/StarredUserSoftKeyController.cs b/Thermo.Active/Controllers/WebApi/StarredUserSoftKeyController.cs
new file mode 100644
index 00000000..e27b6964
--- /dev/null
+++ b/Thermo.Active/Controllers/WebApi/StarredUserSoftKeyController.cs
@@ -0,0 +1,39 @@
+using CMS_CORE_Library.Models;
+using System.Collections.Generic;
+using System.Web.Http;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.NC;
+using Thermo.Active.Utils;
+
+namespace Thermo.Active.Controllers.WebApi
+{
+ [RoutePrefix("api/starred_softkey")]
+ public class StarredUserSoftKeyController : ApiController
+ {
+ ///
+ /// Oggetto adapter condiviso da WebAPI
+ ///
+ protected static NcAdapter ncAdapter = new NcAdapter();
+
+ [Route("get"), HttpGet]
+ public IHttpActionResult GetStarredUserSoftkey()
+ {
+ // // Try connection
+ CmsError libraryError = ncAdapter.Connect();
+ if (libraryError.IsError())
+ {
+ ThermoActiveLogger.LogError($"ncAdapter Not connected! | GetOverview | {libraryError.exception}");
+ }
+
+ libraryError = ncAdapter.GetStarredUserSoftKeys(out List softKeys);
+ if (libraryError.IsError())
+ {
+ ThermoActiveLogger.LogError($"GetStarredUserSoftkey error | {libraryError.exception}");
+ return BadRequest(libraryError.localizationKey);
+ }
+
+ return Ok(softKeys);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Thermo.Active/Properties/AssemblyInfo.cs b/Thermo.Active/Properties/AssemblyInfo.cs
index 8beaf5b9..090e3f3a 100644
--- a/Thermo.Active/Properties/AssemblyInfo.cs
+++ b/Thermo.Active/Properties/AssemblyInfo.cs
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("0.9.38")]
\ No newline at end of file
+[assembly: AssemblyVersion("0.9.39")]
\ No newline at end of file
diff --git a/Thermo.Active/Thermo.Active.csproj b/Thermo.Active/Thermo.Active.csproj
index b4a827b7..339a3652 100644
--- a/Thermo.Active/Thermo.Active.csproj
+++ b/Thermo.Active/Thermo.Active.csproj
@@ -224,6 +224,7 @@
+