Fix changes

This commit is contained in:
Samuele E. Locatelli
2020-11-11 10:07:05 +01:00
parent cefb9df5bd
commit cab2a84231
9 changed files with 56 additions and 20 deletions
@@ -104,6 +104,8 @@
<Component Name="Programs">
<Component Name="01">
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="RepsTarget" BrowseName="RepsTarget" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="RepsDone" BrowseName="RepsDone" DataType="ua:String" ValueRank="Scalar" Units="" />
</Component>
</Component>
</Component>
@@ -15,7 +15,6 @@ namespace Thermo.Active.Database.Controllers
private const string redisAlmIt = "AdpConf:Plc:Condition:It";
private const string redisAlmEn = "AdpConf:Plc:Condition:En";
private const string currentUserPath = "Machine:Hmi:User";
private const string machineMessagePath = "Machine:Messages";
private const string machineStatusPath = "Machine:Status";
private const string machinePowerPath = "Machine:Power";
private const string machineAlarmPath = "Machine:Alarm";
@@ -34,6 +33,7 @@ namespace Thermo.Active.Database.Controllers
private const string machineAxisLoad = "Machine:Axes:%NN%:Load";
private const string machineAxisName = "Machine:Axes:%NN%:Name";
private const string machineEventKpis = "Events:Kpis";
private const string machineMessagePath = "Events:Messages";
public static void WriteProductionNotification(uint ProductionProcess, string Notification)
{
@@ -103,11 +103,6 @@ namespace Thermo.Active.Database.Controllers
string redisHash = redUtil.man.redHash(currentActiveVersionPath);
return redUtil.man.setRSV(redisHash, version.ToString());
}
public static bool SendMessage(DTOMessageModel message)
{
string redisHash = redUtil.man.redHash(machineMessagePath);
return redUtil.man.setJson(redisHash, message);
}
public static bool WriteCurrentMachineStatus(string status)
{
@@ -181,7 +176,13 @@ namespace Thermo.Active.Database.Controllers
redUtil.man.ListPush(redisHash, alarms);
return true;
}
public static bool SendMessage(string msg)
{
string redisHash = redUtil.man.redHash(machineMessagePath);
redUtil.man.ListPush(redisHash, msg);
return true;
}
public static bool WriteCurrentAxisStatus(Dictionary<int, DTOAxisInfoModel> axis)
{
@@ -10,10 +10,5 @@ namespace Thermo.Active.Model.DTOModels
public string Department { get; set; }
public DateTime TimeStamp { get; set; }
public string UserId { get; set; }
public Guid Id { get; set; }
}
}
@@ -3,11 +3,13 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Security.Claims;
using System.Web.Http;
using TeamDev.SDK.MVVM;
using Thermo.Active.CmsConnectGateway;
using Thermo.Active.CmsConnectGateway.Events;
using Thermo.Active.CmsConnectGateway.Exceptions;
using Thermo.Active.Database.Controllers;
using Thermo.Active.Model.DTOModels;
using static Thermo.Active.Model.Constants;
@@ -238,5 +240,28 @@ namespace Thermo.Active.Controllers.WebApi
}
}
[Route("message"), HttpPost]
public IHttpActionResult sendMessages([FromBody][Required]DTOMessageModel message)
{
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();
int userIdInt = Convert.ToInt32(userId.Value);
using (UsersController usersController = new UsersController())
{
// Update database with new language
DTOMessageUserModel user = usersController.GetUserInfo(userIdInt);
String username = user.Username + " (" +user.FirstName + " " + user.LastName + ")";
var ts = DateTime.UtcNow.ToString("o");
var a = "{\"v\": { \"userId\": \"" + username + "\", \"text\": \"" + message.Message + "\", \"resolutionHrs\": " + message.EstimateTime + ", \"department\": \"" + message.Department + "\"},\"ts\": \"" + ts + "\"}";
RedisController.SendMessage(a);
}
return Ok();
}
}
}
@@ -211,7 +211,7 @@
:isEnrolled="cmsConnectActivationData().isEnrolled">
</activationTab>
<!-- ACTIVATION TAB -->
<!-- MESSAGES TAB -->
<messagesTab v-if="selectedTab=='messages'"
@click="sendMessage">
</messagesTab>
@@ -5,6 +5,8 @@ import { Prop } from 'vue-property-decorator';
import { Hub } from "@/services";
import Numeric from "./numeric";
import { unitOfTime } from "moment";
import { KeyboardHelper } from "@/app_modules_thermo/components/KeyboardHelper";
@Component({ name: "slider" })
export default class Slider extends Vue {
@@ -54,10 +56,18 @@ export default class Slider extends Vue {
startIncrementTouch(event){
event.preventDefault();
this.startIncrement();
KeyboardHelper.hideKeyboard();
}
touchSlider(event){
KeyboardHelper.hideKeyboard();
}
startDecrementTouch(event){
event.preventDefault();
this.startDecrement();
KeyboardHelper.hideKeyboard();
}
startIncrement() {
@@ -15,6 +15,7 @@
:max="this.value.range.max"
:step="this.initalStep"
v-model.number="actualvalue"
v-on:touchstart="touchSlider"
type="range"
/>
<div class="lines">
@@ -48,7 +48,15 @@ export default class Thermocamera extends Vue {
if(this.modeEnabled.checkpointHMI != this.modeEnabled.setpointHMI)
this.$emit("enabChanged");
if(this.modeEnabled.setpointHMI == 1)
{
store.state.warmers.tCamStatus.thermoCamMode = true;
store.state.warmers.channels.forEach(function(element, index){
if (element.setpointHMI==0)
store.state.warmers.channels[index].tCamActive = false;
else
store.state.warmers.channels[index].tCamActive = true;
});
}
else
store.state.warmers.tCamStatus.thermoCamMode = false;
}
@@ -166,13 +166,7 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
// recipeActions.setCurrent(store, this.recipe);
this.isLoading = true;
if(this.warmersEdited){
store.state.warmers.channels.forEach(function(element, index){
if (element.setpointHMI==0)
store.state.warmers.channels[index].tCamActive = false;
else
store.state.warmers.channels[index].tCamActive = true;
});
if(this.warmersEdited){
await warmersService.Update(store.state.warmers.channels.reduce((p, c) => { p[c.idChannel] = c.setpointHMI; return p; }, {}));
}
if(this.tempsEdited)