Merge branch 'feature/recipe' into develop

This commit is contained in:
Samuele Locatelli
2020-07-07 19:20:19 +02:00
8 changed files with 134 additions and 201 deletions
+69 -102
View File
@@ -18,6 +18,11 @@ namespace Thermo.Active.Controllers.SignalR
public static List<string> ConnectedClients = new List<string>();
public static bool NewConnectedClients = false;
/// <summary>
/// Oggetto adapter condiviso da Signal-r
/// </summary>
protected static NcAdapter ncAdapter = new NcAdapter();
public override Task OnConnected()
{
Groups.Add(Context.ConnectionId, "ncData");
@@ -55,11 +60,8 @@ namespace Thermo.Active.Controllers.SignalR
[SignalRAuthorize(FunctionAccess = STARTUP_ICONS, Action = ACTIONS.WRITE)]
public void PutPowerOnData(uint id)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
ncAdapter.Connect();
ncAdapter.PutPowerOnData(id);
}
CmsError libraryError = ncAdapter.Connect();
ncAdapter.PutPowerOnData(id);
}
// [SignalRAuthorize(FunctionAccess = "functionAccess", Action = ACTIONS.READ)]
@@ -67,160 +69,125 @@ namespace Thermo.Active.Controllers.SignalR
[SignalRAuthorize(FunctionAccess = ALARM_CMD, Action = ACTIONS.WRITE)]
public void RefreshAllAlarms()
{
using (NcAdapter ncAdapter = new NcAdapter())
{
CmsError libraryError = ncAdapter.Connect();
// Call the library functions
libraryError = ncAdapter.RefreshAllAlarms();
}
// MessageServices.Current.Publish(SHOW_MSG_UI, null, "Refresh All Alarms.");
CmsError libraryError = ncAdapter.Connect();
// Call the library functions
libraryError = ncAdapter.RefreshAllAlarms();
}
[SignalRAuthorize(FunctionAccess = ALARM_CMD, Action = ACTIONS.WRITE)]
public void RefreshAlarm(uint id)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
CmsError libraryError = ncAdapter.Connect();
// Call the library functions
libraryError = ncAdapter.RefreshAlarm(id);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
// MessageServices.Current.Publish(SHOW_MSG_UI, null, "Refresh Single Alarm. ID: " + id);
CmsError libraryError = ncAdapter.Connect();
// Call the library functions
libraryError = ncAdapter.RefreshAlarm(id);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
[SignalRAuthorize(FunctionAccess = ALARM_CMD, Action = ACTIONS.WRITE)]
public void RecoveryProcedure(uint id)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
CmsError libraryError = ncAdapter.Connect();
// Call the library functions
libraryError = ncAdapter.RestoreAlarm(id);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
// MessageServices.Current.Publish(SHOW_MSG_UI, null, "Recovery Alarm. ID: " + id);
CmsError libraryError = ncAdapter.Connect();
// Call the library functions
libraryError = ncAdapter.RestoreAlarm(id);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
[SignalRAuthorize(FunctionAccess = USER_SOFTKEY, Action = ACTIONS.WRITE)]
public void UserSoftKeyClick(int id)
{
using (NcAdapter ncAdapter = new NcAdapter())
ncAdapter.Connect();
foreach (var softKey in SoftKeysConfig)
{
ncAdapter.Connect();
foreach (var softKey in SoftKeysConfig)
// Check softKey type
if (softKey.Type == SOFTKEY_TYPE.GROUP)
{
// Check softKey type
if (softKey.Type == SOFTKEY_TYPE.GROUP)
// Find in the subkeys
foreach (var subkey in softKey.SubKeys)
{
// Find in the subkeys
foreach (var subkey in softKey.SubKeys)
{
if (subkey.Id == id)
{
// Write click button
ncAdapter.PutUserSoftKeyClick((uint)subkey.PlcId);
break;
}
}
}
else
{
if (softKey.Id == id)
if (subkey.Id == id)
{
// Write click button
ncAdapter.PutUserSoftKeyClick((uint)softKey.PlcId);
ncAdapter.PutUserSoftKeyClick((uint)subkey.PlcId);
break;
}
}
}
else
{
if (softKey.Id == id)
{
// Write click button
ncAdapter.PutUserSoftKeyClick((uint)softKey.PlcId);
break;
}
}
}
}
[SignalRAuthorize(FunctionAccess = PROCESS_CMD, Action = ACTIONS.WRITE)]
public void SelectProcess(ushort procNumber)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
// Connect the NC
CmsError libraryError = ncAdapter.Connect();
// Put value into memory
libraryError = ncAdapter.PutSelectProcess(procNumber);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
// Connect the NC
CmsError libraryError = ncAdapter.Connect();
// Put value into memory
libraryError = ncAdapter.PutSelectProcess(procNumber);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
[SignalRAuthorize(FunctionAccess = AXES_SELECTION, Action = ACTIONS.WRITE)]
public void SelectAxis(byte axisId)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
// Connect the Nc
CmsError libraryError = ncAdapter.Connect();
// Put value into memory
libraryError = ncAdapter.PutSelectAxis(axisId);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
// Connect the Nc
CmsError libraryError = ncAdapter.Connect();
// Put value into memory
libraryError = ncAdapter.PutSelectAxis(axisId);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
[SignalRAuthorize(FunctionAccess = HEADS_CMD, Action = ACTIONS.WRITE)]
public void AddOverride(uint id)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
// Connect the Nc
CmsError libraryError = ncAdapter.Connect();
// Connect the Nc
CmsError libraryError = ncAdapter.Connect();
// Put value into memory
libraryError = ncAdapter.PutOverride(id, "plus");
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
// Put value into memory
libraryError = ncAdapter.PutOverride(id, "plus");
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
[SignalRAuthorize(FunctionAccess = HEADS_CMD, Action = ACTIONS.WRITE)]
public void SubOverride(uint id)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
// Connect the Nc
CmsError libraryError = ncAdapter.Connect();
// Connect the Nc
CmsError libraryError = ncAdapter.Connect();
// Put value into memory
libraryError = ncAdapter.PutOverride(id, "minus");
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
// Put value into memory
libraryError = ncAdapter.PutOverride(id, "minus");
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
[SignalRAuthorize(FunctionAccess = GENERAL, Action = ACTIONS.WRITE)]
public void WriteM155Response(int process, double responseVal)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
ncAdapter.Connect();
CmsError libraryError = ncAdapter.WriteM155Data(process, responseVal);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
ncAdapter.Connect();
CmsError libraryError = ncAdapter.WriteM155Data(process, responseVal);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
[SignalRAuthorize(FunctionAccess = GENERAL, Action = ACTIONS.WRITE)]
public void WriteScadaValue(string memIndex, SCADA_MEM_TYPE memType, object value)
{
using (NcAdapter ncAdapter = new NcAdapter())
{
ncAdapter.Connect();
CmsError libraryError = ncAdapter.WriteScada(memIndex, memType, value);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
ncAdapter.Connect();
CmsError libraryError = ncAdapter.WriteScada(memIndex, memType, value);
if (libraryError.IsError())
throw new HubException(libraryError.localizationKey);
}
}
+1 -1
View File
@@ -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.24")]
[assembly: AssemblyVersion("0.9.25")]
-52
View File
@@ -1,52 +0,0 @@
@echo off
REM SCript di creazione e compilazione versioen per test in macchina
REM Check parameters
REM IF "%1"=="" GOTO ShowHelp
REM :MsBuild
:Npm
cd wwwroot
REM install moduli npm
IF "%1"=="y" (
echo %date%-%time% START npm install >> c:\tmp\Script.log
powershell.exe npm install
echo %date%-%time% END npm install >> c:\tmp\Script.log
)
REM: compilazione npm
IF "%2"=="y" (
echo %date%-%time% Start file replace >> c:\tmp\Script.log
REM replace seriate server dev (seriate.steamware.net) --> produzione (locahost)
powershell.exe "((Get-Content -path index.html -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path index.html"
powershell.exe "((Get-Content -path config.development.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.development.json"
powershell.exe "((Get-Content -path config.production.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.production.json"
REM build pacchetti npm
echo %date%-%time% START npm run build >> c:\tmp\Script.log
npm run build
echo %date%-%time% END npm run build >> c:\tmp\Script.log
)
:Copy
cd ..
REM copio wwwroot --> view
echo %date%-%time% Start copy >> c:\tmp\Script.log
robocopy C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\wwwroot C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\bin\view /MIR /Z /LOG:C:\tmp\ViewMirror.log /XF *.babelrc .bowerrc .editorconfig bower.json compilerconfig.json* package*.json tsconfig.json webpack.config.js /XD C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\wwwroot\node_modules C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\wwwroot\src
robocopy C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\bin\ C:\Users\samuele\Desktop\ThermoActive\ /MIR /Z /LOG:C:\tmp\ThermoMirror.log /XD C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\bin\wwwroot C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\bin\Client_Debug
echo %date%-%time% END copy >> c:\tmp\Script.log
REM :Compress
echo "%date%-%time% START zip" >> c:\tmp\Script.log
powershell.exe Compress-Archive -Path C:\Users\samuele\Desktop\ThermoActive -DestinationPath "C:\Users\samuele\Desktop\ThermoActive_%3.zip"
echo "%date%-%time% END zip" >> c:\tmp\Script.log
:ShowHelp
REM echo makeTestVersion n n vers_number - i primi 2 parametri sono y/n per indicare se eseguire npm install ed npm build, il terzo è il nome versione da accodare a zip
@echo on
+61 -38
View File
@@ -1,52 +1,75 @@
@echo off
REM SCript di creazione e compilazione versioen per test in macchina
# Script di creazione e compilazione versione per test in macchina
REM Check parameters
REM IF "%1"=="" GOTO ShowHelp
# Check parameters
Param (
[Parameter(Mandatory=$True)]
[ValidateNotNull()]
$npmInstall,
[Parameter(Mandatory=$True)]
[ValidateNotNull()]
$npmBuild,[Parameter(Mandatory=$True)]
[ValidateNotNull()]
$version
)
REM :MsBuild
# recupera timestamp x logging
function Get-TimeStamp {
return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)
}
# registra log!
function DoLog($txt2log)
{
Write-Output "$(Get-TimeStamp) $txt2log" | Out-File c:\tmp\Script.log -Append
}
:Npm
DoLog("-------------------------------- START script --------------------------------")
$StopWatch = New-Object System.Diagnostics.Stopwatch
$StopWatch.Start()
# mi sposto in wwwroot
cd wwwroot
REM install moduli npm
IF "%1"=="y" (
echo %date%-%time% START npm install >> c:\tmp\Script.log
powershell.exe npm install
echo %date%-%time% END npm install >> c:\tmp\Script.log
)
# NPM install/build step
if($npmInstall -eq "y")
{
DoLog("START npm install")
npm install | Out-File c:\tmp\Script.log -Append
DoLog("END npm install")
}
REM: compilazione npm
IF "%2"=="y" (
echo %date%-%time% Start file replace >> c:\tmp\Script.log
REM replace seriate server dev (seriate.steamware.net) --> produzione (locahost)
powershell.exe "((Get-Content -path index.html -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path index.html"
powershell.exe "((Get-Content -path config.development.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.development.json"
powershell.exe "((Get-Content -path config.production.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.production.json"
if($npmBuild -eq "y")
{
DoLog("START file replace")
# replace seriate server dev (seriate.steamware.net) --> produzione (locahost)
((Get-Content -path index.html -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path index.html
((Get-Content -path config.development.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.development.json
((Get-Content -path config.production.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.production.json
REM build pacchetti npm
echo %date%-%time% START npm run build >> c:\tmp\Script.log
npm run build
echo %date%-%time% END npm run build >> c:\tmp\Script.log
)
# build pacchetti npm
DoLog("START npm run build ")
npm run build | Out-File c:\tmp\Script.log -Append
DoLog("END npm run build ")
}
:Copy
# torno in folder base
cd ..
REM copio wwwroot --> view
echo %date%-%time% Start copy >> c:\tmp\Script.log
# copio wwwroot --> view
DoLog("START copy step")
robocopy C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\wwwroot C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\bin\view /MIR /Z /LOG:C:\tmp\ViewMirror.log /XF *.babelrc .bowerrc .editorconfig bower.json compilerconfig.json* package*.json tsconfig.json webpack.config.js /XD C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\wwwroot\node_modules C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\wwwroot\src
robocopy C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\bin\ C:\Users\samuele\Desktop\ThermoActive\ /MIR /Z /LOG:C:\tmp\ThermoMirror.log /XD C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\bin\wwwroot C:\Users\samuele\Documents\VisualStudio\cms_thermo_active\Thermo.Active\bin\Client_Debug
echo %date%-%time% END copy >> c:\tmp\Script.log
DoLog("END copy step")
REM :Compress
echo "%date%-%time% START zip" >> c:\tmp\Script.log
powershell.exe Compress-Archive -Path C:\Users\samuele\Desktop\ThermoActive -DestinationPath "C:\Users\samuele\Desktop\ThermoActive_%3.zip"
echo "%date%-%time% END zip" >> c:\tmp\Script.log
# Compression step
DoLog("START ZIP step")
$ProgressPreference = "SilentlyContinue"
Compress-Archive -CompressionLevel Fastest -Force -Path C:\Users\samuele\Desktop\ThermoActive -DestinationPath "C:\Users\samuele\Desktop\ThermoActive_$version.zip" | Out-File c:\tmp\Script.log -Append
$ProgressPreference = "Continue"
DoLog("END ZIP step")
:ShowHelp
REM echo makeTestVersion n n vers_number - i primi 2 parametri sono y/n per indicare se eseguire npm install ed npm build, il terzo è il nome versione da accodare a zip
@echo on
$StopWatch.Stop()
$StopWatch.Elapsed | Out-File c:\tmp\Script.log -Append
DoLog("-------------------------------- END script --------------------------------")
@@ -2,7 +2,7 @@
"env": "development",
"api": {
"enabled": true,
"apiServerUrl": "http://seriate.steamware.net:9000/"
"apiServerUrl": "http://localhost:9000/"
},
"allUIVisible": true
}
+1 -1
View File
@@ -13,7 +13,7 @@
<script src="Scripts/jquery.mousewheel.js"></script>
<script src="Scripts/jquery.signalR-2.2.2.min.js"></script>
<script src="Scripts/raphael-2.1.4.min.js"></script>
<script src="http://seriate.steamware.net:9000/signalr/hubs" async></script>
<script src="http://localhost:9000/signalr/hubs" async></script>
<link href="assets/styles/style.css" rel="stylesheet" />
</head>
-5
View File
@@ -16304,11 +16304,6 @@
"integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==",
"dev": true
},
"ts-debounce": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/ts-debounce/-/ts-debounce-2.0.1.tgz",
"integrity": "sha512-+TztZrH7GnAD5CKxUohIAqIVHLrtivsYT7tZCLeRTCaBMSsfgYwprhA00kB/m0ezvYheOXJQqPfarAvgoayb7A=="
},
"ts-loader": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-6.2.1.tgz",
+1 -1
View File
@@ -72,4 +72,4 @@
"last 2 versions",
"not ie <= 8"
]
}
}