Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f11963c4f | |||
| e9d71da793 | |||
| 7c3facdab9 | |||
| 070f0afd21 | |||
| 497d367d8c | |||
| 6ab6be0703 | |||
| 622a6da893 | |||
| 27f1b9b99d | |||
| bb8c88cfbc | |||
| 5c041a28b3 | |||
| 696682745a | |||
| 58d209aab7 |
@@ -22,7 +22,12 @@ Module ConstIni
|
|||||||
Public Const K_DDFDIR As String = "DDFDir"
|
Public Const K_DDFDIR As String = "DDFDir"
|
||||||
Public Const K_DDTDIR As String = "DDTDir"
|
Public Const K_DDTDIR As String = "DDTDir"
|
||||||
Public Const K_GENDDFDIR As String = "GenDDFDir"
|
Public Const K_GENDDFDIR As String = "GenDDFDir"
|
||||||
Public Const K_CSVOUTPUT As String = "CSVOutput"
|
Public Const K_CSV As String = "CSV"
|
||||||
|
Public Const K_ISCSVOUTPUTENABLED As String = "IsCSVOutputEnabled"
|
||||||
|
Public Const K_CSVOUTPUTPATH As String = "CSVOutputPath"
|
||||||
|
Public Const K_RESTART_WINPLACE As String = "RestartWinPlace"
|
||||||
|
Public Const K_LASTPRODUCTIONDIR As String = "LastProductionDir"
|
||||||
|
Public Const K_LASTCSVDIR As String = "LastCsvDir"
|
||||||
|
|
||||||
Public Const S_CSV As String = "CSV"
|
Public Const S_CSV As String = "CSV"
|
||||||
Public Const K_DDFNAME As String = "DDFName"
|
Public Const K_DDFNAME As String = "DDFName"
|
||||||
@@ -38,6 +43,12 @@ Module ConstIni
|
|||||||
Public Const K_MANUALADDEDDOORNAME As String = "ManualAddedDoorName"
|
Public Const K_MANUALADDEDDOORNAME As String = "ManualAddedDoorName"
|
||||||
Public Const K_DELIMITER As String = "Delimiter"
|
Public Const K_DELIMITER As String = "Delimiter"
|
||||||
|
|
||||||
|
Public Const S_PRODUCTION As String = "Production"
|
||||||
|
Public Const K_CUSTOMER As String = "Customer"
|
||||||
|
Public Const K_ORDER As String = "Order"
|
||||||
|
Public Const K_SEQUENCE As String = "Sequence"
|
||||||
|
Public Const K_TICKET As String = "Ticket"
|
||||||
|
|
||||||
Public Const S_DEBUG As String = "Debug"
|
Public Const S_DEBUG As String = "Debug"
|
||||||
Public Const K_VARIABLELIST As String = "VariableList"
|
Public Const K_VARIABLELIST As String = "VariableList"
|
||||||
Public Const K_VARIABLEONDRAW As String = "VariableOnDraw"
|
Public Const K_VARIABLEONDRAW As String = "VariableOnDraw"
|
||||||
|
|||||||
@@ -25,12 +25,19 @@
|
|||||||
Style="{StaticResource Button_Image}"/>
|
Style="{StaticResource Button_Image}"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button ToolTip="Delete CSV file"
|
<Button ToolTip="Delete CSV file"
|
||||||
Command="{Binding DeleteAll_Command}"
|
Command="{Binding DeleteCSV_Command}"
|
||||||
IsEnabled="{Binding bExecButton_IsEnabled}"
|
IsEnabled="{Binding bExecButton_IsEnabled}"
|
||||||
Style="{StaticResource DoorList_Button}">
|
Style="{StaticResource DoorList_Button}">
|
||||||
<Image Source="../Resources/DoorListPage/DeleteCsv.png"
|
<Image Source="../Resources/DoorListPage/DeleteCsv.png"
|
||||||
Style="{StaticResource Button_Image}"/>
|
Style="{StaticResource Button_Image}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button ToolTip="Delete All CSV files"
|
||||||
|
Command="{Binding DeleteAll_Command}"
|
||||||
|
IsEnabled="{Binding bExecButton_IsEnabled}"
|
||||||
|
Style="{StaticResource DoorList_Button}">
|
||||||
|
<Image Source="../Resources/DoorListPage/DeleteAll.png"
|
||||||
|
Style="{StaticResource Button_Image}"/>
|
||||||
|
</Button>
|
||||||
<Button ToolTip="Send selected door to production"
|
<Button ToolTip="Send selected door to production"
|
||||||
Command="{Binding Produce_Command}"
|
Command="{Binding Produce_Command}"
|
||||||
Style="{StaticResource DoorList_Button}">
|
Style="{StaticResource DoorList_Button}">
|
||||||
@@ -110,6 +117,13 @@
|
|||||||
<Image Source="../Resources/DoorListPage/Verify.png"
|
<Image Source="../Resources/DoorListPage/Verify.png"
|
||||||
Style="{StaticResource Button_Image}"/>
|
Style="{StaticResource Button_Image}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
<!--<Button ToolTip="Open production CSV file"
|
||||||
|
Command="{Binding OpenProduction_Command}"
|
||||||
|
IsEnabled="{Binding bExecButton_IsEnabled}"
|
||||||
|
Style="{StaticResource DoorList_Button}">
|
||||||
|
<Image Source="../Resources/DoorListPage/OpenProduction.png"
|
||||||
|
Style="{StaticResource Button_Image}"/>
|
||||||
|
</Button>-->
|
||||||
<TextBlock Text="{Binding sExecPercentage}"
|
<TextBlock Text="{Binding sExecPercentage}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Margin="10,0,5,0"
|
Margin="10,0,5,0"
|
||||||
|
|||||||
@@ -94,11 +94,13 @@ Public Class DoorListPageVM
|
|||||||
Private m_cmdMoveUp As ICommand
|
Private m_cmdMoveUp As ICommand
|
||||||
Private m_cmdMoveDown As ICommand
|
Private m_cmdMoveDown As ICommand
|
||||||
Private m_cmdDelete As ICommand
|
Private m_cmdDelete As ICommand
|
||||||
|
Private m_cmdDeleteCSV As ICommand
|
||||||
Private m_cmdDeleteAll As ICommand
|
Private m_cmdDeleteAll As ICommand
|
||||||
Private m_cmdProduce As ICommand
|
Private m_cmdProduce As ICommand
|
||||||
Private m_cmdProduceAll As ICommand
|
Private m_cmdProduceAll As ICommand
|
||||||
Private m_cmdResetProductionQueue As ICommand
|
Private m_cmdResetProductionQueue As ICommand
|
||||||
Private m_cmdVerify As ICommand
|
Private m_cmdVerify As ICommand
|
||||||
|
Private m_cmdOpenProduction As ICommand
|
||||||
|
|
||||||
#Region "CONSTRUCTOR"
|
#Region "CONSTRUCTOR"
|
||||||
|
|
||||||
@@ -133,17 +135,20 @@ Public Class DoorListPageVM
|
|||||||
AddHandler m_RefreshGraphicsTimer.Tick, AddressOf RefreshGraphicsTimer_Tick
|
AddHandler m_RefreshGraphicsTimer.Tick, AddressOf RefreshGraphicsTimer_Tick
|
||||||
m_BackupTimer.Start()
|
m_BackupTimer.Start()
|
||||||
' verifico path salvataggio CSV
|
' verifico path salvataggio CSV
|
||||||
Dim bStartWriteCSV As Boolean = True
|
Dim bStartWriteCSV As Boolean = False
|
||||||
If GetPluginPrivateProfileString(S_GENERAL, K_CSVOUTPUT, "", m_sCSVOutDirPath) = 0 Then
|
If GetPluginPrivateProfileInt(S_GENERAL, K_ISCSVOUTPUTENABLED, 0) = 1 Then
|
||||||
bStartWriteCSV = False
|
bStartWriteCSV = True
|
||||||
MessageBox.Show("Path di salvataggio CSV non impostata! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
|
If GetPluginPrivateProfileString(S_GENERAL, K_CSVOUTPUTPATH, "", m_sCSVOutDirPath) = 0 Then
|
||||||
End If
|
bStartWriteCSV = False
|
||||||
If bStartWriteCSV AndAlso Not Directory.Exists(m_sCSVOutDirPath) Then
|
MessageBox.Show("Path di salvataggio CSV non impostata! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||||
bStartWriteCSV = False
|
End If
|
||||||
MessageBox.Show("Path di salvataggio CSV impostata non esiste! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
|
If bStartWriteCSV AndAlso Not Directory.Exists(m_sCSVOutDirPath) Then
|
||||||
End If
|
bStartWriteCSV = False
|
||||||
If bStartWriteCSV Then
|
MessageBox.Show("Path di salvataggio CSV impostata non esiste! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||||
m_WriteCSVTimer.Start()
|
End If
|
||||||
|
If bStartWriteCSV Then
|
||||||
|
m_WriteCSVTimer.Start()
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
m_RefreshGraphicsTimer.Start()
|
m_RefreshGraphicsTimer.Start()
|
||||||
End Sub
|
End Sub
|
||||||
@@ -324,10 +329,15 @@ Public Class DoorListPageVM
|
|||||||
|
|
||||||
Friend Function NewDoorId() As Integer
|
Friend Function NewDoorId() As Integer
|
||||||
Dim nId As Integer = 1
|
Dim nId As Integer = 1
|
||||||
If m_DoorList.Count > 0 Then
|
Dim nMaxCircDoorListId As Integer = 0
|
||||||
Dim nMaxId As Integer = m_DoorList.Max(Of Integer)(Function(x) x.nId)
|
If Map.refMachinePageVM.LuaDoorList.Count > 0 Then
|
||||||
nId = nMaxId + 1
|
nMaxCircDoorListId = Map.refMachinePageVM.LuaDoorList.Max(Of Integer)(Function(x) x.nId)
|
||||||
End If
|
End If
|
||||||
|
Dim nMaxDoorListId As Integer = 0
|
||||||
|
If m_DoorList.Count > 0 Then
|
||||||
|
nMaxDoorListId = m_DoorList.Max(Of Integer)(Function(x) x.nId)
|
||||||
|
End If
|
||||||
|
nId = Math.Max(nMaxDoorListId, nMaxCircDoorListId) + 1
|
||||||
Return nId
|
Return nId
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
@@ -348,7 +358,7 @@ Public Class DoorListPageVM
|
|||||||
|
|
||||||
Public Sub OpenCSV()
|
Public Sub OpenCSV()
|
||||||
Dim sDir As String = String.Empty
|
Dim sDir As String = String.Empty
|
||||||
'GetMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, "", sDir)
|
GetPluginPrivateProfileString(S_GENERAL, K_LASTCSVDIR, "", sDir)
|
||||||
Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() With {
|
Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() With {
|
||||||
.DefaultExt = ".csv",
|
.DefaultExt = ".csv",
|
||||||
.Filter = "CSV (*.csv)|*.csv",
|
.Filter = "CSV (*.csv)|*.csv",
|
||||||
@@ -356,6 +366,7 @@ Public Class DoorListPageVM
|
|||||||
.CheckFileExists = True,
|
.CheckFileExists = True,
|
||||||
.ValidateNames = True}
|
.ValidateNames = True}
|
||||||
If OpenFileDialog.ShowDialog() Then
|
If OpenFileDialog.ShowDialog() Then
|
||||||
|
WritePluginPrivateProfileString(S_GENERAL, K_LASTCSVDIR, Path.GetDirectoryName(OpenFileDialog.FileName))
|
||||||
Dim sCSVPath As String = OpenFileDialog.FileName
|
Dim sCSVPath As String = OpenFileDialog.FileName
|
||||||
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(sCSVPath)
|
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(sCSVPath)
|
||||||
MyReader.TextFieldType = FileIO.FieldType.Delimited
|
MyReader.TextFieldType = FileIO.FieldType.Delimited
|
||||||
@@ -499,7 +510,7 @@ Public Class DoorListPageVM
|
|||||||
If sExtension.ToLower() = ".ddf" Then
|
If sExtension.ToLower() = ".ddf" Then
|
||||||
Dim sDDFFilePath As String = sDDFDirPath & "\" & sDDFName
|
Dim sDDFFilePath As String = sDDFDirPath & "\" & sDDFName
|
||||||
If Not File.Exists(sDDFFilePath) Then
|
If Not File.Exists(sDDFFilePath) Then
|
||||||
Dim sErr As String = "Il nome inserito (" & sDDFFilePath & ") non corrisponde a nessun file nella cartella dei Ddf (" & sDDFDirPath & ")"
|
Dim sErr As String = "The inserted name (" & sDDFFilePath & ") do not correspond to any file in the Ddf folder (" & sDDFDirPath & ")"
|
||||||
Map.refSupervisorFunction.PlgOutLog(sErr)
|
Map.refSupervisorFunction.PlgOutLog(sErr)
|
||||||
sErrMessage &= "- " & sErr & Environment.NewLine
|
sErrMessage &= "- " & sErr & Environment.NewLine
|
||||||
Dim ErrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = nId)
|
Dim ErrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = nId)
|
||||||
@@ -537,7 +548,7 @@ Public Class DoorListPageVM
|
|||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Dim sErr As String = "Estensione del file non riconosciuta!"
|
Dim sErr As String = "File extension not recognized!"
|
||||||
Map.refSupervisorFunction.PlgOutLog(sErr)
|
Map.refSupervisorFunction.PlgOutLog(sErr)
|
||||||
sErrMessage &= "- " & sErr & Environment.NewLine
|
sErrMessage &= "- " & sErr & Environment.NewLine
|
||||||
Dim ErrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = nId)
|
Dim ErrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = nId)
|
||||||
@@ -921,8 +932,9 @@ Public Class DoorListPageVM
|
|||||||
|
|
||||||
Public Sub Delete()
|
Public Sub Delete()
|
||||||
If m_DoorList.Count = 0 OrElse IsNothing(SelDoor) OrElse String.Compare(SelDoor.sCSVName, m_ManualAddedDoorName, True) <> 0 Then Return
|
If m_DoorList.Count = 0 OrElse IsNothing(SelDoor) OrElse String.Compare(SelDoor.sCSVName, m_ManualAddedDoorName, True) <> 0 Then Return
|
||||||
Dim bReset As Boolean = True
|
Dim bResetM1 As Boolean = True
|
||||||
If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then
|
Dim bResetM2 As Boolean = True
|
||||||
|
If Not LuaGetGlobVar("bReset_M1", bResetM1) OrElse Not bResetM1 AndAlso Not LuaGetGlobVar("bReset_M2", bResetM2) OrElse Not bResetM2 Then
|
||||||
If (SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.DoorStates.MACHINE_2_END) Then Return
|
If (SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.DoorStates.MACHINE_2_END) Then Return
|
||||||
End If
|
End If
|
||||||
If MessageBox.Show("Are you sure you want to delete the selected door?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
|
If MessageBox.Show("Are you sure you want to delete the selected door?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
|
||||||
@@ -933,21 +945,22 @@ Public Class DoorListPageVM
|
|||||||
|
|
||||||
#End Region ' Delete
|
#End Region ' Delete
|
||||||
|
|
||||||
#Region "DeleteAll"
|
#Region "DeleteCSV"
|
||||||
|
|
||||||
Public ReadOnly Property DeleteAll_Command As ICommand
|
Public ReadOnly Property DeleteCSV_Command As ICommand
|
||||||
Get
|
Get
|
||||||
If m_cmdDeleteAll Is Nothing Then
|
If m_cmdDeleteCSV Is Nothing Then
|
||||||
m_cmdDeleteAll = New Command(AddressOf DeleteAll)
|
m_cmdDeleteCSV = New Command(AddressOf DeleteCSV)
|
||||||
End If
|
End If
|
||||||
Return m_cmdDeleteAll
|
Return m_cmdDeleteCSV
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Sub DeleteAll()
|
Public Sub DeleteCSV()
|
||||||
If m_DoorList.Count = 0 OrElse IsNothing(SelDoor) OrElse String.Compare(SelDoor.sCSVName, m_ManualAddedDoorName, True) = 0 Then Return
|
If m_DoorList.Count = 0 OrElse IsNothing(SelDoor) OrElse String.Compare(SelDoor.sCSVName, m_ManualAddedDoorName, True) = 0 Then Return
|
||||||
Dim bReset As Boolean = True
|
Dim bResetM1 As Boolean = True
|
||||||
If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then
|
Dim bResetM2 As Boolean = True
|
||||||
|
If Not LuaGetGlobVar("bReset_M1", bResetM1) OrElse Not bResetM1 AndAlso Not LuaGetGlobVar("bReset_M2", bResetM2) OrElse Not bResetM2 Then
|
||||||
If (SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.DoorStates.MACHINE_2_END) Then Return
|
If (SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.DoorStates.MACHINE_2_END) Then Return
|
||||||
End If
|
End If
|
||||||
Dim sSelCSVName As String = SelDoor.sCSVName
|
Dim sSelCSVName As String = SelDoor.sCSVName
|
||||||
@@ -975,6 +988,56 @@ Public Class DoorListPageVM
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
#End Region ' DeleteCSV
|
||||||
|
|
||||||
|
#Region "DeleteAll"
|
||||||
|
|
||||||
|
Public ReadOnly Property DeleteAll_Command As ICommand
|
||||||
|
Get
|
||||||
|
If m_cmdDeleteAll Is Nothing Then
|
||||||
|
m_cmdDeleteAll = New Command(AddressOf DeleteAll)
|
||||||
|
End If
|
||||||
|
Return m_cmdDeleteAll
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public Sub DeleteAll()
|
||||||
|
If m_DoorList.Count = 0 Then Return
|
||||||
|
Dim bResetM1 As Boolean = True
|
||||||
|
Dim bResetM2 As Boolean = True
|
||||||
|
If Not LuaGetGlobVar("bReset_M1", bResetM1) OrElse Not bResetM1 OrElse Not LuaGetGlobVar("bReset_M2", bResetM2) OrElse Not bResetM2 Then
|
||||||
|
MessageBox.Show("Delete all doors impossible!" & Environment.NewLine & "Machines needs to be both in Reset state to be able to delete all doors!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
' verifico che tutte le porte siano in stato prodotto o da non produrre
|
||||||
|
Dim bAllProduced As Boolean = True
|
||||||
|
For Each CsvDoor In m_DoorList
|
||||||
|
If CsvDoor.nState <> DoorStates.MACHINE_2_END AndAlso CsvDoor.nState <> DoorStates.PRODUCED AndAlso CsvDoor.nState <> DoorStates.NOTPRODUCE AndAlso CsvDoor.nState <> DoorStates.VERIFICATION_FAILED AndAlso CsvDoor.nState <> DoorStates.VERIFIED Then
|
||||||
|
bAllProduced = False
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If Not bAllProduced Then
|
||||||
|
MessageBox.Show("All CSV delete impossible!" & Environment.NewLine & "To be able to delete all doors, they all need to be not in machining!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
If MessageBox.Show("Are you sure you want to delete all the CSV files?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
|
||||||
|
For CsvDoorIndex = m_DoorList.Count - 1 To 0 Step -1
|
||||||
|
Dim CsvDoor As Door = m_DoorList(CsvDoorIndex)
|
||||||
|
m_DoorList.Remove(CsvDoor)
|
||||||
|
Next
|
||||||
|
WriteBackup()
|
||||||
|
' cancello backup lua per ripartire pulito
|
||||||
|
Try
|
||||||
|
Dim sBackupDirPath As String = ""
|
||||||
|
GetPluginPrivateProfileString(S_GENERAL, K_BACKUPDIR, "", sBackupDirPath)
|
||||||
|
Dim sLuaBackupFilePath As String = sBackupDirPath & "\LuaBackup.json"
|
||||||
|
File.Delete(sLuaBackupFilePath)
|
||||||
|
Catch ex As Exception
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Lua Backup file delete failed!")
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
#End Region ' DeleteAll
|
#End Region ' DeleteAll
|
||||||
|
|
||||||
#Region "Produce"
|
#Region "Produce"
|
||||||
@@ -994,10 +1057,7 @@ Public Class DoorListPageVM
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub ProduceDoor(DoorToProduce As Door, Optional bWriteBackup As Boolean = True)
|
Public Sub ProduceDoor(DoorToProduce As Door, Optional bWriteBackup As Boolean = True)
|
||||||
If IsNothing(DoorToProduce) OrElse DoorToProduce.nState = Door.DoorStates.SKIPPED OrElse
|
If IsNothing(DoorToProduce) OrElse DoorToProduce.nState <> Door.DoorStates.VERIFIED Then Return
|
||||||
DoorToProduce.nState = Door.DoorStates.NOTPRODUCE OrElse
|
|
||||||
DoorToProduce.nState = Door.DoorStates.VERIFICATION_FAILED OrElse
|
|
||||||
DoorToProduce.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
|
|
||||||
' la sposto dopo l'ultima da produrre
|
' la sposto dopo l'ultima da produrre
|
||||||
Dim nNewIndex As Integer = m_DoorList.IndexOf(m_DoorList.FirstOrDefault(Function(x) x.nState < Door.DoorStates.READY_FOR_PRODUCTION))
|
Dim nNewIndex As Integer = m_DoorList.IndexOf(m_DoorList.FirstOrDefault(Function(x) x.nState < Door.DoorStates.READY_FOR_PRODUCTION))
|
||||||
Dim nOldIndex As Integer = m_DoorList.IndexOf(DoorToProduce)
|
Dim nOldIndex As Integer = m_DoorList.IndexOf(DoorToProduce)
|
||||||
@@ -1121,6 +1181,91 @@ Public Class DoorListPageVM
|
|||||||
|
|
||||||
#End Region ' Verify
|
#End Region ' Verify
|
||||||
|
|
||||||
|
#Region "OpenProduction"
|
||||||
|
|
||||||
|
Public ReadOnly Property OpenProduction_Command As ICommand
|
||||||
|
Get
|
||||||
|
If m_cmdOpenProduction Is Nothing Then
|
||||||
|
m_cmdOpenProduction = New Command(AddressOf OpenProduction)
|
||||||
|
End If
|
||||||
|
Return m_cmdOpenProduction
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public Sub OpenProduction()
|
||||||
|
Dim sDir As String = String.Empty
|
||||||
|
GetPluginPrivateProfileString(S_GENERAL, K_LASTPRODUCTIONDIR, "", sDir)
|
||||||
|
Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() With {
|
||||||
|
.DefaultExt = ".csv",
|
||||||
|
.Filter = "CSV (*.csv)|*.csv",
|
||||||
|
.InitialDirectory = If(Directory.Exists(sDir), sDir, ""),
|
||||||
|
.CheckFileExists = True,
|
||||||
|
.ValidateNames = True}
|
||||||
|
If OpenFileDialog.ShowDialog() Then
|
||||||
|
WritePluginPrivateProfileString(S_GENERAL, K_LASTPRODUCTIONDIR, Path.GetDirectoryName(OpenFileDialog.FileName))
|
||||||
|
Dim sProductionCsvPath As String = OpenFileDialog.FileName
|
||||||
|
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(sProductionCsvPath)
|
||||||
|
MyReader.TextFieldType = FileIO.FieldType.Delimited
|
||||||
|
Dim sDelimiter As String = ""
|
||||||
|
GetPluginPrivateProfileString(S_CSV, K_DELIMITER, ";", sDelimiter)
|
||||||
|
MyReader.SetDelimiters(sDelimiter)
|
||||||
|
' leggo intestazione
|
||||||
|
Dim Headers As String() = MyReader.ReadFields()
|
||||||
|
Dim sCustomer As String = ""
|
||||||
|
Dim sOrder As String = ""
|
||||||
|
Dim sSequence As String = ""
|
||||||
|
Dim sTicket As String = ""
|
||||||
|
GetPluginPrivateProfileString(S_PRODUCTION, K_CUSTOMER, "CUST", sCustomer)
|
||||||
|
GetPluginPrivateProfileString(S_PRODUCTION, K_ORDER, "ORDER", sOrder)
|
||||||
|
GetPluginPrivateProfileString(S_PRODUCTION, K_SEQUENCE, "SEQ", sSequence)
|
||||||
|
GetPluginPrivateProfileString(S_PRODUCTION, K_TICKET, "TICKET", sTicket)
|
||||||
|
Dim nCustomerNameIndex As Integer = Array.IndexOf(Headers, sCustomer)
|
||||||
|
Dim nOrderNameIndex As Integer = Array.IndexOf(Headers, sOrder)
|
||||||
|
Dim nSequenceNameIndex As Integer = Array.IndexOf(Headers, sSequence)
|
||||||
|
Dim nTicketNameIndex As Integer = Array.IndexOf(Headers, sTicket)
|
||||||
|
If nCustomerNameIndex = -1 OrElse nOrderNameIndex = -1 OrElse nTicketNameIndex = -1 Then
|
||||||
|
Dim sMessage As String = "Error! Header not found! Csv file will not be read!"
|
||||||
|
' egtoutlog(sMessage)
|
||||||
|
MessageBox.Show(sMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
Dim Values As String()
|
||||||
|
Dim sLineErrorList As String = ""
|
||||||
|
Dim sCsvFolderPath As String = ""
|
||||||
|
GetPluginPrivateProfileString(S_GENERAL, K_CSV, "", sCsvFolderPath)
|
||||||
|
Dim sHeaderLine As String = ""
|
||||||
|
For Index As Integer = 0 To Headers.Count - 1
|
||||||
|
sHeaderLine &= Headers(Index) & If(Index < Headers.Count - 1, ",", "")
|
||||||
|
Next
|
||||||
|
sHeaderLine &= ",DDF"
|
||||||
|
While Not MyReader.EndOfData
|
||||||
|
Try
|
||||||
|
Values = MyReader.ReadFields()
|
||||||
|
' scrivo csv per ogni riga
|
||||||
|
Dim sCsvPath As String = sCsvFolderPath & "\" & Values(nCustomerNameIndex) & "-" & Values(nOrderNameIndex) & "-" & Values(nTicketNameIndex) & ".csv"
|
||||||
|
Dim sValueLine As String = ""
|
||||||
|
For Index As Integer = 0 To Values.Count - 1
|
||||||
|
sValueLine &= Values(Index) & If(Index < Values.Count - 1, ",", "")
|
||||||
|
Next
|
||||||
|
sValueLine &= "," & Values(nCustomerNameIndex) & "-" & Values(nOrderNameIndex) & "\" & Values(nSequenceNameIndex)
|
||||||
|
File.WriteAllLines(sCsvPath, {sHeaderLine, sValueLine})
|
||||||
|
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
|
||||||
|
Dim sMessage As String = "Line " & ex.Message & "is not valid and will be skipped."
|
||||||
|
' egtoutlog(sMessage)
|
||||||
|
sLineErrorList &= Environment.NewLine & ex.Message
|
||||||
|
End Try
|
||||||
|
End While
|
||||||
|
If Not String.IsNullOrWhiteSpace(sLineErrorList) Then
|
||||||
|
MessageBox.Show("The following lines are not valid and have been skipped:" & sLineErrorList, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||||
|
Else
|
||||||
|
MessageBox.Show("Single line csv writing successfully completed!", "Info", MessageBoxButton.OK, MessageBoxImage.Information)
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#End Region ' OpenProduction
|
||||||
|
|
||||||
#End Region ' COMMANDS
|
#End Region ' COMMANDS
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
@@ -1255,6 +1400,8 @@ Public Class Door
|
|||||||
NotifyPropertyChanged(NameOf(sDDFName))
|
NotifyPropertyChanged(NameOf(sDDFName))
|
||||||
Return
|
Return
|
||||||
End If
|
End If
|
||||||
|
NotifyPropertyChanged(NameOf(nState))
|
||||||
|
NotifyPropertyChanged(NameOf(Background))
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -1310,6 +1457,8 @@ Public Class Door
|
|||||||
' Return
|
' Return
|
||||||
'End If
|
'End If
|
||||||
End If
|
End If
|
||||||
|
NotifyPropertyChanged(NameOf(nState))
|
||||||
|
NotifyPropertyChanged(NameOf(Background))
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -1358,6 +1507,8 @@ Public Class Door
|
|||||||
' Return
|
' Return
|
||||||
'End If
|
'End If
|
||||||
End If
|
End If
|
||||||
|
NotifyPropertyChanged(NameOf(nState))
|
||||||
|
NotifyPropertyChanged(NameOf(Background))
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -1406,6 +1557,8 @@ Public Class Door
|
|||||||
' Return
|
' Return
|
||||||
'End If
|
'End If
|
||||||
End If
|
End If
|
||||||
|
NotifyPropertyChanged(NameOf(nState))
|
||||||
|
NotifyPropertyChanged(NameOf(Background))
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -1460,6 +1613,8 @@ Public Class Door
|
|||||||
' Return
|
' Return
|
||||||
'End If
|
'End If
|
||||||
End If
|
End If
|
||||||
|
NotifyPropertyChanged(NameOf(nState))
|
||||||
|
NotifyPropertyChanged(NameOf(Background))
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -1527,7 +1682,7 @@ Public Class Door
|
|||||||
End Property
|
End Property
|
||||||
Public ReadOnly Property sLoadTime As String
|
Public ReadOnly Property sLoadTime As String
|
||||||
Get
|
Get
|
||||||
Return If(m_dtLoadTime <> DateTime.MinValue, m_dtLoadTime.ToString("yy/MM/dd hh:mm:ss"), "")
|
Return ConvertDateTimeToString(m_dtLoadTime)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
Friend Sub SetLoadTime(LoadTime As Long)
|
Friend Sub SetLoadTime(LoadTime As Long)
|
||||||
@@ -1543,7 +1698,7 @@ Public Class Door
|
|||||||
End Property
|
End Property
|
||||||
Public ReadOnly Property sMachining1Start As String
|
Public ReadOnly Property sMachining1Start As String
|
||||||
Get
|
Get
|
||||||
Return If(m_dtMachining1Start <> DateTime.MinValue, m_dtMachining1Start.ToString("yy/MM/dd hh:mm:ss"), "")
|
Return ConvertDateTimeToString(m_dtMachining1Start)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
Friend Sub SetMachining1Start(Machining1Start As Long)
|
Friend Sub SetMachining1Start(Machining1Start As Long)
|
||||||
@@ -1559,7 +1714,7 @@ Public Class Door
|
|||||||
End Property
|
End Property
|
||||||
Public ReadOnly Property sMachining1End As String
|
Public ReadOnly Property sMachining1End As String
|
||||||
Get
|
Get
|
||||||
Return If(m_dtMachining1End <> DateTime.MinValue, m_dtMachining1End.ToString("yy/MM/dd hh:mm:ss"), "")
|
Return ConvertDateTimeToString(m_dtMachining1End)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
Friend Sub SetMachining1End(Machining1End As Long)
|
Friend Sub SetMachining1End(Machining1End As Long)
|
||||||
@@ -1575,7 +1730,7 @@ Public Class Door
|
|||||||
End Property
|
End Property
|
||||||
Public ReadOnly Property sMachining2Start As String
|
Public ReadOnly Property sMachining2Start As String
|
||||||
Get
|
Get
|
||||||
Return If(m_dtMachining2Start <> DateTime.MinValue, m_dtMachining2Start.ToString("yy/MM/dd hh:mm:ss"), "")
|
Return ConvertDateTimeToString(m_dtMachining2Start)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
Friend Sub SetMachining2Start(Machining2Start As Long)
|
Friend Sub SetMachining2Start(Machining2Start As Long)
|
||||||
@@ -1591,13 +1746,17 @@ Public Class Door
|
|||||||
End Property
|
End Property
|
||||||
Public ReadOnly Property sMachining2End As String
|
Public ReadOnly Property sMachining2End As String
|
||||||
Get
|
Get
|
||||||
Return If(m_dtMachining2End <> DateTime.MinValue, m_dtMachining2End.ToString("yy/MM/dd hh:mm:ss"), "")
|
Return ConvertDateTimeToString(m_dtMachining2End)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
Friend Sub SetMachining2End(Machining2End As Long)
|
Friend Sub SetMachining2End(Machining2End As Long)
|
||||||
m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining2End).ToLocalTime()
|
m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining2End).ToLocalTime()
|
||||||
NotifyPropertyChanged(NameOf(sMachining2End))
|
NotifyPropertyChanged(NameOf(sMachining2End))
|
||||||
End Sub
|
End Sub
|
||||||
|
Friend Sub SetMachining2End(Machining2End As DateTime)
|
||||||
|
m_dtMachining2End = Machining2End
|
||||||
|
NotifyPropertyChanged(NameOf(sMachining2End))
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private m_dtUnloadTime As DateTime = DateTime.MinValue
|
Private m_dtUnloadTime As DateTime = DateTime.MinValue
|
||||||
Friend ReadOnly Property dtUnloadTime As DateTime
|
Friend ReadOnly Property dtUnloadTime As DateTime
|
||||||
@@ -1607,13 +1766,17 @@ Public Class Door
|
|||||||
End Property
|
End Property
|
||||||
Public ReadOnly Property sUnloadTime As String
|
Public ReadOnly Property sUnloadTime As String
|
||||||
Get
|
Get
|
||||||
Return If(m_dtUnloadTime <> DateTime.MinValue, m_dtUnloadTime.ToString("yy/MM/dd hh:mm:ss"), "")
|
Return ConvertDateTimeToString(m_dtUnloadTime)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
Friend Sub SetUnloadTime(UnloadTime As Long)
|
Friend Sub SetUnloadTime(UnloadTime As Long)
|
||||||
m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(UnloadTime).ToLocalTime()
|
m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(UnloadTime).ToLocalTime()
|
||||||
NotifyPropertyChanged(NameOf(sUnloadTime))
|
NotifyPropertyChanged(NameOf(sUnloadTime))
|
||||||
End Sub
|
End Sub
|
||||||
|
Friend Sub SetUnloadTime(UnloadTime As DateTime)
|
||||||
|
m_dtUnloadTime = UnloadTime
|
||||||
|
NotifyPropertyChanged(NameOf(sUnloadTime))
|
||||||
|
End Sub
|
||||||
|
|
||||||
#End Region ' Statistics
|
#End Region ' Statistics
|
||||||
|
|
||||||
@@ -1716,37 +1879,49 @@ Public Class Door
|
|||||||
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
|
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
|
||||||
Dim sDDTFilePath As String = sDDTDirPath & "\" & sDDFName
|
Dim sDDTFilePath As String = sDDTDirPath & "\" & sDDFName
|
||||||
If String.IsNullOrWhiteSpace(sDoorCreatorExePath) OrElse Not File.Exists(sDoorCreatorExePath) Then
|
If String.IsNullOrWhiteSpace(sDoorCreatorExePath) OrElse Not File.Exists(sDoorCreatorExePath) Then
|
||||||
MessageBox.Show("Path del programma di calcolo del ddf mancante o errata!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
|
MessageBox.Show("Ddf file calculating software path not set or wrong!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||||
Return False
|
Return False
|
||||||
ElseIf Not File.Exists(sDDTFilePath) Then
|
ElseIf Not File.Exists(sDDTFilePath) Then
|
||||||
Dim sErr As String = "File non trovato! Il nome inserito non corrisponde a nessun file nella cartella dei Ddt (" & sDDTDirPath & ")"
|
Dim sErr As String = "File not found! Write name not correspond to any file in the Ddt folder (" & sDDTDirPath & ")"
|
||||||
Map.refSupervisorFunction.PlgOutLog(sErr)
|
Map.refSupervisorFunction.PlgOutLog(sErr)
|
||||||
sErrMessage &= "- " & sErr & Environment.NewLine
|
sErrMessage &= "- " & sErr & Environment.NewLine
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
' creo il ddf
|
' creo il ddf
|
||||||
Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & If(Not String.IsNullOrWhiteSpace(Path.GetDirectoryName(sDDFName)), Path.GetDirectoryName(sDDFName) & "_", "") & Path.GetFileNameWithoutExtension(sDDFName) & "_" & nId & ".ddf"
|
Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & If(Not String.IsNullOrWhiteSpace(Path.GetDirectoryName(sDDFName)), Path.GetDirectoryName(sDDFName) & "_", "") & Path.GetFileNameWithoutExtension(sDDFName) & "_" & nId & ".ddf"
|
||||||
Dim Proc As New Process()
|
' elimino eventuale vecchio file
|
||||||
Proc.StartInfo.FileName = """" & sDoorCreatorExePath & """"
|
If File.Exists(sGenDDFFilePath) Then
|
||||||
Proc.StartInfo.RedirectStandardInput = False
|
File.Delete(sGenDDFFilePath)
|
||||||
Proc.StartInfo.RedirectStandardOutput = False
|
|
||||||
Proc.StartInfo.Arguments = """" & sDDTFilePath & ";" & DoubleToString(dWidth, 2) & ";" & DoubleToString(dHeight, 2) & ";" & DoubleToString(dThickness, 2) & ";" & sGenDDFFilePath & ";" & If(nSwing = SWINGTYPE.LEFT, "L", "R") & """"
|
|
||||||
Proc.StartInfo.UseShellExecute = False
|
|
||||||
Proc.StartInfo.CreateNoWindow = True
|
|
||||||
Dim ExecCounter = 0
|
|
||||||
If Proc.Start Then
|
|
||||||
While Not Proc.HasExited
|
|
||||||
If ExecCounter >= 30 Then
|
|
||||||
Proc.Kill()
|
|
||||||
Exit While
|
|
||||||
End If
|
|
||||||
Threading.Thread.Sleep(100)
|
|
||||||
ExecCounter += 1
|
|
||||||
End While
|
|
||||||
End If
|
End If
|
||||||
|
Try
|
||||||
|
' creo il ddf
|
||||||
|
Dim Proc As New Process()
|
||||||
|
Proc.StartInfo.FileName = """" & sDoorCreatorExePath & """"
|
||||||
|
Proc.StartInfo.RedirectStandardInput = False
|
||||||
|
Proc.StartInfo.RedirectStandardOutput = False
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("""" & sDDTFilePath & ";" & DoubleToString(dWidth, 2) & ";" & DoubleToString(dHeight, 2) & ";" & DoubleToString(dThickness, 2) & ";" & sGenDDFFilePath & ";" & If(nSwing = SWINGTYPE.LEFT, "L", "R") & """")
|
||||||
|
Proc.StartInfo.Arguments = """" & sDDTFilePath & ";" & DoubleToString(dWidth, 2) & ";" & DoubleToString(dHeight, 2) & ";" & DoubleToString(dThickness, 2) & ";" & sGenDDFFilePath & ";" & If(nSwing = SWINGTYPE.LEFT, "L", "R") & """"
|
||||||
|
Proc.StartInfo.UseShellExecute = False
|
||||||
|
Proc.StartInfo.CreateNoWindow = True
|
||||||
|
Dim ExecCounter = 0
|
||||||
|
If Proc.Start Then
|
||||||
|
|
||||||
|
While Not Proc.HasExited
|
||||||
|
If ExecCounter >= 100 Then
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Process Kill!!")
|
||||||
|
Proc.Kill()
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
Threading.Thread.Sleep(100)
|
||||||
|
ExecCounter += 1
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(ex.Message)
|
||||||
|
End Try
|
||||||
' se file generato
|
' se file generato
|
||||||
If Not File.Exists(sGenDDFFilePath) Then
|
If Not File.Exists(sGenDDFFilePath) Then
|
||||||
Dim sErr As String = "Errore! Generazione file ddf fallita! (" & sDDTDirPath & ")"
|
Dim sErr As String = "Error! Ddf file generation failed! (" & sDDTDirPath & ")"
|
||||||
Map.refSupervisorFunction.PlgOutLog(sErr)
|
Map.refSupervisorFunction.PlgOutLog(sErr)
|
||||||
sErrMessage &= "- " & sErr & Environment.NewLine
|
sErrMessage &= "- " & sErr & Environment.NewLine
|
||||||
Return False
|
Return False
|
||||||
@@ -1796,7 +1971,7 @@ Public Class StateToSelColorConverter
|
|||||||
Return Dictionary.Effector_Green_SelStatus
|
Return Dictionary.Effector_Green_SelStatus
|
||||||
Case DoorStates.VERIFICATION_FAILED
|
Case DoorStates.VERIFICATION_FAILED
|
||||||
Return Dictionary.Effector_Red_SelStatus
|
Return Dictionary.Effector_Red_SelStatus
|
||||||
Case DoorStates.SKIPPED
|
Case DoorStates.SKIPPED, DoorStates.NOTPRODUCE
|
||||||
Return Dictionary.Effector_Yellow_SelStatus
|
Return Dictionary.Effector_Yellow_SelStatus
|
||||||
Case DoorStates.READY_FOR_PRODUCTION, DoorStates.ON_LOAD_STATION
|
Case DoorStates.READY_FOR_PRODUCTION, DoorStates.ON_LOAD_STATION
|
||||||
Return Dictionary.Effector_LightBlue_SelStatus
|
Return Dictionary.Effector_LightBlue_SelStatus
|
||||||
|
|||||||
@@ -54,6 +54,9 @@
|
|||||||
<Reference Include="Effector.Plugin.Lib">
|
<Reference Include="Effector.Plugin.Lib">
|
||||||
<HintPath>..\..\Effector.Plugin.Lib\Effector.Plugin.Lib\bin\Debug\Effector.Plugin.Lib.dll</HintPath>
|
<HintPath>..\..\Effector.Plugin.Lib\Effector.Plugin.Lib\bin\Debug\Effector.Plugin.Lib.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="EgwWPFBaseLib">
|
||||||
|
<HintPath>..\..\..\EgwWPFBaseLib\EgwWPFBaseLib\bin\Debug\EgwWPFBaseLib.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="KeraLua, Version=1.4.1.0, Culture=neutral, PublicKeyToken=6a194c04b9c89217, processorArchitecture=MSIL">
|
<Reference Include="KeraLua, Version=1.4.1.0, Culture=neutral, PublicKeyToken=6a194c04b9c89217, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\KeraLua.1.4.1\lib\net46\KeraLua.dll</HintPath>
|
<HintPath>..\packages\KeraLua.1.4.1\lib\net46\KeraLua.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -101,10 +104,10 @@
|
|||||||
<DependentUpon>DoorListPageV.xaml</DependentUpon>
|
<DependentUpon>DoorListPageV.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="DoorListPage\DoorListPageVM.vb" />
|
<Compile Include="DoorListPage\DoorListPageVM.vb" />
|
||||||
<Compile Include="FiveLakesUI.xaml.vb">
|
<Compile Include="PluginUI\PluginUIV.xaml.vb">
|
||||||
<DependentUpon>FiveLakesUI.xaml</DependentUpon>
|
<DependentUpon>PluginUIV.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="FiveLakesUIVM.vb" />
|
<Compile Include="PluginUI\PluginUIVM.vb" />
|
||||||
<Compile Include="LUA\LuaManager.vb" />
|
<Compile Include="LUA\LuaManager.vb" />
|
||||||
<Compile Include="LUA\Lua_Aux.vb" />
|
<Compile Include="LUA\Lua_Aux.vb" />
|
||||||
<Compile Include="LUA\Lua_General.vb" />
|
<Compile Include="LUA\Lua_General.vb" />
|
||||||
@@ -140,14 +143,8 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Utility\Command.vb" />
|
|
||||||
<Compile Include="Utility\GenInterface.vb" />
|
|
||||||
<Compile Include="Utility\IdNameStruct.vb" />
|
|
||||||
<Compile Include="Utility\IniFile.vb" />
|
|
||||||
<Compile Include="Utility\JsonUtility.vb" />
|
<Compile Include="Utility\JsonUtility.vb" />
|
||||||
<Compile Include="Utility\Map.vb" />
|
<Compile Include="Utility\Map.vb" />
|
||||||
<Compile Include="Utility\StringConversion.vb" />
|
|
||||||
<Compile Include="Utility\VMBase.vb" />
|
|
||||||
<EmbeddedResource Include="My Project\Resources.resx">
|
<EmbeddedResource Include="My Project\Resources.resx">
|
||||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||||
@@ -166,7 +163,7 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="FiveLakesUI.xaml">
|
<Page Include="PluginUI\PluginUIV.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -212,6 +209,12 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\DoorListPage\NotProduce.png" />
|
<Resource Include="Resources\DoorListPage\NotProduce.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\DoorListPage\OpenProduction.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\DoorListPage\DeleteAll.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)</PreBuildEvent>
|
<PreBuildEvent>powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)</PreBuildEvent>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
Imports KeraLua
|
Imports KeraLua
|
||||||
|
Imports System.IO
|
||||||
|
Imports Effector.Plugin.Lib
|
||||||
|
|
||||||
Public Module Lua_General
|
Public Module Lua_General
|
||||||
|
|
||||||
@@ -11,6 +13,7 @@ Public Module Lua_General
|
|||||||
Friend func_PlgGetNextDoor As LuaFunction = AddressOf Lua_PlgGetNextDoor
|
Friend func_PlgGetNextDoor As LuaFunction = AddressOf Lua_PlgGetNextDoor
|
||||||
Friend func_PlgOpenRestartWnd As LuaFunction = AddressOf Lua_PlgOpenRestartWnd
|
Friend func_PlgOpenRestartWnd As LuaFunction = AddressOf Lua_PlgOpenRestartWnd
|
||||||
Friend func_PlgMachineReset As LuaFunction = AddressOf Lua_PlgMachineReset
|
Friend func_PlgMachineReset As LuaFunction = AddressOf Lua_PlgMachineReset
|
||||||
|
Friend func_PlgRestartMachineMessage As LuaFunction = AddressOf Lua_PlgRestartMachineMessage
|
||||||
|
|
||||||
Private Function Lua_PlgGetNumberFromIni(ByVal p As IntPtr) As Integer
|
Private Function Lua_PlgGetNumberFromIni(ByVal p As IntPtr) As Integer
|
||||||
Dim state = Lua.FromIntPtr(p)
|
Dim state = Lua.FromIntPtr(p)
|
||||||
@@ -108,8 +111,8 @@ Public Module Lua_General
|
|||||||
If Not IsNothing(NextDoor) Then
|
If Not IsNothing(NextDoor) Then
|
||||||
' restituisco il risultato
|
' restituisco il risultato
|
||||||
LuaSetParam(state, NextDoor.nId)
|
LuaSetParam(state, NextDoor.nId)
|
||||||
' Dim sGenDDFName As String = Path.GetFileNameWithoutExtension(NextDoor.sDDFName) & "_" & NextDoor.nId & ".ddf"
|
LuaSetParam(state, If(Not String.IsNullOrWhiteSpace(Path.GetDirectoryName(NextDoor.sDDFName)), Path.GetDirectoryName(NextDoor.sDDFName) & "_", "") & Path.GetFileNameWithoutExtension(NextDoor.sDDFName) & "_" & NextDoor.nId & ".ddf")
|
||||||
LuaSetParam(state, NextDoor.sDDFName & "_" & NextDoor.nId)
|
'LuaSetParam(state, NextDoor.sDDFName & "_" & NextDoor.nId)
|
||||||
Return 2
|
Return 2
|
||||||
End If
|
End If
|
||||||
Return 0
|
Return 0
|
||||||
@@ -139,6 +142,15 @@ Public Module Lua_General
|
|||||||
Return 0
|
Return 0
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function Lua_PlgRestartMachineMessage(ByVal p As IntPtr) As Integer
|
||||||
|
Dim state = Lua.FromIntPtr(p)
|
||||||
|
Dim nMachineIndex As Integer = 1
|
||||||
|
LuaGetParam(state, 1, nMachineIndex)
|
||||||
|
LuaClearStack(state)
|
||||||
|
MessageBox.Show("Error! Check log file for description." & Environment.NewLine & "When fixed reset and restart MainAuto on machine " & nMachineIndex)
|
||||||
|
Return 0
|
||||||
|
End Function
|
||||||
|
|
||||||
Friend Function LuaInstallGeneral(state As Lua) As Boolean
|
Friend Function LuaInstallGeneral(state As Lua) As Boolean
|
||||||
If IsNothing(state) Then Return False
|
If IsNothing(state) Then Return False
|
||||||
state.Register("PlgGetNumberFromIni", func_PlgGetNumberFromIni)
|
state.Register("PlgGetNumberFromIni", func_PlgGetNumberFromIni)
|
||||||
@@ -150,6 +162,7 @@ Public Module Lua_General
|
|||||||
state.Register("PlgGetNextDoor", func_PlgGetNextDoor)
|
state.Register("PlgGetNextDoor", func_PlgGetNextDoor)
|
||||||
state.Register("PlgOpenRestartWnd", func_PlgOpenRestartWnd)
|
state.Register("PlgOpenRestartWnd", func_PlgOpenRestartWnd)
|
||||||
state.Register("PlgMachineReset", func_PlgMachineReset)
|
state.Register("PlgMachineReset", func_PlgMachineReset)
|
||||||
|
state.Register("PlgRestartMachineMessage", func_PlgRestartMachineMessage)
|
||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,13 @@
|
|||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
<Grid Grid.Column="1"
|
<Grid Grid.Column="1"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center">
|
||||||
Visibility="{Binding MachineCommands_Visibility}">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid>
|
<Grid Visibility="{Binding MachineCommands_Visibility}">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="20"/>
|
<ColumnDefinition Width="20"/>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Imports System.Windows.Threading
|
|||||||
Imports Newtonsoft.Json.Linq
|
Imports Newtonsoft.Json.Linq
|
||||||
Imports Effector.Plugin.FiveLakes.Variable
|
Imports Effector.Plugin.FiveLakes.Variable
|
||||||
Imports Effector.Plugin.Interface
|
Imports Effector.Plugin.Interface
|
||||||
|
Imports Effector.Plugin.Lib
|
||||||
|
|
||||||
Public Class MachinePageVM
|
Public Class MachinePageVM
|
||||||
Inherits VMBase
|
Inherits VMBase
|
||||||
@@ -162,7 +163,11 @@ Public Class MachinePageVM
|
|||||||
New Variable(Variable.VariableTypes.BOOLEAN, "@BF04", "901.4", 2),
|
New Variable(Variable.VariableTypes.BOOLEAN, "@BF04", "901.4", 2),
|
||||||
New Variable(Variable.VariableTypes.BOOLEAN, "@BF05", "901.5", 2),
|
New Variable(Variable.VariableTypes.BOOLEAN, "@BF05", "901.5", 2),
|
||||||
New Variable(Variable.VariableTypes.BOOLEAN, "@BF06", "901.6", 2),
|
New Variable(Variable.VariableTypes.BOOLEAN, "@BF06", "901.6", 2),
|
||||||
New Variable(Variable.VariableTypes.BOOLEAN, "@BF07", "901.7", 2)})
|
New Variable(Variable.VariableTypes.BOOLEAN, "@BF07", "901.7", 2),
|
||||||
|
New Variable(Variable.VariableTypes.INTEGER, "@P1000_END", "1353", 1),
|
||||||
|
New Variable(Variable.VariableTypes.INTEGER, "@P2000_END", "1354", 1),
|
||||||
|
New Variable(Variable.VariableTypes.INTEGER, "@P1000_END", "1353", 2),
|
||||||
|
New Variable(Variable.VariableTypes.INTEGER, "@P2000_END", "1354", 2)})
|
||||||
AddHandler m_VarTimer.Tick, AddressOf VarTimer_Tick
|
AddHandler m_VarTimer.Tick, AddressOf VarTimer_Tick
|
||||||
m_VarTimer.Interval = New TimeSpan(100)
|
m_VarTimer.Interval = New TimeSpan(100)
|
||||||
m_VarTimer.Start()
|
m_VarTimer.Start()
|
||||||
@@ -216,15 +221,15 @@ Public Class MachinePageVM
|
|||||||
' se in simulazione
|
' se in simulazione
|
||||||
If Map.refSupervisorFunction.PlgGetPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) > 0 Then
|
If Map.refSupervisorFunction.PlgGetPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) > 0 Then
|
||||||
' aggiorno stato porta in macchina da 1 a 2 se in stazione di lavorazione
|
' aggiorno stato porta in macchina da 1 a 2 se in stazione di lavorazione
|
||||||
For nMachineIndex = 1 To 2
|
'For nMachineIndex = 1 To 2
|
||||||
Dim nMachineId As Integer = nMachineIndex
|
' Dim nMachineId As Integer = nMachineIndex
|
||||||
Dim Machine1Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@WP_PR_02" AndAlso x.nMachine = nMachineId)
|
' Dim Machine1Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@WP_PR_02" AndAlso x.nMachine = nMachineId)
|
||||||
If Not IsNothing(Machine1Var) AndAlso Machine1Var.dValue = 1 Then
|
' If Not IsNothing(Machine1Var) AndAlso Machine1Var.dValue = 1 Then
|
||||||
Dim nIndex As Integer = -1
|
' Dim nIndex As Integer = -1
|
||||||
Integer.TryParse(Machine1Var.sIndex, nIndex)
|
' Integer.TryParse(Machine1Var.sIndex, nIndex)
|
||||||
Map.refSupervisorFunction.ComWriteDoubleVar(nIndex, 2, Machine1Var.nMachine)
|
' Map.refSupervisorFunction.ComWriteDoubleVar(nIndex, 2, Machine1Var.nMachine)
|
||||||
End If
|
' End If
|
||||||
Next
|
'Next
|
||||||
' se presente un sent
|
' se presente un sent
|
||||||
Dim Sent1Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@SENT_1" AndAlso x.nMachine = 2)
|
Dim Sent1Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@SENT_1" AndAlso x.nMachine = 2)
|
||||||
Dim Sent2Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@SENT_2" AndAlso x.nMachine = 2)
|
Dim Sent2Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@SENT_2" AndAlso x.nMachine = 2)
|
||||||
@@ -244,6 +249,18 @@ Public Class MachinePageVM
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
' se reset
|
||||||
|
For nMachineIndex = 1 To 2
|
||||||
|
Dim nMachineId As Integer = nMachineIndex
|
||||||
|
Dim Reset As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@RESET_ON" AndAlso x.nMachine = nMachineId)
|
||||||
|
If Not IsNothing(Reset) AndAlso Reset.nValue = 1 Then
|
||||||
|
Dim MachineState As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@STATE" AndAlso x.nMachine = nMachineId)
|
||||||
|
Dim nIndex As Integer = -1
|
||||||
|
Integer.TryParse(MachineState.sIndex, nIndex)
|
||||||
|
Map.refSupervisorFunction.ComWriteShortVar(nIndex, 0, nMachineIndex)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
End If
|
End If
|
||||||
' leggo stato calcolo da lua
|
' leggo stato calcolo da lua
|
||||||
Dim nState As Integer = -1
|
Dim nState As Integer = -1
|
||||||
@@ -262,6 +279,10 @@ Public Class MachinePageVM
|
|||||||
SetNewDoorState(nState)
|
SetNewDoorState(nState)
|
||||||
End If
|
End If
|
||||||
m_LuaDoorList.Clear()
|
m_LuaDoorList.Clear()
|
||||||
|
Dim bM1Reset As Boolean = False
|
||||||
|
LuaGetGlobVar("bReset_M1", bM1Reset)
|
||||||
|
Dim bM2Reset As Boolean = False
|
||||||
|
LuaGetGlobVar("bReset_M2", bM2Reset)
|
||||||
For nDoorIndex = 1 To 10
|
For nDoorIndex = 1 To 10
|
||||||
Dim nId As Integer = -1
|
Dim nId As Integer = -1
|
||||||
LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nId", nId)
|
LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nId", nId)
|
||||||
@@ -296,10 +317,10 @@ Public Class MachinePageVM
|
|||||||
Dim lUnloadTime As Long = 0
|
Dim lUnloadTime As Long = 0
|
||||||
LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nUnloadTime", lUnloadTime)
|
LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nUnloadTime", lUnloadTime)
|
||||||
m_LuaDoorList.Add(New LuaDoor(nId, nCircIndex, nDoorState, nDoorPosition, sDoorCode, sDoorDescription, sDDFName, sCSVName, sM1CNPath, sM2CNPath, lLoadTime, lMachining1Start, lMachining1End, lMachining2Start, lMachining2End, lUnloadTime))
|
m_LuaDoorList.Add(New LuaDoor(nId, nCircIndex, nDoorState, nDoorPosition, sDoorCode, sDoorDescription, sDDFName, sCSVName, sM1CNPath, sM2CNPath, lLoadTime, lMachining1Start, lMachining1End, lMachining2Start, lMachining2End, lUnloadTime))
|
||||||
If nId > 0 Then
|
If nId > 0 AndAlso (Not bM1Reset AndAlso nDoorState >= 2 AndAlso nDoorState <= 4) OrElse (Not bM2Reset AndAlso nDoorState >= 5 AndAlso nDoorState <= 8) Then
|
||||||
' aggiorno dati in lista porte
|
' aggiorno dati in lista porte
|
||||||
Dim Door As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nId = nId)
|
Dim Door As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nId = nId)
|
||||||
If nDoorState <> Door.nProdState Then
|
If Not IsNothing(Door) AndAlso nDoorState <> Door.nProdState Then
|
||||||
Door.SetProdState(nDoorState)
|
Door.SetProdState(nDoorState)
|
||||||
If lLoadTime > 0 Then Door.SetLoadTime(lLoadTime)
|
If lLoadTime > 0 Then Door.SetLoadTime(lLoadTime)
|
||||||
If lMachining1Start > 0 Then Door.SetMachining1Start(lMachining1Start)
|
If lMachining1Start > 0 Then Door.SetMachining1Start(lMachining1Start)
|
||||||
@@ -352,6 +373,56 @@ Public Class MachinePageVM
|
|||||||
NotifyPropertyChanged(NameOf(DoorOnMachineArray))
|
NotifyPropertyChanged(NameOf(DoorOnMachineArray))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Friend Sub PrintAllVariableInLog()
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Writing all variables start")
|
||||||
|
' 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
|
||||||
|
Integer.TryParse(Var.sIndex, nIndex)
|
||||||
|
Dim nValue As Integer = 0
|
||||||
|
If Map.refSupervisorFunction.ComReadShortVar(nIndex, nValue, Var.nMachine) Then
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(Var.nMachine & " " & Var.sName & " " & Var.sIndex & " " & nValue)
|
||||||
|
Else
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Error! Reading Variable " & Var.sIndex & " on machine " & Var.nMachine & "failed!")
|
||||||
|
End If
|
||||||
|
Case Variable.VariableTypes.DOUBLE
|
||||||
|
Dim nIndex As Integer = 0
|
||||||
|
Integer.TryParse(Var.sIndex, nIndex)
|
||||||
|
Dim dValue As Double = 0
|
||||||
|
If Map.refSupervisorFunction.ComReadDoubleVar(nIndex, dValue, Var.nMachine) Then
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(Var.nMachine & " " & Var.sName & " " & Var.sIndex & " " & dValue)
|
||||||
|
Else
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Error! Reading Variable " & Var.sIndex & " on machine " & Var.nMachine & "failed!")
|
||||||
|
End If
|
||||||
|
Case Variable.VariableTypes.BOOLEAN
|
||||||
|
Dim nIndex As Integer = 0
|
||||||
|
Dim nBit As Integer = 0
|
||||||
|
Dim sIndexSplit() As String = Var.sIndex.Split("."c)
|
||||||
|
Integer.TryParse(sIndexSplit(0), nIndex)
|
||||||
|
Integer.TryParse(sIndexSplit(1), nBit)
|
||||||
|
Dim bValue As Boolean = 0
|
||||||
|
If Map.refSupervisorFunction.ComReadBitVar(nIndex, nBit, bValue, Var.nMachine) Then
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(Var.nMachine & " " & Var.sName & " " & Var.sIndex & " " & bValue)
|
||||||
|
Else
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Error! Reading Variable " & Var.sIndex & " on machine " & Var.nMachine & "failed!")
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
Next
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Writing all variables end")
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Friend Sub PrintAllDoorInList()
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Writing door list start")
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Id DDFName State ProdState LoadTime | Machining1Start | Machining1End | Machining2Start | Machining2End | UnloadTime")
|
||||||
|
For Each Door In Map.refDoorListPageVM.DoorList
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(Door.nId & " " & Door.sDDFName & " " & Door.nState & " " & Door.nProdState & " " & Door.sLoadTime & " | " & Door.sMachining1Start & " | " & Door.sMachining1End & " | " & Door.sMachining2Start & " | " & Door.sMachining2End & " | " & Door.sUnloadTime)
|
||||||
|
Next
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Writing door list end")
|
||||||
|
End Sub
|
||||||
|
|
||||||
#Region "COMMANDS"
|
#Region "COMMANDS"
|
||||||
|
|
||||||
#Region "WriteVariable"
|
#Region "WriteVariable"
|
||||||
@@ -615,19 +686,23 @@ Public Class MachinePageVM
|
|||||||
Dim Sent2 As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@SENT_2")
|
Dim Sent2 As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@SENT_2")
|
||||||
Dim StartDoorPresence As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@WP_PR_00")
|
Dim StartDoorPresence As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@WP_PR_00")
|
||||||
Dim EndDoorPresence As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@WP_PR_02")
|
Dim EndDoorPresence As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@WP_PR_02")
|
||||||
|
Dim P1000 As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@P1000_END")
|
||||||
|
Dim P2000 As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@P2000_END")
|
||||||
If StateVariable.nValue < 1 OrElse StateVariable.nValue > 5 Then Return
|
If StateVariable.nValue < 1 OrElse StateVariable.nValue > 5 Then Return
|
||||||
Select Case StateVariable.nValue
|
Select Case StateVariable.nValue
|
||||||
Case 0
|
Case 0
|
||||||
Return
|
Return
|
||||||
Case 1
|
Case 1
|
||||||
If nStartStop = 1 AndAlso (StartDoorPresence.dValue = 1 OrElse EndDoorPresence.dValue = 2) AndAlso Sent1.nValue = 1 Then
|
If nStartStop = 1 AndAlso (StartDoorPresence.dValue = 1 OrElse EndDoorPresence.dValue = 1) AndAlso Sent1.nValue = 1 Then
|
||||||
nState = 2
|
nState = 2
|
||||||
Map.refSupervisorFunction.ComWriteShortVar(Sent1.sIndex, 0, nMachineIndex)
|
Map.refSupervisorFunction.ComWriteShortVar(Sent1.sIndex, 0, nMachineIndex)
|
||||||
Else Return
|
Else Return
|
||||||
End If
|
End If
|
||||||
Case 2
|
Case 2
|
||||||
If nStartStop = 2 AndAlso EndDoorPresence.dValue = 2 Then
|
If nStartStop = 2 AndAlso EndDoorPresence.dValue = 1 Then
|
||||||
|
Map.refSupervisorFunction.ComWriteShortVar(P1000.sIndex, 1, nMachineIndex)
|
||||||
nState = 3
|
nState = 3
|
||||||
|
Map.refSupervisorFunction.ComWriteDoubleVar(EndDoorPresence.sIndex, 2, nMachineIndex)
|
||||||
Else Return
|
Else Return
|
||||||
End If
|
End If
|
||||||
Case 3
|
Case 3
|
||||||
@@ -637,8 +712,10 @@ Public Class MachinePageVM
|
|||||||
Else Return
|
Else Return
|
||||||
End If
|
End If
|
||||||
Case 4
|
Case 4
|
||||||
If nStartStop = 2 AndAlso EndDoorPresence.dValue = 2 Then
|
If nStartStop = 2 AndAlso EndDoorPresence.dValue = 1 Then
|
||||||
|
Map.refSupervisorFunction.ComWriteShortVar(P2000.sIndex, 1, nMachineIndex)
|
||||||
nState = 5
|
nState = 5
|
||||||
|
Map.refSupervisorFunction.ComWriteDoubleVar(EndDoorPresence.sIndex, 2, nMachineIndex)
|
||||||
Else Return
|
Else Return
|
||||||
End If
|
End If
|
||||||
Case 5
|
Case 5
|
||||||
@@ -837,42 +914,42 @@ Public Class LuaDoor
|
|||||||
Private m_dtLoadTime As DateTime
|
Private m_dtLoadTime As DateTime
|
||||||
Public ReadOnly Property sLoadTime As String
|
Public ReadOnly Property sLoadTime As String
|
||||||
Get
|
Get
|
||||||
Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
|
Return ConvertDateTimeToString(m_dtLoadTime)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private m_dtMachining1Start As DateTime
|
Private m_dtMachining1Start As DateTime
|
||||||
Public ReadOnly Property sMachining1Start As String
|
Public ReadOnly Property sMachining1Start As String
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
|
Return ConvertDateTimeToString(m_dtMachining1Start)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private m_dtMachining1End As DateTime
|
Private m_dtMachining1End As DateTime
|
||||||
Public ReadOnly Property sMachining1End As String
|
Public ReadOnly Property sMachining1End As String
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
|
Return ConvertDateTimeToString(m_dtMachining1End)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private m_dtMachining2Start As DateTime
|
Private m_dtMachining2Start As DateTime
|
||||||
Public ReadOnly Property sMachining2Start As String
|
Public ReadOnly Property sMachining2Start As String
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
|
Return ConvertDateTimeToString(m_dtMachining2Start)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private m_dtMachining2End As DateTime
|
Private m_dtMachining2End As DateTime
|
||||||
Public ReadOnly Property sMachining2End As String
|
Public ReadOnly Property sMachining2End As String
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
|
Return ConvertDateTimeToString(m_dtMachining2End)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private m_dtUnloadTime As DateTime
|
Private m_dtUnloadTime As DateTime
|
||||||
Public ReadOnly Property sUnloadTime As String
|
Public ReadOnly Property sUnloadTime As String
|
||||||
Get
|
Get
|
||||||
Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
|
Return ConvertDateTimeToString(m_dtUnloadTime)
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
Public Class MainMenuVM
|
Imports Effector.Plugin.Lib
|
||||||
|
|
||||||
|
Public Class MainMenuVM
|
||||||
Inherits VMBase
|
Inherits VMBase
|
||||||
|
|
||||||
' Definizione comandi
|
' Definizione comandi
|
||||||
@@ -18,7 +20,7 @@
|
|||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Sub Page(nPage As Integer)
|
Public Sub Page(nPage As Integer)
|
||||||
Map.refFiveLakesUIVM.SetSelPage(nPage)
|
Map.refPluginUIVM.SetSelPage(nPage)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region ' Page
|
#End Region ' Page
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ Imports System.Windows
|
|||||||
|
|
||||||
<Assembly: AssemblyTitle("Effector.Plugin.FiveLakes")>
|
<Assembly: AssemblyTitle("Effector.Plugin.FiveLakes")>
|
||||||
<Assembly: AssemblyDescription("")>
|
<Assembly: AssemblyDescription("")>
|
||||||
<Assembly: AssemblyCompany("Windows User")>
|
<Assembly: AssemblyCompany("Egalware s.r.l.")>
|
||||||
<Assembly: AssemblyProduct("Effector.Plugin.FiveLakes")>
|
<Assembly: AssemblyProduct("Effector.Plugin.FiveLakes")>
|
||||||
<Assembly: AssemblyCopyright("Copyright @ Windows User 2024")>
|
<Assembly: AssemblyCopyright("Copyright © 2024-2025 by Egalware s.r.l.")>
|
||||||
<Assembly: AssemblyTrademark("")>
|
<Assembly: AssemblyTrademark("")>
|
||||||
<Assembly: ComVisible(false)>
|
<Assembly: ComVisible(false)>
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ Imports System.Windows
|
|||||||
|
|
||||||
|
|
||||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
<Assembly: Guid("b4747d9a-5420-4702-8e86-59fa0fb1ad51")>
|
<Assembly: Guid("b4747d9a-5420-4702-8e86-59fa0fb1ad51")>
|
||||||
|
|
||||||
' Version information for an assembly consists of the following four values:
|
' Version information for an assembly consists of the following four values:
|
||||||
'
|
'
|
||||||
@@ -55,5 +55,5 @@ Imports System.Windows
|
|||||||
' by using the '*' as shown below:
|
' by using the '*' as shown below:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
<Assembly: AssemblyVersion("2.7.8.1")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("2.7.8.1")>
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
<Grid x:Class="FiveLakesUI"
|
<Grid x:Class="PluginUIV"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
|
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
|
||||||
DataContext="{StaticResource FiveLakesUIVM}">
|
DataContext="{StaticResource PluginUIVM}">
|
||||||
<TabControl SelectedIndex="{Binding SelPage}"
|
<TabControl SelectedIndex="{Binding SelPage}"
|
||||||
Style="{StaticResource NoHeader_TabControl}">
|
Style="{StaticResource NoHeader_TabControl}">
|
||||||
<TabItem Name="DoorList"
|
<TabItem Name="DoorList"
|
||||||
+2
-2
@@ -3,11 +3,11 @@ Imports Effector.Plugin.Interface
|
|||||||
|
|
||||||
<Export(GetType(IPluginControl))>
|
<Export(GetType(IPluginControl))>
|
||||||
<ExportMetadata("Name", "Project")>
|
<ExportMetadata("Name", "Project")>
|
||||||
Public Class FiveLakesUI
|
Public Class PluginUIV
|
||||||
Implements IPluginControl
|
Implements IPluginControl
|
||||||
|
|
||||||
|
|
||||||
Private m_FiveLakesUIVM As FiveLakesUIVM
|
Private m_FiveLakesUIVM As PluginUIVM
|
||||||
|
|
||||||
<ImportingConstructor>
|
<ImportingConstructor>
|
||||||
Sub New(Host As IHost)
|
Sub New(Host As IHost)
|
||||||
+3
-3
@@ -1,7 +1,8 @@
|
|||||||
Imports System.ComponentModel.Composition
|
Imports System.ComponentModel.Composition
|
||||||
Imports Effector.Plugin.Interface
|
Imports Effector.Plugin.Interface
|
||||||
|
Imports Effector.Plugin.Lib
|
||||||
|
|
||||||
Public Class FiveLakesUIVM
|
Public Class PluginUIVM
|
||||||
Inherits VMBase
|
Inherits VMBase
|
||||||
|
|
||||||
Public Enum Pages As Integer
|
Public Enum Pages As Integer
|
||||||
@@ -52,8 +53,7 @@ Public Class FiveLakesUIVM
|
|||||||
' Impostazione direttorio di configurazione
|
' Impostazione direttorio di configurazione
|
||||||
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
|
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
|
||||||
' Impostazione path Ini file
|
' Impostazione path Ini file
|
||||||
IniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME)
|
PluginIniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME)
|
||||||
Effector.Plugin.Lib.PluginIniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME)
|
|
||||||
' Impostazione path resources dir
|
' Impostazione path resources dir
|
||||||
m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
|
m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
|
||||||
End Sub
|
End Sub
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
<Lib:EgtWindow x:Class="ProcessManagerV"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:Lib="clr-namespace:Effector.Plugin.Lib;assembly=Effector.Plugin.Lib"
|
|
||||||
TitleBarHeight="30"
|
|
||||||
WindowStartupLocation="CenterOwner"
|
|
||||||
ShowInTaskbar="False"
|
|
||||||
SizeToContent="WidthAndHeight">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type Lib:EgtWindow}}}"/>
|
|
||||||
<RowDefinition Height="1*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Lib:TitleBar/>
|
|
||||||
<StackPanel Grid.Row="1">
|
|
||||||
<Grid HorizontalAlignment="Center">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="30"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<TextBlock Text="Arguments Queue Count: "/>
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Text="{Binding ArgumentsQueue}"/>
|
|
||||||
<TextBlock Grid.Row="1"
|
|
||||||
Text="ResultQueue: "/>
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Grid.Row="1"
|
|
||||||
Text="{Binding ResultQueue}"/>
|
|
||||||
</Grid>
|
|
||||||
<!--<DataGrid ItemsSource="{Binding ThreadList}"
|
|
||||||
AutoGenerateColumns="False">
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTextColumn Header="Process Status"
|
|
||||||
Binding="{Binding ProcessStatus}"/>
|
|
||||||
<DataGridTextColumn Header="Curr Request Id"
|
|
||||||
Binding="{Binding CurrRequest.nId}"/>
|
|
||||||
<DataGridTextColumn Header="Curr Request Args"
|
|
||||||
Binding="{Binding CurrRequest.sArgs}"/>
|
|
||||||
<DataGridTextColumn Header="Process Result"
|
|
||||||
Binding="{Binding nProcResult}"/>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>-->
|
|
||||||
<ItemsControl ItemsSource="{Binding ThreadList}">
|
|
||||||
<ItemsControl.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Text="{Binding ProcessStatus}"/>
|
|
||||||
<TextBlock Text="{Binding CurrRequest.nId}"/>
|
|
||||||
<TextBlock Text="{Binding CurrRequest.sArgs}"/>
|
|
||||||
<TextBlock Text="{Binding nProcResult}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
|
||||||
<ProgressBar Value="{Binding dProgress_Value, Mode=OneWay}"
|
|
||||||
Minimum="0"
|
|
||||||
Maximum="{Binding dProgress_Maximum}"
|
|
||||||
Height="20"
|
|
||||||
Width="250"/>
|
|
||||||
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Lib:EgtWindow>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
Public Class ProcessManagerV
|
|
||||||
|
|
||||||
Private WithEvents m_ProcessManagerVM As ProcessManagerVM
|
|
||||||
|
|
||||||
Sub New(Owner As Window, ProcessManagerVM As ProcessManagerVM)
|
|
||||||
'MyBase.New(Owner)
|
|
||||||
Me.Owner = Owner
|
|
||||||
' This call is required by the designer.
|
|
||||||
InitializeComponent()
|
|
||||||
Me.DataContext = ProcessManagerVM
|
|
||||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
|
||||||
m_ProcessManagerVM = ProcessManagerVM
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
'Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ProcessManagerVM.m_CloseWindow
|
|
||||||
' Me.DialogResult = bDialogResult
|
|
||||||
'End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
Imports System.Windows.Threading
|
|
||||||
Imports System.Collections.ObjectModel
|
|
||||||
Imports Effector.Plugin.Lib
|
|
||||||
|
|
||||||
Public Class ProcessManagerVM
|
|
||||||
Inherits VMBase
|
|
||||||
|
|
||||||
Private m_nTaskQuantity As Integer = 3
|
|
||||||
|
|
||||||
Private m_UpdateDataTimer As New DispatcherTimer
|
|
||||||
|
|
||||||
Private m_ExecProcessManager As ExecProcessManager
|
|
||||||
Public ReadOnly Property ExecProcessManager As ExecProcessManager
|
|
||||||
Get
|
|
||||||
Return m_ExecProcessManager
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property ArgumentsQueue As String
|
|
||||||
Get
|
|
||||||
Return m_ExecProcessManager.ArgumentsQueueCount.ToString()
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property ResultQueue As String
|
|
||||||
Get
|
|
||||||
Return m_ExecProcessManager.ArgumentsResultQueueCount.ToString()
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property ThreadList As ObservableCollection(Of ThreadData)
|
|
||||||
Get
|
|
||||||
If Not IsNothing(m_ExecProcessManager.ThreadDataList) Then
|
|
||||||
Return New ObservableCollection(Of ThreadData)(m_ExecProcessManager.ThreadDataList.ToList())
|
|
||||||
Else
|
|
||||||
Return New ObservableCollection(Of ThreadData)
|
|
||||||
End If
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_dProgress_Value As Double
|
|
||||||
Public ReadOnly Property dProgress_Value As Double
|
|
||||||
Get
|
|
||||||
Return (m_dProgress_Maximum - m_nTaskQuantity - m_ExecProcessManager.ArgumentsQueueCount) '/ m_dProgress_Maximum * 100
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_dProgress_Maximum As Double
|
|
||||||
Public ReadOnly Property dProgress_Maximum As Double
|
|
||||||
Get
|
|
||||||
Return m_dProgress_Maximum
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Sub New(ExecProcessManager As ExecProcessManager)
|
|
||||||
m_ExecProcessManager = ExecProcessManager
|
|
||||||
m_dProgress_Maximum = m_ExecProcessManager.ArgumentsQueueCount + m_nTaskQuantity
|
|
||||||
m_UpdateDataTimer.Interval = New TimeSpan(0, 0, 1)
|
|
||||||
AddHandler m_UpdateDataTimer.Tick, AddressOf UpdateDataTimer_Tick
|
|
||||||
m_UpdateDataTimer.Start()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub UpdateDataTimer_Tick(sender As Object, e As EventArgs)
|
|
||||||
NotifyPropertyChanged(NameOf(ArgumentsQueue))
|
|
||||||
NotifyPropertyChanged(NameOf(ResultQueue))
|
|
||||||
NotifyPropertyChanged(NameOf(ThreadList))
|
|
||||||
NotifyPropertyChanged(NameOf(dProgress_Value))
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 424 B |
@@ -1,17 +1,18 @@
|
|||||||
<Window x:Class="RestartWndV"
|
<Lib:EffectorWindow x:Class="RestartWndV"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:Lib="clr-namespace:Effector.Plugin.Lib;assembly=Effector.Plugin.Lib"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
|
||||||
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
|
ShowInTaskbar="False"
|
||||||
mc:Ignorable="d"
|
IsMinimizable="False"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
IsClosable="False"
|
||||||
Title="{Binding sTitle}">
|
Title="{Binding sTitle}">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<local:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>
|
<local:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>
|
||||||
<local:DoorToVisibilityConverter x:Key="DoorToVisibilityConverter"/>
|
<local:DoorToVisibilityConverter x:Key="DoorToVisibilityConverter"/>
|
||||||
<local:StateToVisibilityConverter x:Key="StateToVisibilityConverter"/>
|
<local:StateToVisibilityConverter x:Key="StateToVisibilityConverter"/>
|
||||||
<local:VariableNameToVisibilityConverter x:Key="VariableNameToVisibilityConverter"/>
|
<local:VariableNameToVisibilityConverter x:Key="VariableNameToVisibilityConverter"/>
|
||||||
|
<local:ListEmptyToVisibilityConverter x:Key="ListEmptyToVisibilityConverter"/>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="1*"/>
|
<RowDefinition Height="1*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Image Source="{Binding sMachineImagePath}"
|
<Image Source="{Binding sMachineImagePath}"
|
||||||
Stretch="Uniform"/>
|
Stretch="Uniform"/>
|
||||||
@@ -207,76 +209,123 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
||||||
|
<Grid Grid.Row="2">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="Doors not found on machine!"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Visibility="{Binding DoorToBeFixedList, Converter={StaticResource ListEmptyToVisibilityConverter}}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,0,10"/>
|
||||||
|
<ItemsControl Grid.Row="1"
|
||||||
|
ItemsSource="{Binding DoorToBeFixedList}"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,0"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border BorderBrush="{StaticResource Effector_LightBlue}"
|
||||||
|
BorderThickness="2"
|
||||||
|
CornerRadius="10"
|
||||||
|
Padding="5">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="10"/>
|
||||||
|
<ColumnDefinition Width="1*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Grid.Row="0"
|
||||||
|
Text="Id"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
Grid.Row="0"
|
||||||
|
Text="{Binding nId}"
|
||||||
|
TextAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Grid.Row="2"
|
||||||
|
Text="Old State"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
Grid.Row="2"
|
||||||
|
Text="{Binding nOldState}"
|
||||||
|
TextAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Grid.Row="3"
|
||||||
|
Text="DDF Name"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
Grid.Row="3"
|
||||||
|
Text="{Binding sDDFName}"
|
||||||
|
TextAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Grid.Row="4"
|
||||||
|
Text="CSV Name"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
Grid.Row="4"
|
||||||
|
Text="{Binding sCSVName}"
|
||||||
|
TextAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Grid.Row="5"
|
||||||
|
Text="New State"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
<ComboBox Grid.Column="2"
|
||||||
|
Grid.Row="5"
|
||||||
|
ItemsSource="{Binding StateList}"
|
||||||
|
SelectedItem="{Binding SelState}"
|
||||||
|
HorizontalAlignment="Right"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!--<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
<TextBlock Text="Id"/>
|
||||||
|
<TextBlock Text="{Binding nId}"
|
||||||
|
Margin="10,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ComboBox Grid.Row="1"
|
||||||
|
ItemsSource="{Binding StateList}"
|
||||||
|
SelectedItem="{Binding SelState}"/>
|
||||||
|
</Grid>-->
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<!--<ItemsControl ItemsSource="{Binding RestartDoorList}">
|
<StackPanel Grid.Row="1"
|
||||||
<ItemsControl.ItemsPanel>
|
Orientation="Horizontal"
|
||||||
<ItemsPanelTemplate>
|
Margin="20"
|
||||||
<UniformGrid Rows="1"/>
|
HorizontalAlignment="Center">
|
||||||
</ItemsPanelTemplate>
|
|
||||||
</ItemsControl.ItemsPanel>
|
|
||||||
<ItemsControl.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid Visibility="{Binding nState, Converter={StaticResource StateToVisibilityConverter}}">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="1*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Grid.Row="0"
|
|
||||||
Text="Id"/>
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Grid.Row="0"
|
|
||||||
Text="{Binding nId}"/>
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Grid.Row="1"
|
|
||||||
Text="Circular Index"/>
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Grid.Row="1"
|
|
||||||
Text="{Binding nCircIndex}"/>
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Grid.Row="2"
|
|
||||||
Text="State"/>
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Grid.Row="2"
|
|
||||||
Text="{Binding nState}"/>
|
|
||||||
<ComboBox Grid.Column="1"
|
|
||||||
Grid.Row="2"
|
|
||||||
ItemsSource="{Binding DoorStateList}"
|
|
||||||
SelectedItem="{Binding SelDoorState}"/>
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Grid.Row="3"
|
|
||||||
Text="DDF Name"/>
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Grid.Row="3"
|
|
||||||
Text="{Binding sDDFName}"/>
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Grid.Row="4"
|
|
||||||
Text="CSV Name"/>
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Grid.Row="4"
|
|
||||||
Text="{Binding sCSVName}"/>
|
|
||||||
<TextBlock Text="Id"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>-->
|
|
||||||
<Grid Grid.Row="1">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="1*"/>
|
|
||||||
<ColumnDefinition Width="1*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Button Content="Ok"
|
<Button Content="Ok"
|
||||||
Command="{Binding Ok_Command}"/>
|
Command="{Binding Ok_Command}"
|
||||||
|
Margin="0,0,10,0"
|
||||||
|
Visibility="{Binding OkBtn_Visibility}"
|
||||||
|
Style="{StaticResource Restart_Button}"/>
|
||||||
<Button Grid.Column="1"
|
<Button Grid.Column="1"
|
||||||
Content="Empty Line"
|
Content="Empty Machine"
|
||||||
Command="{Binding Empty_Command}"/>
|
Command="{Binding Empty_Command}"
|
||||||
</Grid>
|
Margin="10,0,0,0"
|
||||||
|
Style="{StaticResource Restart_Button}"/>
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Lib:EffectorWindow>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
Public Class RestartWndV
|
Imports Effector.Plugin.Lib
|
||||||
|
|
||||||
|
Public Class RestartWndV
|
||||||
|
|
||||||
Private WithEvents m_RestartWndVM As RestartWndVM
|
Private WithEvents m_RestartWndVM As RestartWndVM
|
||||||
|
|
||||||
@@ -10,6 +12,10 @@
|
|||||||
Me.DataContext = RestartWndVM
|
Me.DataContext = RestartWndVM
|
||||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||||
m_RestartWndVM = RestartWndVM
|
m_RestartWndVM = RestartWndVM
|
||||||
|
' imposto posizione finestra
|
||||||
|
Me.SetPlacementAppName(S_GENERAL)
|
||||||
|
Me.SetPlacementKeyName(K_RESTART_WINPLACE)
|
||||||
|
Me.SetPlacementFileName(PluginIniFile.sPath)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_RestartWndVM.m_CloseWindow
|
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_RestartWndVM.m_CloseWindow
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ Imports System.Collections.ObjectModel
|
|||||||
Imports System.Globalization
|
Imports System.Globalization
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Reflection
|
Imports System.Reflection
|
||||||
|
Imports Effector.Plugin.Lib
|
||||||
|
Imports Effector.Plugin.FiveLakes.Door
|
||||||
|
|
||||||
Public Class RestartWndVM
|
Public Class RestartWndVM
|
||||||
Inherits VMBase
|
Inherits VMBase
|
||||||
@@ -52,12 +54,26 @@ Public Class RestartWndVM
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private m_DoorToBeFixedList As New ObservableCollection(Of DoorToBeFixed)
|
||||||
|
Public ReadOnly Property DoorToBeFixedList As ObservableCollection(Of DoorToBeFixed)
|
||||||
|
Get
|
||||||
|
Return m_DoorToBeFixedList
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Public ReadOnly Property VariableList As ObservableCollection(Of Variable)
|
Public ReadOnly Property VariableList As ObservableCollection(Of Variable)
|
||||||
Get
|
Get
|
||||||
Return Map.refMachinePageVM.VariableList
|
Return Map.refMachinePageVM.VariableList
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private m_OkBtn_Visibility As Visibility = True
|
||||||
|
Public ReadOnly Property OkBtn_Visibility As Visibility
|
||||||
|
Get
|
||||||
|
Return m_OkBtn_Visibility
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
' Definizione comandi
|
' Definizione comandi
|
||||||
Private m_cmdOk As ICommand
|
Private m_cmdOk As ICommand
|
||||||
Private m_cmdEmpty As ICommand
|
Private m_cmdEmpty As ICommand
|
||||||
@@ -74,16 +90,42 @@ Public Class RestartWndVM
|
|||||||
Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M" & m_nMachineIndex & "P" & nIndex, 0)
|
Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M" & m_nMachineIndex & "P" & nIndex, 0)
|
||||||
WriteVariableValueToName(nMachineIndex, "@DOORN_S" & nIndex.ToString(), nValue)
|
WriteVariableValueToName(nMachineIndex, "@DOORN_S" & nIndex.ToString(), nValue)
|
||||||
Next
|
Next
|
||||||
|
' scrive tutte le variabili dell'intera linea
|
||||||
|
'For nIndex = 0 To 4
|
||||||
|
' Dim dValue As Double = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M1P" & nIndex, 0)
|
||||||
|
' WriteVariableValueToName(1, "@WP_PR_0" & nIndex.ToString(), dValue)
|
||||||
|
' Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M1P" & nIndex, 0)
|
||||||
|
' WriteVariableValueToName(1, "@DOORN_S" & nIndex.ToString(), nValue)
|
||||||
|
' dValue = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M2P" & nIndex, 0)
|
||||||
|
' WriteVariableValueToName(2, "@WP_PR_0" & nIndex.ToString(), dValue)
|
||||||
|
' nValue = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M2P" & nIndex, 0)
|
||||||
|
' WriteVariableValueToName(2, "@DOORN_S" & nIndex.ToString(), nValue)
|
||||||
|
'Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
' riporto lista porte su log
|
||||||
|
Map.refMachinePageVM.PrintAllDoorInList()
|
||||||
|
' riporto lista variabili macchina su log
|
||||||
|
Map.refMachinePageVM.PrintAllVariableInLog()
|
||||||
|
|
||||||
Dim sBackupFilePath As String = ""
|
Dim sBackupFilePath As String = ""
|
||||||
GetPluginPrivateProfileString("General", "BackupDir", "", sBackupFilePath)
|
GetPluginPrivateProfileString("General", "BackupDir", "", sBackupFilePath)
|
||||||
sBackupFilePath &= "\LuaBackup.json"
|
sBackupFilePath &= "\LuaBackup.json"
|
||||||
|
|
||||||
Dim JsonLuaDoorList As List(Of JsonLuaDoor)
|
Dim JsonLuaDoorList As List(Of JsonLuaDoor) = Nothing
|
||||||
If File.Exists(sBackupFilePath) Then
|
If File.Exists(sBackupFilePath) Then
|
||||||
Dim sReadedFile As String = File.ReadAllText(sBackupFilePath)
|
Dim sReadedFile As String = File.ReadAllText(sBackupFilePath)
|
||||||
JsonLuaDoorList = JsonConvert.DeserializeObject(Of List(Of JsonLuaDoor))(sReadedFile)
|
JsonLuaDoorList = JsonConvert.DeserializeObject(Of List(Of JsonLuaDoor))(sReadedFile)
|
||||||
JsonLuaDoorList = JsonLuaDoorList.OrderBy(Of Integer)(Function(x) x.nCircIndex).ToList()
|
JsonLuaDoorList = JsonLuaDoorList.OrderBy(Of Integer)(Function(x) x.nCircIndex).ToList()
|
||||||
|
' riporto lista porte come letta da Json
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: Doors read from json start")
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("CircIndex Id State DDFName")
|
||||||
|
For Each Door In JsonLuaDoorList
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(Door.nCircIndex & " " & Door.nId & " " & Door.nState & " " & Door.sDDFName)
|
||||||
|
Next
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: Doors read from json end")
|
||||||
|
Else
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: File json does not exist!")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' creo posti in lista descrizioni
|
' creo posti in lista descrizioni
|
||||||
@@ -100,12 +142,196 @@ Public Class RestartWndVM
|
|||||||
Dim nCircindex As Integer = 0
|
Dim nCircindex As Integer = 0
|
||||||
GetVariableValueFromName(nMachineIndex, "@DOORN_S" & nPositionIndex.ToString(), nCircindex)
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S" & nPositionIndex.ToString(), nCircindex)
|
||||||
If nCircindex <> 0 Then
|
If nCircindex <> 0 Then
|
||||||
m_DoorOnMachineArray(nPositionIndex) = New RestartDoor(JsonLuaDoorList(nCircindex - 1))
|
If Not IsNothing(JsonLuaDoorList) AndAlso JsonLuaDoorList(nCircindex - 1).nId > 0 Then
|
||||||
|
m_DoorOnMachineArray(nPositionIndex) = New RestartDoor(JsonLuaDoorList(nCircindex - 1))
|
||||||
|
Else
|
||||||
|
m_OkBtn_Visibility = Visibility.Collapsed
|
||||||
|
NotifyPropertyChanged(NameOf(OkBtn_Visibility))
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
NotifyPropertyChanged(NameOf(DoorOnMachineArray))
|
NotifyPropertyChanged(NameOf(DoorOnMachineArray))
|
||||||
|
|
||||||
|
' riporto lista porte dopo verifica presenza
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: Doors for restart window start")
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Position CircIndex Id State DDFName")
|
||||||
|
For DoorIndex = 0 To m_DoorOnMachineArray.Count - 1
|
||||||
|
Dim Door As RestartDoor = m_DoorOnMachineArray(DoorIndex)
|
||||||
|
If IsNothing(Door) Then
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(DoorIndex & " Empty")
|
||||||
|
Else
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(DoorIndex & " " & Door.nCircIndex & " " & Door.nId & " " & Door.nState & " " & Door.sDDFName)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: Doors for restart window end")
|
||||||
|
|
||||||
|
' percorro la lista lua
|
||||||
|
If Not IsNothing(JsonLuaDoorList) Then
|
||||||
|
For LuaDoorIndex = 0 To JsonLuaDoorList.Count - 1
|
||||||
|
Dim LuaDoor As JsonLuaDoor = JsonLuaDoorList(LuaDoorIndex)
|
||||||
|
If nMachineIndex = 1 Then
|
||||||
|
' verifico che in base allo stato siano in una posizione conforme, altrimenti li azzero
|
||||||
|
Select Case LuaDoor.nState
|
||||||
|
Case 1, 2 ' IMPORTED, SENT_1
|
||||||
|
Dim nCircIndex0 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S0", nCircIndex0)
|
||||||
|
If nCircIndex0 <> LuaDoor.nCircIndex Then
|
||||||
|
ResetLuaDoor(LuaDoorIndex, JsonLuaDoorList)
|
||||||
|
End If
|
||||||
|
Case 3 ' START_MACHINING_1
|
||||||
|
Dim nCircIndex0 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S0", nCircIndex0)
|
||||||
|
Dim nCircIndex1 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S1", nCircIndex1)
|
||||||
|
Dim nCircIndex2 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S2", nCircIndex2)
|
||||||
|
If nCircIndex0 <> LuaDoor.nCircIndex AndAlso nCircIndex1 <> LuaDoor.nCircIndex AndAlso nCircIndex2 <> LuaDoor.nCircIndex Then
|
||||||
|
ResetLuaDoor(LuaDoorIndex, JsonLuaDoorList)
|
||||||
|
End If
|
||||||
|
Case 4 ' MACHINED_1
|
||||||
|
Dim nCircIndex2 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S2", nCircIndex2)
|
||||||
|
Dim nCircIndex3 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S3", nCircIndex3)
|
||||||
|
Dim nCircIndex4 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S4", nCircIndex4)
|
||||||
|
If nCircIndex2 <> LuaDoor.nCircIndex AndAlso nCircIndex3 <> LuaDoor.nCircIndex AndAlso nCircIndex4 <> LuaDoor.nCircIndex Then
|
||||||
|
ResetLuaDoor(LuaDoorIndex, JsonLuaDoorList)
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
ElseIf nMachineIndex = 2 Then
|
||||||
|
Select Case LuaDoor.nState
|
||||||
|
Case 5 ' SENT_2
|
||||||
|
Dim nCircIndex0 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S0", nCircIndex0)
|
||||||
|
If nCircIndex0 <> LuaDoor.nCircIndex Then
|
||||||
|
ResetLuaDoor(LuaDoorIndex, JsonLuaDoorList)
|
||||||
|
End If
|
||||||
|
Case 6 ' START_MACHINING_2
|
||||||
|
Dim nCircIndex0 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S0", nCircIndex0)
|
||||||
|
Dim nCircIndex1 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S1", nCircIndex1)
|
||||||
|
Dim nCircIndex2 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S2", nCircIndex2)
|
||||||
|
If nCircIndex0 <> LuaDoor.nCircIndex AndAlso nCircIndex1 <> LuaDoor.nCircIndex AndAlso nCircIndex2 <> LuaDoor.nCircIndex Then
|
||||||
|
ResetLuaDoor(LuaDoorIndex, JsonLuaDoorList)
|
||||||
|
End If
|
||||||
|
Case 7 ' MACHINED_2
|
||||||
|
Dim nCircIndex2 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S2", nCircIndex2)
|
||||||
|
Dim nCircIndex3 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S3", nCircIndex3)
|
||||||
|
Dim nCircIndex4 As Integer = 0
|
||||||
|
GetVariableValueFromName(nMachineIndex, "@DOORN_S4", nCircIndex4)
|
||||||
|
If nCircIndex2 <> LuaDoor.nCircIndex AndAlso nCircIndex3 <> LuaDoor.nCircIndex AndAlso nCircIndex4 <> LuaDoor.nCircIndex Then
|
||||||
|
ResetLuaDoor(LuaDoorIndex, JsonLuaDoorList)
|
||||||
|
End If
|
||||||
|
Case 8 ' UNLOADED
|
||||||
|
ResetLuaDoor(LuaDoorIndex, JsonLuaDoorList)
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
' riporto lista porte che scrivo su json
|
||||||
|
If IsNothing(JsonLuaDoorList) Then
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: File json does not exist!")
|
||||||
|
Else
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: Doors to be written on json start")
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("CircIndex Id State DDFName")
|
||||||
|
For Each Door In JsonLuaDoorList
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(Door.nCircIndex & " " & Door.nId & " " & Door.nState & " " & Door.sDDFName)
|
||||||
|
Next
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: Doors to be written on json end")
|
||||||
|
End If
|
||||||
|
|
||||||
|
' aggiorno file backup del lua
|
||||||
|
If File.Exists(sBackupFilePath) Then
|
||||||
|
Try
|
||||||
|
File.Delete(sBackupFilePath)
|
||||||
|
Catch ex As Exception
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Dim sWriteFile As String = JsonConvert.SerializeObject(JsonLuaDoorList, Formatting.Indented)
|
||||||
|
File.WriteAllText(sBackupFilePath, sWriteFile)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' verifico se in lista porte ci sono porte non gestite
|
||||||
|
|
||||||
|
For DoorIndex = 0 To Map.refDoorListPageVM.DoorList.Count - 1
|
||||||
|
Dim CurrDoor As Door = Map.refDoorListPageVM.DoorList(DoorIndex)
|
||||||
|
Select Case CurrDoor.nState
|
||||||
|
Case Door.DoorStates.PRODUCED
|
||||||
|
Continue For
|
||||||
|
Case Door.DoorStates.MACHINE_2_END
|
||||||
|
If nMachineIndex = 1 Then Continue For
|
||||||
|
' cerco porta tra quelle in restart
|
||||||
|
If Not IdIsInRestartList(CurrDoor.nId) Then
|
||||||
|
m_DoorToBeFixedList.Add(New DoorToBeFixed(CurrDoor, nMachineIndex))
|
||||||
|
End If
|
||||||
|
Case Door.DoorStates.MACHINE_2_START
|
||||||
|
If nMachineIndex = 1 Then Continue For
|
||||||
|
' cerco porta tra quelle in restart
|
||||||
|
If Not IdIsInRestartList(CurrDoor.nId) Then
|
||||||
|
m_DoorToBeFixedList.Add(New DoorToBeFixed(CurrDoor, nMachineIndex))
|
||||||
|
End If
|
||||||
|
Case Door.DoorStates.MACHINE_1_END
|
||||||
|
If nMachineIndex = 2 Then
|
||||||
|
Dim bOnMachine1 As Boolean = False
|
||||||
|
' verifico che l'id sia in Json Door
|
||||||
|
Dim Machine1EndDoor As JsonLuaDoor = JsonLuaDoorList.FirstOrDefault(Function(x) x.nId = CurrDoor.nId)
|
||||||
|
If Not IsNothing(Machine1EndDoor) Then
|
||||||
|
' verifico che l'id sia in qualche posizione
|
||||||
|
For nPositionIndex As Integer = 4 To 0 Step -1
|
||||||
|
Dim dWPValue As Double = 0
|
||||||
|
GetVariableValueFromName(1, "@WP_PR_0" & nPositionIndex.ToString(), dWPValue)
|
||||||
|
If dWPValue <> 0 Then
|
||||||
|
' verifico indice
|
||||||
|
Dim nCircindex As Integer = 0
|
||||||
|
GetVariableValueFromName(1, "@DOORN_S" & nPositionIndex.ToString(), nCircindex)
|
||||||
|
If nCircindex = Machine1EndDoor.nCircIndex Then
|
||||||
|
bOnMachine1 = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
If Not bOnMachine1 Then
|
||||||
|
m_DoorToBeFixedList.Add(New DoorToBeFixed(CurrDoor, nMachineIndex))
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
' cerco porta tra quelle in restart
|
||||||
|
If Not IdIsInRestartList(CurrDoor.nId) Then
|
||||||
|
m_DoorToBeFixedList.Add(New DoorToBeFixed(CurrDoor, nMachineIndex))
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Case Door.DoorStates.MACHINE_1_START
|
||||||
|
If nMachineIndex = 2 Then Continue For
|
||||||
|
' cerco porta tra quelle in restart
|
||||||
|
If Not IdIsInRestartList(CurrDoor.nId) Then
|
||||||
|
m_DoorToBeFixedList.Add(New DoorToBeFixed(CurrDoor, nMachineIndex))
|
||||||
|
End If
|
||||||
|
Case Door.DoorStates.ON_LOAD_STATION
|
||||||
|
If nMachineIndex = 2 Then Continue For
|
||||||
|
' cerco porta tra quelle in restart
|
||||||
|
If Not IdIsInRestartList(CurrDoor.nId) Then
|
||||||
|
m_DoorToBeFixedList.Add(New DoorToBeFixed(CurrDoor, nMachineIndex))
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
Next
|
||||||
|
|
||||||
|
' riporto lista porte non gestite
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: Doors not managed from list start")
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Id State")
|
||||||
|
For Each Door In m_DoorToBeFixedList
|
||||||
|
Map.refSupervisorFunction.PlgOutLog(Door.nId & " " & Door.SelState)
|
||||||
|
Next
|
||||||
|
Map.refSupervisorFunction.PlgOutLog("Machine" & nMachineIndex & ".lua: Doors not managed from list end")
|
||||||
|
|
||||||
|
' riporto lista porte su log
|
||||||
|
Map.refMachinePageVM.PrintAllDoorInList()
|
||||||
|
|
||||||
'If File.Exists(sBackupFilePath) Then
|
'If File.Exists(sBackupFilePath) Then
|
||||||
' Dim sReadedFile As String = File.ReadAllText(sBackupFilePath)
|
' Dim sReadedFile As String = File.ReadAllText(sBackupFilePath)
|
||||||
@@ -127,12 +353,22 @@ Public Class RestartWndVM
|
|||||||
|
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
|
' carico immagine della macchina
|
||||||
|
|
||||||
' se macchina 1
|
|
||||||
Dim sResourcesDirPath As String = ""
|
Dim sResourcesDirPath As String = ""
|
||||||
GetPluginPrivateProfileString(S_GENERAL, K_RESOURCESDIR, "", sResourcesDirPath)
|
GetPluginPrivateProfileString(S_GENERAL, K_RESOURCESDIR, "", sResourcesDirPath)
|
||||||
m_sMachineImagePath = sResourcesDirPath & "\Multiax-C1223Ripartenza.png"
|
m_sMachineImagePath = sResourcesDirPath & "\Machine" & m_nMachineIndex & ".png"
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function IdIsInRestartList(nId As Integer) As Boolean
|
||||||
|
For Each Door In m_DoorOnMachineArray
|
||||||
|
If IsNothing(Door) Then Continue For
|
||||||
|
If Door.nId = nId Then Return True
|
||||||
|
Next
|
||||||
|
Return False
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub ResetLuaDoor(Index As Integer, LuaDoorList As List(Of JsonLuaDoor))
|
||||||
|
LuaDoorList(Index) = New JsonLuaDoor(0, LuaDoorList(Index).nCircIndex, 0, "", "", "", "", "", "", 0, 0, 0, 0, 0, 0)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region ' CONSTRUCTOR
|
#End Region ' CONSTRUCTOR
|
||||||
@@ -187,9 +423,53 @@ Public Class RestartWndVM
|
|||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Sub Ok()
|
Public Sub Ok()
|
||||||
|
' se ci sono porte da sistemare
|
||||||
|
If m_DoorToBeFixedList.Count > 0 Then
|
||||||
|
' verifico se devo cambiarne l'ordine
|
||||||
|
For Each ToBeFixedDoor In m_DoorToBeFixedList
|
||||||
|
Dim Door As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nId = ToBeFixedDoor.nId)
|
||||||
|
If ToBeFixedDoor.SelState = Door.DoorStates.NOTPRODUCE Then
|
||||||
|
Dim DoorIndex As Integer = Map.refDoorListPageVM.DoorList.IndexOf(Door)
|
||||||
|
For Index = 0 To Map.refDoorListPageVM.DoorList.Count - 1
|
||||||
|
If Map.refDoorListPageVM.DoorList(Index).nState < Door.DoorStates.READY_FOR_PRODUCTION Then
|
||||||
|
Map.refDoorListPageVM.DoorList.Move(DoorIndex, If(Index > 0, Index - 1, 0))
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Door.SetState(Door.DoorStates.NOTPRODUCE)
|
||||||
|
ElseIf ToBeFixedDoor.SelState = Door.DoorStates.READY_FOR_PRODUCTION Then
|
||||||
|
Door.SetState(Door.DoorStates.READY_FOR_PRODUCTION)
|
||||||
|
Door.SetProdState(Door.DoorProdStates.NOT_INIT)
|
||||||
|
'Door.SetLoadTime(0)
|
||||||
|
'Door.SetMachining1Start(0)
|
||||||
|
'Door.SetMachining1End(0)
|
||||||
|
'Door.SetMachining2Start(0)
|
||||||
|
'Door.SetMachining2End(0)
|
||||||
|
'Door.SetUnloadTime(0)
|
||||||
|
ElseIf ToBeFixedDoor.SelState = Door.DoorStates.PRODUCED Then
|
||||||
|
Door.SetState(Door.DoorStates.PRODUCED)
|
||||||
|
Door.SetProdState(Door.DoorProdStates.UNLOADED)
|
||||||
|
If Door.dtMachining2End = DateTime.MinValue Then
|
||||||
|
Door.SetMachining2End(DateTime.Now)
|
||||||
|
End If
|
||||||
|
If Door.dtUnloadTime = DateTime.MinValue Then
|
||||||
|
Door.SetUnloadTime(DateTime.Now)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
Map.refDoorListPageVM.NotifyPropertyChanged(NameOf(Map.refDoorListPageVM.DoorList))
|
||||||
RaiseEvent m_CloseWindow(True)
|
RaiseEvent m_CloseWindow(True)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function IdIsInToBeFixedList(nId As Integer) As Boolean
|
||||||
|
For Each Door In m_DoorToBeFixedList
|
||||||
|
If IsNothing(Door) Then Continue For
|
||||||
|
If Door.nId = nId Then Return True
|
||||||
|
Next
|
||||||
|
Return False
|
||||||
|
End Function
|
||||||
|
|
||||||
#End Region ' Ok
|
#End Region ' Ok
|
||||||
|
|
||||||
#Region "Empty"
|
#Region "Empty"
|
||||||
@@ -204,8 +484,40 @@ Public Class RestartWndVM
|
|||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Sub Empty()
|
Public Sub Empty()
|
||||||
Map.refDoorListPageVM.ResetProductionQueue()
|
Dim sDoorToRemove As String = ""
|
||||||
Map.refDoorListPageVM.WriteBackup()
|
For DoorIndex As Integer = 0 To m_DoorOnMachineArray.Count - 1
|
||||||
|
Dim DoorToRemove As RestartDoor = m_DoorOnMachineArray(DoorIndex)
|
||||||
|
If Not IsNothing(DoorToRemove) Then
|
||||||
|
sDoorToRemove &= "- " & DoorToRemove.nId & DoorToRemove.sCSVName & If(DoorIndex > m_DoorOnMachineArray.Count - 1, Environment.NewLine, "")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
MessageBox.Show("Are you sure you want to empty the machine?" & Environment.NewLine &
|
||||||
|
If(Not String.IsNullOrWhiteSpace(sDoorToRemove), "You have to remove doors:" & Environment.NewLine & sDoorToRemove, "") & Environment.NewLine &
|
||||||
|
"You have to reset the machine and then restart it.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||||
|
' se ci sono porte sulla macchina
|
||||||
|
If m_DoorOnMachineArray.Count > 0 Then
|
||||||
|
For Each DoorOnmachine In m_DoorOnMachineArray
|
||||||
|
If Not IsNothing(DoorOnmachine) Then
|
||||||
|
Dim Door As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nId = DoorOnmachine.nId)
|
||||||
|
If Not IsNothing(Door) Then
|
||||||
|
Door.SetState(Door.DoorStates.READY_FOR_PRODUCTION)
|
||||||
|
Door.SetProdState(Door.DoorProdStates.NOT_INIT)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
' se ci sono porte da sistemare
|
||||||
|
If m_DoorToBeFixedList.Count > 0 Then
|
||||||
|
' verifico se devo cambiarne l'ordine
|
||||||
|
For Each ToBeFixedDoor In m_DoorToBeFixedList
|
||||||
|
Dim Door As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nId = ToBeFixedDoor.nId)
|
||||||
|
If Not IsNothing(Door) Then
|
||||||
|
Door.SetState(Door.DoorStates.READY_FOR_PRODUCTION)
|
||||||
|
Door.SetProdState(Door.DoorProdStates.NOT_INIT)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
' imposto stato di reset
|
||||||
RaiseEvent m_CloseWindow(False)
|
RaiseEvent m_CloseWindow(False)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -248,6 +560,83 @@ Public Class VariableNameToVisibilityConverter
|
|||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
Public Class ListEmptyToVisibilityConverter
|
||||||
|
Implements IValueConverter
|
||||||
|
|
||||||
|
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
|
||||||
|
If IsNothing(value) OrElse Not TypeOf value Is IList Then Return Visibility.Collapsed
|
||||||
|
Dim List As IList = DirectCast(value, IList)
|
||||||
|
Return If(List.Count > 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 DoorToBeFixed
|
||||||
|
|
||||||
|
Private m_nId As Integer = -1
|
||||||
|
Public ReadOnly Property nId As Integer
|
||||||
|
Get
|
||||||
|
Return m_nId
|
||||||
|
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_nOldState As DoorStates
|
||||||
|
Public ReadOnly Property nOldState As DoorStates
|
||||||
|
Get
|
||||||
|
Return m_nOldState
|
||||||
|
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_StateList As New ObservableCollection(Of Door.DoorStates)
|
||||||
|
Public ReadOnly Property StateList As ObservableCollection(Of Door.DoorStates)
|
||||||
|
Get
|
||||||
|
Return m_StateList
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_SelState As Door.DoorStates
|
||||||
|
Public Property SelState As Door.DoorStates
|
||||||
|
Get
|
||||||
|
Return m_SelState
|
||||||
|
End Get
|
||||||
|
Set(value As Door.DoorStates)
|
||||||
|
m_SelState = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Sub New(Door As Door, nMachineIndex As Integer)
|
||||||
|
m_nId = Door.nId
|
||||||
|
m_sDDFName = Door.sDDFName
|
||||||
|
m_nOldState = Door.nState
|
||||||
|
m_sCSVName = Door.sCSVName
|
||||||
|
If nMachineIndex = 1 Then
|
||||||
|
m_StateList = New ObservableCollection(Of Door.DoorStates)({Door.DoorStates.READY_FOR_PRODUCTION, Door.DoorStates.NOTPRODUCE})
|
||||||
|
ElseIf nMachineIndex = 2 Then
|
||||||
|
m_StateList = New ObservableCollection(Of Door.DoorStates)({Door.DoorStates.READY_FOR_PRODUCTION, Door.DoorStates.NOTPRODUCE, Door.DoorStates.PRODUCED})
|
||||||
|
End If
|
||||||
|
m_SelState = Door.DoorStates.NOTPRODUCE
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
Public Class RestartDoor
|
Public Class RestartDoor
|
||||||
Inherits VMBase
|
Inherits VMBase
|
||||||
|
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
|
|
||||||
''' <summary>
|
|
||||||
''' A command whose sole purpose is to
|
|
||||||
''' relay its functionality to other
|
|
||||||
''' objects by invoking delegates. The
|
|
||||||
''' default return value for the CanExecute
|
|
||||||
''' method is 'true'.
|
|
||||||
''' </summary>
|
|
||||||
Public Class Command
|
|
||||||
Implements ICommand
|
|
||||||
|
|
||||||
#Region "Fields"
|
|
||||||
|
|
||||||
Private ReadOnly _execute As Action(Of Object)
|
|
||||||
Private ReadOnly _canExecute As Predicate(Of Object)
|
|
||||||
|
|
||||||
#End Region ' Fields
|
|
||||||
|
|
||||||
#Region "Constructors"
|
|
||||||
|
|
||||||
''' <summary>
|
|
||||||
''' Creates a new command that can always execute.
|
|
||||||
''' </summary>
|
|
||||||
''' <param name="execute">The execution logic.</param>
|
|
||||||
Public Sub New(ByVal execute As Action(Of Object))
|
|
||||||
Me.New(execute, Nothing)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
''' <summary>
|
|
||||||
''' Creates a new command.
|
|
||||||
''' </summary>
|
|
||||||
''' <param name="execute">The execution logic.</param>
|
|
||||||
''' <param name="canExecute">The execution status logic.</param>
|
|
||||||
Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
|
|
||||||
If execute Is Nothing Then
|
|
||||||
Throw New ArgumentNullException("execute")
|
|
||||||
End If
|
|
||||||
|
|
||||||
_execute = execute
|
|
||||||
_canExecute = canExecute
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
#End Region ' Constructors
|
|
||||||
|
|
||||||
#Region "ICommand Members"
|
|
||||||
|
|
||||||
<DebuggerStepThrough> _
|
|
||||||
Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
|
|
||||||
Return If(_canExecute Is Nothing, True, _canExecute(parameter))
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
|
|
||||||
AddHandler(ByVal value As EventHandler)
|
|
||||||
AddHandler CommandManager.RequerySuggested, value
|
|
||||||
End AddHandler
|
|
||||||
RemoveHandler(ByVal value As EventHandler)
|
|
||||||
RemoveHandler CommandManager.RequerySuggested, value
|
|
||||||
End RemoveHandler
|
|
||||||
RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
|
||||||
End RaiseEvent
|
|
||||||
End Event
|
|
||||||
|
|
||||||
Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
|
|
||||||
_execute(parameter)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
#End Region ' ICommand Members
|
|
||||||
|
|
||||||
End Class
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
Assign a Key to every Panel ViewModel to use
|
Assign a Key to every Panel ViewModel to use
|
||||||
it in xaml file(ProjectView.xaml).
|
it in xaml file(ProjectView.xaml).
|
||||||
-->
|
-->
|
||||||
<local:FiveLakesUIVM x:Key="FiveLakesUIVM"/>
|
<local:PluginUIVM x:Key="PluginUIVM"/>
|
||||||
<local:MainMenuVM x:Key="MainMenuVM"/>
|
<local:MainMenuVM x:Key="MainMenuVM"/>
|
||||||
<local:DoorListPageVM x:Key="DoorListVM"/>
|
<local:DoorListPageVM x:Key="DoorListVM"/>
|
||||||
<local:MachinePageVM x:Key="MachinePageVM"/>
|
<local:MachinePageVM x:Key="MachinePageVM"/>
|
||||||
@@ -157,6 +157,18 @@
|
|||||||
<Setter Property="Padding" Value="2"/>
|
<Setter Property="Padding" Value="2"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="Restart_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||||
|
<Setter Property="Height" Value="40"/>
|
||||||
|
<Setter Property="Width" Value="150"/>
|
||||||
|
<Setter Property="Foreground" Value="White"/>
|
||||||
|
<Setter Property="FontSize" Value="15"/>
|
||||||
|
<Setter Property="FontWeight" Value="Regular"/>
|
||||||
|
<Setter Property="FontFamily" Value="/Resources/Fonts/#Roboto"/>
|
||||||
|
<Setter Property="Background" Value="{StaticResource Effector_DarkBlue}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Padding" Value="10,5,10,5"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<!--ToggleButton-->
|
<!--ToggleButton-->
|
||||||
|
|
||||||
<Style TargetType="{x:Type ToggleButton}">
|
<Style TargetType="{x:Type ToggleButton}">
|
||||||
|
|||||||
@@ -1,712 +0,0 @@
|
|||||||
Imports System.IO
|
|
||||||
Imports System.Threading
|
|
||||||
Imports MS.Internal
|
|
||||||
Imports Effector.Plugin.FiveLakes.ThreadData
|
|
||||||
Imports System.Windows.Threading
|
|
||||||
Imports Effector.Plugin.Lib
|
|
||||||
|
|
||||||
Public Class ExecProcessManager
|
|
||||||
|
|
||||||
Public Event m_AllArgsProcessed()
|
|
||||||
|
|
||||||
Public Enum ExecutionThreadStatuses As Integer
|
|
||||||
RUNNING = 1
|
|
||||||
STOPPED = 2
|
|
||||||
End Enum
|
|
||||||
|
|
||||||
Private Enum ProcessManagerStates
|
|
||||||
NULL = 0
|
|
||||||
OPEN = 1
|
|
||||||
CLOSE = 2
|
|
||||||
End Enum
|
|
||||||
|
|
||||||
Private m_ProcessManagerTimer As New DispatcherTimer
|
|
||||||
Private m_ProcessManagerState As ProcessManagerStates
|
|
||||||
Private m_ProcessManagerV As ProcessManagerV
|
|
||||||
Public ReadOnly Property ProcessManagerV As ProcessManagerV
|
|
||||||
Get
|
|
||||||
Return m_ProcessManagerV
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
' riferimento al thread principale
|
|
||||||
Private m_ExecutionThread As Thread
|
|
||||||
Private m_ExecutionThreadStatus As ExecutionThreadStatuses = ExecutionThreadStatuses.STOPPED
|
|
||||||
Public ReadOnly Property ExecutionThreadStatus As ExecutionThreadStatuses
|
|
||||||
Get
|
|
||||||
Return m_ExecutionThreadStatus
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
' array dei thread
|
|
||||||
Private m_ThreadList As Thread()
|
|
||||||
' array dei dati dei thread
|
|
||||||
Private m_ThreadDataList As ThreadData()
|
|
||||||
Friend ReadOnly Property ThreadDataList As ThreadData()
|
|
||||||
Get
|
|
||||||
Return m_ThreadDataList
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
' variabile che ferma i processi
|
|
||||||
Private m_bStopProcess As Boolean = False
|
|
||||||
' variabile che conferma chiusura dei processi
|
|
||||||
Private m_bExecutionThreadStoped As Boolean = False
|
|
||||||
' numero massimo di istanze del cam
|
|
||||||
Private m_MaxCamInstances As Integer = 1
|
|
||||||
' nome dell'eseguibile da lanciare
|
|
||||||
Private m_sProcessFileName As String = ""
|
|
||||||
' stringa di argomenti dell'eseguibile da lanciare
|
|
||||||
Private m_sProcessArguments As String = ""
|
|
||||||
' coda delle cose da eseguire
|
|
||||||
Private ArgumentsQueueLock As New Object
|
|
||||||
Private m_ArgumentsQueue As New Queue(Of ProcessArgs)
|
|
||||||
Public ReadOnly Property ArgumentsQueue As Queue(Of ProcessArgs)
|
|
||||||
Get
|
|
||||||
Return m_ArgumentsQueue
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
' coda dei risultati
|
|
||||||
Private ArgumentsResultQueueLock As New Object
|
|
||||||
Private m_ArgumentsResultQueue As New Queue(Of ProcessArgsResult)
|
|
||||||
Public ReadOnly Property ArgumentsResultQueue As Queue(Of ProcessArgsResult)
|
|
||||||
Get
|
|
||||||
Return m_ArgumentsResultQueue
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
' funzione che richiede prossimo elemento da processare
|
|
||||||
Private m_delGetNextProcessArgs As Func(Of ProcessArgs)
|
|
||||||
Public Sub SetGetNextProcessArgs(GetNextProcessArgs As Func(Of ProcessArgs))
|
|
||||||
m_delGetNextProcessArgs = GetNextProcessArgs
|
|
||||||
End Sub
|
|
||||||
' funzione di pre processing dell'elemento
|
|
||||||
Private m_delPreProcess As Func(Of ProcessArgs, ProcessArgs)
|
|
||||||
Public Sub SetPreProcess(PreProcess As Func(Of ProcessArgs, ProcessArgs))
|
|
||||||
m_delPreProcess = PreProcess
|
|
||||||
End Sub
|
|
||||||
' funzione di post processing dell'elemento
|
|
||||||
Private m_delPostProcess As Action(Of ProcessArgsResult)
|
|
||||||
Public Sub SetPostProcess(PostProcess As Action(Of ProcessArgsResult))
|
|
||||||
m_delPostProcess = PostProcess
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub New(sProcessFileName As String, sProcessArguments As String)
|
|
||||||
m_sProcessFileName = sProcessFileName
|
|
||||||
m_sProcessArguments = sProcessArguments
|
|
||||||
m_ProcessManagerTimer.Interval = New TimeSpan(0, 0, 1)
|
|
||||||
AddHandler m_ProcessManagerTimer.Tick, AddressOf ProcessManagerTimer_Tick
|
|
||||||
m_ProcessManagerTimer.Start()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub ProcessManagerTimer_Tick(sender As Object, e As EventArgs)
|
|
||||||
Select Case m_ProcessManagerState
|
|
||||||
Case ProcessManagerStates.OPEN
|
|
||||||
' creo finestra statistiche processi
|
|
||||||
m_ProcessManagerV = New ProcessManagerV(Application.Current.MainWindow, New ProcessManagerVM(Me))
|
|
||||||
ProcessManagerV.Show()
|
|
||||||
m_ProcessManagerState = ProcessManagerStates.NULL
|
|
||||||
Case ProcessManagerStates.CLOSE
|
|
||||||
' chiudo finestra statistiche processi
|
|
||||||
If Not IsNothing(m_ProcessManagerV) Then
|
|
||||||
ProcessManagerV.Close()
|
|
||||||
m_ProcessManagerV = Nothing
|
|
||||||
End If
|
|
||||||
m_ProcessManagerState = ProcessManagerStates.NULL
|
|
||||||
End Select
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Function ArgumentsEnqueue(ProcessArgs As ProcessArgs) As Boolean
|
|
||||||
If ProcessArgs.nId <= 0 OrElse String.IsNullOrWhiteSpace(ProcessArgs.sArgs) Then Return False
|
|
||||||
SyncLock ArgumentsQueueLock
|
|
||||||
m_ArgumentsQueue.Enqueue(ProcessArgs)
|
|
||||||
End SyncLock
|
|
||||||
Return True
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function ArgumentsDequeue() As ProcessArgs
|
|
||||||
Dim DequeueProcessArgs As ProcessArgs = Nothing
|
|
||||||
SyncLock ArgumentsQueueLock
|
|
||||||
If m_ArgumentsQueue.Count > 0 Then
|
|
||||||
DequeueProcessArgs = m_ArgumentsQueue.Dequeue()
|
|
||||||
End If
|
|
||||||
End SyncLock
|
|
||||||
Return DequeueProcessArgs
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function ArgumentsQueueCount() As Integer
|
|
||||||
Dim nCount As Integer = 0
|
|
||||||
SyncLock ArgumentsQueueLock
|
|
||||||
nCount = m_ArgumentsQueue.Count
|
|
||||||
End SyncLock
|
|
||||||
Return nCount
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function ArgumentsResultEnqueue(ProcessArgsResult As ProcessArgsResult) As Boolean
|
|
||||||
SyncLock ArgumentsResultQueueLock
|
|
||||||
m_ArgumentsResultQueue.Enqueue(ProcessArgsResult)
|
|
||||||
End SyncLock
|
|
||||||
Return True
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function ArgumentsResultDequeue() As ProcessArgsResult
|
|
||||||
Dim DequeueProcessArgsResult As ProcessArgsResult = Nothing
|
|
||||||
SyncLock ArgumentsResultQueueLock
|
|
||||||
If m_ArgumentsResultQueue.Count > 0 Then
|
|
||||||
DequeueProcessArgsResult = m_ArgumentsResultQueue.Dequeue()
|
|
||||||
End If
|
|
||||||
End SyncLock
|
|
||||||
Return DequeueProcessArgsResult
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function ArgumentsResultQueueCount() As Integer
|
|
||||||
Dim nCount As Integer = 0
|
|
||||||
SyncLock ArgumentsResultQueueLock
|
|
||||||
nCount = m_ArgumentsResultQueue.Count
|
|
||||||
End SyncLock
|
|
||||||
Return nCount
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Sub SetMaxCamInstances(nValue As Integer)
|
|
||||||
' Numero di core logici da utilizzare (minimo tra presenti sul PC e imposti da INI)
|
|
||||||
Dim nMaxThread As Integer = Math.Min(Environment.ProcessorCount, nValue)
|
|
||||||
m_MaxCamInstances = nMaxThread
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
' funzione che avvia thread principale
|
|
||||||
Public Sub StartExecutionThread()
|
|
||||||
If m_ExecutionThreadStatus = ExecutionThreadStatuses.RUNNING Then Return
|
|
||||||
m_bStopProcess = False
|
|
||||||
m_bExecutionThreadStoped = False
|
|
||||||
m_ExecutionThread = New Thread(Sub()
|
|
||||||
ExecutionProcess()
|
|
||||||
End Sub)
|
|
||||||
|
|
||||||
m_ExecutionThread.SetApartmentState(ApartmentState.STA)
|
|
||||||
' avvio thread di gestione della macchina che avvia la connessione
|
|
||||||
m_ExecutionThread.Start()
|
|
||||||
|
|
||||||
m_ExecutionThreadStatus = ExecutionThreadStatuses.RUNNING
|
|
||||||
' lancio apertura finestra statistiche processi
|
|
||||||
m_ProcessManagerState = ProcessManagerStates.OPEN
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub StopExecutionThread()
|
|
||||||
If m_ExecutionThreadStatus = ExecutionThreadStatuses.STOPPED Then Return
|
|
||||||
m_bStopProcess = True
|
|
||||||
While Not m_bExecutionThreadStoped
|
|
||||||
Thread.Sleep(100)
|
|
||||||
End While
|
|
||||||
If Not IsNothing(m_ExecutionThread) Then
|
|
||||||
m_ExecutionThread.Abort()
|
|
||||||
While Not m_ExecutionThread.ThreadState = ThreadState.Aborted
|
|
||||||
Thread.Sleep(100)
|
|
||||||
End While
|
|
||||||
m_ExecutionThread = Nothing
|
|
||||||
End If
|
|
||||||
m_ThreadList = Nothing
|
|
||||||
m_ExecutionThreadStatus = ExecutionThreadStatuses.STOPPED
|
|
||||||
' lancio chiusura finestra statistiche processi
|
|
||||||
m_ProcessManagerState = ProcessManagerStates.CLOSE
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
' funzione di esecuzione del thread principale che gestice i processi
|
|
||||||
Private Sub ExecutionProcess()
|
|
||||||
Dim bStopMainProcess As Boolean = False
|
|
||||||
Dim nStartingProc As Integer = 0
|
|
||||||
While Not bStopMainProcess
|
|
||||||
bStopMainProcess = m_bStopProcess
|
|
||||||
' se processo fermato, fermo i thread
|
|
||||||
If bStopMainProcess Then
|
|
||||||
If Not IsNothing(m_ThreadList) AndAlso m_ThreadList.Count > 0 AndAlso Not IsNothing(m_ThreadList(0)) Then
|
|
||||||
' li fermo
|
|
||||||
m_bStopProcess = True
|
|
||||||
' verifico siano terminati
|
|
||||||
Dim bOneNotEnded As Boolean = True
|
|
||||||
While bOneNotEnded
|
|
||||||
bOneNotEnded = False
|
|
||||||
For Each Thread In m_ThreadList
|
|
||||||
If Not IsNothing(Thread) Then
|
|
||||||
If Thread.IsAlive Then
|
|
||||||
bOneNotEnded = True
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
End While
|
|
||||||
' pulisco la lista
|
|
||||||
For ThreadIndex = 0 To m_ThreadList.Count - 1
|
|
||||||
m_ThreadList(ThreadIndex) = Nothing
|
|
||||||
Next
|
|
||||||
m_bStopProcess = False
|
|
||||||
End If
|
|
||||||
m_bExecutionThreadStoped = True
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
' se lista processi nulla o vuota, li faccio partire
|
|
||||||
If (IsNothing(m_ThreadList) OrElse m_ThreadList.Count = 0) Then
|
|
||||||
m_ThreadList = New Thread(m_MaxCamInstances - 1) {}
|
|
||||||
m_ThreadDataList = New ThreadData(m_MaxCamInstances - 1) {}
|
|
||||||
For nThreadIndex = 0 To m_MaxCamInstances - 1
|
|
||||||
Dim ThreadId As Integer = nThreadIndex
|
|
||||||
m_ThreadList(nThreadIndex) = New Thread(Sub()
|
|
||||||
ThreadFunction(ThreadId)
|
|
||||||
End Sub)
|
|
||||||
m_ThreadList(nThreadIndex).SetApartmentState(ApartmentState.STA)
|
|
||||||
' avvio thread di gestione della macchina che avvia la connessione
|
|
||||||
m_ThreadList(nThreadIndex).Start()
|
|
||||||
Thread.Sleep(100)
|
|
||||||
Next
|
|
||||||
End If
|
|
||||||
' se qualche processo in stop, lo faccio ripartire
|
|
||||||
For ThreadIndex = 0 To m_ThreadList.Count - 1
|
|
||||||
If ThreadIndex < m_ThreadList.Count Then
|
|
||||||
Dim Thread = m_ThreadList(ThreadIndex)
|
|
||||||
If Not IsNothing(Thread) Then
|
|
||||||
If Thread.ThreadState = ThreadState.Stopped OrElse
|
|
||||||
Thread.ThreadState = ThreadState.Aborted OrElse
|
|
||||||
Thread.ThreadState = ThreadState.Suspended OrElse
|
|
||||||
(Not m_ThreadDataList(ThreadIndex).ProcessStatus = ProcessStatuses.TOBESTARTED AndAlso
|
|
||||||
(IsNothing(m_ThreadDataList(ThreadIndex).Process) OrElse
|
|
||||||
(Not IsNothing(m_ThreadDataList(ThreadIndex).Process) AndAlso m_ThreadDataList(ThreadIndex).Process.HasExited))) Then
|
|
||||||
' inserire un ritardo di rilancio?
|
|
||||||
' lo chiudo e rilancio
|
|
||||||
'Thread.Sleep(500)
|
|
||||||
Thread.Abort()
|
|
||||||
Thread.Sleep(100)
|
|
||||||
While Not Thread.ThreadState = ThreadState.Aborted
|
|
||||||
Thread.Sleep(100)
|
|
||||||
End While
|
|
||||||
Thread = Nothing
|
|
||||||
Dim ThreadId As Integer = ThreadIndex
|
|
||||||
m_ThreadList(ThreadIndex) = New Thread(Sub()
|
|
||||||
ThreadFunction(ThreadId)
|
|
||||||
End Sub)
|
|
||||||
m_ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
|
|
||||||
' avvio thread di gestione della macchina che avvia la connessione
|
|
||||||
m_ThreadList(ThreadIndex).Start()
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
Dim ThreadId As Integer = ThreadIndex
|
|
||||||
If ThreadIndex < m_ThreadList.Count Then
|
|
||||||
m_ThreadList(ThreadIndex) = New Thread(Sub()
|
|
||||||
ThreadFunction(ThreadId)
|
|
||||||
End Sub)
|
|
||||||
m_ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
|
|
||||||
' avvio thread di gestione della macchina che avvia la connessione
|
|
||||||
m_ThreadList(ThreadIndex).Start()
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
' verifico se coda vuota e tutti i processi hanno finito
|
|
||||||
Dim nQueueArgs As Integer = 0
|
|
||||||
SyncLock ArgumentsQueueLock
|
|
||||||
nQueueArgs = m_ArgumentsQueue.Count
|
|
||||||
End SyncLock
|
|
||||||
If nQueueArgs = 0 Then
|
|
||||||
Dim bProcessWaiting As Boolean = False
|
|
||||||
For Each ThreadData In m_ThreadDataList
|
|
||||||
If ThreadData.ProcessStatus = ProcessStatuses.WAITINGANSWER OrElse ThreadData.ProcessStatus = ProcessStatuses.ANSWERRECEIVED Then
|
|
||||||
bProcessWaiting = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
If Not bProcessWaiting Then
|
|
||||||
' creo thread per lanciare evento asincrono di fine calcolo
|
|
||||||
Dim AllArgsProcessedThread = New Thread(Sub()
|
|
||||||
RaiseEvent m_AllArgsProcessed()
|
|
||||||
End Sub)
|
|
||||||
AllArgsProcessedThread.SetApartmentState(ApartmentState.STA)
|
|
||||||
AllArgsProcessedThread.Start()
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Thread.Sleep(1000)
|
|
||||||
End While
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
' funzione di esecuzione del singolo processo che comunica con il programma
|
|
||||||
Private Sub ThreadFunction(ThreadIndex As Integer)
|
|
||||||
Dim MyThreadData As New ThreadData
|
|
||||||
m_ThreadDataList(ThreadIndex) = MyThreadData
|
|
||||||
'Dim CurrThreadStat As New ThreadStat(ThreadIndex, DateTime.Now)
|
|
||||||
'HistoryThreadDataList.Add(CurrThreadStat)
|
|
||||||
'MyThreadData.SetThreadStat(CurrThreadStat)
|
|
||||||
'Dim sDrive As String = "c" ' If(ThreadIndex Mod 2 = 0, "A", "B")
|
|
||||||
'Dim sCurrDdfDir As String = sDrive & ":\EgtData\WebDoor\Ddf"
|
|
||||||
'Dim stopWatch As New Stopwatch()
|
|
||||||
'Dim lExeTime As Long = 0
|
|
||||||
'Dim lOtherTime As Long = 0
|
|
||||||
|
|
||||||
' avvio processo
|
|
||||||
Dim Proc As Process = New Process()
|
|
||||||
Proc.StartInfo.FileName = m_sProcessFileName
|
|
||||||
Proc.StartInfo.RedirectStandardInput = True
|
|
||||||
Proc.StartInfo.RedirectStandardOutput = True
|
|
||||||
Proc.StartInfo.Arguments = ThreadIndex.ToString() & " " & m_sProcessArguments
|
|
||||||
Proc.StartInfo.UseShellExecute = False
|
|
||||||
Proc.StartInfo.CreateNoWindow = True
|
|
||||||
AddHandler Proc.OutputDataReceived, AddressOf Thread_OutputDataReceived
|
|
||||||
|
|
||||||
If Proc.Start() Then
|
|
||||||
'Dim CurrPocStat As New ProcStat(DateTime.Now)
|
|
||||||
'CurrThreadStat.ProcExecutionList.Add(CurrPocStat)
|
|
||||||
Proc.BeginOutputReadLine()
|
|
||||||
MyThreadData.SetProcess(Proc)
|
|
||||||
MyThreadData.SetProcessStatus(ProcessStatuses.NULL)
|
|
||||||
|
|
||||||
'Dim nProc0Wait As Integer = 0
|
|
||||||
' ciclo per leggere coda ed eseguire
|
|
||||||
While Not m_bStopProcess AndAlso Not Proc.HasExited
|
|
||||||
Select Case MyThreadData.ProcessStatus
|
|
||||||
Case ThreadData.ProcessStatuses.NULL
|
|
||||||
'MyThreadData.SetThreadOperation(ThreadOperations.WaitingData)
|
|
||||||
' se c'e' qualcosa da processare
|
|
||||||
'Dim nNumTaskToProcess As Integer = 0
|
|
||||||
'If ThreadIndex = 0 Then
|
|
||||||
' nNumTaskToProcess = currWDC.numTask2proc
|
|
||||||
' If nNumTaskToProcess > 0 Then
|
|
||||||
' If Not m_bCheckOrder Then m_bCheckOrder = True
|
|
||||||
' Else
|
|
||||||
' If m_bCheckOrder Then m_bCheckOrder = False
|
|
||||||
' Thread.Sleep(100)
|
|
||||||
' End If
|
|
||||||
'ElseIf m_bCheckOrder Then
|
|
||||||
' nNumTaskToProcess = currWDC.numTask2proc
|
|
||||||
' If nNumTaskToProcess = 0 Then
|
|
||||||
' m_bCheckOrder = False
|
|
||||||
' End If
|
|
||||||
'End If
|
|
||||||
Dim NextProcessArgs As ProcessArgs = Nothing
|
|
||||||
If Not IsNothing(m_delGetNextProcessArgs) Then
|
|
||||||
NextProcessArgs = m_delGetNextProcessArgs()
|
|
||||||
Else
|
|
||||||
NextProcessArgs = ArgumentsDequeue()
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Not IsNothing(NextProcessArgs) AndAlso NextProcessArgs.nId > 0 AndAlso Not String.IsNullOrWhiteSpace(NextProcessArgs.sArgs) Then
|
|
||||||
If Not IsNothing(m_delPreProcess) Then
|
|
||||||
NextProcessArgs = m_delPreProcess(NextProcessArgs)
|
|
||||||
End If
|
|
||||||
MyThreadData.SetCurrRequest(NextProcessArgs)
|
|
||||||
Proc.StandardInput.WriteLine(ThreadIndex & "," & NextProcessArgs.sArgs)
|
|
||||||
MyThreadData.SetProcessStatus(ThreadData.ProcessStatuses.WAITINGANSWER)
|
|
||||||
End If
|
|
||||||
'If m_bCheckOrder Then
|
|
||||||
' Dim LastRequest As Dictionary(Of String, CalcReqtDTO) = currWDC.queueList(1)
|
|
||||||
' If LastRequest.Count > 0 Then
|
|
||||||
' MyThreadData.SetThreadOperation(ThreadOperations.FoundRequest)
|
|
||||||
|
|
||||||
' Dim ConvItem As KeyValuePair(Of String, String)
|
|
||||||
' ConvItem = New KeyValuePair(Of String, String)(LastRequest.First().Key, LastRequest.First().Value.DDF)
|
|
||||||
' MyThreadData.SetCurrRequest(ConvItem)
|
|
||||||
|
|
||||||
' ' vecchia versione
|
|
||||||
' 'MyThreadData.SetCurrRequest(LastRequest.First())
|
|
||||||
|
|
||||||
' Dim Item As KeyValuePair(Of String, String) = MyThreadData.CurrRequest
|
|
||||||
' Dim bOk As Boolean = Not IsNothing(Item)
|
|
||||||
' If bOk Then
|
|
||||||
|
|
||||||
' ' avvio cronometro
|
|
||||||
' 'stopWatch.Reset()
|
|
||||||
' stopWatch.Restart()
|
|
||||||
' ' svuoto vecchio set file della porta richiesta
|
|
||||||
' Dim fileList As String() = Directory.GetFiles(sCurrDdfDir, Item.Key + ".*")
|
|
||||||
' ' elimino vecchi
|
|
||||||
' If Not IsNothing(fileList) Then
|
|
||||||
' For Each sFile In fileList
|
|
||||||
' Try
|
|
||||||
' File.Delete(sFile)
|
|
||||||
' Catch ex As Exception
|
|
||||||
' End Try
|
|
||||||
' Next
|
|
||||||
' End If
|
|
||||||
|
|
||||||
' ' scrivo ddf
|
|
||||||
' MyThreadData.SetThreadOperation(ThreadOperations.WritingDdf)
|
|
||||||
' MyThreadData.SetDdfPath(sCurrDdfDir & "\" & Item.Key & ".ddf")
|
|
||||||
' Dim sDdfPath As String = MyThreadData.sDdfPath
|
|
||||||
' Try
|
|
||||||
' File.WriteAllText(sDdfPath, Item.Value)
|
|
||||||
' Catch ex As Exception
|
|
||||||
' bOk = False
|
|
||||||
' End Try
|
|
||||||
|
|
||||||
' If bOk Then
|
|
||||||
' MyThreadData.SetThreadOperation(ThreadOperations.ProcessingDdf)
|
|
||||||
|
|
||||||
' Proc.StandardInput.WriteLine(ThreadIndex & "," & sDdfPath)
|
|
||||||
|
|
||||||
' MyThreadData.SetWaitProcAnswer(ThreadData.ProcComm.WaitingAnswer)
|
|
||||||
' End If
|
|
||||||
' End If
|
|
||||||
' Else
|
|
||||||
' Thread.Sleep(100)
|
|
||||||
' End If
|
|
||||||
'Else
|
|
||||||
' Thread.Sleep(100)
|
|
||||||
'End If
|
|
||||||
Case ThreadData.ProcessStatuses.WAITINGANSWER
|
|
||||||
Thread.Sleep(10)
|
|
||||||
Case ThreadData.ProcessStatuses.ANSWERRECEIVED
|
|
||||||
Dim NewProcessArgsResult As New ProcessArgsResult(MyThreadData.CurrRequest, MyThreadData.nProcResult)
|
|
||||||
If Not IsNothing(m_delPostProcess) Then
|
|
||||||
m_delPostProcess(NewProcessArgsResult)
|
|
||||||
End If
|
|
||||||
ArgumentsResultEnqueue(NewProcessArgsResult)
|
|
||||||
'Dim Item As ProcessArgs = MyThreadData.CurrRequest
|
|
||||||
'Dim sDdfPath As String = MyThreadData.sDdfPath
|
|
||||||
'Dim bOk As Boolean = True
|
|
||||||
'' salvo exe time...
|
|
||||||
'stopWatch.Stop()
|
|
||||||
'lExeTime = stopWatch.ElapsedMilliseconds
|
|
||||||
'stopWatch.Restart()
|
|
||||||
'Dim procResults As New List(Of CalcResultDTO)
|
|
||||||
'Dim currRes As New CalcResultDTO
|
|
||||||
'Dim fContent As String = ""
|
|
||||||
'MyThreadData.SetThreadOperation(ThreadOperations.ReadingSvg)
|
|
||||||
'' verifico esistenza file svg e lo carico
|
|
||||||
'bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
|
|
||||||
'' !!! ToDo: inserire TIPO di richiesta secondo quanto ricevuto....
|
|
||||||
'' invio risposta
|
|
||||||
'currRes.Validated = MyThreadData.nProcResult = 0 AndAlso bOk
|
|
||||||
'currRes.DoorIdVers = Item.Key
|
|
||||||
'' per ora cablato a svg, prendere da MimeType richiesta...
|
|
||||||
'currRes.MimeType = "svg"
|
|
||||||
|
|
||||||
'' se NON fosse validato --> messo il messaggio...
|
|
||||||
'If (currRes.Validated) Then
|
|
||||||
' currRes.RawContent = fContent
|
|
||||||
'Else
|
|
||||||
' bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
|
|
||||||
' currRes.ErrorMsg = fContent
|
|
||||||
'End If
|
|
||||||
'MyThreadData.SetThreadOperation(ThreadOperations.SendResult)
|
|
||||||
|
|
||||||
'procResults.Add(currRes)
|
|
||||||
'Dim respPut As String = currWDC.SendProcResults(procResults)
|
|
||||||
|
|
||||||
'stopWatch.Stop()
|
|
||||||
'lOtherTime = stopWatch.ElapsedMilliseconds
|
|
||||||
'CurrPocStat.IncrementDoneRequest()
|
|
||||||
'' aggiorno thread display...
|
|
||||||
'UpdateThreadList(Item.Key, lExeTime, lOtherTime)
|
|
||||||
'' cambio nomi file generati in old
|
|
||||||
'Dim OldSvg As String = Path.ChangeExtension(sDdfPath, "svg")
|
|
||||||
'Dim NewSvg As String = Path.GetDirectoryName(sDdfPath) & "\" & Path.GetFileNameWithoutExtension(sDdfPath) & "_old.svg"
|
|
||||||
'Try
|
|
||||||
' File.Delete(NewSvg)
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Delete(Path.ChangeExtension(NewSvg, "txt"))
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Delete(Path.ChangeExtension(NewSvg, "log"))
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Delete(Path.ChangeExtension(NewSvg, "nge"))
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Delete(Path.ChangeExtension(NewSvg, "ddf"))
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Move(OldSvg, NewSvg)
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Move(Path.ChangeExtension(OldSvg, "txt"), Path.ChangeExtension(NewSvg, "txt"))
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Move(Path.ChangeExtension(OldSvg, "log"), Path.ChangeExtension(NewSvg, "log"))
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Move(Path.ChangeExtension(OldSvg, "nge"), Path.ChangeExtension(NewSvg, "nge"))
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
'Try
|
|
||||||
' File.Move(Path.ChangeExtension(OldSvg, "ddf"), Path.ChangeExtension(NewSvg, "ddf"))
|
|
||||||
'Catch ex As Exception
|
|
||||||
'End Try
|
|
||||||
MyThreadData.SetProcessStatus(ThreadData.ProcessStatuses.NULL)
|
|
||||||
End Select
|
|
||||||
|
|
||||||
End While
|
|
||||||
' CurrPocStat.SetStopProc(DateTime.Now)
|
|
||||||
If m_bStopProcess Then
|
|
||||||
Proc.StandardInput.WriteLine("quit")
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
' CurrThreadStat.SetStopThread(DateTime.Now)
|
|
||||||
MyThreadData.SetProcess(Nothing)
|
|
||||||
' MyThreadData.SetThreadOperation(ThreadOperations.Closed)
|
|
||||||
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub Thread_OutputDataReceived(sender As Object, e As DataReceivedEventArgs)
|
|
||||||
Dim sResult As String = e.Data
|
|
||||||
If Not String.IsNullOrWhiteSpace(sResult) AndAlso sResult.StartsWith("#42315#,") Then
|
|
||||||
Dim Results() As String = sResult.Split(","c)
|
|
||||||
If Results.Count >= 2 Then
|
|
||||||
Dim nIndex As Integer = -1
|
|
||||||
Dim nResult As Integer = -1
|
|
||||||
Dim dResult As Integer = -1
|
|
||||||
If Integer.TryParse(Results(1), nIndex) AndAlso nIndex >= 0 Then
|
|
||||||
If Integer.TryParse(Results(2), nResult) AndAlso nResult >= 0 Then
|
|
||||||
m_ThreadDataList(nIndex).SetProcResult(nResult)
|
|
||||||
ElseIf StringToDouble(Results(2), dResult) AndAlso dResult >= 0 Then
|
|
||||||
nResult = Math.Floor(dResult)
|
|
||||||
m_ThreadDataList(nIndex).SetProcResult(nResult)
|
|
||||||
End If
|
|
||||||
m_ThreadDataList(nIndex).SetProcessStatus(ThreadData.ProcessStatuses.ANSWERRECEIVED)
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
|
|
||||||
Public Class ThreadData
|
|
||||||
|
|
||||||
'Enum ThreadOperations As Integer
|
|
||||||
' WaitingData = 1
|
|
||||||
' FoundRequest = 2
|
|
||||||
' WritingDdf = 3
|
|
||||||
' ProcessingDdf = 4
|
|
||||||
' ReadingSvg = 5
|
|
||||||
' SendResult = 6
|
|
||||||
' Closed = 10
|
|
||||||
'End Enum
|
|
||||||
|
|
||||||
Public Enum ProcessStatuses As Integer
|
|
||||||
NULL = 0
|
|
||||||
WAITINGANSWER = 1
|
|
||||||
ANSWERRECEIVED = 2
|
|
||||||
TOBESTARTED = 10
|
|
||||||
End Enum
|
|
||||||
|
|
||||||
Private m_ProcessStatus As ProcessStatuses = ProcessStatuses.TOBESTARTED
|
|
||||||
Public ReadOnly Property ProcessStatus As ProcessStatuses
|
|
||||||
Get
|
|
||||||
Return m_ProcessStatus
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Friend Sub SetProcessStatus(value As ProcessStatuses)
|
|
||||||
m_ProcessStatus = value
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private m_CurrRequest As ProcessArgs
|
|
||||||
Public ReadOnly Property CurrRequest As ProcessArgs
|
|
||||||
Get
|
|
||||||
Return m_CurrRequest
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Friend Sub SetCurrRequest(value As ProcessArgs)
|
|
||||||
m_CurrRequest = value
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
'Private m_sDdfPath As String
|
|
||||||
'Public ReadOnly Property sDdfPath As String
|
|
||||||
' Get
|
|
||||||
' Return m_sDdfPath
|
|
||||||
' End Get
|
|
||||||
'End Property
|
|
||||||
'Friend Sub SetDdfPath(value As String)
|
|
||||||
' m_sDdfPath = value
|
|
||||||
'End Sub
|
|
||||||
|
|
||||||
Private m_nProcResult As Integer
|
|
||||||
Public ReadOnly Property nProcResult As Integer
|
|
||||||
Get
|
|
||||||
Return m_nProcResult
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Friend Sub SetProcResult(value As Integer)
|
|
||||||
m_nProcResult = value
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
'Private m_ThreadOperation As ThreadOperations
|
|
||||||
'Public ReadOnly Property ThreadOperation As ThreadOperations
|
|
||||||
' Get
|
|
||||||
' Return m_ThreadOperation
|
|
||||||
' End Get
|
|
||||||
'End Property
|
|
||||||
'Friend Sub SetThreadOperation(value As ThreadOperations)
|
|
||||||
' m_ThreadOperation = value
|
|
||||||
'End Sub
|
|
||||||
|
|
||||||
Private m_Process As Process
|
|
||||||
Public ReadOnly Property Process As Process
|
|
||||||
Get
|
|
||||||
Return m_Process
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Friend Sub SetProcess(value As Process)
|
|
||||||
m_Process = value
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
'Private m_ThreadStat As ThreadStat
|
|
||||||
'Public ReadOnly Property ThreadStat As ThreadStat
|
|
||||||
' Get
|
|
||||||
' Return m_ThreadStat
|
|
||||||
' End Get
|
|
||||||
'End Property
|
|
||||||
'Friend Sub SetThreadStat(value As ThreadStat)
|
|
||||||
' m_ThreadStat = value
|
|
||||||
'End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
|
|
||||||
Public Class ProcessArgs
|
|
||||||
|
|
||||||
Private m_nId As Integer
|
|
||||||
Public ReadOnly Property nId As Integer
|
|
||||||
Get
|
|
||||||
Return m_nId
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_sArgs As String
|
|
||||||
Public ReadOnly Property sArgs As String
|
|
||||||
Get
|
|
||||||
Return m_sArgs
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Sub New(nId As Integer, sArgs As String)
|
|
||||||
m_nId = nId
|
|
||||||
m_sArgs = sArgs
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
|
|
||||||
Public Class ProcessArgsResult
|
|
||||||
|
|
||||||
Private m_ProcessArgs As ProcessArgs
|
|
||||||
Public ReadOnly Property ProcessArgs As ProcessArgs
|
|
||||||
Get
|
|
||||||
Return m_ProcessArgs
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_nResult As Integer
|
|
||||||
Public ReadOnly Property nResult As Integer
|
|
||||||
Get
|
|
||||||
Return m_nResult
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Public Sub SetResult(nResult As Integer)
|
|
||||||
m_nResult = nResult
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub New(ProcessArgs As ProcessArgs, nResult As Integer)
|
|
||||||
m_ProcessArgs = ProcessArgs
|
|
||||||
m_nResult = nResult
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
Imports System.Globalization
|
|
||||||
Imports System.Runtime.InteropServices
|
|
||||||
Imports System.Text
|
|
||||||
|
|
||||||
Public Module GenInterface
|
|
||||||
|
|
||||||
'-------------------------------- IniFile : Get --------------------------------------------------
|
|
||||||
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
||||||
Public Function GetPrivateProfileInt(
|
|
||||||
lpAppName As String,
|
|
||||||
lpKeyName As String,
|
|
||||||
nDefault As Integer,
|
|
||||||
lpFileName As String) As Integer
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function GetPrivateProfileDouble(
|
|
||||||
lpAppName As String,
|
|
||||||
lpKeyName As String,
|
|
||||||
dDefault As Double,
|
|
||||||
lpFileName As String) As Double
|
|
||||||
Dim sValue As String = String.Empty
|
|
||||||
GetPrivateProfileString(lpAppName, lpKeyName, dDefault.ToString(), sValue, lpFileName)
|
|
||||||
Dim nPos As Integer = sValue.IndexOf(";")
|
|
||||||
If nPos >= 0 Then
|
|
||||||
sValue = sValue.Remove(nPos)
|
|
||||||
End If
|
|
||||||
Dim dValue As Double
|
|
||||||
If Not Double.TryParse(sValue, NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, dValue) Then
|
|
||||||
dValue = dDefault
|
|
||||||
End If
|
|
||||||
Return dValue
|
|
||||||
End Function
|
|
||||||
|
|
||||||
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
||||||
Private Function GetPrivateProfileString(
|
|
||||||
lpAppName As String,
|
|
||||||
lpKeyName As String,
|
|
||||||
lpDefault As String,
|
|
||||||
lpReturnedString As StringBuilder,
|
|
||||||
nSize As Integer,
|
|
||||||
lpFileName As String) As Integer
|
|
||||||
End Function
|
|
||||||
Public Function GetPrivateProfileString(
|
|
||||||
lpAppName As String,
|
|
||||||
lpKeyName As String,
|
|
||||||
lpDefault As String,
|
|
||||||
ByRef lpString As String,
|
|
||||||
lpFileName As String) As Integer
|
|
||||||
Dim sb As New StringBuilder(1024)
|
|
||||||
Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName)
|
|
||||||
lpString = sb.ToString
|
|
||||||
Return nRet
|
|
||||||
End Function
|
|
||||||
|
|
||||||
'-------------------------------- IniFile : Write ------------------------------------------------
|
|
||||||
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
||||||
Public Function WritePrivateProfileString(
|
|
||||||
lpAppName As String,
|
|
||||||
lpKeyName As String,
|
|
||||||
lpString As String,
|
|
||||||
lpFileName As String) As Boolean
|
|
||||||
End Function
|
|
||||||
|
|
||||||
'-------------------------------- Windows --------------------------------------------------------
|
|
||||||
Public Enum SW As Integer
|
|
||||||
HIDE = 0
|
|
||||||
SHOWMAXIMIZED = 3
|
|
||||||
RESTORE = 9
|
|
||||||
End Enum
|
|
||||||
|
|
||||||
<DllImport("user32.dll")>
|
|
||||||
Public Function ShowWindow(hWnd As IntPtr, nCmdShow As Integer) As Boolean
|
|
||||||
End Function
|
|
||||||
|
|
||||||
|
|
||||||
End Module
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
Imports System.Collections.ObjectModel
|
|
||||||
|
|
||||||
Public Structure IdNameStruct
|
|
||||||
|
|
||||||
Private m_Id As Integer
|
|
||||||
Public Property Id As Integer
|
|
||||||
Get
|
|
||||||
Return m_Id
|
|
||||||
End Get
|
|
||||||
Set(value As Integer)
|
|
||||||
m_Id = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_Name As String
|
|
||||||
Public Property Name As String
|
|
||||||
Get
|
|
||||||
Return m_Name
|
|
||||||
End Get
|
|
||||||
Set(value As String)
|
|
||||||
m_Name = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Sub New(Id As Integer, Name As String)
|
|
||||||
m_Id = Id
|
|
||||||
m_Name = Name
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Overrides Function ToString() As String
|
|
||||||
Return Name
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Shared Function IndFromId(Id As Integer, List As ObservableCollection(Of IdNameStruct)) As Integer
|
|
||||||
For i = 0 To List.Count - 1
|
|
||||||
If List(i).Id = Id Then Return i
|
|
||||||
Next
|
|
||||||
Return 0
|
|
||||||
End Function
|
|
||||||
Public Shared Function IndFromId(Id As Integer, List As List(Of IdNameStruct)) As Integer
|
|
||||||
For i = 0 To List.Count - 1
|
|
||||||
If List(i).Id = Id Then Return i
|
|
||||||
Next
|
|
||||||
Return 0
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Shared Function IdFromInd(Ind As Integer, List As ObservableCollection(Of IdNameStruct)) As Integer
|
|
||||||
Return List(Ind).Id
|
|
||||||
End Function
|
|
||||||
Public Shared Function IdFromInd(Ind As Integer, List As List(Of IdNameStruct)) As Integer
|
|
||||||
Return List(Ind).Id
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Shared Function IndFromId(Id As Integer, List As ObservableCollection(Of Object)) As Integer
|
|
||||||
For i = 0 To List.Count - 1
|
|
||||||
If TypeOf (List(i)) Is IdNameStruct AndAlso DirectCast(List(i), IdNameStruct).Id = Id Then
|
|
||||||
Return i
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Return 0
|
|
||||||
End Function
|
|
||||||
Public Shared Function IndFromId(Id As Integer, List As List(Of Object)) As Integer
|
|
||||||
For i = 0 To List.Count - 1
|
|
||||||
If TypeOf (List(i)) Is IdNameStruct AndAlso DirectCast(List(i), IdNameStruct).Id = Id Then
|
|
||||||
Return i
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Return 0
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Shared Function IdFromInd(Ind As Integer, List As ObservableCollection(Of Object)) As Integer
|
|
||||||
If TypeOf (List(Ind)) Is IdNameStruct Then
|
|
||||||
Return DirectCast(List(Ind), IdNameStruct).Id
|
|
||||||
End If
|
|
||||||
Return 0
|
|
||||||
End Function
|
|
||||||
Public Shared Function IdFromInd(Ind As Integer, List As List(Of Object)) As Integer
|
|
||||||
If TypeOf (List(Ind)) Is IdNameStruct Then
|
|
||||||
Return DirectCast(List(Ind), IdNameStruct).Id
|
|
||||||
End If
|
|
||||||
Return 0
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Shared Function IdFromName(Name As String, List As ObservableCollection(Of Object)) As Integer
|
|
||||||
For i = 0 To List.Count - 1
|
|
||||||
If DirectCast(List(i), IdNameStruct).Name = Name Then Return DirectCast(List(i), IdNameStruct).Id
|
|
||||||
Next
|
|
||||||
Return 0
|
|
||||||
End Function
|
|
||||||
Public Shared Function IdFromName(Name As String, List As List(Of Object)) As Integer
|
|
||||||
For i = 0 To List.Count - 1
|
|
||||||
If DirectCast(List(i), IdNameStruct).Name = Name Then Return DirectCast(List(i), IdNameStruct).Id
|
|
||||||
Next
|
|
||||||
Return 0
|
|
||||||
End Function
|
|
||||||
|
|
||||||
End Structure
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
'----------------------------------------------------------------------------
|
|
||||||
' EgalTech 2017-2017
|
|
||||||
'----------------------------------------------------------------------------
|
|
||||||
' File : IniFile.vb Data : 08.05.24 Versione : 2.6e1
|
|
||||||
' Contenuto : Modulo IniFile per gestione lettura/scrittura da file INI.
|
|
||||||
'
|
|
||||||
'
|
|
||||||
'
|
|
||||||
' Modifiche : 08.05.24 ES Creazione modulo.
|
|
||||||
'
|
|
||||||
'
|
|
||||||
'----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
Imports System.Collections.ObjectModel
|
|
||||||
|
|
||||||
Public Module IniFile
|
|
||||||
|
|
||||||
Private m_sPath As String
|
|
||||||
Public ReadOnly Property sPath As String
|
|
||||||
Get
|
|
||||||
Return m_sPath
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Friend Sub SetIniFile(sPath)
|
|
||||||
m_sPath = sPath
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Function GetPluginPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer
|
|
||||||
Return GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sPath)
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function GetPluginPrivateProfileDouble(IpAppName As String, IpKeyName As String, dDefault As Double) As Double
|
|
||||||
Return GetPrivateProfileDouble(IpAppName, IpKeyName, dDefault, m_sPath)
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function GetPluginPrivateProfileString(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Integer
|
|
||||||
Return GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sPath)
|
|
||||||
End Function
|
|
||||||
|
|
||||||
'Public Function GetPrivateProfileLanguage(lpAppName As String, lpKeyName As String, lpFileName As String) As Language
|
|
||||||
' Dim sVal As String = String.Empty
|
|
||||||
' GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
|
|
||||||
' Dim sItems() As String = sVal.Split(",".ToCharArray)
|
|
||||||
' If sItems.Count() = 2 Then
|
|
||||||
' Return New Language(sItems(0), sItems(1))
|
|
||||||
' End If
|
|
||||||
' Return Nothing
|
|
||||||
'End Function
|
|
||||||
|
|
||||||
'Public Function GetMainPrivateProfileLanguage(lpAppName As String, lpKeyName As String) As Language
|
|
||||||
' Dim sVal As String = String.Empty
|
|
||||||
' GetMainPrivateProfileString(lpAppName, lpKeyName, "", sVal)
|
|
||||||
' Dim sItems() As String = sVal.Split(",".ToCharArray)
|
|
||||||
' If sItems.Count() = 2 Then
|
|
||||||
' Return New Language(sItems(0), sItems(1))
|
|
||||||
' End If
|
|
||||||
' Return Nothing
|
|
||||||
'End Function
|
|
||||||
|
|
||||||
Public Function WritePluginPrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean
|
|
||||||
Return WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sPath)
|
|
||||||
End Function
|
|
||||||
|
|
||||||
End Module
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
Imports System.Globalization
|
Imports System.Globalization
|
||||||
Imports Newtonsoft.Json
|
Imports Newtonsoft.Json
|
||||||
Imports Newtonsoft.Json.Converters
|
Imports Newtonsoft.Json.Converters
|
||||||
|
Imports Effector.Plugin.Lib
|
||||||
Imports Effector.Plugin.FiveLakes.Door
|
Imports Effector.Plugin.FiveLakes.Door
|
||||||
|
|
||||||
Public Class JsonDoor
|
Public Class JsonDoor
|
||||||
@@ -218,30 +219,30 @@ Public Class JsonLuaDoor
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private m_DoorStateList As New List(Of IdNameStruct)({New IdNameStruct(0, "Not On Machine"),
|
'Private m_DoorStateList As New List(Of IdNameStruct)({New IdNameStruct(0, "Not On Machine"),
|
||||||
New IdNameStruct(1, "Imported"),
|
' New IdNameStruct(1, "Imported"),
|
||||||
New IdNameStruct(2, "On Load"),
|
' New IdNameStruct(2, "On Load"),
|
||||||
New IdNameStruct(3, "On Machine 1"),
|
' New IdNameStruct(3, "On Machine 1"),
|
||||||
New IdNameStruct(4, "On Medium Station"),
|
' New IdNameStruct(4, "On Medium Station"),
|
||||||
New IdNameStruct(6, "On Machine 2"),
|
' New IdNameStruct(6, "On Machine 2"),
|
||||||
New IdNameStruct(7, "On Unload"),
|
' New IdNameStruct(7, "On Unload"),
|
||||||
New IdNameStruct(8, "Produced"),
|
' New IdNameStruct(8, "Produced"),
|
||||||
New IdNameStruct(100, "Scrap")})
|
' New IdNameStruct(100, "Scrap")})
|
||||||
Public ReadOnly Property DoorStateList As List(Of IdNameStruct)
|
'Public ReadOnly Property DoorStateList As List(Of IdNameStruct)
|
||||||
Get
|
' Get
|
||||||
Return m_DoorStateList
|
' Return m_DoorStateList
|
||||||
End Get
|
' End Get
|
||||||
End Property
|
'End Property
|
||||||
|
|
||||||
Private m_SelDoorState As IdNameStruct
|
'Private m_SelDoorState As IdNameStruct
|
||||||
Public Property SelDoorState As IdNameStruct
|
'Public Property SelDoorState As IdNameStruct
|
||||||
Get
|
' Get
|
||||||
Return m_SelDoorState
|
' Return m_SelDoorState
|
||||||
End Get
|
' End Get
|
||||||
Set(value As IdNameStruct)
|
' Set(value As IdNameStruct)
|
||||||
m_SelDoorState = value
|
' m_SelDoorState = value
|
||||||
End Set
|
' End Set
|
||||||
End Property
|
'End Property
|
||||||
|
|
||||||
Private m_sDoorCode As String = ""
|
Private m_sDoorCode As String = ""
|
||||||
Public ReadOnly Property sDoorCode As String
|
Public ReadOnly Property sDoorCode As String
|
||||||
@@ -285,72 +286,115 @@ Public Class JsonLuaDoor
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property nLoadTime As Integer
|
||||||
|
Get
|
||||||
|
'Return m_nLoadTime
|
||||||
|
Return ConvertDateTimeToLuaInteger(m_dtLoadTime)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
Private m_dtLoadTime As DateTime
|
Private m_dtLoadTime As DateTime
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property sLoadTime As String
|
Public ReadOnly Property sLoadTime As String
|
||||||
Get
|
Get
|
||||||
Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
|
Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property dtLoadTime As DateTime
|
Public ReadOnly Property dtLoadTime As DateTime
|
||||||
Get
|
Get
|
||||||
Return m_dtLoadTime
|
Return m_dtLoadTime
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property nMachining1Start As Integer
|
||||||
|
Get
|
||||||
|
Return ConvertDateTimeToLuaInteger(m_dtMachining1Start)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
Private m_dtMachining1Start As DateTime
|
Private m_dtMachining1Start As DateTime
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property sMachining1Start As String
|
Public ReadOnly Property sMachining1Start As String
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
|
Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property dtMachining1Start As DateTime
|
Public ReadOnly Property dtMachining1Start As DateTime
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining1Start
|
Return m_dtMachining1Start
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property nMachining1End As Integer
|
||||||
|
Get
|
||||||
|
Return ConvertDateTimeToLuaInteger(m_dtMachining1End)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
Private m_dtMachining1End As DateTime
|
Private m_dtMachining1End As DateTime
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property sMachining1End As String
|
Public ReadOnly Property sMachining1End As String
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
|
Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property dtMachining1End As DateTime
|
Public ReadOnly Property dtMachining1End As DateTime
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining1End
|
Return m_dtMachining1End
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property nMachining2Start As Integer
|
||||||
|
Get
|
||||||
|
Return ConvertDateTimeToLuaInteger(m_dtMachining2Start)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
Private m_dtMachining2Start As DateTime
|
Private m_dtMachining2Start As DateTime
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property sMachining2Start As String
|
Public ReadOnly Property sMachining2Start As String
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
|
Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property dtMachining2Start As DateTime
|
Public ReadOnly Property dtMachining2Start As DateTime
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining2Start
|
Return m_dtMachining2Start
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property nMachining2End As Integer
|
||||||
|
Get
|
||||||
|
Return ConvertDateTimeToLuaInteger(m_dtMachining2End)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
Private m_dtMachining2End As DateTime
|
Private m_dtMachining2End As DateTime
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property sMachining2End As String
|
Public ReadOnly Property sMachining2End As String
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
|
Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property dtMachining2End As DateTime
|
Public ReadOnly Property dtMachining2End As DateTime
|
||||||
Get
|
Get
|
||||||
Return m_dtMachining2End
|
Return m_dtMachining2End
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property nUnloadTime As Integer
|
||||||
|
Get
|
||||||
|
Return ConvertDateTimeToLuaInteger(m_dtUnloadTime)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
Private m_dtUnloadTime As DateTime
|
Private m_dtUnloadTime As DateTime
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property sUnloadTime As String
|
Public ReadOnly Property sUnloadTime As String
|
||||||
Get
|
Get
|
||||||
Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
|
Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
<JsonIgnore>
|
||||||
Public ReadOnly Property dtUnloadTime As DateTime
|
Public ReadOnly Property dtUnloadTime As DateTime
|
||||||
Get
|
Get
|
||||||
Return m_dtUnloadTime
|
Return m_dtUnloadTime
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Module Map
|
Module Map
|
||||||
|
|
||||||
Private m_refFiveLakesUIVM As FiveLakesUIVM
|
Private m_refPluginUIVM As PluginUIVM
|
||||||
Private m_refDoorListPageVM As DoorListPageVM
|
Private m_refDoorListPageVM As DoorListPageVM
|
||||||
Private m_refMachinePageVM As MachinePageVM
|
Private m_refMachinePageVM As MachinePageVM
|
||||||
Private m_refSupervisorFunction As IHost
|
Private m_refSupervisorFunction As IHost
|
||||||
@@ -42,9 +42,9 @@ Module Map
|
|||||||
|
|
||||||
#Region "Get"
|
#Region "Get"
|
||||||
|
|
||||||
Public ReadOnly Property refFiveLakesUIVM As FiveLakesUIVM
|
Public ReadOnly Property refPluginUIVM As PluginUIVM
|
||||||
Get
|
Get
|
||||||
Return m_refFiveLakesUIVM
|
Return m_refPluginUIVM
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@@ -451,9 +451,9 @@ Module Map
|
|||||||
|
|
||||||
#Region "Init"
|
#Region "Init"
|
||||||
|
|
||||||
Friend Function BeginInit(FiveLakesUIVM As FiveLakesUIVM) As Boolean
|
Friend Function BeginInit(FiveLakesUIVM As PluginUIVM) As Boolean
|
||||||
m_refFiveLakesUIVM = FiveLakesUIVM
|
m_refPluginUIVM = FiveLakesUIVM
|
||||||
Return Not IsNothing(m_refFiveLakesUIVM)
|
Return Not IsNothing(m_refPluginUIVM)
|
||||||
End Function
|
End Function
|
||||||
Friend Function EndInit() As Boolean
|
Friend Function EndInit() As Boolean
|
||||||
' Verifico se tutti i pezzi necessari sono stati caricati
|
' Verifico se tutti i pezzi necessari sono stati caricati
|
||||||
@@ -465,7 +465,7 @@ Module Map
|
|||||||
' Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso
|
' Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso
|
||||||
' Not IsNothing(m_refMachiningTabVM) AndAlso
|
' Not IsNothing(m_refMachiningTabVM) AndAlso
|
||||||
' LibMap.EndInit()
|
' LibMap.EndInit()
|
||||||
Return Not IsNothing(m_refFiveLakesUIVM)
|
Return Not IsNothing(m_refPluginUIVM)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
#End Region ' Init
|
#End Region ' Init
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
Imports System.Globalization
|
|
||||||
|
|
||||||
Public Module StringConversion
|
|
||||||
|
|
||||||
Public Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
|
|
||||||
Dim sFormat As String = "F" + Math.Abs(nNumDec).ToString()
|
|
||||||
Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
|
|
||||||
If nNumDec > 0 Then
|
|
||||||
Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
|
|
||||||
Else
|
|
||||||
Return sVal
|
|
||||||
End If
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function StringToDouble(ByVal sVal As String, ByRef dVal As Double) As Boolean
|
|
||||||
' Return EgtLuaEvalNumExpr(sVal, dVal)
|
|
||||||
Return Double.TryParse(sVal, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, dVal)
|
|
||||||
End Function
|
|
||||||
|
|
||||||
'Public Function StringToDoubleAdv(ByVal sVal As String, ByRef dVal As Double, Optional bEval As Boolean = False) As Boolean
|
|
||||||
' If bEval Then
|
|
||||||
' Return EgtLuaEvalNumExpr(sVal, dVal)
|
|
||||||
' Else
|
|
||||||
' Return Double.TryParse(sVal, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, dVal)
|
|
||||||
' End If
|
|
||||||
'End Function
|
|
||||||
|
|
||||||
Public Function StringToInt(sVal As String, ByRef nVal As Integer) As Boolean
|
|
||||||
Dim dVal As Double = 0
|
|
||||||
If Not StringToDouble(sVal, dVal) Then Return False
|
|
||||||
nVal = CInt(Math.Round(dVal))
|
|
||||||
Return True
|
|
||||||
End Function
|
|
||||||
|
|
||||||
'Public Function LenToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
|
|
||||||
' Return DoubleToString(EgtToUiUnits(dVal), nNumDec)
|
|
||||||
'End Function
|
|
||||||
|
|
||||||
'Public Function StringToLen(ByVal sVal As String, ByRef dVal As Double) As Boolean
|
|
||||||
' If EgtLuaEvalNumExpr(sVal, dVal) Then
|
|
||||||
' dVal = EgtFromUiUnits(dVal)
|
|
||||||
' Return True
|
|
||||||
' Else
|
|
||||||
' Return False
|
|
||||||
' End If
|
|
||||||
'End Function
|
|
||||||
|
|
||||||
'Public Function StringToLenAdv(ByVal sVal As String, ByRef dVal As Double, Optional bEval As Boolean = False) As Boolean
|
|
||||||
' If bEval Then
|
|
||||||
' If EgtLuaEvalNumExpr(sVal, dVal) Then
|
|
||||||
' dVal = EgtFromUiUnits(dVal)
|
|
||||||
' Return True
|
|
||||||
' Else
|
|
||||||
' Return False
|
|
||||||
' End If
|
|
||||||
' Else
|
|
||||||
' If Double.TryParse(sVal, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, dVal) Then
|
|
||||||
' dVal = EgtFromUiUnits(dVal)
|
|
||||||
' Return True
|
|
||||||
' Else
|
|
||||||
' Return False
|
|
||||||
' End If
|
|
||||||
' End If
|
|
||||||
'End Function
|
|
||||||
|
|
||||||
End Module
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
Imports System.ComponentModel
|
|
||||||
|
|
||||||
Public Class VMBase
|
|
||||||
Implements INotifyPropertyChanged
|
|
||||||
|
|
||||||
Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
|
|
||||||
|
|
||||||
Public Sub NotifyPropertyChanged(propName As String)
|
|
||||||
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
Reference in New Issue
Block a user