diff --git a/THermo.Active.Thermocamera/Properties/AssemblyInfo.cs b/THermo.Active.Thermocamera/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..3367c6c1 --- /dev/null +++ b/THermo.Active.Thermocamera/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("THermo.Active.Thermocamera")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("THermo.Active.Thermocamera")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8d8ec91a-3a15-4a1d-951b-a35e7068debd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/THermo.Active.Thermocamera/Thermo.Active.Thermocamera.csproj b/THermo.Active.Thermocamera/Thermo.Active.Thermocamera.csproj new file mode 100644 index 00000000..9d299c7b --- /dev/null +++ b/THermo.Active.Thermocamera/Thermo.Active.Thermocamera.csproj @@ -0,0 +1,49 @@ + + + + + Debug + AnyCPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD} + Library + Properties + THermo.Active.Thermocamera + THermo.Active.Thermocamera + v4.6.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/THermo.Active.Thermocamera/ThermocameraComunicator.cs b/THermo.Active.Thermocamera/ThermocameraComunicator.cs new file mode 100644 index 00000000..e08fe287 --- /dev/null +++ b/THermo.Active.Thermocamera/ThermocameraComunicator.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Globalization; +using System.IO.MemoryMappedFiles; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; + +namespace Thermo.Active.Thermocamera +{ + + public class ThermocameraComunicator + { + const string MMF_REQ = "CMS_MMF_REQ"; + const string MMF_RES = "CMS_MMF_RES"; + const int NUM_CHAR_MSG = 5000; + const int REQ = 1; + const int RES = 2; + const int DIM_MMF = NUM_CHAR_MSG * 2 + 2; + + MemoryMappedFile mmf; + MemoryMappedFile mmfRes; + MemoryMappedViewAccessor accessor; + MemoryMappedViewAccessor accessorResp; + + private static ThermocameraComunicator _instance; + + public static ThermocameraComunicator getInstance() + { + if (_instance == null) + _instance = new ThermocameraComunicator(); + return _instance; + } + + private ThermocameraComunicator() + { + mmf = MemoryMappedFile.CreateOrOpen(MMF_REQ, DIM_MMF); + mmfRes = MemoryMappedFile.CreateOrOpen(MMF_RES, DIM_MMF); + accessor = mmf.CreateViewAccessor(); + accessorResp = mmfRes.CreateViewAccessor(); + } + + public bool takePicture(int timeoutMS) + { + const string tempCommand = "SetParameter_Integer"; + string response; + + if (!writeCommand(accessor, tempCommand + ";TAKE_IMAGE;")) + return false; + if (!readCommand(accessorResp, tempCommand, timeoutMS, out response)) + return false; + if (response != "True;") + return false; + return true; + } + public bool showWindow(int x, int y, int dimX, int dimY, int timeoutMS) + { + const string tempCommand = "ShowWindow"; + string response; + if (!writeCommand(accessor, tempCommand + ";" + x + ";" + y + ";" + dimX + ";" + dimY + ";")) + return false; + if (!readCommand(accessorResp, tempCommand, timeoutMS, out response)) + return false; + if (response != "1;") + return false; + return true; + } + + public bool readTemperature(int x, int y, int timeoutMS, out float temp) + { + temp = 0f; + const string tempCommand = "GetTemperature"; + string response; + + if (!writeCommand(accessor, tempCommand + ";" + x + ";" + y + ";")) + return false; + if (!readCommand(accessorResp, tempCommand, timeoutMS, out response)) + return false; + response = response.TrimEnd(';'); + if (!float.TryParse(response, NumberStyles.Float, CultureInfo.InvariantCulture, out temp)) + return false; + + return true; + } + public bool readMultiTemperatures(IEnumerable points, int timeoutMS, out List temp) + { + temp = new List(); + const string tempCommand = "GetTemperature"; + string response; + + string cmdRead = ""; + foreach (Point point in points) + { + cmdRead += point.X + ";" + point.Y + ";"; + } + + if (!writeCommand(accessor, tempCommand + ";" + cmdRead)) + return false; + if (!readCommand(accessorResp, tempCommand, timeoutMS, out response)) + return false; + + string[] respSplitted = response.Split(';'); + foreach (string str in respSplitted) + { + float tmp; + if (str.Trim() != "") + { + if (float.TryParse(str.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)) + temp.Add(tmp); + else + return false; + } + } + return true; + } + + + private bool writeCommand(MemoryMappedViewAccessor accessor, string command) + { + char[] bufferToClean = Enumerable.Repeat('\0', NUM_CHAR_MSG).ToArray(); + accessor.WriteArray(0, bufferToClean, 0, bufferToClean.Length); + + char[] bufferToWrite = command.ToCharArray(); + + //Write Pre-Command + accessor.Write(0, REQ); + + //Write Command + accessor.WriteArray(1, bufferToWrite, 0, bufferToWrite.Length); + + return true; + } + + + private bool readCommand(MemoryMappedViewAccessor accessor, string command, int timeoutMS, out string resp) + { + resp = ""; + byte response = 0; + int totalCycle = 0; + int sleepTime = 500; + byte[] bytesToRead = new byte[NUM_CHAR_MSG]; + + if (!accessor.CanRead) return false; + + //Read Pre-Command + while (response != RES) + { + totalCycle++; + accessor.Read(0, out response); + if (response != RES) + Thread.Sleep(sleepTime); + if (totalCycle * sleepTime > timeoutMS) + return false; + } + + //Read Command + accessor.ReadArray(1, bytesToRead, 0, bytesToRead.Length); + + //Elaborate String + string textRecieved = Encoding.UTF8.GetString(bytesToRead); + if (textRecieved == null) return false; + + string[] textSplitted = textRecieved.Replace("\0", string.Empty).Split(';'); + if (textSplitted.Length < 2) return false; + if (textSplitted[0] != command) return false; + + char[] bufferToClean = Enumerable.Repeat('\0', NUM_CHAR_MSG).ToArray(); + accessor.WriteArray(0, bufferToClean, 0, bufferToClean.Length); + + //Output + textSplitted = textSplitted.Skip(1).ToArray(); + resp = String.Join(";", textSplitted); + return true; + } + + } +} diff --git a/Thermo.Active.CmsConnectGateway/CMSConnectConstants.cs b/Thermo.Active.CmsConnectGateway/CMSConnectConstants.cs index ce9d6434..b32aabb2 100644 --- a/Thermo.Active.CmsConnectGateway/CMSConnectConstants.cs +++ b/Thermo.Active.CmsConnectGateway/CMSConnectConstants.cs @@ -113,7 +113,7 @@ namespace Thermo.Active.CmsConnectGateway List alms = new List(); foreach (DTOPlcAlarmModel alarm in alarms.PlcAlarms) { int severity = alarm.IsWarning ? 500 : 900; - alms.Add(alarm.Id + "|" + severity); + alms.Add(alarm.Id.ToString("D6") + "|" + severity); } return string.Join(",", alms); } diff --git a/Thermo.Active.Config/Config/DataModel.xml b/Thermo.Active.Config/Config/DataModel.xml index aecba01e..cb0abf08 100644 --- a/Thermo.Active.Config/Config/DataModel.xml +++ b/Thermo.Active.Config/Config/DataModel.xml @@ -1,107 +1,112 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Thermo.Active.Config/Config/serverConfig.xml b/Thermo.Active.Config/Config/serverConfig.xml index 18f49773..cc6dbd26 100644 --- a/Thermo.Active.Config/Config/serverConfig.xml +++ b/Thermo.Active.Config/Config/serverConfig.xml @@ -76,6 +76,22 @@ LoaderXsize 1400 + + ThermoCameraXpos + 68 + + + ThermoCameraYpos + 728 + + + ThermoCameraXdim + 828 + + + ThermoCameraYdim + 1004 + diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs index 2580263f..3b29808b 100644 --- a/Thermo.Active.Config/ServerConfigController.cs +++ b/Thermo.Active.Config/ServerConfigController.cs @@ -310,7 +310,12 @@ namespace Thermo.Active.Config else if(elem.Name.LocalName == "Property") Paths.Add(Parent + ":" + elem.Attribute("SymbolicName").Value, elem.Attribute("Value").Value); else - Paths.Add(Parent + ":" + elem.Attribute("SymbolicName").Value, "UNAVAILABLE"); + { + if(elem.Attribute("SymbolicName") != null && elem.Attribute("SymbolicName").Value == "Condition") + Paths.Add(Parent + ":" + elem.Attribute("SymbolicName").Value, ""); + else + Paths.Add(Parent + ":" + elem.Attribute("SymbolicName").Value, "UNAVAILABLE"); + } } } diff --git a/Thermo.Active.Core/ThreadsFunctions.cs b/Thermo.Active.Core/ThreadsFunctions.cs index 44566643..7a7001be 100644 --- a/Thermo.Active.Core/ThreadsFunctions.cs +++ b/Thermo.Active.Core/ThreadsFunctions.cs @@ -1140,7 +1140,7 @@ public static class ThreadsFunctions NcAdapter ncAdapter = new NcAdapter(); try { - + //Write all the datamodel if (!RedisController.WriteDatamodel(CMSConnectDataModel)) ManageError(ERROR_LEVEL.FATAL, CMS_CONNECT_SETUP_ALARM_MESSAGE); @@ -1153,6 +1153,11 @@ public static class ThreadsFunctions if (!RedisController.WriteActiveVersion(SupportFunctions.GetSoftwareVersionAndBuildDate())) ManageError(ERROR_LEVEL.FATAL, CMS_CONNECT_SETUP_ALARM_MESSAGE); + //Write the Overrides + if (!RedisController.WriteFakeOverrides(1)) + ManageError(ERROR_LEVEL.FATAL, CMS_CONNECT_SETUP_ALARM_MESSAGE); + + List availableLanguages = LanguageController.GetLanguageListFromDirectory(); if (availableLanguages == null) return; diff --git a/Thermo.Active.Database/Controllers/RedisController.cs b/Thermo.Active.Database/Controllers/RedisController.cs index 01e13fa1..2eeed753 100644 --- a/Thermo.Active.Database/Controllers/RedisController.cs +++ b/Thermo.Active.Database/Controllers/RedisController.cs @@ -23,12 +23,17 @@ namespace Thermo.Active.Database.Controllers 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"; + private const string processRapidOverridePath = "Machine:Cnc:CncProcesses:%NN%:RapidOverride"; + 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 machineAxisPosition = "Machine:Axes:%NN%:CurrentPos"; private const string machineAxisSpeed = "Machine:Axes:%NN%:FeedRate"; private const string machineAxisLoad = "Machine:Axes:%NN%:Load"; private const string machineAxisName = "Machine:Axes:%NN%:Name"; + private const string machineEventKpis = "Machine:Events:Kpis"; public static void WriteProductionNotification(uint ProductionProcess, string Notification) { @@ -122,6 +127,21 @@ namespace Thermo.Active.Database.Controllers return redUtil.man.setRSV(redisHash, status.ToString()); } + public static bool WriteFakeOverrides(uint ProductionProcess) + { + string redisHash = redUtil.man.redHash(processFeedOverridePath).Replace("%NN%", ProductionProcess.ToString("00")); + if (!redUtil.man.setRSV(redisHash, "100")) + return false; + redisHash = redUtil.man.redHash(processRapidOverridePath).Replace("%NN%", ProductionProcess.ToString("00")); + if (!redUtil.man.setRSV(redisHash, "100")) + return false; + redisHash = redUtil.man.redHash(processSpeedOverridePath).Replace("%NN%", ProductionProcess.ToString("00")); + if(!redUtil.man.setRSV(redisHash, "100")) + return false; + return true; + } + + public static bool WriteCurrentMachinePowerPath(bool status) { string redisHash = redUtil.man.redHash(machinePowerPath); @@ -155,6 +175,14 @@ namespace Thermo.Active.Database.Controllers return redUtil.man.setRSV(redisHash, alarms); } + public static bool WriteMachineEventKpis(string alarms) + { + string redisHash = redUtil.man.redHash(machineEventKpis); + redUtil.man.ListPush(redisHash, alarms); + return true; + } + + public static bool WriteCurrentAxisStatus(Dictionary axis) { foreach(KeyValuePair asse in axis) diff --git a/Thermo.Active.Database/Redis/redUtil.cs b/Thermo.Active.Database/Redis/redUtil.cs index 9b988cf8..35345558 100644 --- a/Thermo.Active.Database/Redis/redUtil.cs +++ b/Thermo.Active.Database/Redis/redUtil.cs @@ -826,5 +826,70 @@ namespace Thermo.Active.Database.Redis #endregion + + #region gestione Stack / List + + /// + /// Lunghezza Stack + /// + /// + /// + public long StackLen(string stackName) + { + return connRedis.GetDatabase().ListLength((RedisKey)stackName); + } + + /// + /// Mette in Stack un valore (F.I.L.O.) + /// + /// + /// + public void StackPush(string stackName, string value) + { + connRedis.GetDatabase().ListRightPush((RedisKey)stackName, (RedisValue)value); + } + + /// + /// Recupera valore da Stack (F.I.L.O.) + /// + /// + /// + public string StackPop(string stackName) + { + return connRedis.GetDatabase().ListRightPop((RedisKey)stackName).ToString(); + } + + /// + /// Lunghezza List + /// + /// + /// + public long ListLen(string queueName) + { + return connRedis.GetDatabase().ListLength((RedisKey)queueName); + } + + /// + /// Mette un valore in List (F.I.F.O.) + /// + /// + /// + public void ListPush(string queueName, string value) + { + connRedis.GetDatabase().ListRightPush((RedisKey)queueName, (RedisValue)value); + } + + /// + /// Recupera valore da List (F.I.F.O.) + /// + /// + /// + public string ListPop(string queueName) + { + return connRedis.GetDatabase().ListLeftPop((RedisKey)queueName).ToString(); + } + + #endregion gestione Stack / List + } } diff --git a/Thermo.Active.sln b/Thermo.Active.sln index 6f78eb1f..8b03643b 100644 --- a/Thermo.Active.sln +++ b/Thermo.Active.sln @@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thermo.Active.CmsConnectGat EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMS_CORE_Library", "..\cms_core_library\CMS_CORE_Library\CMS_CORE_Library.csproj", "{4ABF8EEF-2B23-483E-ACDC-53214FE28681}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thermo.Active.Thermocamera", "THermo.Active.Thermocamera\Thermo.Active.Thermocamera.csproj", "{8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -219,6 +221,18 @@ Global {4ABF8EEF-2B23-483E-ACDC-53214FE28681}.Release|x64.Build.0 = Release|x64 {4ABF8EEF-2B23-483E-ACDC-53214FE28681}.Release|x86.ActiveCfg = Release|x86 {4ABF8EEF-2B23-483E-ACDC-53214FE28681}.Release|x86.Build.0 = Release|x86 + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Debug|x64.ActiveCfg = Debug|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Debug|x64.Build.0 = Debug|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Debug|x86.ActiveCfg = Debug|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Debug|x86.Build.0 = Debug|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Release|Any CPU.Build.0 = Release|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Release|x64.ActiveCfg = Release|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Release|x64.Build.0 = Release|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Release|x86.ActiveCfg = Release|Any CPU + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -237,6 +251,7 @@ Global {B2366B08-96BD-4F6B-B748-B45089B87A14} = {0769EE3C-4259-4C72-97B4-0CCAEBFA7724} {F9F17F23-660E-488C-A7FA-6A5B35D64313} = {2F873243-A483-40B6-A0F7-65FC3541A269} {49B04D99-0ECD-4900-86D3-7098D61314D7} = {0769EE3C-4259-4C72-97B4-0CCAEBFA7724} + {8D8EC91A-3A15-4A1D-951B-A35E7068DEBD} = {0769EE3C-4259-4C72-97B4-0CCAEBFA7724} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {51D459FB-B45B-4A47-984E-46C35F933A82} diff --git a/Thermo.Active/Controllers/WebApi/ThermocameraController.cs b/Thermo.Active/Controllers/WebApi/ThermocameraController.cs new file mode 100644 index 00000000..87fa7be3 --- /dev/null +++ b/Thermo.Active/Controllers/WebApi/ThermocameraController.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Security.Claims; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; +using Thermo.Active.Database.Controllers; +using Thermo.Active.Listeners; +using Thermo.Active.Model.DatabaseModels; +using Thermo.Active.Model.DTOModels.AlarmModels; +using Thermo.Active.Provider; +using Thermo.Active.Thermocamera; +using static Thermo.Active.Config.ServerConfig; +using static Thermo.Active.Model.Constants; + +namespace Thermo.Active.Controllers.WebApi +{ + [RoutePrefix("api/thermocamera")] + public class ThermocameraController : ApiController + { + [Route("show"), HttpPost] + public IHttpActionResult GetDataPaginated() + { + String ThermoCameraXpos = AdditionalParametersConfig["ThermoCameraXpos"]; + String ThermoCameraYpos = AdditionalParametersConfig["ThermoCameraYpos"]; + String ThermoCameraXdim = AdditionalParametersConfig["ThermoCameraXdim"]; + String ThermoCameraYdim = AdditionalParametersConfig["ThermoCameraYdim"]; + if(ThermoCameraXpos != null && ThermoCameraYpos != null && ThermoCameraXdim != null && ThermoCameraYdim != null) + { + + if (ThermocameraComunicator.getInstance().showWindow(Int32.Parse(ThermoCameraXpos), Int32.Parse(ThermoCameraYpos), Int32.Parse(ThermoCameraXdim), Int32.Parse(ThermoCameraYdim), 3000)) + return Ok(); + else + return BadRequest(); + + } + return BadRequest(); + } + } +} \ No newline at end of file diff --git a/Thermo.Active/Listeners/SignalR/SignalRListener.cs b/Thermo.Active/Listeners/SignalR/SignalRListener.cs index fb67ae73..02820ec5 100644 --- a/Thermo.Active/Listeners/SignalR/SignalRListener.cs +++ b/Thermo.Active/Listeners/SignalR/SignalRListener.cs @@ -459,7 +459,9 @@ namespace Thermo.Active.Listeners.SignalR if (Config.ServerConfig.ServerStartupConfig.CmsConnectReady && currProdPanel.NumDone > 0 && currProdPanel.NumDone != LastProdPanelData.NumDone) { - //TODO + var ts = DateTime.UtcNow.ToString("o"); + var a = "{\"v\": { \"PART_COUNT\": 1}\"ts\": " + ts + "}"; + RedisController.WriteMachineEventKpis(a); } } @@ -612,6 +614,16 @@ namespace Thermo.Active.Listeners.SignalR // THERMO prod cycle data group.prodCycleData(LastProdCycleData); + if (Config.ServerConfig.ServerStartupConfig.CmsConnectReady) + { + RedisController.WriteCurrentAlarms(CMSConnectConstants.ConvertThermoToConnectAlarms(LastAlarms)); + RedisController.WriteCurrentMachineAlarmPath(CMSConnectConstants.ConvertThermoToConnectMachineAlarm(LastAlarms)); + RedisController.WriteCurrentMachineStatus(CMSConnectConstants.ConvertThermoToConnectStatus(LastProdCycleData.Status)); + RedisController.WriteCurrentMachinePowerPath(CMSConnectConstants.ConvertThermoToConnectPower(LastProdCycleData.Status)); + RedisController.WriteCurrentProcessStatus(1, CMSConnectConstants.ConvertThermoToConnectProcessStatus(LastProdCycleData.Status)); + RedisController.WriteCurrentProcessMode(1, CMSConnectConstants.ConvertThermoToConnectProcessMode(LastProdCycleData.Mode)); + } + Debug.WriteLine(string.Format("{0} {1} Broadcast..completed", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"), DateTime.Now.Millisecond)); Monitor.Exit(_broadcastlock); } diff --git a/Thermo.Active/Thermo.Active.csproj b/Thermo.Active/Thermo.Active.csproj index 75fab874..853d2397 100644 --- a/Thermo.Active/Thermo.Active.csproj +++ b/Thermo.Active/Thermo.Active.csproj @@ -227,6 +227,7 @@ + @@ -16195,6 +16196,10 @@ {b2366b08-96bd-4f6b-b748-b45089b87a14} Thermo.Active.NC + + {8d8ec91a-3a15-4a1d-951b-a35e7068debd} + Thermo.Active.Thermocamera + {20fc0937-e7ca-4693-95f9-7a948efd173b} Thermo.Active.UI diff --git a/Thermo.Active/wwwroot/assets/styles/base/riscaldi.less b/Thermo.Active/wwwroot/assets/styles/base/riscaldi.less index cb4bacc8..199e2373 100644 --- a/Thermo.Active/wwwroot/assets/styles/base/riscaldi.less +++ b/Thermo.Active/wwwroot/assets/styles/base/riscaldi.less @@ -30,6 +30,17 @@ font-size: 32px; font-weight: bold; color: #fff; + + &.temp{ + grid-template-columns: 50% 50%; + grid-template-rows: 50% 50%; + display: grid; + font-size: 22px; + span{ + text-align: right; + margin-right: 5px; + } + } } } diff --git a/Thermo.Active/wwwroot/assets/styles/style.css b/Thermo.Active/wwwroot/assets/styles/style.css index 2090ac32..105edd6a 100644 --- a/Thermo.Active/wwwroot/assets/styles/style.css +++ b/Thermo.Active/wwwroot/assets/styles/style.css @@ -4683,6 +4683,16 @@ article .box .body { font-weight: bold; color: #fff; } +.warmers svg .resistance.temp { + grid-template-columns: 50% 50%; + grid-template-rows: 50% 50%; + display: grid; + font-size: 22px; +} +.warmers svg .resistance.temp span { + text-align: right; + margin-right: 5px; +} .warmers .icon { font-size: 30px; margin-left: 10px; diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/resistance.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/resistance.ts index d0d68f36..37d072b7 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/resistance.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/resistance.ts @@ -15,6 +15,9 @@ export default class Resistance extends Vue { @Prop({ default: false }) selected: boolean; + @Prop({ default: false }) + temperature: boolean; + @Prop({ default: function () { return [253, 216, 53] } }) colorFrom: number[]; diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/resistance.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/resistance.vue index 89077b38..04a3e4be 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/resistance.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/resistance.vue @@ -2,9 +2,23 @@ {{channel.setpointHMI}} % + + {{channel.setpointHMI}} °C + {{channel.setpointHMI}} °C + {{channel.setpointHMI}} % + {{channel.setpointHMI}} % + \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/thermocamera.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/thermocamera.ts new file mode 100644 index 00000000..58abc861 --- /dev/null +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/thermocamera.ts @@ -0,0 +1,92 @@ +import Vue from 'vue'; +import Component from 'vue-class-component'; +import { Prop } from 'vue-property-decorator'; +import warmers from "./warmers.vue"; +import { store } from '@/store'; +import { thermocameraService } from "@/services/thermocameraService"; + +@Component({ + name: "thermocamera", components: { + + warmers + } +}) +export default class Thermocamera extends Vue { + + @Prop() + recipe: Recipe.IRecipe; + + selectedChannelIds: number[] = []; + uniformChannelValue: number = -1; + + beforeMount(){ + this.uniformChannelValue = -1; + } + + get selectedChannels(): Warmers.IChannel[] { + return store.state.warmers.channels.filter(i => this.selectedChannelIds.indexOf(i.idChannel) >= 0); + } + + selectionMethod = "none" + + changedSelectValue(v){ + if(this.uniformChannelValue>=0) + for (const c of this.selectedChannels) c.setpointHMI = this.uniformChannelValue; + } + + + zoomIn() { + (this.$refs.warmers as any).zoomIn(); + } + + zoomOut() { + (this.$refs.warmers as any).zoomOut(); + } + zoomReset() { + (this.$refs.warmers as any).zoomReset(); + } + + async showcamera(){ + this.zoomReset() + await thermocameraService.show(); + + } + + selectionChanged(selected: number[]) { + this.selectedChannelIds = [] + this.uniformChannelValue = -1; + this.selectedChannelIds = selected; + } + + disableHeater(){ + + } + + enableHeater(){ + + } + + setAllTemperature(){ + + } + + add5() { + for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) + 5, 0), 100); + this.$emit("warmersChanged"); + } + + remove5() { + for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) - 5, 0), 100); + this.$emit("warmersChanged"); + } + + add1() { + for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) + 1, 0), 100); + this.$emit("warmersChanged"); + } + + remove1() { + for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) - 1, 0), 100); + this.$emit("warmersChanged"); + } +} \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/thermocamera.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/thermocamera.vue new file mode 100644 index 00000000..bf2f9630 --- /dev/null +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/thermocamera.vue @@ -0,0 +1,105 @@ + + + + + + selectionMethod = m" + :recipe="recipe" + :temperature="true" + > + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.ts index f851bb9f..0306c01d 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.ts @@ -32,6 +32,10 @@ export default class Warmers extends Vue { @Prop({ default: true }) usePanZoom: boolean; + @Prop({ default: false }) + temperature: boolean; + + get planSizeX() { return parseFloat(this.parameters.warmerPlanSizeX.toString()); } diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.vue index 79eb7817..f82ff8bc 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.vue @@ -26,6 +26,7 @@ @mouseup="stopSelection" @click="select(cell)" :selected="isSelected(cell.idChannel)" + :temperature="temperature" /> diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.ts index e5928155..6d93be8d 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.ts @@ -6,6 +6,8 @@ import { Prop, Watch } from 'vue-property-decorator'; import StepFooter from "@/app_modules_thermo/setup/components/step-footer.vue"; import RiscaldiSup from "./base-components/riscaldi-superiori.vue"; import RiscaldiInf from "./base-components/riscaldi-inferiori.vue"; +import Thermocamera from "./base-components/thermocamera.vue"; + import SostDecomp from "./base-components/sostentamento-decompressione.vue"; import { recipeActions } from "@/store/recipe.store"; import { store } from "@/store"; @@ -14,7 +16,7 @@ import { recipeService } from "@/services/recipeService"; import { warmersService } from "@/services/warmersService"; import { debounce } from "@/_base/debounce"; -@Component({ components: { modal: Modal, stepfooter: StepFooter, riscaldiinf: RiscaldiInf, riscaldisup: RiscaldiSup, sostdecomp: SostDecomp } }) +@Component({ components: { modal: Modal, stepfooter: StepFooter, riscaldiinf: RiscaldiInf, riscaldisup: RiscaldiSup, sostdecomp: SostDecomp,thermocamera:Thermocamera } }) export default class ShowRiscaldamentoSuperioreInfo extends Vue { recipe: Recipe.IRecipe = this.$store.getters.getCurrent(); diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.vue index 6335f7cd..df92a105 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.vue @@ -17,6 +17,11 @@ @click="show = 'decomsustain'" v-if="isDecomsustainEnabled()" >{{'decomsustain' | localize("Sostentamento/Decompressione")}} + {{'Thermoprophet' | localize("Thermoprophet")}} @@ -25,6 +30,7 @@ +