Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Paolo Possanzini
2018-12-03 14:39:29 +01:00
73 changed files with 1298 additions and 379 deletions
+8
View File
@@ -44,6 +44,7 @@ namespace CMS_Client.Browser_Tools
AddFunction("maximizeForm").Execute += maximizeForm;
AddFunction("closeForm").Execute += closeForm;
AddFunction("forceStepFocus").Execute += forceStepFocus;
AddFunction("forceNcFocus").Execute += forceNcFocus;
AddFunction("reloadBrokenPage").Execute += reloadBrokenPage;
AddFunction("setNcWindowState").Execute += setNcWindowState;
@@ -190,6 +191,13 @@ namespace CMS_Client.Browser_Tools
NcWindow.ForceStepFocus();
}
public void forceNcFocus(object sender, CfrV8HandlerExecuteEventArgs e)
{
//NcWindow.ForceNcRedraw();
NcWindow.ForceNcFocus();
mainForm.ShowNCWindow();
}
// Get the option of virtual Keyb configured
private void isVirtualKeybConfigured(object sender, CfrV8HandlerExecuteEventArgs e)
{
+22 -3
View File
@@ -262,7 +262,7 @@ namespace CMS_Client.View
//If the NC is Siemens Exit from Function and lets the HMI to continue his life
if (!forced && Config.VendorHmiConfig.Type == 2)
{
HideNcWindow();
MinimizeNcWindow();
return;
}
//If FollowNcWindow is OFF, set the Border and lets the HMI to continue his life
@@ -310,11 +310,20 @@ namespace CMS_Client.View
//Minimize Nc Window
public static void MinimizeNcWindow()
{
if (windowstarted)
ShowWindow(ncprocess.MainWindowHandle, WS_MINIMIZE);
}
//Hide Nc Window
public static void HideNcWindow()
{
if (windowstarted)
ShowWindow(ncprocess.MainWindowHandle, WS_MINIMIZE);
ShowWindow(ncprocess.MainWindowHandle, WS_HIDE);
}
@@ -366,7 +375,17 @@ namespace CMS_Client.View
if (windowstarted)
ForceFocus(ncprocess.MainWindowHandle);
}
//Force NC Focus
public static void ForceNcRedraw()
{
if (windowstarted){
HideNcWindow();
ShowNcWindow();
}
}
//Force NC Focus
@@ -1203,7 +1222,7 @@ namespace CMS_Client.View
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, StringBuilder lParam);
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
Binary file not shown.
+1 -1
View File
@@ -8,7 +8,7 @@
<alarm>
<alarmId>2</alarmId>
<plcId>2</plcId>
<restoreIsActive>false</restoreIsActive>
<restoreIsActive>true</restoreIsActive>
</alarm>
<alarm>
<alarmId>3</alarmId>
+4
View File
@@ -2,7 +2,11 @@
<serverConfig>
<ncConfig>
<ncVendor>DEMO</ncVendor> <!-- NO_NC/DEMO/FANUC/SIEMENS/OSAI -->
<<<<<<< HEAD
<showNcHMI>true</showNcHMI>
=======
<showNcHMI>false</showNcHMI>
>>>>>>> develop
<ncIpAddress>localhost</ncIpAddress>
<ncPort>8080</ncPort>
<machineModel>Ares 37 OF</machineModel>
+7 -7
View File
@@ -47,7 +47,7 @@ namespace Step.Config
{
// Create new instance
XmlSchemaSet readerSettings = new XmlSchemaSet();
// Add Schema from Assembly
Assembly myAssembly = Assembly.GetExecutingAssembly();
using (Stream schemaStream = myAssembly.GetManifestResourceStream(configSchemaFilePath))
@@ -61,7 +61,7 @@ namespace Step.Config
// Open file reader
XDocument xmlConfigFile = XDocument.Load(BASE_PATH + "\\" + configFilePath);
// Validate file
xmlConfigFile.Validate(readerSettings, ValidationHandler, true);
xmlConfigFile.Validate(readerSettings, ValidationHandler);
return xmlConfigFile;
}
@@ -120,14 +120,14 @@ namespace Step.Config
private static void ValidationHandler(object sender, ValidationEventArgs e)
{
if (e.Severity == XmlSeverityType.Warning)
{
{
ExceptionManager.Manage(ERROR_LEVEL.WARNING, e.Message);
}
}
else if (e.Severity == XmlSeverityType.Error)
{
{
ExceptionManager.Manage(ERROR_LEVEL.FATAL,
"Error while reading file: " + e.Exception.SourceUri +
"\n Error: " + e.Message
// "Error while reading file: " + e.Exception.SourceUri +
"Error while reading configuration file: " + e.Message
);
}
}
+57 -8
View File
@@ -24,10 +24,52 @@ public static class ThreadsFunctions
private static long ReadAxesNamesTimer = 0, ReadAxesNamesTimes = 0;
private static long ReadHeadsTimer = 0, ReadHeadsTimes = 0;
private static long ReadToolDataTimer = 0, ReadToolDataTimes = 0;
private static long WatchdogTimer = 0, WatchdogTimes = 0;
private static Thread ConnThread;
#region Nc functions threads
#region Functions
public static void ManageWatchdog()
{
NcHandler ncHandler = new NcHandler();
Stopwatch sw = new Stopwatch();
try
{
CmsError libraryError = ncHandler.Connect();
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
while (true)
{
sw.Restart();
// Check if client is connected
if (ncHandler.numericalControl.NC_IsConnected())
{
// Manage watchdog
libraryError = ncHandler.ManageWatchdog();
}
else
TryNcConnection();
sw.Stop();
//Update thread timer
WatchdogTimer += sw.ElapsedMilliseconds;
WatchdogTimes++;
// Wait
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
{
ncHandler.Dispose();
}
}
public static void ReadAlarms()
{
@@ -115,7 +157,6 @@ public static class ThreadsFunctions
}
}
// Read processes part program status
public static void ReadProcessesPPStatus()
{
NcHandler ncHandler = new NcHandler();
@@ -146,10 +187,18 @@ public static class ThreadsFunctions
ManageLibraryError(libraryError);
else
{
// Send processes through signalR
MessageServices.Current.Publish(SEND_PROCESSES_DATA, null, processesPPData);
// Send ncSoftKeys through signalR
MessageServices.Current.Publish(SEND_NC_SOFTKEYS_DATA, null, ncSoftKeys);
libraryError = ncHandler.GetM155Data(out List<DTOM155InputModel> m155Data);
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
else
{
// Send processes through signalR
MessageServices.Current.Publish(SEND_PROCESSES_DATA, null, processesPPData);
// Send ncSoftKeys through signalR
MessageServices.Current.Publish(SEND_NC_SOFTKEYS_DATA, null, ncSoftKeys);
// Send m155 through signalR
MessageServices.Current.Publish(SEND_M155_DATA, null, m155Data);
}
}
}
}
@@ -450,7 +499,7 @@ public static class ThreadsFunctions
try
{
// Try connection
CmsError libraryError = ncHandler.Connect();
CmsError libraryError = ncHandler.Connect();
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
@@ -666,7 +715,7 @@ public static class ThreadsFunctions
}
}
#endregion Nc functions threads
#endregion Functions
#region SupportFunctions
+37 -13
View File
@@ -7,6 +7,8 @@ using System.Data.Entity;
using System.IO;
using System.Linq;
using static Step.Model.Constants;
using static Step.Config.ServerConfig;
using System.Diagnostics;
namespace Step.Database.Controllers
{
@@ -26,24 +28,46 @@ namespace Step.Database.Controllers
dbCtx.Dispose();
}
public List<DTOAlarmHistoricModel> GetPaginatedWithFilter(string message, List<ALARM_TYPE> types, int page, int pageSize, DateTime startDate, DateTime endDate, List<int> userIds)
public List<DTOAlarmHistoricModel> GetPaginatedWithFilter(string title, List<ALARM_TYPE> types, int page, int pageSize, DateTime startDate, DateTime endDate, List<int?> userIds, Dictionary<int, string> plcMessages)
{
var occurrences = dbCtx
bool ifNoUser = false;
var index = userIds.IndexOf(-1);
if (userIds.IndexOf(-1) != -1)
ifNoUser = true;
List<int> ncAlarmDescIds = dbCtx
.AlarmDescriptions
.Where(x => x.Title.Contains(title))
.Select(x => x.AlarmId)
.ToList();
// Get Plc messages ids
List<int> plcAlarmDescIds =
plcMessages
.Where(x => x.Value.Contains(title))
.Select(x => x.Key)
.ToList();
// Query
var occurrencesQuery = dbCtx
.AlarmOccurrences
.OrderBy(x => x.AlarmOccurrenceId)
.Include("Users")
.Include("Users")
.Where(x =>
x.TimeStamp >= startDate && x.TimeStamp <= endDate
&& types.Contains(x.Type)
&& x.Users.Any(y => userIds.Any(z => z == y.UserId))
)
.Skip(page * pageSize)
x.TimeStamp >= startDate && x.TimeStamp <= endDate // Filter by date
&& types.Contains(x.Type) // Type
&& ( (ifNoUser && x.Users.Count() == 0) || x.Users.Any(y => userIds.Any(z => z == y.UserId))) // Check user
&&
((x.Source == ALARM_SOURCE.NC && ncAlarmDescIds.Contains(x.AlarmDescriptionId.Value)) // Check if message is contained in NC messages
|| (x.Source == ALARM_SOURCE.PLC && plcAlarmDescIds.Contains(x.PlcMessageId.Value))) // Check if message is contained in PLC messages
)
.Skip(page * pageSize) // Paginate
.Take(pageSize)
.Include("AlarmDescription")
.Include("AlarmDescription") // Include foreign key
.ToList();
return occurrences
.Select(x => (DTOAlarmHistoricModel)x)
return occurrencesQuery
.Select(x => (DTOAlarmHistoricModel)x) // Convert to DTOALarmHistoricModel
.ToList();
}
@@ -73,7 +97,7 @@ namespace Step.Database.Controllers
{
dbCtx.AlarmUsers.AddRange(loggedUser);
dbCtx.SaveChangesAsync(); // TODO check if it is the best solutions
dbCtx.SaveChanges(); // TODO check if it is the best solutions
}
public DTOAlarmsData GetAlarmsData(int pageSize)
@@ -147,14 +147,6 @@ namespace Step.Database.Controllers
List<DTONcShankModel> dtoShanks = dbShanks
.Select(x => (DTONcShankModel)x)
.ToList();
// new List<DTONcShankModel>();
//foreach (var shank in dbShanks)
//{
// //dbCtx.Shanks.Attach(shank);
// DTONcShankModel dtoShank = (DTONcShankModel)shank;
// dtoShanks.Add(dtoShank);
//}
return dtoShanks;
}
@@ -447,7 +439,10 @@ namespace Step.Database.Controllers
// Set ids with new positions
shank.MagazineId = magazineId;
shank.PositionId = positionId;
// Set original Ids
shank.OriginMagazineId = magazineId;
shank.OriginPositionId = positionId;
dbCtx.SaveChanges();
return FindMagazinePosition(magazineId, positionId);
@@ -459,6 +454,9 @@ namespace Step.Database.Controllers
// set id to null
shank.MagazineId = null;
shank.PositionId = null;
shank.OriginMagazineId = null;
shank.OriginPositionId = null;
dbCtx.SaveChanges();
@@ -35,6 +35,8 @@ namespace Step.Database.Controllers
.Sessions
.Include("MachineUser")
.Select(x => x.MachineUser)
.GroupBy(x => x.MachineUserId)
.Select(x => x.FirstOrDefault())
.ToList();
}
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@ namespace Step.Database.Migrations
string IMigrationMetadata.Id
{
get { return "201810240848483_InitMigration"; }
get { return "201811300854588_InitMigration"; }
}
string IMigrationMetadata.Source
@@ -56,6 +56,7 @@ namespace Step.Database.Migrations
type = c.Int(nullable: false),
processes = c.Int(nullable: false),
timestamp = c.DateTime(nullable: false, precision: 0),
plc_message_id = c.Int(),
})
.PrimaryKey(t => t.id)
.ForeignKey("dbo.alarm_description", t => t.alarm_id)
@@ -142,10 +143,12 @@ namespace Step.Database.Migrations
c => new
{
magazine_id = c.Byte(),
position_id = c.Byte(),
position_id = c.Int(),
id = c.Short(nullable: false),
balluf = c.Int(),
magazine_position_type = c.Byte(nullable: false),
origin_magazine_id = c.Byte(),
origin_position_id = c.Int(),
})
.PrimaryKey(t => t.id)
.ForeignKey("dbo.magazine_position", t => new { t.magazine_id, t.position_id })
@@ -156,7 +159,7 @@ namespace Step.Database.Migrations
c => new
{
magazine_id = c.Byte(nullable: false),
position_id = c.Byte(nullable: false),
position_id = c.Int(nullable: false),
type = c.Byte(nullable: false),
disabled = c.Boolean(nullable: false),
})
File diff suppressed because one or more lines are too long
+13 -13
View File
@@ -25,22 +25,22 @@ namespace Step.Database.Migrations
);
context.FunctionsAccess.AddOrUpdate(
// General Function
new FunctionAccessModel() { Name = GENERAL, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 100, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = USER_FUNCTIONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = NC_DATA, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 10, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = ALARM_CMD, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 1 },
new FunctionAccessModel() { Name = STARTUP_ICONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 2 },
// General Function, if plcId is 0 then the functionality is not connected to the NC
new FunctionAccessModel() { Name = GENERAL, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 100, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = USER_FUNCTIONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = NC_DATA, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 10, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = ALARM_CMD, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 1},
new FunctionAccessModel() { Name = STARTUP_ICONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 2},
// Under hood
new FunctionAccessModel() { Name = PROCESS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 3 },
new FunctionAccessModel() { Name = NC_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 4 },
new FunctionAccessModel() { Name = USER_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 5 },
new FunctionAccessModel() { Name = HEADS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 6 },
new FunctionAccessModel() { Name = AXES_SELECTION, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 7 },
new FunctionAccessModel() { Name = PROCESS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 3},
new FunctionAccessModel() { Name = NC_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 4},
new FunctionAccessModel() { Name = USER_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 5},
new FunctionAccessModel() { Name = HEADS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 6},
new FunctionAccessModel() { Name = AXES_SELECTION, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 7},
new FunctionAccessModel() { Name = TOOL_MANAGER, Area = TOOLING_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 8 },
new FunctionAccessModel() { Name = MAINTENANCE, Area = MAINTENANCE_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 9 }
new FunctionAccessModel() { Name = TOOL_MANAGER, Area = TOOLING_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 8},
new FunctionAccessModel() { Name = MAINTENANCE, Area = MAINTENANCE_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 9}
);
context.SaveChanges();
+5 -5
View File
@@ -81,9 +81,9 @@
<Compile Include="Controllers\MachinesUsersController.cs" />
<Compile Include="Controllers\UserSoftkeysController.cs" />
<Compile Include="DatabaseContext.cs" />
<Compile Include="Migrations\201810240848483_InitMigration.cs" />
<Compile Include="Migrations\201810240848483_InitMigration.Designer.cs">
<DependentUpon>201810240848483_InitMigration.cs</DependentUpon>
<Compile Include="Migrations\201811300854588_InitMigration.cs" />
<Compile Include="Migrations\201811300854588_InitMigration.Designer.cs">
<DependentUpon>201811300854588_InitMigration.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -119,8 +119,8 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\201810240848483_InitMigration.resx">
<DependentUpon>201810240848483_InitMigration.cs</DependentUpon>
<EmbeddedResource Include="Migrations\201811300854588_InitMigration.resx">
<DependentUpon>201811300854588_InitMigration.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+1
View File
@@ -185,6 +185,7 @@ namespace Step.Model
public const string UPDATE_TOOLS_DATA = "UPDATE_TOOLS_DATA";
public const string NC_MAGAZINE_IS_ACTIVE = "UPDATE_NC_MAGAZINE_STATUS";
public const string SEND_QUEUE_DATA = "SEND_QUEUE_DATA";
public const string SEND_M155_DATA = "SEND_M155_DATA";
public const string BROADCAST_DATA = "BROADCAST_DATA";
@@ -4,8 +4,6 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Step.Model.Constants;
namespace Step.Model.DTOModels.AlarmModels
@@ -21,15 +19,15 @@ namespace Step.Model.DTOModels.AlarmModels
public string Description { get; set; }
public ALARM_SOURCE Source { get; set; }
public ALARM_TYPE Type { get; set; }
public List<int> Processes { get; set; }
public DateTime TimeStamp { get; set; }
public List<int> Users { get; set; }
public static explicit operator DTOAlarmHistoricModel(AlarmOccurrencesModel obj)
{
List<int> processes = new List<int>();
@@ -55,29 +53,35 @@ namespace Step.Model.DTOModels.AlarmModels
};
}
}
public class DTOAlarmsFilterModel
{
[Required]
public int Page { get; set; }
[Required]
public int PageSize { get; set; }
[Required]
public string Title { get; set; }
[Required]
public List<ALARM_TYPE> Type { get; set; }
[Required]
public DateTime? StartDate { get; set; }
[Required]
public DateTime EndDate { get; set; }
[Required]
public List<int> UserIds { get; set; }
public List<int?> UserIds { get; set; }
public string Language { get; set; }
}
public struct DTOAlarmsData
{
public int Pages;
public DateTime FirstDate;
}
}
}
+21 -1
View File
@@ -60,7 +60,7 @@ namespace Step.Model.DTOModels
{
public override bool Equals(object obj)
{
var item = obj as ProcessModel;
ProcessModel item = obj as ProcessModel;
if (item == null)
return false;
@@ -84,4 +84,24 @@ namespace Step.Model.DTOModels
return base.GetHashCode();
}
}
public class DTOM155InputModel : M155InputIsNeededModel
{
public new string Type;
public override bool Equals(object obj)
{
DTOM155InputModel item = obj as DTOM155InputModel;
if (item == null)
return false;
if (Process != item.Process)
return false;
if (Type != item.Type)
return false;
return true;
}
}
}
@@ -12,7 +12,7 @@ namespace Step.Model.DTOModels.ToolModels
{
public byte MagazineId { get; set; }
public byte PositionId { get; set; }
public int PositionId { get; set; }
[Required]
public bool Disabled { get; set; }
@@ -38,9 +38,15 @@ namespace Step.Model.DTOModels.ToolModels
[Range(1, byte.MaxValue)]
public byte? MagazineId { get; set; }
[Range(1, ushort.MaxValue)]
public int? PositionId { get; set; }
[Range(1, byte.MaxValue)]
public byte? PositionId { get; set; }
public byte? OriginMagazineId { get; set; }
[Range(1, ushort.MaxValue)]
public int? OriginPositionId { get; set; }
public List<DTONcToolModel> ChildsTools { get; set; }
public static explicit operator DTONcShankModel(DbNcShankModel obj)
@@ -60,6 +66,8 @@ namespace Step.Model.DTOModels.ToolModels
MagazinePositionType = obj.MagazinePositionType,
MagazineId = obj.MagazineId,
PositionId = obj.PositionId,
OriginMagazineId = obj.OriginMagazineId,
OriginPositionId = obj.OriginPositionId,
ChildsTools = tools
};
}
@@ -72,7 +80,9 @@ namespace Step.Model.DTOModels.ToolModels
Balluf = obj.Balluf,
MagazinePositionType = obj.MagazinePositionType,
MagazineId = obj.MagazineId,
PositionId = obj.PositionId
PositionId = obj.PositionId,
OriginMagazineId = obj.OriginMagazineId,
OriginPositionId = obj.OriginPositionId,
};
}
}
@@ -28,6 +28,9 @@ namespace Step.Model.DatabaseModels
[Column("timestamp")]
public DateTime TimeStamp { get; set; }
[Column("plc_message_id")]
public int? PlcMessageId { get; set; }
public AlarmDescriptionsModel AlarmDescription { get; set; }
public List<AlarmUserModel> Users { get; set; }
@@ -12,7 +12,7 @@ namespace Step.Model.DatabaseModels
public byte MagazineId { get; set; }
[Key, Column("position_id", Order = 1)]
public byte PositionId { get; set; }
public int PositionId { get; set; }
[Column("type")]
public byte Type { get; set; }
@@ -25,7 +25,7 @@ namespace Step.Model.DatabaseModels
return new NcMagazinePositionModel()
{
MagazineId = obj.MagazineId,
PositionId = obj.PositionId,
PositionId = (ushort)obj.PositionId,
Disabled = obj.Disabled ? (byte)1 : (byte)0,
Type = obj.Type
};
+13 -4
View File
@@ -24,7 +24,14 @@ namespace Step.Model.DatabaseModels
public byte? MagazineId { get; set; }
[ForeignKey("MagazinePosition"), Column("position_id", Order = 1)]
public byte? PositionId { get; set; }
public int? PositionId { get; set; }
[Column("origin_magazine_id")]
public byte? OriginMagazineId { get; set; }
[Column("origin_position_id")]
public int? OriginPositionId { get; set; }
public DbNcMagazinePositionModel MagazinePosition { get; set; }
@@ -34,12 +41,14 @@ namespace Step.Model.DatabaseModels
{
return new NcShankModel()
{
ShankId = obj.ShankId,
ShankId = (ushort)obj.ShankId,
Balluf = obj.Balluf == null ? (ushort)0 : (ushort)obj.Balluf.Value,
MagazineId = obj.MagazineId == null ? (byte)0 : obj.MagazineId.Value,
PositionId = obj.PositionId == null ? (byte)0 : obj.PositionId.Value,
PositionId = obj.PositionId == null ? (ushort)0 : (ushort)obj.PositionId.Value,
MagazinePositionType = obj.MagazinePositionType,
};
OriginMagazineId = obj.OriginMagazineId == null ? (byte)0 : obj.OriginMagazineId.Value,
OriginPositionId = obj.OriginPositionId == null ? (ushort)0 : (ushort)obj.OriginPositionId.Value,
};
}
}
}
+47 -41
View File
@@ -15,6 +15,7 @@ using Step.Utils;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -30,8 +31,8 @@ namespace Step.NC
public Nc numericalControl;
public NcHandler() =>
// Choose NC
numericalControl = SetNumericalControl();
// Choose NC
numericalControl = SetNumericalControl();
public void Dispose()
{
@@ -87,7 +88,7 @@ namespace Step.NC
CmsError cmsError = NO_ERROR;
if (File.Exists(path))
cmsError = LocalPartProgramFileInfo(path, out fileInfo);
cmsError = LocalPartProgramFileInfo(path, out fileInfo);
else
cmsError = numericalControl.FILES_RGetFileInfo(path, ref fileInfo);
@@ -120,10 +121,10 @@ namespace Step.NC
return FILE_NOT_FOUND_ERROR;
string base64Img = model.Metadata.Generics.Images.Count() > 0 ? model.Metadata.Generics.Images[0].Base64 : "";
fileInfo = new DTOActiveImageAndNameDataModel()
{
Image = base64Img,
Image = base64Img,
Name = Path.GetFileName(path) // TODO: Get From NC
};
@@ -139,13 +140,13 @@ namespace Step.NC
fileInfo = new DTOActiveImageAndNameDataModel()
{
Image = SupportFunctions.FindImageBase64String(IMAGES_PATH, name),
Image = SupportFunctions.FindImageBase64String(IMAGES_PATH, name),
Name = Path.GetFileName(name) // TODO: Get From NC
};
}
return NO_ERROR;
}
}
public CmsError LocalPartProgramFileInfo(string path, out InfoFile fileInfo)
{
@@ -164,7 +165,7 @@ namespace Step.NC
// Populate fileInfo content
fileInfo.Content = new List<string>();
while ((line = fileRead.ReadLine()) != null && count < 10)
while ((line = fileRead.ReadLine()) != null && count < 10)
{
fileInfo.Content.Add(line);
count++;
@@ -250,7 +251,7 @@ namespace Step.NC
};
return cmsError;
}
}
public CmsError UploadPartProgram(string localPath, string fileName, out string newFilePath)
{
@@ -430,34 +431,6 @@ namespace Step.NC
return NO_ERROR;
}
//public CmsError SwapQueueItems(int processId, int item1Index, int item2Index)
//{
// item1Index = item1Index - 1;
// item2Index = item2Index - 1;
// // Check if there is a queue
// if (!PartProgramQueue.ContainsKey(processId))
// return INCORRECT_PARAMETERS_ERROR;
// // Check if items exists
// if (PartProgramQueue[processId].ElementAtOrDefault(item1Index) == null || PartProgramQueue[processId].ElementAtOrDefault(item2Index) == null)
// return INCORRECT_PARAMETERS_ERROR;
// // Create a item
// DTOQueueModel tmp = PartProgramQueue[processId][item1Index];
// // Swap item 1 with 2
// PartProgramQueue[processId][item1Index] = PartProgramQueue[processId][item2Index];
// // Swap 2 with tmp
// PartProgramQueue[processId][item2Index] = tmp;
// // Swap ids
// PartProgramQueue[processId][item2Index].Id = item2Index + 1;
// // Swap 2 with tmp
// PartProgramQueue[processId][item1Index].Id = item1Index + 1;
// return NO_ERROR;
//}
public CmsError MoveQueueItems(int processId, int itemId, int newIndex, out List<DTOQueueModel> queue)
{
itemId = itemId - 1;
@@ -578,6 +551,11 @@ namespace Step.NC
#region Read Data
public CmsError ManageWatchdog()
{
return numericalControl.PLC_RWManageWatchdog();
}
public CmsError GetNcGenericData(out DTONcGenericDataModel genericData)
{
genericData = new DTONcGenericDataModel(MachineConfig.Model);
@@ -1327,7 +1305,7 @@ namespace Step.NC
public CmsError ReadAxisData(out List<DTOAxisNameModel> axesNames)
{
axesNames = new List<DTOAxisNameModel>();
List<AxisModel> plcAxes = new List<AxisModel>();
List<AxisModel> plcAxes = new List<AxisModel>();
// Read selected process
ushort selectedProcess = 0;
CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess);
@@ -1343,7 +1321,7 @@ namespace Step.NC
{
Id = x.Id,
Name = x.Name,
IsSelectable = x.IsSelectable
IsSelectable = x.IsSelectable
}).ToList();
}
@@ -1464,6 +1442,26 @@ namespace Step.NC
return cmsError;
}
public CmsError GetM155Data(out List<DTOM155InputModel> data)
{
data = new List<DTOM155InputModel>();
List<M155InputIsNeededModel> ncData = new List<M155InputIsNeededModel>();
CmsError cmsError = numericalControl.PLC_ROperatorInputIsNeeded(ref ncData);
if (cmsError.IsError())
return cmsError;
data = ncData.Select(x => new DTOM155InputModel()
{
Buttons = x.Buttons,
IsNeeded = x.IsNeeded,
Message = x.Message,
Process = x.Process,
Type = x.Type.ToString()
}).ToList();
return NO_ERROR;
}
#endregion Read Data
#region Write data
@@ -1537,6 +1535,11 @@ namespace Step.NC
return numericalControl.NC_SetScreenVisible((Nc.SCREEN_PAGE)screen);
}
public CmsError WriteM155Data(int process, double responseValue)
{
return numericalControl.PLC_WOperatorInputResponse(process, responseValue);
}
#endregion Write data
#region Siemens Tools
@@ -2227,7 +2230,7 @@ namespace Step.NC
.Where(x => x.MagazineId != null)
.Select(x => (NcShankModel)x)
.ToList();
// Update shanks
CmsError cmsError = numericalControl.TOOLS_WUpdateShanks(shanks);
if (cmsError.IsError())
return cmsError;
@@ -2236,6 +2239,7 @@ namespace Step.NC
List<NcMagazinePositionModel> positions = toolsManager.FindMagazinesPositions()
.Select(x => (NcMagazinePositionModel)x)
.ToList();
// Update positions
cmsError = numericalControl.TOOLS_WUpdateMagazinePositions(positions);
if (cmsError.IsError())
return cmsError;
@@ -2248,15 +2252,17 @@ namespace Step.NC
.ToList();
// Update tools
cmsError = numericalControl.TOOLS_WUpdateTools(tools);
cmsError = numericalControl.TOOLS_WUpdateTools(tools);
if (cmsError.IsError())
return cmsError;
// Get families
List<NcFamilyModel> families = toolsManager
.FindFamilies()
.Select(x => (NcFamilyModel)x)
.Where(x => tools.Any(y => y.FamilyId == x.FamilyId)) // Find only families of mounted tools
.ToList();
// Update families
cmsError = numericalControl.TOOLS_WUpdateFamilies(families);
if (cmsError.IsError())
+3 -2
View File
@@ -131,12 +131,13 @@ namespace Step.Utils
public static string FindImageBase64String(string directoryPath, string imageName)
{
string fileName = Path.GetFileNameWithoutExtension(imageName);
foreach (string ext in VALID_IMAGE_EXTENSIONS)
{
if (File.Exists(directoryPath + "\\" + imageName + ext))
if (File.Exists(directoryPath + "\\" + fileName + ext))
{
// Convert image to a base 64 string
return "data:image/" + ext + ";base64," + Convert.ToBase64String(File.ReadAllBytes(directoryPath + "\\" + imageName + ext));
return "data:image/" + ext + ";base64," + Convert.ToBase64String(File.ReadAllBytes(directoryPath + "\\" + fileName + ext));
}
}
@@ -8,6 +8,7 @@ using Step.Config;
using Step.Model.DatabaseModels;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
using static Step.Listeners.SignalRStaticObjects;
namespace Step
{
@@ -79,6 +80,15 @@ namespace Step
if (functionAccess.WriteLevelMin > machineUser.Role.Level)
return false; // Not authorized
}
// Check if PLC bit exists
if(functionAccess.PlcId != 0)
{
// Check if functionality is enabled by PLC
var functionalityIsEnabled = LastRuntimeFunctionality.Where(x => x.Name == functionName).FirstOrDefault();
if (functionalityIsEnabled == null || functionalityIsEnabled.Enabled == false)
return false;
}
}
else
return false;
+12
View File
@@ -210,5 +210,17 @@ namespace Step.Controllers.SignalR
throw new HubException(libraryError.localizationKey);
}
}
[SignalRAuthorize(FunctionAccess = GENERAL, Action = ACTIONS.WRITE)]
public void WriteM155Response(int process, double responseVal)
{
using (NcHandler ncHandler = new NcHandler())
{
ncHandler.Connect();
CmsError cmsError = ncHandler.WriteM155Data(process, responseVal);
if (cmsError.IsError())
throw new HubException(cmsError.localizationKey);
}
}
}
}
+11 -17
View File
@@ -1,10 +1,10 @@
using Step.Database.Controllers;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels.AlarmModels;
using Step.NC;
using Step.Provider;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Net;
@@ -19,28 +19,23 @@ namespace Step.Controllers.WebApi
[RoutePrefix("api/alarm")]
public class ApiAlarmController : ApiController
{
//[Route(""), HttpGet]
//public IHttpActionResult GetAll(int page, int pageSize)
//{
// using (AlarmsController alarm = new AlarmsController())
// {
// var a = alarm.GetPaginated(page, pageSize);
// return Ok(a);
// }
//}
[Route("paginated"), HttpPost]
public IHttpActionResult GetDataPaginated([FromBody]DTOAlarmsFilterModel data)
public IHttpActionResult GetDataPaginated([FromBody]DTOAlarmsFilterModel filter)
{
Validate(data);
var a = ModelState.Values.Select(x => x.Errors);
if (!ModelState.IsValid)
return BadRequest(ModelState);
Dictionary<int, string> plcMessages = new Dictionary<int, string>();
using (NcHandler ncHandler = new NcHandler())
{
// Read data
ncHandler.numericalControl.NC_GetTranslatedPlcMessages(filter.Language, ref plcMessages);
}
using (AlarmsController alarm = new AlarmsController())
{
var alarms = alarm.GetPaginatedWithFilter(data.Title, data.Type, data.Page - 1, data.PageSize, data.StartDate.Value, data.EndDate, data.UserIds);
var alarms = alarm.GetPaginatedWithFilter(filter.Title, filter.Type, filter.Page - 1, filter.PageSize, filter.StartDate.Value, filter.EndDate, filter.UserIds, plcMessages);
return Ok(alarms);
}
@@ -165,7 +160,6 @@ namespace Step.Controllers.WebApi
#endregion Note
#region Attachment
[Route("{alarmDescId:int}/attachments"), HttpGet]
@@ -16,7 +16,7 @@ namespace Step.Controllers.WebApi
public class FavoriteUserSoftkeyController : ApiController
{
[Route("favorite"), HttpGet]
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.MAINTENANCE, Action = ACTIONS.WRITE)]
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_SOFTKEY, Action = ACTIONS.WRITE)]
public IHttpActionResult GetFavoriteSoftkeys()
{
var identity = User.Identity as ClaimsIdentity;
@@ -32,7 +32,7 @@ namespace Step.Controllers.WebApi
}
[Route("favorite"), HttpPut]
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.MAINTENANCE, Action = ACTIONS.WRITE)]
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_SOFTKEY, Action = ACTIONS.WRITE)]
public IHttpActionResult PutFavoriteSoftkeys(List<uint> favoriteSoftkeyIds)
{
var identity = User.Identity as ClaimsIdentity;
@@ -121,13 +121,12 @@ namespace Step.Controllers.WebApi
{
using (NcHandler ncHandler = new NcHandler())
{
CmsError cmsError = ncHandler.Connect();
Dictionary<string, string> returnValue = new Dictionary<string, string>();
Dictionary<int, string> messages = new Dictionary<int, string>();
// Read data from CN
cmsError = ncHandler.numericalControl.NC_GetTranslatedPlcMessages(language, ref messages);
ncHandler.numericalControl.NC_GetTranslatedPlcMessages(language, ref messages); // Avoid checking error because in the worst case "messages" is empty
// Id start from 1
for (int i = 1; i <= 1024; i++)
{
@@ -141,6 +141,7 @@ namespace Step.Listeners.Database
alarmNewOccurrences.AddRange(differences.PlcAlarms.Select(x =>
{
int processesByte = 0;
// Convert list to byte
x.Process.ForEach(y => processesByte |= (1 << y));
return new AlarmOccurrencesModel()
@@ -149,7 +150,8 @@ namespace Step.Listeners.Database
Type = x.IsWarning ? ALARM_TYPE.WARNING : ALARM_TYPE.ERROR,
Processes = processesByte,
TimeStamp = x.DateTime,
Source = ALARM_SOURCE.PLC
Source = ALARM_SOURCE.PLC,
PlcMessageId = (int)x.Id
};
}));
+5 -1
View File
@@ -86,7 +86,10 @@ namespace Step.Listeners
SignalRListener.SendPartProgramQueue(a);
SignalRDatabaseHandler.UpdateQueue(a);
}));
infos.Add(MessageServices.Current.Subscribe(SEND_M155_DATA, (a, b) =>
{
SignalRListener.SendM155Data(a);
}));
// Database
infos.Add(MessageServices.Current.Subscribe(UPDATE_TOOLS_DATA, (a, b) =>
@@ -100,6 +103,7 @@ namespace Step.Listeners
SignalRListener.BroadcastData();
}));
}
public static void Stop()
{
+14
View File
@@ -232,6 +232,18 @@ namespace Step.Listeners.SignalR
}
}
public static void SendM155Data(object data)
{
List<DTOM155InputModel> dtoM155Data = data as List<DTOM155InputModel>;
if (!LastM155Data.SequenceEqual(dtoM155Data))
{
LastM155Data = dtoM155Data;
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
context.Clients.Group("ncData").m155Data(dtoM155Data);
}
}
private volatile static object _broadcastlock = new Object();
public static void BroadcastData()
@@ -282,6 +294,8 @@ namespace Step.Listeners.SignalR
context.Clients.Group("ncData").magazineIsActive(LastNcMagazineIsActive);
// Send PP Queue
context.Clients.Group("ncData").partProgramQueue(LastPartProgramQueue);
// Send m155 data
context.Clients.Group("ncData").m155Data(LastM155Data);
Debug.WriteLine(string.Format("{0} {1} Broadcast..completed", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"), DateTime.Now.Millisecond));
Monitor.Exit(_broadcastlock);
+1
View File
@@ -21,6 +21,7 @@ namespace Step.Listeners
public static DTOActiveProgramDataModel LastProgramData = new DTOActiveProgramDataModel();
public static Dictionary<int, bool> LastNcMagazineIsActive = new Dictionary<int, bool>();
public static List<DTOQueueModel> LastPartProgramQueue = new List<DTOQueueModel>();
public static List<DTOM155InputModel> LastM155Data = new List<DTOM155InputModel>();
public static bool LastIsNcConnected = false;
}
+7 -2
View File
@@ -38,7 +38,7 @@ namespace Step
ServerControlWindow.Start();
// Create unhandled exception handler
// AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);
// Read config
ServerConfigController.ReadStartupConfig();
@@ -117,7 +117,12 @@ namespace Step
private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
{
using (NcHandler ncHandler = new NcHandler())
ncHandler.Disconnect();
{
if (ncHandler.numericalControl.NC_IsConnected())
{
ncHandler.Disconnect();
}
}
LogException((Exception)args.ExceptionObject, ERROR_LEVEL.FATAL);
}
+1 -5
View File
@@ -9,16 +9,12 @@
top: 40px;
background-color: #fff;
padding: 0 0;
z-index: 949;
z-index: 800;
box-sizing: border-box;
display: flex;
flex-wrap: nowrap;
overflow: hidden;
transition: width 200ms ease-in-out, height 200ms ease-in-out, padding 200ms ease-in-out, background-color 200ms ease-in-out,box-shadow 0ms 0ms;
&.coveredByModal{
z-index: 500;
filter: blur(10px);
}
&.expanded {
width: 494px;
+1 -5
View File
@@ -9,14 +9,10 @@
height: @header-height;
width: calc(~"100% - 152px");
position: absolute;
z-index: 950;
z-index: 801;
top: 0;
right: 0;
left: 0;
&.coveredByModal{
z-index: 200;
filter: blur(10px);
}
button {
font-size: 28px;
justify-content: center;
+4 -3
View File
@@ -117,14 +117,15 @@ body {
height: calc(~'100vh - 80px');
background-color: @background-color;
z-index: 100;
transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
transition: transform 0.5s ease-out;
.handle {
display: none;
}
&.liftedUp {
transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.1s ease-out 1.0s;
transition: transform 0.5s ease-out, box-shadow 0.1s ease-out 0.5s;
box-shadow: 2px 3px 5px 0 rgba(0, 0, 0, 0.2);
}
}
#main-view.turn-up,
@@ -139,7 +140,7 @@ body {
width: 100vw; // box-shadow: 2px 3px 5px 0 rgba(0, 0, 0, 0.4);
box-shadow: none;
z-index: 250;
transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
transition: transform 0.5s ease-out;
.handle {
background-color: @background-color;
display: block;
@@ -338,6 +338,10 @@
background-color: @color-backdrop;
z-index: 900;
&.nc {
z-index: 700;
}
&.internal {
height: calc(~"100vh - 80px");
}
@@ -1332,6 +1336,58 @@
justify-content: flex-end;
border-top: solid 2px @color-whitethree;
}
.box-description{
box-sizing: border-box;
padding-top: 10px;
height: 120px;
width: 100%;
border-top: solid 2px #e7e7e7;
}
.box-image{
display: flex;
justify-content: flex-start;
flex-flow: column;
min-height: 415px;
width: 100%;
margin-top: 16px;
.box-image-container{
display: flex;
justify-content: center;
align-items: center;
min-height: 329px;
width: 100%;
margin: 25px auto 23px auto;
img{
max-width: 577px;
max-height: 329px;
box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.4);
}
}
.linenumber{
display: flex;
justify-content: center;
align-items: center;
div{
width: 32px;
height: 18px;
button{
margin: auto 4px;
border: none;
padding: 0;
background: none;
font-size: 18px;
line-height: 1;
color: @color-greyish-brown;
}
.target{
color: @color-clear-blue;
font-weight: 600;
}
}
}
}
}
.@{modal}.modal-job-add-parameter {
+9
View File
@@ -9,6 +9,15 @@
background-color: #4e585e;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.5);
height: 784px;
&.noproc{
width: 1038px;
left:50px;
#nc-hmi{
left: -2px !important;
}
}
}
#nc-hmi{
+73 -14
View File
@@ -288,6 +288,9 @@
background-color: rgba(217, 217, 217, 0.5);
z-index: 900;
}
.backdrop.nc {
z-index: 700;
}
.backdrop.internal {
height: calc(100vh - 80px);
}
@@ -1414,6 +1417,64 @@
justify-content: flex-end;
border-top: solid 2px #e7e7e7;
}
.modal.modal-load-program .box-description,
.modal.modal-add-element-queue .box-description {
box-sizing: border-box;
padding-top: 10px;
height: 120px;
width: 100%;
border-top: solid 2px #e7e7e7;
}
.modal.modal-load-program .box-image,
.modal.modal-add-element-queue .box-image {
display: flex;
justify-content: flex-start;
flex-flow: column;
min-height: 415px;
width: 100%;
margin-top: 16px;
}
.modal.modal-load-program .box-image .box-image-container,
.modal.modal-add-element-queue .box-image .box-image-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 329px;
width: 100%;
margin: 25px auto 23px auto;
}
.modal.modal-load-program .box-image .box-image-container img,
.modal.modal-add-element-queue .box-image .box-image-container img {
max-width: 577px;
max-height: 329px;
box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.4);
}
.modal.modal-load-program .box-image .linenumber,
.modal.modal-add-element-queue .box-image .linenumber {
display: flex;
justify-content: center;
align-items: center;
}
.modal.modal-load-program .box-image .linenumber div,
.modal.modal-add-element-queue .box-image .linenumber div {
width: 32px;
height: 18px;
}
.modal.modal-load-program .box-image .linenumber div button,
.modal.modal-add-element-queue .box-image .linenumber div button {
margin: auto 4px;
border: none;
padding: 0;
background: none;
font-size: 18px;
line-height: 1;
color: #4b4b4b;
}
.modal.modal-load-program .box-image .linenumber div .target,
.modal.modal-add-element-queue .box-image .linenumber div .target {
color: #1791ff;
font-weight: 600;
}
.modal.modal-job-add-parameter {
width: 704px;
height: 608px;
@@ -2612,15 +2673,11 @@ fieldset[disabled] .form-group.is-focused .togglebutton label {
height: 80px;
width: calc(100% - 152px);
position: absolute;
z-index: 950;
z-index: 801;
top: 0;
right: 0;
left: 0;
}
#app > header.coveredByModal {
z-index: 200;
filter: blur(10px);
}
#app > header button {
font-size: 28px;
justify-content: center;
@@ -3222,18 +3279,13 @@ footer .container button.big:before {
top: 40px;
background-color: #fff;
padding: 0 0;
z-index: 949;
z-index: 800;
box-sizing: border-box;
display: flex;
flex-wrap: nowrap;
overflow: hidden;
transition: width 200ms ease-in-out, height 200ms ease-in-out, padding 200ms ease-in-out, background-color 200ms ease-in-out, box-shadow 0ms 0ms;
}
#alarm-list.coveredByModal,
#service-list.coveredByModal {
z-index: 500;
filter: blur(10px);
}
#alarm-list.expanded,
#service-list.expanded {
width: 494px;
@@ -3881,6 +3933,13 @@ footer .container button.big:before {
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.5);
height: 784px;
}
.hmi-container.noproc {
width: 1038px;
left: 50px;
}
.hmi-container.noproc #nc-hmi {
left: -2px !important;
}
#nc-hmi {
position: absolute;
top: 0;
@@ -13846,13 +13905,13 @@ body {
height: calc(100vh - 80px);
background-color: #d8d8d8;
z-index: 100;
transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
transition: transform 0.5s ease-out;
}
#main-view .handle {
display: none;
}
#main-view.liftedUp {
transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.1s ease-out 1s;
transition: transform 0.5s ease-out, box-shadow 0.1s ease-out 0.5s;
box-shadow: 2px 3px 5px 0 rgba(0, 0, 0, 0.2);
}
#main-view.turn-up,
@@ -13866,7 +13925,7 @@ body {
width: 100vw;
box-shadow: none;
z-index: 250;
transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
transition: transform 0.5s ease-out;
}
#main-view-handler .handle {
background-color: #d8d8d8;
+226 -11
View File
@@ -1,15 +1,15 @@
<template>
<div class="container">
<div id="app">
<app-header :showHeaderOnBlur="showHeaderOnBlur" :modalOpened="applyBlur"></app-header>
<alarm-list :showHeaderOnBlur="showHeaderOnBlur" :modalOpened="applyBlur"></alarm-list>
<app-header :class="{'blur':applyBlur}"></app-header>
<alarm-list :applyBlur="applyBlur"></alarm-list>
<under-the-hood :class="{'blur':applyBlur}"></under-the-hood>
<div id="main-view" ref="main-view" :class="{liftedUp : isMainViewLiftedUp,'blur':applyBlur}" >
<under-the-hood :class="{'blur':(applyBlur || applyBlurNc)}"></under-the-hood>
<div id="main-view" ref="main-view" :class="{liftedUp : isMainViewLiftedUp,'blur':(applyBlur || applyBlurNc)}" >
<router-view :class="{'blur':applyBlurInternal}" />
<modal-container name="modal" container-name="modal2" :inform-hmi="false" ></modal-container>
<modal-container name="modal" container-name="modal-internal" :inform-hmi="false" ></modal-container>
</div>
<div id="main-view-handler" ref="main-view-handler" @click="toggleMainView()" :class="{liftedUp : isMainViewLiftedUp,'blur':applyBlur}">
<div id="main-view-handler" ref="main-view-handler" @click="toggleMainView()" :class="{liftedUp : isMainViewLiftedUp,'blur':(applyBlur || applyBlurNc)}">
<vue-gesture :type="'swipedown'" :call="toggleMainView" :onmove="movepanel" :onstart="onstartdrag" :onstop="onstopdrag">
<div class="handle" :title="'header_tooltip_close_uth' | localize('Close under-the-hood area')" >
@@ -17,16 +17,231 @@
</div>
</vue-gesture>
</div>
<app-footer :class="{'blur':applyBlur}"></app-footer>
<app-footer :class="{'blur':(applyBlur || applyBlurNc)}"></app-footer>
</div>
<modal-nc-container name="modal-nc" :class="{'blur':applyBlur}"></modal-nc-container>
<modal-container name="modal" ></modal-container>
<div class="window-buttons">
<button class="gray square close" @click="sendMessage('hide')" :title="'header_tooltip_btn_minimize' | localize('Minimize the application')">-</button>
<button class="gray square close" @click="sendMessage('close')" :title="'header_tooltip_btn_close' | localize('Close the application')">&times;</button>
</div>
<div class="window-buttons">
<button class="gray square close" @click="sendMessage('hide')" :title="'header_tooltip_btn_minimize' | localize('Minimize the application')">-</button>
<button class="gray square close" @click="sendMessage('close')" :title="'header_tooltip_btn_close' | localize('Close the application')">&times;</button>
</div>
</div>
</template>
<<<<<<< HEAD
<script src="./App.ts" lang="ts"></script>
=======
<script>
import Vue from "vue";
import { Hub } from "./services/hub";
import { Header, Footer, Login } from "./app.modules";
import { alarmList } from "src/app_modules/alarms";
import { LoginService } from "src/services/loginService";
import { DataService } from "src/services/dataService";
import { Factory, MessageService } from "./_base";
import { ModalContainer,ModalNcContainer, ModalHelper } from "./modules/base-components";
import { appModelActions } from "src/store";
import underTheHood from "src/components/under-the-hood.vue";
import * as iziToast from "izitoast";
import moment from "moment";
export default {
name: "app",
components: {
appHeader: Header,
appFooter: Footer,
modalContainer: ModalContainer,
modalNcContainer: ModalNcContainer,
alarmList,
underTheHood
},
beforeMount: function() {
moment.locale(window.navigator.userLanguage || window.navigator.language);
},
mounted: function() {
let ms = Factory.Get(MessageService);
// if cms is connected
if (typeof cmsClient != "undefined")
this.HMIsrc = cmsClient.getScreenBase64();
ms.subscribeToChannel("show-modal", args => {
this.applyBlur = true;
});
ms.subscribeToChannel("hide-modal", args => {
this.applyBlur = false;
});
ms.subscribeToChannel("show-modal-nc-called", args => {
this.applyBlurNc = true;
});
ms.subscribeToChannel("hide-modal-nc-called", args => {
this.applyBlurNc = false;
});
ms.subscribeToChannel("show-modal-internal", args => {
this.applyBlurInternal = true;
});
ms.subscribeToChannel("hide-modal-internal", args => {
this.applyBlurInternal = false;
});
ms.subscribeToChannel("show-loading", args => {
this.loadingOperations++;
});
ms.subscribeToChannel("hide-loading", args => {
this.loadingOperations--;
});
ms.subscribeToChannel("force-ui-update", args => {
this.$forceUpdate();
});
ms.subscribeToChannel("HMI-production-show-state", args => {
this.showHMIinProduction = true;
});
ms.subscribeToChannel("HMI-production-hide-state", args => {
this.showHMIinProduction = false;
});
let _this = this;
Factory.Get(LoginService)
.getUserInfo()
.then(() => {
if (!_this.isAuthenticated)
_this.$nextTick(() => ModalHelper.ShowModal(Login));
});
this.$store.watch(
s => s.currentUser,
(n, o) => {
if (!n) {
this.$nextTick(() => ModalHelper.ShowModal(Login));
} else
new DataService().SetCurrentNcLanguage(
this.$store.state.currentUser.language
);
}
);
this.hub = new Hub();
window.addEventListener("keyup", function(event) {
// If down arrow was pressed...
if (event.keyCode == 27) {
Factory.Get(MessageService).publishToChannel("esc_pressed");
}
});
},
computed: {
isAuthenticated: function() {
return this.$store.state.currentUser != null;
},
debugStore: function() {
return this.$store.state;
},
isMainViewLiftedUp: function() {
return this.$store.state.isMainViewLiftedUp;
}
},
watch: {
isMainViewLiftedUp: function() {
if (this.state.isMainViewLiftedUp) {
//Setup the Position of the View
this.applyViewPosition(-window.innerHeight + 84);
//Hide the HMI if is showed (in production)
Factory.Get(MessageService).publishToChannel("HMI-production-hide");
//Show the HMI with delay (For the animation)
Factory.Get(MessageService).publishToChannel("HMI-show", 500);
} else {
//Setup the Position of the View
this.applyViewPosition(0);
//Hide the HMI
Factory.Get(MessageService).publishToChannel("HMI-hide");
//Launche the show in delay if we are in production
if (this.showHMIinProduction && this.$route.path.includes("production"))
Factory.Get(MessageService).publishToChannel(
"HMI-production-show",
700
);
}
},
loadingOperations: function(n, o) {
if (o == 0 && n > 0) {
iziToast.show({
id: "loader",
class: "t-loading",
theme: "dark",
icon: "fa fa-refresh fa-spin fa-2x fa-fw",
position: "bottomLeft",
animateInside: false,
timeout: false,
transitionIn: "fadeIn",
transitionOut: "fadeOut",
toastOnce: true
});
}
if (n == 0 || n < 0) {
this.loadingOperations = 0;
let element = document.querySelector(".t-loading");
if (element) iziToast.hide(element, { transitionOut: "fadeOut" });
}
}
},
methods: {
callHub: function() {
this.hub.Hello();
},
onstartdrag: function() {
Factory.Get(MessageService).publishToChannel("HMI-start-drag");
},
onstopdrag: function() {
Factory.Get(MessageService).publishToChannel("HMI-stop-drag", 600);
},
toggleMainView(direction) {
if (!direction || direction == "down" || direction == "none")
appModelActions.MainViewToggle(this.$store);
else {
this.applyViewPosition(-window.innerHeight + 84);
}
},
sendMessage(name) {
Factory.Get(MessageService).publishToChannel(name);
},
movepanel(e) {
if (e && e.touches && e.touches[0]) {
this.applyViewPosition(
-window.innerHeight + 84 + e.touches[0].screenY,
true
);
}
},
applyViewPosition(position, removetransition) {
this.$refs["main-view"].style = this.$refs["main-view-handler"].style =
"transform:translateY(" +
position +
"px);" +
(removetransition ? "transition:unset;" : "");
}
},
data: function() {
return {
state: this.$store.state,
applyBlur: false,
applyBlurNc: false,
applyBlurInternal: false,
showHMIinProduction: false,
loadingOperations: 0
};
}
};
</script>
>>>>>>> develop
+33 -2
View File
@@ -23,11 +23,13 @@ let HMIvisibleInProduction = false
let oldHMIvisible = false;
let HMIAlarmsVisible = false;
let HMIModalsVisible = false;
let HMIModalsNcVisible = false;
let HMIDragging = false;
let HMIshowTimeout;
let HMIAlarmsTimeout;
let HMIModalsTimeout;
let HMIDraggingTimeout;
let HMIModalsNcTimeout;
let HMIScreenshotInterval;
let HMIprodTimeout;
let RerenderInterval;
@@ -36,7 +38,12 @@ const messageService = Factory.Get(MessageService);
messageService.subscribeToChannel("show-user-info", () => { ModalHelper.ShowModal(UserInfoDialog); });
messageService.subscribeToChannel("show-machine-info", () => { ModalHelper.ShowModal(MachineInfoDialog); });
<<<<<<< HEAD
messageService.subscribeToChannel("show-axes-calibration", () => { ModalHelper.ShowModal(AxesCalibration, null, true); });
=======
messageService.subscribeToChannel("show-axes-calibration", () => { ModalHelper.ShowNcModal(AxesCalibration); });
messageService.subscribeToChannel("hide-axes-calibration", () => { ModalHelper.HideNcModal(AxesCalibration); });
>>>>>>> develop
@@ -165,6 +172,14 @@ if (typeof cmsClient != "undefined") {
showModal()
});
Factory.Get(MessageService).subscribeToChannel("HMI-show-modal-nc", args => {
clearTimeout(HMIModalsNcTimeout);
if (args[0] > 0)
HMIModalsNcTimeout = setTimeout(showNcModal, args[0]);
else
showNcModal()
});
Factory.Get(MessageService).subscribeToChannel("HMI-hide-modal", args => {
clearTimeout(HMIModalsTimeout);
if (args[0] > 0)
@@ -173,6 +188,14 @@ if (typeof cmsClient != "undefined") {
hideModal()
});
Factory.Get(MessageService).subscribeToChannel("HMI-hide-modal-nc", args => {
clearTimeout(HMIModalsNcTimeout);
if (args[0] > 0)
HMIModalsNcTimeout = setTimeout(hideNcModal, args[0]);
else
hideNcModal()
});
Factory.Get(MessageService).subscribeToChannel("HMI-start-drag", args => {
clearTimeout(HMIDraggingTimeout);
if (args[0] > 0)
@@ -206,6 +229,10 @@ function hideModal() {
HMIModalsVisible = false;
ElaborateHMIStatus();
}
function hideNcModal() {
HMIModalsNcVisible = false;
ElaborateHMIStatus();
}
function stopDrag() {
HMIDragging = false;
ElaborateHMIStatus();
@@ -229,6 +256,10 @@ function showModal() {
HMIModalsVisible = true;
ElaborateHMIStatus();
}
function showNcModal() {
HMIModalsNcVisible = true;
ElaborateHMIStatus();
}
function startDrag() {
HMIDragging = true;
ElaborateHMIStatus();
@@ -248,12 +279,12 @@ function ElaborateHMIStatus() {
clearInterval(HMIScreenshotInterval);
cmsClient.setNcWindowState(0);
}
else if (hmiv && !HMIAlarmsVisible && !HMIModalsVisible && !HMIDragging) {
else if (hmiv && !HMIAlarmsVisible && !HMIModalsVisible && !HMIDragging && !HMIModalsNcVisible) {
if (HMIScreenshotInterval)
clearInterval(HMIScreenshotInterval);
cmsClient.setNcWindowState(1);
}
else if (hmiv && (HMIAlarmsVisible || HMIModalsVisible || HMIDragging)) {
else if (hmiv && (HMIAlarmsVisible || HMIModalsVisible || HMIDragging || HMIModalsNcVisible)) {
cmsClient.setNcWindowState(0);
}
}
@@ -10,7 +10,7 @@ import { Hub } from "src/services";
declare let $: any;
@Component({ name: "alarms-list", components: { alarmItem, alarmDetail }, props: {modalOpened: Boolean, showHeaderOnBlur: Boolean} })
@Component({ name: "alarms-list", components: { alarmItem, alarmDetail }, props: {applyBlur: Boolean} })
export default class alarmsList extends Vue {
$store: any;
$route: any;
@@ -1,6 +1,6 @@
<template>
<div>
<div id="alarm-list" :class="{expanded: ribbonStatus>1, coveredByModal:(!showHeaderOnBlur && modalOpened),
<div id="alarm-list" :class="{expanded: ribbonStatus>1,blur:applyBlur,
alarm: (!currentAlarm && ribbonStatus == 3) || (currentAlarm && currentAlarm.type =='alarm'), working: ribbonStatus == 1,
warning: (!currentAlarm && ribbonStatus == 2) || (currentAlarm && currentAlarm.type =='warning'), opened: opened}">
<div class="content scrollable" :class="{collapsed: currentAlarm, animated: opened}">
@@ -30,7 +30,7 @@
<alarm-detail :alarm="currentAlarm" @close-detail="closeDetail()"></alarm-detail>
</transition>
</div>
<div id="service-list" :class="{expanded: ribbonStatus>1, opened: serviceOpened, coveredByModal:(!showHeaderOnBlur && modalOpened),}" v-if="hasServices">
<div id="service-list" :class="{expanded: ribbonStatus>1, opened: serviceOpened,blur:applyBlur}" v-if="hasServices">
<div class="content scrollable">
<alarm-item :title="alarm.title == null? getTitle(alarm): alarm.title"
:type="alarm.type"
@@ -5,7 +5,7 @@ import moment from "moment";
import { AppModel } from "src/store";
import { getColorFromName,isDarkColor } from "src/_base/utils";
@Component({ name: "user-info", props: {disabledByModal: Boolean} })
@Component({ name: "user-info"})
export default class UserInfo extends Vue {
$store: any;
@@ -1,14 +1,13 @@
<template>
<div class="user-info">
<button class="dark-blue"
:disabled="disabledByModal"
@click="sendMessage('show-help')"
:title="'header_tooltip_btn_help' | localize('Show Machine Help')"
>
?
</button>
<button class="dark-blue"
:disabled="disabledByModal" @click="sendMessage('show-machine-info')" :title="'header_tooltip_btn_mchinfo' | localize('Show Machine Info')">
@click="sendMessage('show-machine-info')" :title="'header_tooltip_btn_mchinfo' | localize('Show Machine Info')">
<img src="assets/icons/png/machine-info.png" width="28px">
<div class="machine-info" v-if="state.isMainViewLiftedUp">
<small>{{state.machineInfo.machineName}}</small>
@@ -19,7 +18,6 @@
v-if="currentUser"
@click="sendMessage('show-user-info')"
:title="'header_tooltip_btn_usrinfo' | localize('Show User Info')"
:disabled="disabledByModal"
:class="{'colorWhite':isDarkColor(getColor(currentUser.lastName,currentUser.firstName))}"
:style="{'background-color':getColor(currentUser.lastName,currentUser.firstName) }"
>
@@ -27,7 +25,6 @@
</button>
<button class="profile dark-blue colorWhite"
v-if="!currentUser"
:disabled="disabledByModal"
@click="sendMessage('show-user-info')"
:title="'header_tooltip_btn_usrinfo' | localize('Show User Info')"
>
@@ -15,6 +15,7 @@ declare let $: any;
@Component({ components: { MaintenanceProgress, maintenanceCard } })
export default class Maintenance extends Vue {
<<<<<<< HEAD:Step/wwwroot/src/app_modules/maintenance/components/maintenance.ts
$route: any;
public get maintenances(): server.Maintenance[] { return (this.$store.state as AppModel).maintenance.maintenances; }
@@ -92,6 +93,92 @@ export default class Maintenance extends Vue {
for (let i = 0; i < this.arrayState.length; i++) {
if (this.arrayState[i] == state) {
bool = true;
=======
$route: any;
public get maintenances(): server.Maintenance[] {return (this.$store.state as AppModel).maintenance.maintenances; }
public enableMaintenance: boolean = true;
get selectedMaintenance() {
return (this.$store.getters as MaintenanceGetters).getMaintenance(this.selectedMaintenanceId);
}
get noteMaintenance(){
return (this.$store.state as AppModel).maintenance.noteMaintenance;
}
get attachmentsMaintenance(){
return (this.$store.state as AppModel).maintenance.attachMaintenance;
}
public searchText: string = "";
public selectedState: Array<string> = [];
public arrayState: Array<string> = ["expired", "ending", "running"];
public currentFilter: string = "";
public currentFilterState: string = "";
@Watch("searchText")
public applyFilter(n) {
this.currentFilter = n.toLowerCase();
}
selectedMaintenanceId : number = null;
// public static selectedMaintenance: any = null;
// public static currentSelected: any = null;
@Watch("$route.path")
changePath(){
/** Path che viene dall'allarme delle manutenzioni */
if(this.$route.params.id){
this.selectedMaintenanceId = this.$route.params.id;
this.enableMaintenance = false;
}
}
async mounted(){
Factory.Get(MessageService).subscribeToChannel("update-maintenance", args => {
awaiter(new MaintenanceService().GetMaintenances());
});
ModalHelper.HideModal("modal-internal");
await awaiter(new MaintenanceService().GetMaintenances());
if(this.$route.params.id){
this.selectedMaintenanceId = this.$route.params.id;
this.enableMaintenance = false;
}
}
updated(){
$(document).mouseup(function (e) {
var container = $(".checkboxes");
var selector = $("#selectListCheckboxes");
if (!container.is(e.target) && !selector.is(e.target) && container.has(e.target).length === 0)
{
container.removeClass('checkboxesView');
}
});
}
public openSelectState(){
if(!$('.checkboxes').hasClass('checkboxesView'))
$('.checkboxes').addClass('checkboxesView');
else
$('.checkboxes').removeClass('checkboxesView');
}
public controlState(state){
let bool = true;
for(let i = 0; i < this.arrayState.length; i++){
if(this.arrayState[i] == state){
bool = true;
return bool;
}
else{
bool = false;
}
}
>>>>>>> develop:Step/wwwroot/src/components/maintenance.ts
return bool;
}
else {
@@ -35,7 +35,7 @@ export default class Production extends Vue {
}
async mounted() {
this.confirmationDelegate = null;
ModalHelper.HideModal("modal2");
ModalHelper.HideModal("modal-internal");
}
get machineInfo() {
@@ -213,19 +213,19 @@ export default class depot extends Vue {
@Watch("magazineStatusModel")
public modalBlockMagazine() {
if (this.magazineStatusModel.action == 0) {
ModalHelper.HideModal("modal2");
ModalHelper.HideModal("modal-internal");
}
else if (this.magazineStatusModel.action == 1) {
ModalHelper.ShowModal(DepotActionLoading, "modal2");
ModalHelper.ShowModal(DepotActionLoading, "modal-internal");
}
else if (this.magazineStatusModel.action == 2) {
ModalHelper.ShowModal(DepotActionUnloading, "modal2");
ModalHelper.ShowModal(DepotActionUnloading, "modal-internal");
}
else if (this.magazineStatusModel.action == 4) {
ModalHelper.ShowModal(DepotActionTransfer, "modal2");
ModalHelper.ShowModal(DepotActionTransfer, "modal-internal");
}
else if (this.magazineStatusModel.action == 5) {
ModalHelper.ShowModal(DepotActionGeneric, "modal2");
ModalHelper.ShowModal(DepotActionGeneric, "modal-internal");
}
}
@@ -60,19 +60,19 @@ export default class toolingEquipment extends Vue {
@Watch("magazineStatusModel")
public modalBlockMagazine(){
if(this.magazineStatusModel.action == 0){
ModalHelper.HideModal("modal2");
ModalHelper.HideModal("modal-internal");
}
else if(this.magazineStatusModel.action == 1){
ModalHelper.ShowModal(DepotActionLoading, "modal2");
ModalHelper.ShowModal(DepotActionLoading, "modal-internal");
}
else if(this.magazineStatusModel.action == 2){
ModalHelper.ShowModal(DepotActionUnloading, "modal2");
ModalHelper.ShowModal(DepotActionUnloading, "modal-internal");
}
else if(this.magazineStatusModel.action == 4){
ModalHelper.ShowModal(DepotActionTransfer, "modal2");
ModalHelper.ShowModal(DepotActionTransfer, "modal-internal");
}
else if(this.magazineStatusModel.action == 5){
ModalHelper.ShowModal(DepotActionGeneric, "modal2");
ModalHelper.ShowModal(DepotActionGeneric, "modal-internal");
}
}
@@ -38,19 +38,19 @@ export default class toolingFamilies extends Vue {
@Watch("magazineStatusModel")
public modalBlockMagazine(){
if(this.magazineStatusModel.action == 0){
ModalHelper.HideModal("modal2");
ModalHelper.HideModal("modal-internal");
}
else if(this.magazineStatusModel.action == 1){
ModalHelper.ShowModal(DepotActionLoading, "modal2");
ModalHelper.ShowModal(DepotActionLoading, "modal-internal");
}
else if(this.magazineStatusModel.action == 2){
ModalHelper.ShowModal(DepotActionUnloading, "modal2");
ModalHelper.ShowModal(DepotActionUnloading, "modal-internal");
}
else if(this.magazineStatusModel.action == 4){
ModalHelper.ShowModal(DepotActionTransfer, "modal2");
ModalHelper.ShowModal(DepotActionTransfer, "modal-internal");
}
else if(this.magazineStatusModel.action == 5){
ModalHelper.ShowModal(DepotActionGeneric, "modal2");
ModalHelper.ShowModal(DepotActionGeneric, "modal-internal");
}
}
@@ -33,19 +33,19 @@ export default class toolingMagPos extends Vue {
@Watch("magazineStatusModel")
public modalBlockMagazine(){
if(this.magazineStatusModel.action == 0){
ModalHelper.HideModal("modal2");
ModalHelper.HideModal("modal-internal");
}
else if(this.magazineStatusModel.action == 1){
ModalHelper.ShowModal(DepotActionLoading, "modal2");
ModalHelper.ShowModal(DepotActionLoading, "modal-internal");
}
else if(this.magazineStatusModel.action == 2){
ModalHelper.ShowModal(DepotActionUnloading, "modal2");
ModalHelper.ShowModal(DepotActionUnloading, "modal-internal");
}
else if(this.magazineStatusModel.action == 4){
ModalHelper.ShowModal(DepotActionTransfer, "modal2");
ModalHelper.ShowModal(DepotActionTransfer, "modal-internal");
}
else if(this.magazineStatusModel.action == 5){
ModalHelper.ShowModal(DepotActionGeneric, "modal2");
ModalHelper.ShowModal(DepotActionGeneric, "modal-internal");
}
}
@@ -48,19 +48,19 @@ export default class toolingShanks extends Vue {
@Watch("magazineStatusModel")
public modalBlockMagazine(){
if(this.magazineStatusModel.action == 0){
ModalHelper.HideModal("modal2");
ModalHelper.HideModal("modal-internal");
}
else if(this.magazineStatusModel.action == 1){
ModalHelper.ShowModal(DepotActionLoading, "modal2");
ModalHelper.ShowModal(DepotActionLoading, "modal-internal");
}
else if(this.magazineStatusModel.action == 2){
ModalHelper.ShowModal(DepotActionUnloading, "modal2");
ModalHelper.ShowModal(DepotActionUnloading, "modal-internal");
}
else if(this.magazineStatusModel.action == 4){
ModalHelper.ShowModal(DepotActionTransfer, "modal2");
ModalHelper.ShowModal(DepotActionTransfer, "modal-internal");
}
else if(this.magazineStatusModel.action == 5){
ModalHelper.ShowModal(DepotActionGeneric, "modal2");
ModalHelper.ShowModal(DepotActionGeneric, "modal-internal");
}
}
@@ -35,19 +35,19 @@ export default class Tooling extends Vue {
@Watch("magazineStatusModel")
public modalBlockMagazine() {
if (this.magazineStatusModel.action == 0) {
ModalHelper.HideModal("modal2");
ModalHelper.HideModal("modal-internal");
}
else if (this.magazineStatusModel.action == 1) {
ModalHelper.ShowModal(DepotActionLoading, "modal2");
ModalHelper.ShowModal(DepotActionLoading, "modal-internal");
}
else if (this.magazineStatusModel.action == 2) {
ModalHelper.ShowModal(DepotActionUnloading, "modal2");
ModalHelper.ShowModal(DepotActionUnloading, "modal-internal");
}
else if (this.magazineStatusModel.action == 4) {
ModalHelper.ShowModal(DepotActionTransfer, "modal2");
ModalHelper.ShowModal(DepotActionTransfer, "modal-internal");
}
else if (this.magazineStatusModel.action == 5) {
ModalHelper.ShowModal(DepotActionGeneric, "modal2");
ModalHelper.ShowModal(DepotActionGeneric, "modal-internal");
}
}
@@ -14,7 +14,8 @@
<div class="axes-menu-container" v-if="showAxesMenu">
<div class="menu">
<button @click="setAxes(a.id)"
v-for="a in axes" v-if="a.isSelectable"
v-for="a in axes"
v-if="a.isSelectable"
:key="a.id"
:class="{active: a.id == selectedAxisId}">{{a.name}}</button>
</div>
@@ -1,3 +1,32 @@
<<<<<<< HEAD:Step/wwwroot/src/app_modules/under-the-hood/components/under-the-hood.ts
=======
<template>
<div id="back-view">
<header>
<hmi-menu></hmi-menu>
<button class="close" @click="toggleMainView()" :title="'header_tooltip_close_uth' | localize('Close under-the-hood area')">&times;</button>
</header>
<div class="hmi-container" :class="{'noproc':(processes.length <= 1)}" >
<process-selection></process-selection>
<div id="nc-hmi">
<img id="nc-hmi-img" src="assets/images/Siemens_Placeholder.jpg" @click="closeAlarmsRibbon()" v-if="isSiemens()">
<img id="nc-hmi-img-fanuc" src="assets/images/Fanuc_Placeholder.jpg" @click="closeAlarmsRibbon()" v-if="isFanuc()">
<img id="nc-hmi-img" src="assets/images/Osai_Placeholder.jpg" @click="closeAlarmsRibbon()" v-if="isOsai()">
<img id="nc-hmi-img" src="assets/images/Demo_Placeholder.jpg" @click="closeAlarmsRibbon()" v-if="isDemo()">
</div >
</div>
<div class="keys-area">
<nc-soft-keys></nc-soft-keys>
<axes-soft-keys v-if="showAxisBtn"></axes-soft-keys>
<mheads></mheads>
<jog-menu v-if="showJog"></jog-menu>
<auto-menu v-if="showAuto"></auto-menu>
<plc-soft-keys></plc-soft-keys>
</div>
</div>
</template>
<script>
>>>>>>> develop:Step/wwwroot/src/components/under-the-hood.vue
import { appModelActions } from "src/store";
import plcSoftKeys from "./plc-softkeys.vue";
import ncSoftKeys from "./nc-softkeys.vue";
@@ -27,7 +56,14 @@ export default {
isMainViewLiftedUp: function () {
return this.$store.state.isMainViewLiftedUp;
},
<<<<<<< HEAD:Step/wwwroot/src/app_modules/under-the-hood/components/under-the-hood.ts
showJog: function () {
=======
processes: function() {
return this.$store.state.process.process;
},
showJog: function() {
>>>>>>> develop:Step/wwwroot/src/components/under-the-hood.vue
let ref = this.$store.getters.getNcSoftKeyStatus(5);
let jog = this.$store.getters.getNcSoftKeyStatus(6);
let joginc = this.$store.getters.getNcSoftKeyStatus(7);
@@ -56,7 +56,19 @@ export class ModalHelper {
Factory.Get(MessageService).publishToChannel("show-" + modalname, view, null, null, showHeader);
}
<<<<<<< HEAD:Step/wwwroot/src/components/modals/ModalHelper.ts
public static ShowModalAsync(view, model = null, modalname: string = "modal"): Promise<any> {
=======
public static ShowNcModal(view) {
Factory.Get(MessageService).publishToChannel("show-modal-nc", view);
}
public static HideNcModal(view) {
Factory.Get(MessageService).publishToChannel("hide-modal-nc", view);
}
public static ShowModalAsync(view, model= null, modalname: string = "modal"): Promise<any> {
>>>>>>> develop:Step/wwwroot/src/modules/base-components/ModalHelper.ts
let deferred = new Deferred();
Factory.Get(MessageService).publishToChannel("show-" + modalname, view, deferred, model);
return deferred.promise;
@@ -67,7 +79,7 @@ export class ModalHelper {
Factory.Get(MessageService).publishToChannel("hide-" + modalname);
}
public static AskConfirm(title: string, body: string, onConfirm: Function, onCancel: Function, modalcontainer: string = "modal2") {
public static AskConfirm(title: string, body: string, onConfirm: Function, onCancel: Function, modalcontainer: string = "modal-internal") {
ModalHelper._modalData.title = title;
ModalHelper._modalData.content = body;
@@ -0,0 +1,33 @@
import Vue from "vue";
import Component from "vue-class-component";
import {
machineStatusActions,
MachineStatusModel,
alarmsModelActions,
processModelActions
} from "../store";
import { ModalHelper } from "../modules/base-components";
@Component({})
export default class TestStatus extends Vue {
mounted(){
ModalHelper.HideModal("modal-internal");
}
addProcess() {
// processModelActions.addProcess(this.$store, {});
}
removeProcess() {
processModelActions.removeAllProcess(this.$store);
}
removeAlarms() {
alarmsModelActions.removeAllAlarms(this.$store);
}
addService() {
alarmsModelActions.addServiceAlarm(this.$store, { message: "Lorem Ipsum dolor sit amen ... ", dateTime: new Date()} as any);
}
}
+4
View File
@@ -12,7 +12,11 @@ export default class Utilities extends Vue{
mounted(){
<<<<<<< HEAD
ModalHelper.HideModal("modal2");
=======
ModalHelper.HideModal("modal-internal");
>>>>>>> develop
}
+4
View File
@@ -10,7 +10,11 @@ import userInfo from "src/app_modules/machine/components/user-info.vue"
declare let $: any;
<<<<<<< HEAD
@Component({ name: "app-header", components: { appRibbon: AppRibbon, userInfo: userInfo, processInfo: ProcessInfo }, props: { modalOpened: Boolean, showHeaderOnBlur: Boolean } })
=======
@Component({ name: "app-header", components: { appRibbon: AppRibbon, userInfo: UserInfo, processInfo: ProcessInfo } })
>>>>>>> develop
export default class AppHeader extends Vue {
$store: any;
+2 -2
View File
@@ -1,5 +1,5 @@
<template>
<header :class="{'turn-up':isMainViewLiftedUp,coveredByModal:(modalOpened && !showHeaderOnBlur)}">
<header :class="{'turn-up':isMainViewLiftedUp}">
<app-ribbon :status="{'alarm': ribbonStatus == 3, 'working': ribbonStatus == 1, 'warning': ribbonStatus == 2}"
:expanded="ribbonStatus>1"
:show-expander="ribbonStatus>1"
@@ -85,7 +85,7 @@
</process-info>
</div>
<user-info :disabledByModal="(modalOpened && showHeaderOnBlur)" ></user-info>
<user-info></user-info>
</header>
</template>
@@ -1,7 +1,12 @@
import Popup from "./popup.vue";
import ModalContainer from "./modal-container.vue";
<<<<<<< HEAD:Step/wwwroot/src/modules/base-components/index.ts
=======
import ModalNcContainer from "./modal-nc-container.vue";
import { ModalHelper } from "./ModalHelper";
>>>>>>> develop:Step/wwwroot/src/modules/base-components/index.js
import ProcessInfo from "./process-info.vue";
import Accordion from "./accordion.vue";
@@ -22,7 +27,12 @@ export {
Popup,
ModalContainer,
<<<<<<< HEAD:Step/wwwroot/src/modules/base-components/index.ts
=======
ModalNcContainer,
ModalHelper,
>>>>>>> develop:Step/wwwroot/src/modules/base-components/index.js
ProcessInfo,
Accordion,
Keypad,
@@ -12,6 +12,7 @@ import { ModalHelper, Modal } from "src/components/modals";
import { Factory, MessageService } from "../../_base";
import { MaintenanceService } from "src/services/maintenanceService";
export default {
<<<<<<< HEAD
components: { modal: Modal },
data: function() {
return {
@@ -27,6 +28,32 @@ export default {
close() {
Factory.Get(MessageService).deleteChannel("esc_pressed");
ModalHelper.HideModal();
=======
components: { modal: Modal },
data: function(){
return{
content: "",
title: ""
}
},
mounted(){
this.content = ModalHelper.modalIframe.content;
this.title = ModalHelper.modalIframe.title;
},
beforeMount() {
Factory.Get(MessageService).subscribeToChannel("esc_pressed", args => {
this.close();
});
},
beforeDestroy() {
Factory.Get(MessageService).deleteChannel("esc_pressed");
},
methods:{
close(){
Factory.Get(MessageService).deleteChannel("esc_pressed");
ModalHelper.HideModal();
}
>>>>>>> develop
}
}
};
@@ -11,6 +11,7 @@ import { Modal, ModalHelper } from "src/components/modals";
import { Factory, MessageService } from "../../_base";
export default {
<<<<<<< HEAD
components: { modal: Modal },
data: function() {
return {
@@ -26,6 +27,32 @@ export default {
close() {
Factory.Get(MessageService).deleteChannel("esc_pressed");
ModalHelper.HideModal();
=======
components: { modal: Modal },
data: function(){
return{
content: "",
title: ""
}
},
mounted(){
this.content = ModalHelper.modalImage.content;
this.title = ModalHelper.modalImage.title;
},
beforeMount() {
Factory.Get(MessageService).subscribeToChannel("esc_pressed", args => {
this.close();
});
},
beforeDestroy() {
Factory.Get(MessageService).deleteChannel("esc_pressed");
},
methods:{
close(){
Factory.Get(MessageService).deleteChannel("esc_pressed");
ModalHelper.HideModal();
}
>>>>>>> develop
}
}
};
@@ -60,6 +60,7 @@ export default class ModalLoadProgram extends Vue {
currentFilterSecond: string = "";
navigationDepth: number = 0;
selectedNumberImage: number = 0;
mounted() {
if (typeof cmsClient != "undefined") {
@@ -141,7 +142,8 @@ export default class ModalLoadProgram extends Vue {
Name: i.name || i.Name,
AbsolutePath: i.absolutePath || i.AbsolutePath,
Path: i.path || i.Path,
IsDirectory: (i.isDirectory != null && i.isDirectory) || (i.IsDirectory != null && i.IsDirectory)
IsDirectory: (i.isDirectory != null && i.isDirectory) || (i.IsDirectory != null && i.IsDirectory),
IsJob: i.isJob || i.IsJob
};
});
}
@@ -185,7 +187,7 @@ export default class ModalLoadProgram extends Vue {
} as FileInfo;
}
async fileInfo(str, fromdepth: number) {
async fileInfo(str,isJob, fromdepth: number) {
this.lastClickPath = str;
if (fromdepth == 1)
this.secondColumnData.splice(0, this.secondColumnData.length);
@@ -194,15 +196,25 @@ export default class ModalLoadProgram extends Vue {
this.selectedFile = this.toUpperCaseFileModel(
JSON.parse(cmsClient.getProgramInfo(str))
);
this.selectedFileMetadata = JSON.parse(cmsClient.readJobMetadata(str)).metadata;
console.log(this.selectedFileMetadata);
this.selectedFile.IsJob = isJob;
if(isJob){
this.selectedFileMetadata = JSON.parse(cmsClient.readJobMetadata(str)).metadata;
this.selectedNumberImage = 0;
}
}
if (!this.isLocalNavigation)
this.selectedFile = this.toUpperCaseFileModel(
await awaiter(fileService.getFileInfo(str)));
}
beforeMount() {
Factory.Get(MessageService).subscribeToChannel("esc_pressed", args => {
this.close();
});
}
beforeDestroy() {
Factory.Get(MessageService).deleteChannel("esc_pressed");
}
close() {
Factory.Get(MessageService).deleteChannel("esc_pressed");
@@ -252,5 +264,9 @@ export default class ModalLoadProgram extends Vue {
// var result = await ModalHelper.ShowModalAsync(, jobMetadata);
}
selectNumberImage(value) {
this.selectedNumberImage = value;
}
}
@@ -46,7 +46,7 @@
:selected="isInPath(val.AbsolutePath) || val.AbsolutePath == lastClickPath"
:withArrow="val.IsDirectory == true"
:iconType="val.IsDirectory? 'FOLDER':'FILE'"
@click="val.IsDirectory ? navigateTo(val.Path, val.AbsolutePath, isLocalNavigation, 2,1): fileInfo(val.AbsolutePath,1)"></card-folder-path>
@click="val.IsDirectory ? navigateTo(val.Path, val.AbsolutePath, isLocalNavigation, 2,1): fileInfo(val.AbsolutePath,val.IsJob,1)"></card-folder-path>
</div>
</div>
<div class="third-column" v-if="navigationDepth <2"></div>
@@ -68,7 +68,7 @@
:selected="isInPath(val.AbsolutePath) || val.AbsolutePath == lastClickPath"
:withArrow="val.IsDirectory == true"
:iconType="val.IsDirectory? 'FOLDER':'FILE'"
@click="val.IsDirectory? navigateTo(val.Path, val.AbsolutePath, isLocalNavigation, 2,2):fileInfo(val.AbsolutePath,2) "></card-folder-path>
@click="val.IsDirectory? navigateTo(val.Path, val.AbsolutePath, isLocalNavigation, 2,2):fileInfo(val.AbsolutePath,val.IsJob,2) "></card-folder-path>
<!-- <card-folder-path name="Cliente A" @click="selectItem()" :with-arrow="false"></card-folder-path>-->
</div>
</div>
@@ -89,19 +89,37 @@
<button class="btn" disabled><i class="fa fa-pencil-square-o"></i></button>
</div>
</div>
<div class="selected-item-body">
<div class="selected-item-body" v-if="!selectedFile.IsJob">
<div class="selected-item-body-image">
<img v-if="selectedFileMetadata.generics && selectedFileMetadata.generics.images[0]" :src="selectedFileMetadata.generics.images[0].base64">
<img v-if="selectedFile.PreviewBase64" :src="selectedFile.PreviewBase64">
<div v-else class="noimage">
{{'modal_load_program_lbl_img_not_found' | localize('Preview non disponibile')}}
</div>
</div>
<div class="selected-item-body-description scrollable">
<div class="row" v-for="(item,index) in selectedFileMetadata" :key="'line' + index">
<div class="row" v-for="(item,index) in selectedFile.Content" :key="'line' + index">
<label>{{item}}</label>
</div>
</div>
</div>
<div class="selected-item-body" v-if="selectedFile.IsJob">
<div class="box-image" v-if="selectedFileMetadata.generics.images.length > 0">
<div class="box-image-container">
<img :src="selectedFileMetadata.generics.images[selectedNumberImage].base64">
</div>
<div class="linenumber">
<div v-for="(n,i) in selectedFileMetadata.generics.images" :key="i"><button :class="{'target': i == selectedNumberImage}" @click="selectNumberImage(i)">{{i+1}}</button></div>
</div>
</div>
<div v-else class="selected-item-body-image">
<div class="noimage">
{{'modal_load_program_lbl_img_not_found' | localize('Preview non disponibile')}}
</div>
</div>
<div class="box-description" v-if="selectedFileMetadata.generics.description">
{{selectedFileMetadata.generics.description}}
</div>
</div>
</div>
<div class="selected-item" v-if="!selectedFile">
<div class="notselecteditem">
@@ -0,0 +1,53 @@
import { Factory, MessageService } from "src/_base";
export default {
computed: {
isVisible: function () {
return this.currentView.length > 0;
},
VisibleModal: function(){
return this.currentView[this.currentView.length - 1];
}
},
props: {
},
data: function () {
return {
currentView: []
};
},
created() {
Factory.Get(MessageService).subscribeToChannel("show-modal-nc", args => {
//set blur effect && hide NC HMI
Factory.Get(MessageService).publishToChannel("show-modal-nc-called");
Factory.Get(MessageService).publishToChannel("HMI-show-modal-nc");
//Search in the array
let v = this.currentView.indexOf(args[0]);
//Save in the array
if(v>=0)
this.currentView[v] = args[0]
else
this.currentView.push(args[0]);
});
Factory.Get(MessageService).subscribeToChannel("hide-modal-nc", args => {
//Search in the array
let v = this.currentView.indexOf(args[0]);
//If esists delete it
if(v>=0)
this.currentView.splice(v, 1);
//If no modals esists show the normal software
if(this.currentView.length == 0){
Factory.Get(MessageService).publishToChannel("hide-modal-nc-called");
Factory.Get(MessageService).publishToChannel("HMI-hide-modal-nc", 300);
}
});
}
};
@@ -0,0 +1,10 @@
<template>
<transition v-if="isVisible" name="modal">
<div class="backdrop nc">
<component v-bind:is="VisibleModal">
</component>
</div>
</transition>
</template>
<script src="./modal-nc-container.ts" lang="ts"></script>
@@ -28,8 +28,13 @@ export default class createMaintenance extends Vue {
this.newMaintenance.time = this.newMaintenance.deadline;
}
}
Factory.Get(MessageService).subscribeToChannel("esc_pressed", args => {
this.close();
});
}
beforeDestroy() {
Factory.Get(MessageService).deleteChannel("esc_pressed");
}
close() {
Factory.Get(MessageService).deleteChannel("esc_pressed");
ModalHelper.HideModal();
+6 -1
View File
@@ -2,6 +2,8 @@ import { baseRestService } from "src/_base/baseRestService";
import { store, MachineInfoModel, machineInfoActions } from "src/store";
import {SoftKeysConfigurationModel} from "../store/machineInfo.store"
declare var cmsClient: any;
export class DataService extends baseRestService {
async GetSoftKeysConfiguration() {
@@ -36,7 +38,10 @@ export class DataService extends baseRestService {
}
public async setActiveScreenOnHMI(screen) {
return await this.put("/api/nc/active_screen/"+ screen,null, true);
let result = await this.put("/api/nc/active_screen/"+ screen,null, true);
if(typeof cmsClient != "undefined"){}
cmsClient.forceNcFocus();
return result;
}
//async GetAlarmsResetConfiguration(){
+12 -3
View File
@@ -71,6 +71,7 @@ export class Hub {
this._hub.client.magazinesStatus = Hub.magazineStatusChanged;
this._hub.client.activeProgramData = Hub.activeProgramData;
this._hub.client.magazineIsActive = Hub.magazineIsActive;
this._hub.client.m155Data = Hub.m155Data;
this._hub.client.partProgramQueue = Hub.partProgramQueue;
@@ -115,8 +116,7 @@ export class Hub {
private static activeProgramData(data) {
if(data.path != ""){
fileService.getActiveFileInfo(data.path).then(r => {
var image = r.previewBase64;
processModelActions.setCurrentProgramImage(store, image);
processModelActions.setCurrentProgramImage(store, r.image);
processModelActions.setCurrentProgramName(store, r.name);
});
}
@@ -156,6 +156,11 @@ export class Hub {
toolingActions.updateMagazine(store, newArrayMagazine);
}
private static m155Data(data){
console.log(data);
}
private static magazineStatusChanged(data) {
depotActions.setMagazineStatusModel(store, data);
@@ -342,7 +347,7 @@ export class Hub {
me._axesVisible = true;
}
else if (!resettingAxes && me._axesVisible) {
ModalHelper.HideModal();
Factory.Get(MessageService).publishToChannel("hide-axes-calibration");
me._axesVisible = false;
}
}, 500);
@@ -398,6 +403,10 @@ export class Hub {
this._hub.server.selectAxis(id);
}
public WriteM155Response(process: number,value: number) {
this._hub.server.WriteM155Response(process,value);
}
public Hello() {
this._hub.server.hello();
}