Aggiunta conf x sample variabile
This commit is contained in:
@@ -19,7 +19,7 @@ namespace Thermo.Active.Database.Controllers
|
||||
private const string machinePowerPath = "Machine:Power";
|
||||
private const string machineAlarmPath = "Machine:Alarm";
|
||||
private const string machineEmergencyPath = "Machine:Emergency";
|
||||
private const string alarmsPath = "Machine:Plc:Condition";
|
||||
private const string alarmsPath = "Machine:Plc:Condition";
|
||||
private const string processStatusPath = "Machine:Cnc:CncProcesses:%NN%:Status";
|
||||
private const string processModePath = "Machine:Cnc:CncProcesses:%NN%:Mode";
|
||||
private const string processFeedOverridePath = "Machine:Cnc:CncProcesses:%NN%:FeedOverride";
|
||||
@@ -27,7 +27,7 @@ namespace Thermo.Active.Database.Controllers
|
||||
private const string processSpeedOverridePath = "Machine:Cnc:CncProcesses:%NN%:SpeedOverride";
|
||||
|
||||
private const string datamodelPath = "AdpConf:DataModel";
|
||||
private const string currentActiveVersionPath = "Machine:Hmi:Version";
|
||||
private const string currentActiveVersionPath = "Machine:Hmi:Version";
|
||||
private const string machineAxisPosition = "Machine:Axes:%NN%:CurrentPos";
|
||||
private const string machineAxisSpeed = "Machine:Axes:%NN%:FeedRate";
|
||||
private const string machineAxisLoad = "Machine:Axes:%NN%:Load";
|
||||
@@ -70,7 +70,7 @@ namespace Thermo.Active.Database.Controllers
|
||||
string redisHash = redUtil.man.redHash(redisAlmEn);
|
||||
return redUtil.man.redSaveHashDict(redisHash, alarms);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool WriteDatamodel(string datamodel)
|
||||
{
|
||||
@@ -79,7 +79,7 @@ namespace Thermo.Active.Database.Controllers
|
||||
}
|
||||
public static bool WriteDefaultEntry(Dictionary<string, string> entries)
|
||||
{
|
||||
foreach (KeyValuePair<string,string> entry in entries)
|
||||
foreach (KeyValuePair<string, string> entry in entries)
|
||||
{
|
||||
if (!redUtil.man.setRSV(redUtil.man.redHash(entry.Key), entry.Value))
|
||||
return false;
|
||||
@@ -109,7 +109,7 @@ namespace Thermo.Active.Database.Controllers
|
||||
string redisHash = redUtil.man.redHash(machineStatusPath);
|
||||
return redUtil.man.setRSV(redisHash, status.ToString());
|
||||
}
|
||||
|
||||
|
||||
public static bool WriteCurrentProcessStatus(uint ProductionProcess, string status)
|
||||
{
|
||||
string redisHash = redUtil.man.redHash(processStatusPath).Replace("%NN%", ProductionProcess.ToString("00"));
|
||||
@@ -131,21 +131,21 @@ namespace Thermo.Active.Database.Controllers
|
||||
if (!redUtil.man.setRSV(redisHash, "100"))
|
||||
return false;
|
||||
redisHash = redUtil.man.redHash(processSpeedOverridePath).Replace("%NN%", ProductionProcess.ToString("00"));
|
||||
if(!redUtil.man.setRSV(redisHash, "100"))
|
||||
if (!redUtil.man.setRSV(redisHash, "100"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool WriteCurrentMachinePowerPath(bool status)
|
||||
{
|
||||
string redisHash = redUtil.man.redHash(machinePowerPath);
|
||||
if(status)
|
||||
if (status)
|
||||
return redUtil.man.setRSV(redisHash, "true");
|
||||
else
|
||||
return redUtil.man.setRSV(redisHash, "false");
|
||||
}
|
||||
|
||||
|
||||
public static bool WriteCurrentMachineAlarmPath(bool status)
|
||||
{
|
||||
string redisHash = redUtil.man.redHash(machineAlarmPath);
|
||||
@@ -154,7 +154,7 @@ namespace Thermo.Active.Database.Controllers
|
||||
else
|
||||
return redUtil.man.setRSV(redisHash, "false");
|
||||
}
|
||||
|
||||
|
||||
public static bool WriteCurrentMachineEmergencyPath(bool status)
|
||||
{
|
||||
string redisHash = redUtil.man.redHash(machineEmergencyPath);
|
||||
@@ -205,18 +205,19 @@ namespace Thermo.Active.Database.Controllers
|
||||
}
|
||||
set
|
||||
{
|
||||
// imposta con TTL a 5 min
|
||||
WriteValue("FastIoSample", "Active", 60 * 5);
|
||||
// TTL: se true 5 min, altrimenti 1 sec
|
||||
int ttlSec = value ? 60 * 5 : 1;
|
||||
WriteValue("FastIoSample", "Active", ttlSec);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool WriteCurrentAxisStatus(Dictionary<int, DTOAxisInfoModel> axis)
|
||||
{
|
||||
foreach(KeyValuePair<int, DTOAxisInfoModel> asse in axis)
|
||||
foreach (KeyValuePair<int, DTOAxisInfoModel> asse in axis)
|
||||
{
|
||||
string redisHash = redUtil.man.redHash(machineAxisName).Replace("%NN%", asse.Value.ID.ToString("00"));
|
||||
|
||||
if(redUtil.man.getRSV(redisHash) != null)
|
||||
if (redUtil.man.getRSV(redisHash) != null)
|
||||
{
|
||||
redisHash = redUtil.man.redHash(machineAxisPosition).Replace("%NN%", asse.Value.ID.ToString("00"));
|
||||
if (!redUtil.man.setRSV(redisHash, asse.Value.position.ToString()))
|
||||
@@ -229,7 +230,7 @@ namespace Thermo.Active.Database.Controllers
|
||||
redisHash = redUtil.man.redHash(machineAxisLoad).Replace("%NN%", asse.Value.ID.ToString("00"));
|
||||
if (!redUtil.man.setRSV(redisHash, asse.Value.load.ToString()))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -235,6 +235,16 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
// scrivo sul PLC con i parametri specificati x ritardo/raggruppamento
|
||||
ncAdapter.WriteReset_IO_ALL_ToPLC();//parametersList);
|
||||
|
||||
// ritorno solo fatto!
|
||||
return Ok();
|
||||
}
|
||||
[Route("io_sample_fast"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.MAINTENANCE, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult SetFastSample(bool value)
|
||||
{
|
||||
// imposta (su redis) campionamento RAPIDO/lento x IO...
|
||||
RedisController.FastIoSample = value;
|
||||
|
||||
// ritorno solo fatto!
|
||||
return Ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user