diff --git a/Supervisor.Plugin.FiveLakes/Constants/ConstIni.vb b/Supervisor.Plugin.FiveLakes/Constants/ConstIni.vb
index 79ab7d5..78ae2b3 100644
--- a/Supervisor.Plugin.FiveLakes/Constants/ConstIni.vb
+++ b/Supervisor.Plugin.FiveLakes/Constants/ConstIni.vb
@@ -15,6 +15,8 @@ Module ConstIni
Public Const INI_FILE_NAME As String = "Supervisor.Plugin.FiveLakes.ini"
Public Const S_GENERAL As String = "General"
+ Public Const K_BACKUPDIR As String = "BackupDir"
+ Public Const K_RESOURCESDIR As String = "ResourcesDir"
Public Const S_CSV As String = "CSV"
Public Const K_DDFNAME As String = "DDFName"
@@ -23,4 +25,10 @@ Module ConstIni
Public Const K_WIDTH As String = "Width"
Public Const K_THICKNESS As String = "Thickness"
+ Public Const S_DEBUG As String = "Debug"
+ Public Const K_VARIABLELIST As String = "VariableList"
+ Public Const K_VARIABLEONDRAW As String = "VariableOnDraw"
+ Public Const K_MACHINECOMMANDS As String = "MachineCommands"
+ Public Const K_DOORCIRCLIST As String = "DoorCircList"
+
End Module
diff --git a/Supervisor.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml b/Supervisor.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml
index f1fa2f8..b8762d4 100644
--- a/Supervisor.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml
+++ b/Supervisor.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml
@@ -1,7 +1,6 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@@ -9,7 +8,8 @@
+ Command="{Binding OpenCSV_Command}"
+ IsEnabled="{Binding bExecButton_IsEnabled}"/>
@@ -31,9 +31,13 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/Supervisor.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb b/Supervisor.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb
index 2fdc16d..af59777 100644
--- a/Supervisor.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb
+++ b/Supervisor.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb
@@ -27,6 +27,16 @@ Public Class DoorListPageVM
End Set
End Property
+ Private m_bExecButton_IsEnabled As Boolean = True
+ Public ReadOnly Property bExecButton_IsEnabled As Boolean
+ Get
+ Return m_bExecButton_IsEnabled
+ End Get
+ End Property
+ Private Sub SetExecButtonIsEnabled(bValue As Boolean)
+ m_bExecButton_IsEnabled = bValue
+ NotifyPropertyChanged(NameOf(bExecButton_IsEnabled))
+ End Sub
Private m_nModifyIndex As Integer = 0
Private m_nBackupindex As Integer = 0
Private m_bWritingBackup As Boolean = False
@@ -40,7 +50,8 @@ Public Class DoorListPageVM
Private m_cmdDeleteAll As ICommand
Private m_cmdProduce As ICommand
Private m_cmdProduceAll As ICommand
- Private m_cmdRefresh As ICommand
+ Private m_cmdResetProductionQueue As ICommand
+ Private m_cmdVerify As ICommand
#Region "CONSTRUCTOR"
@@ -73,6 +84,18 @@ Public Class DoorListPageVM
Return Map.refSupervisorFunction.PlgExecProcess(sCamExePath, sMainLuaPath, sDDFFilePath)
End Function
+ Friend Function ExecCAMProcessAsync(sDDFName As String) As Boolean
+ ' lancio esecuzione programma
+ Dim sCamExePath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
+ Dim sMainLuaPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "MainLUA", "", sMainLuaPath)
+ Dim sDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
+ Dim sDDFFilePath As String = sDDFDirPath & "\" & sDDFName
+ Return Map.refSupervisorFunction.PlgExecProcessAsync(sCamExePath, sMainLuaPath, sDDFFilePath)
+ End Function
+
Public Sub Read(FilePath As String)
If Not File.Exists(FilePath) Then Return
Dim sReadedFile As String = File.ReadAllText(FilePath)
@@ -112,7 +135,7 @@ Public Class DoorListPageVM
m_bWritingBackup = True
m_nBackupindex = m_nModifyIndex
Dim sBackupDirPath As String = ""
- GetPluginPrivateProfileString(S_GENERAL, "BackupDir", "", sBackupDirPath)
+ GetPluginPrivateProfileString(S_GENERAL, K_BACKUPDIR, "", sBackupDirPath)
Dim sBackupFilePath As String = sBackupDirPath & "\Backup.json"
Write(sBackupFilePath)
m_bWritingBackup = False
@@ -146,7 +169,8 @@ Public Class DoorListPageVM
Friend Function GetNextDoor() As Door
Dim NextDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nState = Door.DoorStates.READY_FOR_PRODUCTION)
If Not IsNothing(NextDoor) Then
- NextDoor.SetState(Door.DoorStates.SENT_TO_PRODUCTION)
+ NextDoor.SetState(Door.DoorStates.ON_LOAD_STATION)
+ WriteBackup()
End If
Return NextDoor
End Function
@@ -284,6 +308,7 @@ Public Class DoorListPageVM
Next
If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
m_ExecProcessManager.StartExecutionThread()
+ SetExecButtonIsEnabled(False)
End If
End If
WriteBackup()
@@ -291,6 +316,7 @@ Public Class DoorListPageVM
Public Sub ExecProcessManager_AllArgsProcessed()
m_ExecProcessManager.StopExecutionThread()
+ SetExecButtonIsEnabled(True)
End Sub
Public Sub ExecProcessManager_PostProcess(ProcessArgsResult As ProcessArgsResult)
@@ -472,24 +498,68 @@ Public Class DoorListPageVM
#End Region ' ProduceAll
-#Region "Refresh"
+#Region "ResetProductionQueue"
- Public ReadOnly Property Refresh_Command As ICommand
+ Public ReadOnly Property ResetProductionQueue_Command As ICommand
Get
- If m_cmdRefresh Is Nothing Then
- m_cmdRefresh = New Command(AddressOf Refresh)
+ If m_cmdResetProductionQueue Is Nothing Then
+ m_cmdResetProductionQueue = New Command(AddressOf ResetProductionQueue)
End If
- Return m_cmdRefresh
+ Return m_cmdResetProductionQueue
End Get
End Property
- Public Sub Refresh()
- m_SelDoor.SetState(Door.DoorStates.READY_FOR_PRODUCTION)
-
- 'RefreshGraphicsTimer_Tick(Nothing, Nothing)
+ Public Sub ResetProductionQueue()
+ For Each Door In m_DoorList
+ If Door.nState = Door.DoorStates.READY_FOR_PRODUCTION Then
+ Door.SetState(Door.DoorStates.VERIFIED)
+ End If
+ Next
+ WriteBackup()
End Sub
-#End Region ' Refresh
+#End Region ' ResetProductionQueue
+
+#Region "Verify"
+
+ Public ReadOnly Property Verify_Command As ICommand
+ Get
+ If m_cmdVerify Is Nothing Then
+ m_cmdVerify = New Command(AddressOf Verify)
+ End If
+ Return m_cmdVerify
+ End Get
+ End Property
+
+ Public Sub Verify()
+ Dim sCamExePath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
+ Dim sMainLuaPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "MainPipeLUA", "", sMainLuaPath)
+ Dim bStartExecProcessManager As Boolean = False
+ If IsNothing(m_ExecProcessManager) Then
+ bStartExecProcessManager = True
+ m_ExecProcessManager = New ExecProcessManager(sCamExePath, """" & sMainLuaPath & """")
+ 'm_ExecProcessManager.SetPostProcess(AddressOf ExecProcessManager_PostProcess)
+ AddHandler m_ExecProcessManager.m_AllArgsProcessed, AddressOf ExecProcessManager_AllArgsProcessed
+ m_ExecProcessManager.SetMaxCamInstances(3)
+ End If
+ Dim sDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
+ For Each Door In m_DoorList
+ If Door.nState = Door.DoorStates.LOADED_FROM_CSV Then
+ Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName
+ m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sDDFFilePath))
+ End If
+ Next
+ If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
+ m_ExecProcessManager.StartExecutionThread()
+ SetExecButtonIsEnabled(False)
+ End If
+ WriteBackup()
+ End Sub
+
+#End Region ' Verify
#End Region ' COMMANDS
@@ -505,12 +575,27 @@ Public Class Door
VERIFICATION_FAILED = 11
SKIPPED = 20
READY_FOR_PRODUCTION = 30
- SENT_TO_PRODUCTION = 31
- IN_PRODUCTION = 32
- PRODUCED = 32
+ ON_LOAD_STATION = 31
+ MACHINE_1_START = 33
+ MACHINE_1_END = 34
+ MACHINE_2_START = 35
+ MACHINE_2_END = 35
+ PRODUCED = 36
SCRAP = 40
End Enum
+ Public Enum DoorProdStates As Integer
+ NOT_INIT = 0
+ IMPORTED = 1
+ SENT_1 = 2
+ START_MACHINING_1 = 3
+ MACHINED_1 = 4
+ SENT_2 = 5
+ START_MACHINING_2 = 6
+ MACHINED_2 = 7
+ UNLOADED = 8
+ End Enum
+
Private m_nId As Integer
Public ReadOnly Property nId As Integer
Get
@@ -585,6 +670,129 @@ Public Class Door
If bUpdate Then NotifyPropertyChanged(NameOf(nState))
End Sub
+#Region "Statistics"
+
+ Private m_nProdState As DoorProdStates = DoorProdStates.NOT_INIT
+ Public ReadOnly Property nProdState As DoorProdStates
+ Get
+ Return m_nProdState
+ End Get
+ End Property
+ Friend Sub SetProdState(value As DoorProdStates)
+ m_nProdState = value
+ Select Case value
+ Case DoorProdStates.START_MACHINING_1
+ SetState(DoorStates.MACHINE_1_START)
+ Case DoorProdStates.MACHINED_1
+ SetState(DoorStates.MACHINE_1_END)
+ Case DoorProdStates.START_MACHINING_2
+ SetState(DoorStates.MACHINE_2_START)
+ Case DoorProdStates.MACHINED_2
+ SetState(DoorStates.MACHINE_2_END)
+ Case DoorProdStates.UNLOADED
+ SetState(DoorStates.PRODUCED)
+ End Select
+ NotifyPropertyChanged(NameOf(nProdState))
+ End Sub
+
+ Private m_dtLoadTime As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtLoadTime As DateTime
+ Get
+ Return m_dtLoadTime
+ End Get
+ End Property
+ Public ReadOnly Property sLoadTime As String
+ Get
+ Return If(m_dtLoadTime <> DateTime.MinValue, m_dtLoadTime.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetLoadTime(LoadTime As Long)
+ m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(LoadTime).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sLoadTime))
+ End Sub
+
+ Private m_dtMachining1Start As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachining1Start As DateTime
+ Get
+ Return m_dtMachining1Start
+ End Get
+ End Property
+ Public ReadOnly Property sMachining1Start As String
+ Get
+ Return If(m_dtMachining1Start <> DateTime.MinValue, m_dtMachining1Start.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetMachining1Start(Machining1Start As Long)
+ m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining1Start).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sMachining1Start))
+ End Sub
+
+ Private m_dtMachining1End As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachining1End As DateTime
+ Get
+ Return m_dtMachining1End
+ End Get
+ End Property
+ Public ReadOnly Property sMachining1End As String
+ Get
+ Return If(m_dtMachining1End <> DateTime.MinValue, m_dtMachining1End.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetMachining1End(Machining1End As Long)
+ m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining1End).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sMachining1End))
+ End Sub
+
+ Private m_dtMachining2Start As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachining2Start As DateTime
+ Get
+ Return m_dtMachining2Start
+ End Get
+ End Property
+ Public ReadOnly Property sMachining2Start As String
+ Get
+ Return If(m_dtMachining2Start <> DateTime.MinValue, m_dtMachining2Start.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetMachining2Start(Machining2Start As Long)
+ m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining2Start).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sMachining2Start))
+ End Sub
+
+ Private m_dtMachining2End As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachining2End As DateTime
+ Get
+ Return m_dtMachining2End
+ End Get
+ End Property
+ Public ReadOnly Property sMachining2End As String
+ Get
+ Return If(m_dtMachining2End <> DateTime.MinValue, m_dtMachining2End.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetMachining2End(Machining2End As Long)
+ m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining2End).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sMachining2End))
+ End Sub
+
+ Private m_dtUnloadTime As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtUnloadTime As DateTime
+ Get
+ Return m_dtUnloadTime
+ End Get
+ End Property
+ Public ReadOnly Property sUnloadTime As String
+ Get
+ Return If(m_dtUnloadTime <> DateTime.MinValue, m_dtUnloadTime.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetUnloadTime(UnloadTime As Long)
+ m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(UnloadTime).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sUnloadTime))
+ End Sub
+
+#End Region ' Statistics
+
Sub New(nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, HeaderList As String(), ValueList As String())
m_nId = nId
m_nCSVLine = nCSVLine
@@ -612,6 +820,13 @@ Public Class Door
m_dThickness = JsonDoor.dThickness
m_nState = JsonDoor.nState
m_CustomerParameters = JsonDoor.CustomerParameters
+ m_nProdState = JsonDoor.nProdState
+ m_dtLoadTime = JsonDoor.dtLoadTime
+ m_dtMachining1Start = JsonDoor.dtMachining1Start
+ m_dtMachining1End = JsonDoor.dtMachining1End
+ m_dtMachining2Start = JsonDoor.dtMachining2Start
+ m_dtMachining2End = JsonDoor.dtMachining2End
+ m_dtUnloadTime = JsonDoor.dtUnloadTime
End Sub
End Class
diff --git a/Supervisor.Plugin.FiveLakes/FiveLakesUI.xaml b/Supervisor.Plugin.FiveLakes/FiveLakesUI.xaml
index 51d0ba1..9ab227d 100644
--- a/Supervisor.Plugin.FiveLakes/FiveLakesUI.xaml
+++ b/Supervisor.Plugin.FiveLakes/FiveLakesUI.xaml
@@ -2,9 +2,13 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Supervisor.Plugin.FiveLakes"
- DataContext="{StaticResource FiveLakesUIVM}"
- Background="Red">
+ DataContext="{StaticResource FiveLakesUIVM}">
+
+
+
@@ -13,6 +17,10 @@
Header="Machine">
+
+
+
-
-
+
+
-
-
-
+
+
-
+
+
+
+
+
+
-
-
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
- -->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Supervisor.Plugin.FiveLakes/MachinePage/MachinePageVM.vb b/Supervisor.Plugin.FiveLakes/MachinePage/MachinePageVM.vb
index 287b2a2..b170f8e 100644
--- a/Supervisor.Plugin.FiveLakes/MachinePage/MachinePageVM.vb
+++ b/Supervisor.Plugin.FiveLakes/MachinePage/MachinePageVM.vb
@@ -1,10 +1,14 @@
Imports System.Collections.ObjectModel
+Imports System.ComponentModel.Composition
+Imports System.Globalization
Imports System.Reflection
Imports System.Windows.Threading
Imports Newtonsoft.Json.Linq
Imports Supervisor.Plugin.FiveLakes.Variable
+Imports Supervisor.Plugin.Interface
Public Class MachinePageVM
+ Inherits VMBase
Private m_DoorOnMachineList As New ObservableCollection(Of Door)
Public ReadOnly Property DoorOnMachineList As ObservableCollection(Of Door)
@@ -22,9 +26,77 @@ Public Class MachinePageVM
End Get
End Property
+ Private m_sMachineImagePath As String
+ Public ReadOnly Property sMachineImagePath As String
+ Get
+ Return m_sMachineImagePath
+ End Get
+ End Property
+
+ Private m_nDDfCalcState As Integer = -1
+ Public ReadOnly Property nDDfCalcState As Integer
+ Get
+ Return m_nDDfCalcState
+ End Get
+ End Property
+ Private Sub SetDDfCalcState(nState As Integer)
+ m_nDDfCalcState = nState
+ NotifyPropertyChanged(NameOf(nDDfCalcState))
+ End Sub
+
+ Private m_nNewDoorState As Integer = -1
+ Public ReadOnly Property nNewDoorState As Integer
+ Get
+ Return m_nNewDoorState
+ End Get
+ End Property
+ Private Sub SetNewDoorState(nState As Integer)
+ m_nNewDoorState = nState
+ NotifyPropertyChanged(NameOf(nNewDoorState))
+ End Sub
+
+ Private m_DoorIndexOnMachine(8) As Integer
+ Public ReadOnly Property DoorIndexOnMachine As Integer()
+ Get
+ Return m_DoorIndexOnMachine
+ End Get
+ End Property
+
+ Private m_LuaDoorList As New ObservableCollection(Of LuaDoor)
+ Public ReadOnly Property LuaDoorList As ObservableCollection(Of LuaDoor)
+ Get
+ Return m_LuaDoorList
+ End Get
+ End Property
+
+ Public ReadOnly Property VariableList_Visibility As Visibility
+ Get
+ Return If(GetPluginPrivateProfileInt(S_DEBUG, K_VARIABLELIST, 0) <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Public ReadOnly Property VariableOnDraw_Visibility As Visibility
+ Get
+ Return If(GetPluginPrivateProfileInt(S_DEBUG, K_VARIABLEONDRAW, 0) <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Public ReadOnly Property MachineCommands_Visibility As Visibility
+ Get
+ Return If(GetPluginPrivateProfileInt(S_DEBUG, K_MACHINECOMMANDS, 0) <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Public ReadOnly Property DoorCircList_Visibility As Visibility
+ Get
+ Return If(GetPluginPrivateProfileInt(S_DEBUG, K_DOORCIRCLIST, 0) <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
' Definizione comandi
Private m_cmdWriteVariable As ICommand
Private m_cmdMoveVariable As ICommand
+ Private m_cmdManageMachining As ICommand
Sub New()
m_VariableList = New ObservableCollection(Of Variable)({New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_00", "980", 1),
@@ -79,10 +151,15 @@ Public Class MachinePageVM
m_VarTimer.Interval = New TimeSpan(100)
m_VarTimer.Start()
m_DoorOnMachineList.Add(New Door(35, 1, "Test.ddf", "Produzione2024", 1, 800, 1800, 40, {""}, {""}))
+ Dim sResourcesDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_RESOURCESDIR, "", sResourcesDirPath)
+ m_sMachineImagePath = sResourcesDirPath & "\FiveLakesMachine.png"
End Sub
Friend Sub VarTimer_Tick()
- For Each Var In m_VariableList
+ ' leggo variabili da macchina
+ For nVarIndex As Integer = 0 To m_VariableList.Count - 1
+ Dim Var As Variable = m_VariableList(nVarIndex)
Select Case Var.Type
Case Variable.VariableTypes.INTEGER
Dim nIndex As Integer = 0
@@ -115,6 +192,77 @@ Public Class MachinePageVM
Map.refSupervisorFunction.PlgOutLog("Error! Reading Variable " & Var.sIndex & " on machine " & Var.nMachine & "failed!")
End If
End Select
+ If nVarIndex >= 5 AndAlso nVarIndex <= 9 Then
+ Dim nId As Integer = -1
+ If LuaGetGlobVar("ListaCircPorte." & Var.nValue & ".Id", nId) Then
+ m_DoorIndexOnMachine(nVarIndex - 5) = nId
+ Else
+ m_DoorIndexOnMachine(nVarIndex - 5) = 0
+ End If
+ End If
+ If nVarIndex >= 30 AndAlso nVarIndex <= 33 Then
+ Dim nId As Integer = -1
+ If LuaGetGlobVar("ListaCircPorte." & Var.nValue & ".Id", nId) Then
+ m_DoorIndexOnMachine(nVarIndex - 25) = nId
+ Else
+ m_DoorIndexOnMachine(nVarIndex - 25) = 0
+ End If
+ End If
+ Next
+ NotifyPropertyChanged(NameOf(DoorIndexOnMachine))
+ ' leggo stato calcolo da lua
+ Dim nState As Integer = -1
+ If LuaGetGlobVar("MACHINE1.DDfCalcState", nState) Then
+ SetDDfCalcState(nState)
+ End If
+ If LuaGetGlobVar("MACHINE1.NewDoorState", nState) Then
+ SetNewDoorState(nState)
+ End If
+ m_LuaDoorList.Clear()
+ For nDoorIndex = 1 To 10
+ Dim nId As Integer = -1
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".Id", nId)
+ Dim nCircIndex As Integer = -1
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".IndiceCirc", nCircIndex)
+ Dim nDoorState As Integer = -1
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".Stato", nDoorState)
+ Dim sDoorCode As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".CodicePorta", sDoorCode)
+ Dim sDoorDescription As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".DescrizionePorta", sDoorDescription)
+ Dim sDDFName As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".NomeDDF", sDDFName)
+ Dim sCSVName As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".NomeCSV", sCSVName)
+ Dim sM1CNPath As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".CN_macchina_1", sM1CNPath)
+ Dim sM2CNPath As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".CN_macchina_2", sM2CNPath)
+ Dim lLoadTime As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".tempo_carico", lLoadTime)
+ Dim lMachining1Start As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".tempo_inizio_lav_1", lMachining1Start)
+ Dim lMachining1End As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".tempo_fine_lav_1", lMachining1End)
+ Dim lMachining2Start As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".tempo_inizio_lav_2", lMachining2Start)
+ Dim lMachining2End As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".tempo_fine_lav_2", lMachining2End)
+ Dim lUnloadTime As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".tempo_scarico", lUnloadTime)
+ m_LuaDoorList.Add(New LuaDoor(nId, nCircIndex, nDoorState, sDoorCode, sDoorDescription, sDDFName, sCSVName, sM1CNPath, sM2CNPath, lLoadTime, lMachining1Start, lMachining1End, lMachining2Start, lMachining2End, lUnloadTime))
+ If nId > 0 Then
+ Dim Door As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nId = nId)
+ If nDoorState <> Door.nProdState Then
+ Door.SetProdState(nDoorState)
+ If lLoadTime > 0 Then Door.SetLoadTime(lLoadTime)
+ If lMachining1Start > 0 Then Door.SetMachining1Start(lMachining1Start)
+ If lMachining1End > 0 Then Door.SetMachining1End(lMachining1End)
+ If lMachining2Start > 0 Then Door.SetMachining2Start(lMachining2Start)
+ If lMachining2End > 0 Then Door.SetMachining2End(lMachining2End)
+ If lUnloadTime > 0 Then Door.SetUnloadTime(lUnloadTime)
+ End If
+ End If
Next
End Sub
@@ -132,34 +280,37 @@ Public Class MachinePageVM
End Property
Public Sub WriteVariable(sVariable As String)
- Dim sVariableArgs As String() = sVariable.Split(","c)
- Dim nMachineIndex As Integer = -1
- Integer.TryParse(sVariableArgs(0), nMachineIndex)
- Dim nVariableType As Integer = -1
- Integer.TryParse(sVariableArgs(1), nVariableType)
- Select Case nVariableType
- Case 1
- Dim nVarAddress As Integer = -1
- Integer.TryParse(sVariableArgs(2), nVarAddress)
- Dim nVarValue As Integer = -1
- Integer.TryParse(sVariableArgs(3), nVarValue)
- Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, nVarValue, nMachineIndex)
- Case 2
- Dim nVarAddress As Integer = -1
- Integer.TryParse(sVariableArgs(2), nVarAddress)
- Dim dVarValue As Double = -1
- StringToDouble(sVariableArgs(3), dVarValue)
- Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, dVarValue, nMachineIndex)
- Case 3
- Dim sVarAddress As String() = sVariableArgs(2).Split("."c)
- Dim nVarAddress As Integer = -1
- Integer.TryParse(sVarAddress(0), nVarAddress)
- Dim nBit As Integer = -1
- Integer.TryParse(sVarAddress(1), nBit)
- Dim nVarValue As Integer = -1
- Integer.TryParse(sVariableArgs(3), nVarValue)
- Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, nVarValue <> 0, nMachineIndex)
- End Select
+ Dim sVariables As String() = sVariable.Split(";"c)
+ For nVariableIndex As Integer = 0 To sVariables.Count - 1
+ Dim sVariableArgs As String() = sVariables(nVariableIndex).Split(","c)
+ Dim nMachineIndex As Integer = -1
+ Integer.TryParse(sVariableArgs(0), nMachineIndex)
+ Dim nVariableType As Integer = -1
+ Integer.TryParse(sVariableArgs(1), nVariableType)
+ Select Case nVariableType
+ Case 1
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVariableArgs(2), nVarAddress)
+ Dim nVarValue As Integer = -1
+ Integer.TryParse(sVariableArgs(3), nVarValue)
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, nVarValue, nMachineIndex)
+ Case 2
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVariableArgs(2), nVarAddress)
+ Dim dVarValue As Double = -1
+ StringToDouble(sVariableArgs(3), dVarValue)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, dVarValue, nMachineIndex)
+ Case 3
+ Dim sVarAddress As String() = sVariableArgs(2).Split("."c)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVarAddress(0), nVarAddress)
+ Dim nBit As Integer = -1
+ Integer.TryParse(sVarAddress(1), nBit)
+ Dim nVarValue As Integer = -1
+ Integer.TryParse(sVariableArgs(3), nVarValue)
+ Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, nVarValue <> 0, nMachineIndex)
+ End Select
+ Next
End Sub
#End Region ' WriteVariable
@@ -177,8 +328,35 @@ Public Class MachinePageVM
Public Sub MoveVariable(sVariableToMove As String)
Dim sVariableToMoveArgs As String() = sVariableToMove.Split({"->"}, StringSplitOptions.None)
+ Dim sFromAndPresenceVariables As String() = sVariableToMoveArgs(0).Split("/"c)
+ ' verifico presenza da variabile di partenza
+ Dim sVerifyFromVariables As String() = sFromAndPresenceVariables(0).Split(";"c)
+ Dim sVerifyFromVariableArgs As String() = sVerifyFromVariables(0).Split(","c)
+ Dim nVerifyFromMachineIndex As Integer = -1
+ Integer.TryParse(sVerifyFromVariableArgs(0), nVerifyFromMachineIndex)
+ Dim nVerifyFromVarAddress As Integer = -1
+ Integer.TryParse(sVerifyFromVariableArgs(2), nVerifyFromVarAddress)
+ Dim dVerifyFromVarValue As Double = -1
+ Map.refSupervisorFunction.ComReadShortVar(nVerifyFromVarAddress, dVerifyFromVarValue, nVerifyFromMachineIndex)
+ If dVerifyFromVarValue < 1 Then Return
+ ' verifco se variabile dopo macchina, che la macchina abbia lavorato
+ If nVerifyFromVarAddress = 1362 Then
+ Dim MachineStateVar As Variable = VariableList.FirstOrDefault(Function(x) x.nMachine = nVerifyFromMachineIndex AndAlso x.sName = "@STATE")
+ If MachineStateVar.nValue <> 3 AndAlso MachineStateVar.nValue <> 5 Then Return
+ End If
+ ' verifico che stazione di destinazione non sia gia' occupata
+ Dim sToAndPresenceVariables As String() = sVariableToMoveArgs(1).Split("/"c)
+ Dim sVerifyToVariables As String() = sToAndPresenceVariables(1).Split(";"c)
+ Dim sVerifyToVariableArgs As String() = sVerifyToVariables(0).Split(","c)
+ Dim nVerifyToMachineIndex As Integer = -1
+ Integer.TryParse(sVerifyToVariableArgs(0), nVerifyToMachineIndex)
+ Dim nVerifyToVarAddress As Integer = -1
+ Integer.TryParse(sVerifyToVariableArgs(2), nVerifyToVarAddress)
+ Dim dVerifyToVarValue As Double = -1
+ Map.refSupervisorFunction.ComReadDoubleVar(nVerifyToVarAddress, dVerifyToVarValue, nVerifyToMachineIndex)
+ If dVerifyToVarValue > 0 Then Return
' leggo variabili di partenza
- Dim sFromVariables As String() = sVariableToMoveArgs(0).Split(";"c)
+ Dim sFromVariables As String() = sFromAndPresenceVariables(0).Split(";"c)
Dim sFromVariableArgs As String() = sFromVariables(0).Split(","c)
Dim nFromMachineIndex As Integer = -1
Integer.TryParse(sFromVariableArgs(0), nFromMachineIndex)
@@ -204,8 +382,8 @@ Public Class MachinePageVM
Integer.TryParse(sVarAddress(1), nBit)
Map.refSupervisorFunction.ComReadBitVar(nVarAddress, nBit, bVarValue, nFromMachineIndex)
End Select
- ' scrivo valore in variabili di arivo
- Dim sToVariables As String() = sVariableToMoveArgs(1).Split(";"c)
+ ' scrivo valore in variabili di arrivo
+ Dim sToVariables As String() = sToAndPresenceVariables(0).Split(";"c)
For nToVariableIndex As Integer = 0 To sToVariables.Count - 1
Dim sToVariableArgs As String() = sToVariables(nToVariableIndex).Split(","c)
Dim nToMachineIndex As Integer = -1
@@ -270,10 +448,112 @@ Public Class MachinePageVM
Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, False, nFromMachineIndex)
End Select
Next
+ ' resetto presenza da variabili di partenza
+ Dim sFromPresenceVariables As String() = sFromAndPresenceVariables(1).Split(";"c)
+ For nFromPresenceVariableIndex As Integer = 0 To sFromPresenceVariables.Count - 1
+ Dim sFromPresenceVariableArgs As String() = sFromPresenceVariables(nFromPresenceVariableIndex).Split(","c)
+ Dim nFromPresenceMachineIndex As Integer = -1
+ Integer.TryParse(sFromPresenceVariableArgs(0), nFromPresenceMachineIndex)
+ Dim nFromPresenceVariableType As Integer = -1
+ Integer.TryParse(sFromPresenceVariableArgs(1), nFromPresenceVariableType)
+ Select Case nFromPresenceVariableType
+ Case 1
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromPresenceVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, 0, nFromPresenceMachineIndex)
+ Case 2
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromPresenceVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, 0, nFromPresenceMachineIndex)
+ Case 3
+ Dim sVarAddress As String() = sFromPresenceVariableArgs(2).Split("."c)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVarAddress(0), nVarAddress)
+ Dim nBit As Integer = -1
+ Integer.TryParse(sVarAddress(1), nBit)
+ Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, False, nFromPresenceMachineIndex)
+ End Select
+ Next
+ ' imposto presenza in variabili di arrivo
+ Dim sToPresenceVariables As String() = sToAndPresenceVariables(1).Split(";"c)
+ For nToPresenceVariableIndex As Integer = 0 To sToPresenceVariables.Count - 1
+ Dim sToPresenceVariableArgs As String() = sToPresenceVariables(nToPresenceVariableIndex).Split(","c)
+ Dim nToPresenceMachineIndex As Integer = -1
+ Integer.TryParse(sToPresenceVariableArgs(0), nToPresenceMachineIndex)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sToPresenceVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, 1, nToPresenceMachineIndex)
+ Next
End Sub
#End Region ' MoveVariable
+#Region "ManageMachining"
+
+ Public ReadOnly Property ManageMachining_Command As ICommand
+ Get
+ If m_cmdManageMachining Is Nothing Then
+ m_cmdManageMachining = New Command(AddressOf ManageMachining)
+ End If
+ Return m_cmdManageMachining
+ End Get
+ End Property
+
+ Public Sub ManageMachining(sArg As String)
+ Dim sArgs As String() = sArg.Split(","c)
+ Dim nMachineIndex As Integer = -1
+ Dim nStartStop As Integer = -1
+ Integer.TryParse(sArgs(0), nMachineIndex)
+ Integer.TryParse(sArgs(1), nStartStop)
+ Dim nVarAddress As Integer
+ If nMachineIndex = 1 Then
+ nVarAddress = 1352
+ ElseIf nMachineIndex = 2 Then
+ nVarAddress = 1352
+ Else Return
+ End If
+ Dim nState As Integer
+ Dim StateVariable As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@STATE")
+ Dim Sent1 As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@SENT_1")
+ Dim Sent2 As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@SENT_2")
+ Dim DoorPresence As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@WP_PR_02")
+ If StateVariable.nValue < 1 OrElse StateVariable.nValue > 5 Then Return
+ Select Case StateVariable.nValue
+ Case 0
+ Return
+ Case 1
+ If nStartStop = 1 AndAlso DoorPresence.dValue = 1 AndAlso Sent1.nValue = 1 Then
+ nState = 2
+ Map.refSupervisorFunction.ComWriteShortVar(Sent1.sIndex, 0, nMachineIndex)
+ Else Return
+ End If
+ Case 2
+ If nStartStop = 2 Then
+ nState = 3
+ Else Return
+ End If
+ Case 3
+ If nStartStop = 1 AndAlso DoorPresence.dValue = 1 AndAlso Sent2.nValue = 1 Then
+ nState = 4
+ Map.refSupervisorFunction.ComWriteShortVar(Sent2.sIndex, 0, nMachineIndex)
+ Else Return
+ End If
+ Case 4
+ If nStartStop = 2 Then
+ nState = 5
+ Else Return
+ End If
+ Case 5
+ If nStartStop = 1 Then
+ nState = 2
+ Else Return
+ End If
+ End Select
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, nState, nMachineIndex)
+ End Sub
+
+#End Region ' ManageMachining
+
#End Region ' COMMANDS
End Class
@@ -316,7 +596,17 @@ Public Class Variable
End Property
Private m_nValue As Integer
+ Friend ReadOnly Property nValue As Integer
+ Get
+ Return m_nValue
+ End Get
+ End Property
Private m_dValue As Double
+ Friend ReadOnly Property dValue As Integer
+ Get
+ Return m_dValue
+ End Get
+ End Property
Private m_bValue As Boolean
Public Property sValue As String
Get
@@ -371,3 +661,269 @@ Public Class Variable
End Sub
End Class
+
+Public Class LuaDoor
+ Inherits VMBase
+
+ Private m_nId As Integer = -1
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_nCircIndex As Integer = -1
+ Public ReadOnly Property nCircIndex As Integer
+ Get
+ Return m_nCircIndex
+ End Get
+ End Property
+
+ Private m_nState As Integer = 0
+ Public ReadOnly Property nState As Integer
+ Get
+ Return m_nState
+ End Get
+ End Property
+
+ Private m_sDoorCode As String = ""
+ Public ReadOnly Property sDoorCode As String
+ Get
+ Return m_sDoorCode
+ End Get
+ End Property
+
+ Private m_sDoorDescription As String = ""
+ Public ReadOnly Property sDoorDescription As String
+ Get
+ Return m_sDoorDescription
+ End Get
+ End Property
+
+ Private m_sDDFName As String = ""
+ Public ReadOnly Property sDDFName As String
+ Get
+ Return m_sDDFName
+ End Get
+ End Property
+
+ Private m_sCSVName As String = ""
+ Public ReadOnly Property sCSVName As String
+ Get
+ Return m_sCSVName
+ End Get
+ End Property
+
+ Private m_sM1CNPath As String = ""
+ Public ReadOnly Property sM1CNPath As String
+ Get
+ Return m_sM1CNPath
+ End Get
+ End Property
+
+ Private m_sM2CNPath As String = ""
+ Public ReadOnly Property sM2CNPath As String
+ Get
+ Return m_sM2CNPath
+ End Get
+ End Property
+
+ Private m_dtLoadTime As DateTime
+ Public ReadOnly Property sLoadTime As String
+ Get
+ Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining1Start As DateTime
+ Public ReadOnly Property sMachining1Start As String
+ Get
+ Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining1End As DateTime
+ Public ReadOnly Property sMachining1End As String
+ Get
+ Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining2Start As DateTime
+ Public ReadOnly Property sMachining2Start As String
+ Get
+ Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining2End As DateTime
+ Public ReadOnly Property sMachining2End As String
+ Get
+ Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtUnloadTime As DateTime
+ Public ReadOnly Property sUnloadTime As String
+ Get
+ Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Sub New(nId As Integer, nCircIndex As Integer, nState As Integer, sDoorCode As String, sDoorDescription As String, sDDFName As String, sCSVName As String,
+ sM1CNPath As String, sM2CNPath As String, lLoadTime As Long, lMachining1Start As Long, lMachining1End As Long, lMachining2Start As Long, lMachining2End As Long, lUnloadTime As Long)
+ m_nId = nId
+ m_nCircIndex = nCircIndex
+ m_nState = nState
+ m_sDoorCode = sDoorCode
+ m_sDoorDescription = sDoorDescription
+ m_sDDFName = sDDFName
+ m_sCSVName = sCSVName
+ m_sM1CNPath = sM1CNPath
+ m_sM2CNPath = sM2CNPath
+ m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lLoadTime).ToLocalTime()
+ m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lMachining1Start).ToLocalTime()
+ m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lMachining1End).ToLocalTime()
+ m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lMachining2Start).ToLocalTime()
+ m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lMachining2End).ToLocalTime()
+ m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lUnloadTime).ToLocalTime()
+ End Sub
+
+End Class
+
+Public Class StringToVisibilityConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return Visibility.Collapsed
+ Dim sValue As String = value
+ Dim sLowerValue As String = sValue.ToLower()
+ If sLowerValue = "true" Then Return Visibility.Visible
+ If sLowerValue = "false" Then Return Visibility.Collapsed
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return Visibility.Collapsed
+ Return If(nValue <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToMachineStateConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return Visibility.Collapsed
+ Dim sValue As String = value
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return ""
+ Select Case nValue
+ Case -1
+ Return "Not Initialized"
+ Case 0
+ Return "Reset"
+ Case 1
+ Return "Initialized"
+ Case 2
+ Return "Start machining 1000"
+ Case 3
+ Return "End machining 1000"
+ Case 4
+ Return "Start machining 2000"
+ Case 5
+ Return "End machining 2000"
+ Case Else
+ Return "Unknown State"
+ End Select
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToDDFCalcStateConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is Integer Then Return value
+ Dim sValue As String = value
+ Dim nValue As Integer = value
+ Select Case nValue
+ Case 0
+ Return "Null"
+ Case 1
+ Return "Running"
+ Case 2
+ Return "Result"
+ Case Else
+ Return value
+ End Select
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToNewDoorStateConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is Integer Then Return value
+ Dim nValue As Integer = value
+ Select Case nValue
+ Case 0
+ Return "Null"
+ Case 1
+ Return "Present"
+ Case 2
+ Return "Assigned"
+ Case Else
+ Return value
+ End Select
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToBooleanConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return False
+ Dim sValue As String = value
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return False
+ Return nValue <> 0
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToBackgroundConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return False
+ Dim sValue As String = value
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return Brushes.LightGray
+ Return If(nValue <> 0, Brushes.Green, Brushes.LightGray)
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
diff --git a/Supervisor.Plugin.FiveLakes/MainMenu/MainMenuV.xaml b/Supervisor.Plugin.FiveLakes/MainMenu/MainMenuV.xaml
index 59bde0d..142cf0f 100644
--- a/Supervisor.Plugin.FiveLakes/MainMenu/MainMenuV.xaml
+++ b/Supervisor.Plugin.FiveLakes/MainMenu/MainMenuV.xaml
@@ -1,17 +1,32 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:sys="clr-namespace:System;assembly=mscorlib"
+ DataContext="{StaticResource MainMenuVM}"
+ WindowChrome.IsHitTestVisibleInChrome="True">
+
+ 0
+ 1
+ 2
+
-
-
-
+
+
+
diff --git a/Supervisor.Plugin.FiveLakes/MainMenu/MainMenuVM.vb b/Supervisor.Plugin.FiveLakes/MainMenu/MainMenuVM.vb
index b468f09..5e92528 100644
--- a/Supervisor.Plugin.FiveLakes/MainMenu/MainMenuVM.vb
+++ b/Supervisor.Plugin.FiveLakes/MainMenu/MainMenuVM.vb
@@ -1,28 +1,27 @@
Public Class MainMenuVM
+ Inherits VMBase
' Definizione comandi
- Private m_cmdDoorList As ICommand
- Private m_cmdMachineStatus As ICommand
- Private m_cmdStatistics As ICommand
+ Private m_cmdPage As ICommand
#Region "COMMANDS"
-#Region "DoorList"
+#Region "Page"
- Public ReadOnly Property DoorList_Command As ICommand
+ Public ReadOnly Property Page_Command As ICommand
Get
- If m_cmdDoorList Is Nothing Then
- m_cmdDoorList = New Command(AddressOf DoorList)
+ If m_cmdPage Is Nothing Then
+ m_cmdPage = New Command(AddressOf Page)
End If
- Return m_cmdDoorList
+ Return m_cmdPage
End Get
End Property
- Public Sub DoorList()
-
+ Public Sub Page(nPage As Integer)
+ Map.refFiveLakesUIVM.SetSelPage(nPage)
End Sub
-#End Region ' DoorList
+#End Region ' Page
#End Region ' COMMANDS
diff --git a/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml b/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml
new file mode 100644
index 0000000..7e86205
--- /dev/null
+++ b/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml.vb b/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml.vb
new file mode 100644
index 0000000..2113c27
--- /dev/null
+++ b/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class StatisticsPageV
+
+End Class
diff --git a/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageVM.vb b/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageVM.vb
new file mode 100644
index 0000000..209e57c
--- /dev/null
+++ b/Supervisor.Plugin.FiveLakes/StatisticsPage/StatisticsPageVM.vb
@@ -0,0 +1,3 @@
+Public Class StatisticsPageVM
+
+End Class
diff --git a/Supervisor.Plugin.FiveLakes/Supervisor.Plugin.FiveLakes.vbproj b/Supervisor.Plugin.FiveLakes/Supervisor.Plugin.FiveLakes.vbproj
index f7c18d3..62f9ef4 100644
--- a/Supervisor.Plugin.FiveLakes/Supervisor.Plugin.FiveLakes.vbproj
+++ b/Supervisor.Plugin.FiveLakes/Supervisor.Plugin.FiveLakes.vbproj
@@ -120,6 +120,10 @@
+
+ StatisticsPageV.xaml
+
+ Dictionary.xaml
@@ -176,12 +180,15 @@
DesignerMSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+ DesignerMSBuild:Compile
- powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)
diff --git a/Supervisor.Plugin.FiveLakes/Utility/Dictionary.xaml b/Supervisor.Plugin.FiveLakes/Utility/Dictionary.xaml
index 1e8874f..e761c10 100644
--- a/Supervisor.Plugin.FiveLakes/Utility/Dictionary.xaml
+++ b/Supervisor.Plugin.FiveLakes/Utility/Dictionary.xaml
@@ -10,8 +10,10 @@
it in xaml file(ProjectView.xaml).
-->
+
+
@@ -24,6 +26,12 @@
+
+
+
+
+
+
diff --git a/Supervisor.Plugin.FiveLakes/Utility/JsonUtility.vb b/Supervisor.Plugin.FiveLakes/Utility/JsonUtility.vb
index 05814af..7a8431e 100644
--- a/Supervisor.Plugin.FiveLakes/Utility/JsonUtility.vb
+++ b/Supervisor.Plugin.FiveLakes/Utility/JsonUtility.vb
@@ -83,8 +83,64 @@ Public Class JsonDoor
End Get
End Property
+#Region "Statistics"
+
+ Private m_nProdState As DoorProdStates = DoorProdStates.NOT_INIT
+
+
+ Public ReadOnly Property nProdState As DoorProdStates
+ Get
+ Return m_nProdState
+ End Get
+ End Property
+
+ Private m_dtLoadTime As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtLoadTime As DateTime
+ Get
+ Return m_dtLoadTime
+ End Get
+ End Property
+
+ Private m_dtMachining1Start As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachining1Start As DateTime
+ Get
+ Return m_dtMachining1Start
+ End Get
+ End Property
+
+ Private m_dtMachining1End As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachining1End As DateTime
+ Get
+ Return m_dtMachining1End
+ End Get
+ End Property
+
+ Private m_dtMachining2Start As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachining2Start As DateTime
+ Get
+ Return m_dtMachining2Start
+ End Get
+ End Property
+
+ Private m_dtMachining2End As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachining2End As DateTime
+ Get
+ Return m_dtMachining2End
+ End Get
+ End Property
+
+ Private m_dtUnloadTime As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtUnloadTime As DateTime
+ Get
+ Return m_dtUnloadTime
+ End Get
+ End Property
+
+#End Region ' Statistics
+
- Sub New(nListIndex As Integer, nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nState As DoorStates, CustomerParameters As List(Of CustomerParameter))
+ Sub New(nListIndex As Integer, nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nState As DoorStates, CustomerParameters As List(Of CustomerParameter),
+ nProdState As DoorProdStates, dtLoadTime As DateTime, dtMachining1Start As DateTime, dtMachining1End As DateTime, dtMachining2Start As DateTime, dtMachining2End As DateTime, dtUnloadTime As DateTime)
m_nListIndex = nListIndex
m_nId = nId
m_nCSVLine = nCSVLine
@@ -96,6 +152,13 @@ Public Class JsonDoor
m_dThickness = dThickness
m_nState = nState
m_CustomerParameters = CustomerParameters
+ m_nProdState = nProdState
+ m_dtLoadTime = dtLoadTime
+ m_dtMachining1Start = dtMachining1Start
+ m_dtMachining1End = dtMachining1End
+ m_dtMachining2Start = dtMachining2Start
+ m_dtMachining2End = dtMachining2End
+ m_dtUnloadTime = dtUnloadTime
End Sub
Sub New(nListIndex As Integer, Door As Door)
@@ -110,6 +173,13 @@ Public Class JsonDoor
m_dThickness = Door.dThickness
m_nState = Door.nState
m_CustomerParameters = Door.CustomerParameters
+ m_nProdState = Door.nProdState
+ m_dtLoadTime = Door.dtLoadTime
+ m_dtMachining1Start = Door.dtMachining1Start
+ m_dtMachining1End = Door.dtMachining1End
+ m_dtMachining2Start = Door.dtMachining2Start
+ m_dtMachining2End = Door.dtMachining2End
+ m_dtUnloadTime = Door.dtUnloadTime
End Sub
End Class