First commit

This commit is contained in:
Nicola Carminati
2019-03-21 17:52:55 +01:00
parent 7ae6237248
commit 03e953bbf1
13 changed files with 559 additions and 36 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ namespace Client.Utils
public const String BROWSER_JS_OBJ_NAME = "cmsClient";
//Nc States
public enum NcState { HIDE = 0, SHOW = 1,READONLY = 2 };
public enum NcState { HIDE = 0, SHOW = 1, SHOWPROD = 2 };
//HMI Size & Position
+10 -2
View File
@@ -146,8 +146,10 @@ namespace CMS_Client.Browser_Tools
if (NcWindow.State == NcState.SHOW)
mainForm.ShowNCWindow();
else if(NcWindow.State == NcState.SHOWPROD)
mainForm.ShowProdWindow();
else
mainForm.HideNCWindow();
mainForm.HideAUXWindow();
}
public void getNcWindowState(object sender, CfrV8HandlerExecuteEventArgs e)
@@ -196,7 +198,13 @@ namespace CMS_Client.Browser_Tools
//NcWindow.ForceNcRedraw();
NcWindow.ForceNcFocus();
mainForm.ShowNCWindow();
}
}
public void forceProdFocus(object sender, CfrV8HandlerExecuteEventArgs e)
{
NcWindow.ForceProdFocus();
mainForm.ShowProdWindow();
}
// Get the option of virtual Keyb configured
private void isVirtualKeybConfigured(object sender, CfrV8HandlerExecuteEventArgs e)
+9
View File
@@ -191,6 +191,12 @@
<DependentUpon>NcForm.cs</DependentUpon>
</Compile>
<Compile Include="View\NcWindow.cs" />
<Compile Include="View\ProdForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="View\ProdForm.Designer.cs">
<DependentUpon>ProdForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="View\LoadingForm.resx">
<DependentUpon>LoadingForm.cs</DependentUpon>
</EmbeddedResource>
@@ -213,6 +219,9 @@
<EmbeddedResource Include="View\NcForm.resx">
<DependentUpon>NcForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="View\ProdForm.resx">
<DependentUpon>ProdForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
+61 -11
View File
@@ -26,9 +26,11 @@ namespace CMS_Client.View
//Internal Variables
private PageError LoadingError;
private NcForm NcFrm;
private ProdForm ProdFrm;
private LoadingForm LdFrm;
private static IntPtr MainHandle;
private static IntPtr NcHandle;
private static IntPtr ProdHandle;
private int X = 0, Y = 0;
private string BrokenUrl;
@@ -124,11 +126,16 @@ namespace CMS_Client.View
if (NcWindow.State == NcState.SHOW)
{
HideNCWindow();
HideAUXWindow();
ShowNCWindow();
}
else if(NcWindow.State == NcState.SHOWPROD)
{
HideAUXWindow();
ShowProdWindow();
}
else
HideNCWindow();
HideAUXWindow();
}
//Refresh Browser Paint
@@ -158,6 +165,7 @@ namespace CMS_Client.View
if (Config.VendorHmiConfig.Enabled)
NcWindow.CloseNcWindow(false);
NcWindow.CloseProdWindow(false);
//Close Chromium Runtime
try
@@ -198,8 +206,11 @@ namespace CMS_Client.View
if (Config.VendorHmiConfig.Enabled)
{
NcFrm = new NcForm(Config.ClientConfig.TranspColor, X, Y);
ProdFrm = new ProdForm(Config.ClientConfig.TranspColor, X, Y);
NcHandle = NcFrm.Handle;
ProdHandle = ProdFrm.Handle;
NcFrm.Show();
ProdFrm.Show();
}
//Steup the Step variables
@@ -280,7 +291,7 @@ namespace CMS_Client.View
{
//Hide NC Window
NcWindow.SetState(0);
HideNCWindow();
HideAUXWindow();
//Set the title of the window in "Loading"
SetWindowTitle("Loading...");
@@ -470,7 +481,7 @@ namespace CMS_Client.View
{
//Start following NC Window
if (Config.VendorHmiConfig.Enabled)
NcWindow.StartNcFollowing(MainHandle, NcHandle, NcFrm.Width, NcFrm.Height);
NcWindow.StartNcFollowing(MainHandle, NcHandle, ProdHandle, NcFrm.Width, NcFrm.Height);
else
NcWindow.StartStepFollowing(MainHandle);
}
@@ -574,6 +585,7 @@ namespace CMS_Client.View
{
Owner = null;
NcFrm.Owner = this;
ProdFrm.Owner = null;
}
NcFrm.TopMost = true;
NcFrm.TopMost = false;
@@ -585,18 +597,54 @@ namespace CMS_Client.View
{
Owner = null;
NcFrm.Owner = this;
ProdFrm.Owner = null;
}
NcFrm.TopMost = true;
NcFrm.TopMost = false;
}
}
}
//Show NC Method
public void ShowProdWindow()
{
if (!Config.VendorHmiConfig.Enabled)
return;
//Invoke method if is needed or call the method in STD mode
if (!IsDisposed)
{
if (InvokeRequired)
Invoke((MethodInvoker)delegate ()
{
if (ProdFrm.Owner == null)
{
Owner = null;
ProdFrm.Owner = this;
NcFrm.Owner = null;
}
ProdFrm.TopMost = true;
ProdFrm.TopMost = false;
});
else
{
if (ProdFrm.Owner == null)
{
Owner = null;
ProdFrm.Owner = this;
NcFrm.Owner = null;
}
ProdFrm.TopMost = true;
ProdFrm.TopMost = false;
}
}
}
//Hide NC Method
public void HideNCWindow()
public void HideAUXWindow()
{
if (!Config.VendorHmiConfig.Enabled || NcFrm==null)
return;
@@ -608,9 +656,9 @@ namespace CMS_Client.View
Invoke((MethodInvoker)delegate ()
{
if (NcFrm.Owner != null)
{
NcFrm.Owner = null;
}
if (ProdFrm.Owner != null)
ProdFrm.Owner = null;
TopMost = true;
TopMost = false;
});
@@ -618,9 +666,9 @@ namespace CMS_Client.View
else
{
if (NcFrm.Owner != null)
{
NcFrm.Owner = null;
}
if (ProdFrm.Owner != null)
ProdFrm.Owner = null;
TopMost = true;
TopMost = false;
}
@@ -628,7 +676,7 @@ namespace CMS_Client.View
}
//CAlculate Window Position
//Calculate Window Position
private void CalcWindowPosition()
{
//Position of the Window
@@ -656,6 +704,7 @@ namespace CMS_Client.View
{
HideLoadingWindow();
NcWindow.CloseNcWindow(false);
NcWindow.CloseProdWindow(false);
Program.ShowAlarmAndClose("Screen resolution " + ss.Bounds.Width + "x" + ss.Bounds.Height + " is not supported");
}
}
@@ -678,6 +727,7 @@ namespace CMS_Client.View
{
HideLoadingWindow();
NcWindow.CloseNcWindow(false);
NcWindow.CloseProdWindow(false);
Program.ShowAlarmAndClose("Screen resolution " + ps.Bounds.Width + "x" + ps.Bounds.Height + " is not supported");
}
}
+171 -17
View File
@@ -44,12 +44,19 @@ namespace CMS_Client.View
private static bool FollowingFocus;
public static bool WindowStarted { get { return windowstarted; } }
private static bool windowstarted = false;
public static bool ProdWindowStarted { get { return prodwindowstarted; } }
private static bool prodwindowstarted = false;
public static String ProcessName { get { return processname; } }
private static String processname = "";
public static String ProcessPath { get { return processpath; } }
private static String processpath = "";
public static Process NcProcess { get { return ncprocess; } }
private static Process ncprocess;
public static Process prodProcess { get { return prodprocess; } }
private static Process prodprocess;
public static String NcCapture { get { return ncCapture; } }
private static String ncCapture;
@@ -103,7 +110,6 @@ namespace CMS_Client.View
public static int StartNcWindow()
{
Process[] processes;
int style;
//Setup the variables
ProcKilled = false;
@@ -241,15 +247,105 @@ namespace CMS_Client.View
//Wait until window title become correct
//Remove the Frame Border
style = GetWindowLong(ncprocess.MainWindowHandle, GWL_STYLE);
SetWindowLong(ncprocess.MainWindowHandle, GWL_STYLE, (style & ~WS_CAPTION & ~WS_THICKFRAME));
RemoveFrameBorder(ncprocess.MainWindowHandle);
return 0;
}
// Start/Open the PROD Window
public static int StartProdWindow(string EXEpath, string EXEname)
{
Process[] processes;
ProcKilled = false;
//Set Window Started = false
prodwindowstarted = false;
//Read if exists a Process with correct name
processes = Process.GetProcessesByName(EXEname);
//If exists the Process
if (processes.Length > 0)
{
//Set the first founded process
prodprocess = processes[0];
prodprocess.WaitForInputIdle();
//Wait until the process is started
TriedTimes = 1;
while ((processes[0].MainWindowHandle == IntPtr.Zero || !isWindowReady(processes[0].MainWindowTitle)) && TriedTimes < TimesToTryKill)
{
processes = Process.GetProcessesByName(EXEname);
if (processes[0].MainWindowHandle == IntPtr.Zero)
{
Thread.Sleep(WaitingMs);
TriedTimes++;
}
}
//Kill the process if needed
if ((TriedTimes == TimesToTryKill))
{
//Kill the Process
CloseProdWindow(true);
//Setup the Variable
ProcKilled = true;
}
}
if (processes.Length <= 0 || ProcKilled)
{
prodprocess = new Process();
// Check if exists the Nc Path
if (!File.Exists(EXEpath))
return 1;
//Setup the Process path
prodprocess.StartInfo.FileName = EXEpath;
//Start the Process
prodprocess.Start();
prodprocess.WaitForInputIdle();
//Wait until the process is started
TriedTimes = 1;
while ((processes.Length <= 0 || (processes[0].MainWindowHandle == IntPtr.Zero) || !isWindowReady(processes[0].MainWindowTitle)) && TriedTimes < TimesToTryOpen)
{
processes = Process.GetProcessesByName(EXEname);
if (processes.Length <= 0 || (processes[0].MainWindowHandle == IntPtr.Zero))
{
Thread.Sleep(WaitingMs);
TriedTimes++;
}
}
if (TriedTimes == TimesToTryOpen)
return 2;
//Set the first founded process
prodprocess = processes[0];
Thread.Sleep(1000);
}
//Set Window Started => true
prodwindowstarted = true;
//Show the Main Window & Hide the Others (Only Siemens)
ShowWindow(prodprocess.MainWindowHandle, WS_SHOW);
//Remove the Frame Border
RemoveFrameBorder(prodprocess.MainWindowHandle);
return 0;
}
//Kill/Close the NC Window
public static void CloseNcWindow(bool forced)
{
@@ -297,37 +393,63 @@ namespace CMS_Client.View
if (Config.VendorHmiConfig.Type == 2)
KillAllProcessWithName(SiemensTool2Name);
}
//Kill/Close the PROD Window
public static void CloseProdWindow(bool forced)
{
//Kill the Process
if (prodprocess != null && !prodprocess.HasExited)
prodprocess.Kill();
}
//Show Nc Window
public static void ShowNcWindow()
{
if (windowstarted)
ShowWindow(ncprocess.MainWindowHandle, SW_SHOWNOACTIVATE);
}
//Show Prod Window
public static void ShowProdWindow()
{
if (windowstarted)
ShowWindow(prodprocess.MainWindowHandle, SW_SHOWNOACTIVATE);
}
//Minimize Nc Window
public static void MinimizeNcWindow()
{
if (windowstarted)
ShowWindow(ncprocess.MainWindowHandle, WS_MINIMIZE);
}
//Show Prod Window
public static void MinimizeProdWindow()
{
if (windowstarted)
ShowWindow(prodprocess.MainWindowHandle, WS_MINIMIZE);
}
//Hide Nc Window
public static void HideNcWindow()
{
if (windowstarted)
ShowWindow(ncprocess.MainWindowHandle, WS_HIDE);
}
//Hide Prod Window
public static void HideProdWindow()
{
if (windowstarted)
ShowWindow(prodprocess.MainWindowHandle, WS_HIDE);
}
//Set State
public static void SetState(NcState St)
{
@@ -375,9 +497,16 @@ namespace CMS_Client.View
if (windowstarted)
ForceFocus(ncprocess.MainWindowHandle);
}
//Force Prod Focus
public static void ForceProdFocus()
{
if (windowstarted)
ForceFocus(prodprocess.MainWindowHandle);
}
//Force NC Focus
//Force NC Redraw
public static void ForceNcRedraw()
{
if (windowstarted){
@@ -387,8 +516,7 @@ namespace CMS_Client.View
}
//Force NC Focus
//Force STEP Focus
public static void ForceStepFocus()
{
if (MainViewHandle != IntPtr.Zero)
@@ -426,14 +554,17 @@ namespace CMS_Client.View
//Start following Nc Window (bring-to-font the main window)
public static void StartNcFollowing(IntPtr Handle, IntPtr NcHandle, int Width, int Height)
public static void StartNcFollowing(IntPtr Handle, IntPtr NcHandle, IntPtr ProdHandle, int Width, int Height)
{
//Setup the Handle-variable
MainViewHandle = Handle;
NcHND = NcHandle;
//Set the parent of the window
SetParent(ncprocess.MainWindowHandle, NcHandle);
SetParent(ncprocess.MainWindowHandle, NcHandle);
//Set the parent of the window
SetParent(prodprocess.MainWindowHandle, ProdHandle);
//Get the Process-Id
GetWindowThreadProcessId(MainViewHandle, out MainProcessPID);
@@ -441,6 +572,7 @@ namespace CMS_Client.View
//Resize the Window
ResizeAndMoveNcWindow(ncWindowX, ncWindowY, ncWindowWidth, ncWindowHeight);
ResizeAndMoveProdWindow(ncWindowX, ncWindowY, ncWindowWidth, ncWindowHeight);
//Start Keyboard Hook
if (keybhook != IntPtr.Zero)
@@ -933,8 +1065,23 @@ namespace CMS_Client.View
}
//Resize & Move NC Window
private static void ResizeAndMoveProdWindow(int X, int Y, int width, int height)
{
LastX = X;
LastY = Y;
LastWidth = width;
LastHeight = height;
//Win32 Method
if (prodProcess != null && windowstarted)
{
MoveWindow(prodProcess.MainWindowHandle, LastX, LastY, LastWidth, LastHeight, true);
}
}
private static bool isWindowReady(string Title)
{
switch (Config.VendorHmiConfig.Type)
@@ -1071,6 +1218,13 @@ namespace CMS_Client.View
//Set as foreground
SetForegroundWindow(Handle);
}
}
private static void RemoveFrameBorder(IntPtr Handle)
{
int style = GetWindowLong(Handle, GWL_STYLE);
SetWindowLong(Handle, GWL_STYLE, (style & ~WS_CAPTION & ~WS_THICKFRAME));
}
#endregion
@@ -1092,7 +1246,7 @@ namespace CMS_Client.View
{
while (true)
{
if (state == NcState.READONLY)
if (state == NcState.SHOWPROD)
{
Thread.BeginThreadAffinity();
m = new MemoryStream();
+21 -1
View File
@@ -287,7 +287,26 @@ namespace CMS_Client.View
{
switch(NcWindow.StartNcWindow())
{
case 0: return true;
case 0:
{
switch (NcWindow.StartProdWindow("C:\\Windows\\System32\\notepad.exe", "notepad"))
{
case 0: return true;
case 1:
{
setStatus("Close the application!", "PROD EXE Path not found: " + NcWindow.ProcessPath);
return false;
};
case 2:
{
setStatus("Close the application!", "Unable to start the PROD EXE application: ");
return false;
};
}
return false;
};
case 1: {
setStatus("Close the application!", "NC Path not found: " + NcWindow.ProcessPath);
@@ -300,6 +319,7 @@ namespace CMS_Client.View
return false;
};
}
return false;
}
+51
View File
@@ -0,0 +1,51 @@
namespace CMS_Client.View
{
partial class ProdForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// ProdForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(101)))), ((int)(((byte)(113)))), ((int)(((byte)(120)))));
this.ClientSize = new System.Drawing.Size(1920, 1280);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "ProdForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "ProdForm";
this.ResumeLayout(false);
}
#endregion
}
}
+38
View File
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CMS_Client.View
{
public partial class ProdForm : Form
{
public ProdForm(Color TranspColor, int PosX, int PosY)
{
InitializeComponent();
//Force to use on Screen 1
this.DesktopLocation = new Point(PosX, PosY);
//If is on top -> Transp.color
this.TransparencyKey = TranspColor;
this.BackColor = this.TransparencyKey;
}
protected override CreateParams CreateParams
{
get
{
var Params = base.CreateParams;
Params.ExStyle |= 0x80;
return Params;
}
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+15
View File
@@ -39,6 +39,7 @@ export default class app extends Vue {
applyBlurNc= false;
applyBlurInternal = false;
showHMIinProduction = false;
showPRODinProduction = false;
loadingOperations = 0;
HMIsrc = null;
hub: Hub = null;
@@ -92,6 +93,12 @@ export default class app extends Vue {
ms.subscribeToChannel("HMI-production-hide-state", args => {
this.showHMIinProduction = false;
});
ms.subscribeToChannel("PROD-production-show-state", args => {
this.showPRODinProduction = true;
});
ms.subscribeToChannel("PROD-production-hide-state", args => {
this.showPRODinProduction = false;
});
let $this = this;
Factory.Get(LoginService)
@@ -140,6 +147,7 @@ export default class app extends Vue {
//Hide the HMI if is showed (in production)
Factory.Get(MessageService).publishToChannel("HMI-production-hide");
Factory.Get(MessageService).publishToChannel("PROD-production-hide");
//Show the HMI with delay (For the animation)
Factory.Get(MessageService).publishToChannel("HMI-show", 500);
} else {
@@ -154,6 +162,13 @@ export default class app extends Vue {
"HMI-production-show",
700
);
if (this.showPRODinProduction && this.$route.path.includes("production"))
Factory.Get(MessageService).publishToChannel(
"PROD-production-show",
700
);
}
}
@Watch("loadingOperations")
+39 -3
View File
@@ -21,7 +21,8 @@ import { scadaService } from "./services/scadaService";
declare let cmsClient: any;
let HMIvisible = false;
let HMIvisibleInProduction = false
let HMIvisibleInProduction = false;
let PRODvisibleInProduction = false;
let oldHMIvisible = false;
let HMIAlarmsVisible = false;
let HMIModalsVisible = false;
@@ -32,6 +33,7 @@ let HMIAlarmsTimeout;
let HMIModalsTimeout;
let HMIDraggingTimeout;
let HMIModalsNcTimeout;
let PRODprodTimeout;
let HMIScreenshotInterval;
let HMIprodTimeout;
let RerenderInterval;
@@ -159,6 +161,24 @@ if (typeof cmsClient != "undefined") {
});
Factory.Get(MessageService).subscribeToChannel("PROD-production-show", args => {
clearTimeout(PRODprodTimeout);
if (args[0] > 0)
PRODprodTimeout = setTimeout(ShowProdProduction, args[0]);
else
ShowProdProduction()
});
Factory.Get(MessageService).subscribeToChannel("PROD-production-hide", args => {
clearTimeout(PRODprodTimeout);
if (args[0] > 0)
PRODprodTimeout = setTimeout(HideProdProduction, args[0]);
else
HideProdProduction()
});
Factory.Get(MessageService).subscribeToChannel("HMI-show-alarms", args => {
clearTimeout(HMIAlarmsTimeout);
if (args[0] > 0)
@@ -258,6 +278,11 @@ function ShowHmiProduction() {
ElaborateHMIStatus();
}
function ShowProdProduction() {
PRODvisibleInProduction = true;
ElaborateHMIStatus();
}
//Private functions for HMI State (hide-functions):
function HideHmi() {
HMIvisible = false;
@@ -281,20 +306,31 @@ function HideHmiProduction() {
ElaborateHMIStatus();
}
function HideProdProduction() {
PRODvisibleInProduction = false;
ElaborateHMIStatus();
}
//Private function for elaborate status
function ElaborateHMIStatus() {
let hmiv = HMIvisible || HMIvisibleInProduction;
let hmiv = HMIvisible || HMIvisibleInProduction || PRODvisibleInProduction;
console.log(hmiv);
if (!hmiv) {
if (HMIScreenshotInterval)
clearInterval(HMIScreenshotInterval);
cmsClient.setNcWindowState(0);
}
else if (hmiv && !HMIAlarmsVisible && !HMIModalsVisible && !HMIDragging && !HMIModalsNcVisible) {
else if (hmiv && (HMIvisible || HMIvisibleInProduction) && !HMIAlarmsVisible && !HMIModalsVisible && !HMIDragging && !HMIModalsNcVisible) {
if (HMIScreenshotInterval)
clearInterval(HMIScreenshotInterval);
cmsClient.setNcWindowState(1);
}
else if (hmiv && PRODvisibleInProduction && !HMIAlarmsVisible && !HMIModalsVisible && !HMIDragging && !HMIModalsNcVisible) {
if (HMIScreenshotInterval)
clearInterval(HMIScreenshotInterval);
cmsClient.setNcWindowState(2);
}
else if (hmiv && (HMIAlarmsVisible || HMIModalsVisible || HMIDragging || HMIModalsNcVisible)) {
cmsClient.setNcWindowState(0);
}
@@ -24,6 +24,7 @@ export default class Production extends Vue {
activeCms = true;
activeCnc = false;
activeProd = false;
headsR = [];
selectedHead = null;
selectedPositionTop = 0;
@@ -65,19 +66,31 @@ export default class Production extends Vue {
}
@Watch("activeCnc")
@Watch("activeProd")
activeCncChanged() {
if (this.activeCnc) {
Factory.Get(MessageService).publishToChannel("HMI-production-show");
Factory.Get(MessageService).publishToChannel("PROD-production-hide");
Factory.Get(MessageService).publishToChannel("HMI-production-show-state");
Factory.Get(MessageService).publishToChannel("PROD-production-hide-state");
}
else if (this.activeProd) {
Factory.Get(MessageService).publishToChannel("PROD-production-show");
Factory.Get(MessageService).publishToChannel("HMI-production-hide");
Factory.Get(MessageService).publishToChannel("HMI-production-hide-state");
Factory.Get(MessageService).publishToChannel("PROD-production-show-state");
}
else {
Factory.Get(MessageService).publishToChannel("HMI-production-hide");
Factory.Get(MessageService).publishToChannel("PROD-production-hide");
Factory.Get(MessageService).publishToChannel("HMI-production-hide-state");
Factory.Get(MessageService).publishToChannel("PROD-production-hide-state");
}
}
beforeDestroy() {
Factory.Get(MessageService).publishToChannel("HMI-production-hide");
Factory.Get(MessageService).publishToChannel("PROD-production-hide");
Factory.Get(MessageService).publishToChannel("HMI-production-hide-state");
}
@@ -105,10 +118,17 @@ export default class Production extends Vue {
clickCms() {
this.activeCms = true;
this.activeCnc = false;
this.activeProd = false;
}
clickCnc() {
this.activeCnc = true;
this.activeCms = false;
this.activeProd = false;
}
clickProd() {
this.activeCnc = false;
this.activeCms = false;
this.activeProd = true;
}
ncClick(id) {
Hub.Current.ncSoftKeyClick(id);
@@ -13,8 +13,10 @@
</div>
<button class="btn" :class="{'pressed': activeCms}" @click="clickCms()">{{'production_box_video_button_cms' | localize("CMS")}}</button>
<button class="btn" :class="{'pressed': activeCnc}" @click="clickCnc()">{{'production_box_video_button_cnc' | localize("CNC")}}</button>
<button class="btn" :class="{'pressed': activeProd}" @click="clickProd()">{{'production_box_video_button_prod' | localize("PROD")}}</button>
</div>
<div class="cnc" v-if="activeCnc">
<div class="cnc" v-if="activeCnc || activeProd">
<img id="cnc-img" src="assets/images/Siemens_Placeholder.jpg" @click="closeAlarmsRibbon()" v-if="isSiemens()">
<img id="cnc-img-fanuc" src="assets/images/Fanuc_Placeholder.jpg" @click="closeAlarmsRibbon()" v-if="isFanuc()">
<img id="cnc-img" src="assets/images/Osai_Placeholder.jpg" @click="closeAlarmsRibbon()" v-if="isOsai()">