diff --git a/Effector.Plugin.FiveLakes.sln b/Effector.Plugin.FiveLakes.sln index 781f5b1..dfa3a56 100644 --- a/Effector.Plugin.FiveLakes.sln +++ b/Effector.Plugin.FiveLakes.sln @@ -9,6 +9,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.Interface", EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.FiveLakes", "Effector.Plugin.FiveLakes\Effector.Plugin.FiveLakes.vbproj", "{7C77F537-8235-40AB-B24A-4E71CFB96D2C}" EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.Lib", "..\Effector.Plugin.Lib\Effector.Plugin.Lib\Effector.Plugin.Lib.vbproj", "{E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -55,6 +57,18 @@ Global {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.Build.0 = Release|Any CPU {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.ActiveCfg = Release|Any CPU {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.Build.0 = Release|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Debug|x64.ActiveCfg = Debug|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Debug|x64.Build.0 = Debug|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Debug|x86.ActiveCfg = Debug|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Debug|x86.Build.0 = Debug|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Release|Any CPU.Build.0 = Release|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Release|x64.ActiveCfg = Release|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Release|x64.Build.0 = Release|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Release|x86.ActiveCfg = Release|Any CPU + {E5ECC5E1-EA7B-447D-9A07-F5EE25D27779}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Effector.Plugin.FiveLakes/Constants/ConstIni.vb b/Effector.Plugin.FiveLakes/Constants/ConstIni.vb index fab97d5..12153b0 100644 --- a/Effector.Plugin.FiveLakes/Constants/ConstIni.vb +++ b/Effector.Plugin.FiveLakes/Constants/ConstIni.vb @@ -15,10 +15,14 @@ Module ConstIni Public Const INI_FILE_NAME As String = "Effector.Plugin.FiveLakes.ini" Public Const S_GENERAL As String = "General" + Public Const K_CAMEXEPATH As String = "CAMExePath" + Public Const K_DOORCREATOREXEPATH As String = "DoorCreatorExePath" Public Const K_BACKUPDIR As String = "BackupDir" Public Const K_RESOURCESDIR As String = "ResourcesDir" Public Const K_DDFDIR As String = "DDFDir" + Public Const K_DDTDIR As String = "DDTDir" Public Const K_GENDDFDIR As String = "GenDDFDir" + Public Const K_CSVOUTPUT As String = "CSVOutput" Public Const S_CSV As String = "CSV" Public Const K_DDFNAME As String = "DDFName" @@ -26,6 +30,12 @@ Module ConstIni Public Const K_HEIGHT As String = "Height" Public Const K_WIDTH As String = "Width" Public Const K_THICKNESS As String = "Thickness" + Public Const K_SWING As String = "Swing" + Public Const K_STATE As String = "State" + Public Const K_PROGRAMSENT As String = "ProgramSent" + Public Const K_PROGRAMSTART As String = "ProgramStart" + Public Const K_PROGRAMEND As String = "ProgramEnd" + Public Const K_MANUALADDEDDOORNAME As String = "ManualAddedDoorName" Public Const K_DELIMITER As String = "Delimiter" Public Const S_DEBUG As String = "Debug" diff --git a/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml index 8382235..74783cd 100644 --- a/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml +++ b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml @@ -1,103 +1,301 @@  + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"> + + + + + - - + + + + + + + + + + + + + + + + + + + + ScrollViewer.VerticalScrollBarVisibility="Auto" + ScrollViewer.HorizontalScrollBarVisibility="Disabled" + HorizontalGridLinesBrush="Transparent" + VerticalGridLinesBrush="Transparent" + ColumnHeaderHeight="32" + HeadersVisibility="Column" + FontSize="12" + FontFamily="/Resources/Fonts/#Roboto" + FontWeight="Regular" + RowHeight="32" + BorderThickness="0"> + + + + + + + + + + + + - - - + - - + Width="1*" + MinWidth="100" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/>--> + + + + + + + + + + + + + + Width="Auto" + IsReadOnly="{Binding Path=DataContext.DDTList, Source={x:Reference dummyElement}, Converter={StaticResource DDTListToBooleanConverter}}" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> + - + + + Width="Auto" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"> + + + + + + Width="Auto" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> + Width="Auto" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> + Width="Auto" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> + Width="Auto" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> + Width="Auto" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> + Width="Auto" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> + Width="Auto" + IsReadOnly="True" + ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" + EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> - diff --git a/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb index 4c225e5..3d43a07 100644 --- a/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb +++ b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb @@ -3,11 +3,15 @@ Imports System.IO Imports Newtonsoft.Json Imports System.Windows.Threading Imports System.Text.RegularExpressions +Imports Effector.Plugin.FiveLakes.Door +Imports System.Globalization +Imports Effector.Plugin.Lib Public Class DoorListPageVM Inherits VMBase Private m_BackupTimer As New DispatcherTimer + Private m_WriteCSVTimer As New DispatcherTimer Private m_RefreshGraphicsTimer As New DispatcherTimer Private m_ExecProcessManager As ExecProcessManager @@ -27,6 +31,20 @@ Public Class DoorListPageVM End Set End Property + Private m_DDTList As New ObservableCollection(Of String) + Public ReadOnly Property DDTList As ObservableCollection(Of String) + Get + Return m_DDTList + End Get + End Property + + Private m_ManualAddedDoorName As String = "Manual" + Public ReadOnly Property ManualAddedDoorName As String + Get + Return m_ManualAddedDoorName + End Get + End Property + Private m_bExecButton_IsEnabled As Boolean = True Public ReadOnly Property bExecButton_IsEnabled As Boolean Get @@ -41,9 +59,38 @@ Public Class DoorListPageVM Private m_nBackupindex As Integer = 0 Private m_bWritingBackup As Boolean = False + Private m_sCSVOutDirPath As String = "" + + Private m_nExecIncrement As Integer = 0 + Private m_nExecutedArgsCount As Integer = 0 + Public ReadOnly Property dExecPercentage As Double + Get + If IsNothing(m_ExecProcessManager) Then Return 0 + Dim dExecIncrement As Double = If(m_ExecProcessManager.nArgsInQueue = 0, 0, Math.Min(28, m_nExecIncrement) / 34) + Return (m_ExecProcessManager.nExecutedArgsCounter + dExecIncrement) / (m_ExecProcessManager.nExecutedArgsCounter + m_ExecProcessManager.nArgsInQueue) * 100 + End Get + End Property + + Public ReadOnly Property sExecPercentage As String + Get + Return DoubleToString(dExecPercentage, 1) & "%" + End Get + End Property + + Public ReadOnly Property ExecPercentage_Visibility As Visibility + Get + Return If(Not IsNothing(m_ExecProcessManager) AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.RUNNING, Visibility.Visible, Visibility.Collapsed) + End Get + End Property + ' Definizione comandi Private m_cmdOpenCSV As ICommand + Private m_cmdSaveCSV As ICommand Private m_cmdSkipDoor As ICommand + Private m_cmdNotProduceDoor As ICommand + Private m_cmdAddDoor As ICommand + Private m_cmdCopyDoor As ICommand + Private m_cmdMultipleCopyDoor As ICommand Private m_cmdMoveUp As ICommand Private m_cmdMoveDown As ICommand Private m_cmdDelete As ICommand @@ -58,15 +105,46 @@ Public Class DoorListPageVM Sub New() ' imposto riferimento in Map Map.SetRefDoorListPageVM(Me) + ' leggo nome porta manuale + m_ManualAddedDoorName = "" + GetPluginPrivateProfileString(S_CSV, K_MANUALADDEDDOORNAME, "ManualAddedDoor", m_ManualAddedDoorName) + ' leggo lista ddt + Dim sDdtDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_DDTDIR, "", sDdtDirPath) + If Not String.IsNullOrWhiteSpace(sDdtDirPath) AndAlso Directory.Exists(sDdtDirPath) Then + Dim FileList As String() = Directory.GetFiles(sDdtDirPath) + Dim DdtFileList As List(Of String) = (From sFile In FileList + Where Path.GetExtension(sFile).ToLower() = ".ddt" + Select Path.GetFileName(sFile)).ToList() + For Each DdtFile In DdtFileList + m_DDTList.Add(DdtFile) + Next + End If + ' leggo backup Dim sBackupDirPath As String = "" GetPluginPrivateProfileString(S_GENERAL, "BackupDir", "", sBackupDirPath) Dim sBackupFilePath As String = sBackupDirPath & "\Backup.json" Read(sBackupFilePath) m_BackupTimer.Interval = New TimeSpan(0, 0, 1) AddHandler m_BackupTimer.Tick, AddressOf BackupTimer_Tick + m_WriteCSVTimer.Interval = New TimeSpan(0, 1, 0) + AddHandler m_WriteCSVTimer.Tick, AddressOf WriteCSVTimer_Tick m_RefreshGraphicsTimer.Interval = New TimeSpan(0, 0, 1) AddHandler m_RefreshGraphicsTimer.Tick, AddressOf RefreshGraphicsTimer_Tick m_BackupTimer.Start() + ' verifico path salvataggio CSV + Dim bStartWriteCSV As Boolean = True + If GetPluginPrivateProfileString(S_GENERAL, K_CSVOUTPUT, "", m_sCSVOutDirPath) = 0 Then + bStartWriteCSV = False + MessageBox.Show("Path di salvataggio CSV non impostata! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) + End If + If bStartWriteCSV AndAlso Not Directory.Exists(m_sCSVOutDirPath) Then + bStartWriteCSV = False + MessageBox.Show("Path di salvataggio CSV impostata non esiste! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) + End If + If bStartWriteCSV Then + m_WriteCSVTimer.Start() + End If m_RefreshGraphicsTimer.Start() End Sub #End Region ' CONSTRUCTOR @@ -103,8 +181,15 @@ Public Class DoorListPageVM Dim JsonDoorList As List(Of JsonDoor) = JsonConvert.DeserializeObject(Of List(Of JsonDoor))(sReadedFile) JsonDoorList = JsonDoorList.OrderBy(Of Integer)(Function(x) x.nListIndex).ToList() - m_DoorList = New ObservableCollection(Of Door)((From JsonDoor In JsonDoorList - Select New Door(JsonDoor)).ToList()) + Dim TempDoorList As ObservableCollection(Of Door) = New ObservableCollection(Of Door)((From JsonDoor In JsonDoorList + Select New Door(JsonDoor)).ToList()) + For Each CurrDoor In TempDoorList + If CurrDoor.nState = Door.DoorStates.READY_FOR_PRODUCTION Then + CurrDoor.SetState(Door.DoorStates.VERIFIED, False) + End If + Next + WriteBackup() + m_DoorList = TempDoorList End Sub Public Sub Write(FilePath As String) @@ -152,6 +237,10 @@ Public Class DoorListPageVM End If End Sub + Private Sub WriteCSVTimer_Tick(sender As Object, e As EventArgs) + SaveCSV() + End Sub + Private Sub RefreshGraphicsTimer_Tick(sender As Object, e As EventArgs) If IsNothing(m_ExecProcessManager) Then Return ' ciclo su coda risultati @@ -164,7 +253,7 @@ Public Class DoorListPageVM ' elimino file generati Dim sGenDDFDirPath As String = "" GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath) - Dim sDoorFileName As String = CurrRequestDoor.sDDFName & "_" & CurrRequestDoor.nId + Dim sDoorFileName As String = Path.GetFileNameWithoutExtension(CurrRequestDoor.sDDFName) & "_" & CurrRequestDoor.nId Try File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".tok") File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.tok") @@ -175,24 +264,52 @@ Public Class DoorListPageVM File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2_a.cnc") File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".html") File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.html") - File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".log") - File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".nge") + If ArgumentsResult.nResult = 0 Then + File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".log") + End If + 'File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".nge") File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".nge") File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".sest") File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.sest") - File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".txt") + Dim SestFiles() As String = System.IO.Directory.GetFiles(sGenDDFDirPath & "\", sDoorFileName & "*.sest") + For Each FilePath In SestFiles + File.Delete(FilePath) + Next + 'File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".txt") File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".txt") File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.txt") Catch ex As Exception End Try End If + ' verifico se ci sono altre porte dello stesso tipo da aggiornare + If m_AssociationList.ContainsKey(CurrRequestDoor.nId) Then + Dim SameDoorList As List(Of Integer) = m_AssociationList(CurrRequestDoor.nId) + For Each CurrDoorId In SameDoorList + Dim CurrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = CurrDoorId) + If Not IsNothing(CurrDoor) Then + CurrDoor.SetState(If(ArgumentsResult.nResult = 0, Door.DoorStates.VERIFIED, Door.DoorStates.VERIFICATION_FAILED)) + End If + Next + End If WriteBackup() ArgumentsResult = m_ExecProcessManager.ArgumentsResultDequeue End While + ' aggiorno grafica + If m_nExecutedArgsCount <> m_ExecProcessManager.nExecutedArgsCounter Then + m_nExecutedArgsCount = m_ExecProcessManager.nExecutedArgsCounter + m_nExecIncrement = 0 + ElseIf m_ExecProcessManager.nCalculatingProcesses > 0 Then + m_nExecIncrement += 1 + End If + If Not bExecButton_IsEnabled AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.RUNNING Then + NotifyPropertyChanged(NameOf(dExecPercentage)) + NotifyPropertyChanged(NameOf(sExecPercentage)) + End If If Not bExecButton_IsEnabled AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then SetExecButtonIsEnabled(True) End If + NotifyPropertyChanged(NameOf(ExecPercentage_Visibility)) End Sub Friend Function GetNextDoor() As Door @@ -205,13 +322,14 @@ Public Class DoorListPageVM Return NextDoor End Function - Public Sub ResetProductionQueue() - For Each Door In m_DoorList - If Door.nState = Door.DoorStates.READY_FOR_PRODUCTION Then - Door.SetState(Door.DoorStates.VERIFIED, False) - End If - Next - End Sub + Friend Function NewDoorId() As Integer + Dim nId As Integer = 1 + If m_DoorList.Count > 0 Then + Dim nMaxId As Integer = m_DoorList.Max(Of Integer)(Function(x) x.nId) + nId = nMaxId + 1 + End If + Return nId + End Function #End Region ' METHODS @@ -254,16 +372,19 @@ Public Class DoorListPageVM Dim sHeightName As String = "" Dim sWidthName As String = "" Dim sThicknessName As String = "" + Dim sSwingName As String = "" GetPluginPrivateProfileString(S_CSV, K_DDFNAME, K_DDFNAME, sDDFName) GetPluginPrivateProfileString(S_CSV, K_QUANTITY, "", sQuantityName) GetPluginPrivateProfileString(S_CSV, K_HEIGHT, "", sHeightName) GetPluginPrivateProfileString(S_CSV, K_WIDTH, "", sWidthName) GetPluginPrivateProfileString(S_CSV, K_THICKNESS, "", sThicknessName) + GetPluginPrivateProfileString(S_CSV, K_SWING, "", sSwingName) Dim nDDFNameIndex As Integer = Array.IndexOf(Headers, sDDFName) Dim nQuantityNameIndex As Integer = Array.IndexOf(Headers, sQuantityName) Dim nHeightNameIndex As Integer = Array.IndexOf(Headers, sHeightName) Dim nWidthNameIndex As Integer = Array.IndexOf(Headers, sWidthName) Dim nThicknessNameIndex As Integer = Array.IndexOf(Headers, sThicknessName) + Dim nSwingNameIndex As Integer = Array.IndexOf(Headers, sSwingName) If nDDFNameIndex = -1 Then Dim sMessage As String = "Error! DDFName column not found! Csv file will not be read!" ' egtoutlog(sMessage) @@ -284,7 +405,7 @@ Public Class DoorListPageVM For nValueIndex = 0 To Values.Count - 1 sLine &= Values(nValueIndex) & If(nValueIndex < Values.Count, ";", "") Next - sLineErrorList &= "Quantity not readable in line " & sLine & ". This line will be skipped" + sLineErrorList &= "Quantity not readable in line " & sLine & ". This line will be skipped" & Environment.NewLine Continue While End If End If @@ -306,16 +427,20 @@ Public Class DoorListPageVM dThickness = 0 End If End If - For nQuantityIndex = 1 To nQuantity - Dim nId As Integer = 1 - If m_DoorList.Count > 0 Then - Dim nMaxId As Integer = m_DoorList.Max(Of Integer)(Function(x) x.nId) - 'If nMaxId < 100 Then - nId = nMaxId + 1 - 'End If + Dim nSwing As Integer = 0 + If nSwingNameIndex >= 0 AndAlso nSwingNameIndex < Values.Count Then + If Values(nSwingNameIndex).ToUpper = "S" Then + nSwing = SWINGTYPE.LEFT + Else + nSwing = SWINGTYPE.RIGHT End If - Dim NewDoor As New Door(nId, nLineIndex, Values(nDDFNameIndex), Path.GetFileName(sCSVPath), - 1, dWidth, dHeight, dThickness, Headers, Values) + Else + nSwing = SWINGTYPE.UNDEFINED + End If + For nQuantityIndex = 1 To nQuantity + Dim nId As Integer = NewDoorId() + Dim NewDoor As New Door(nId, nLineIndex, Values(nDDFNameIndex) & ".ddf", Path.GetFileName(sCSVPath), + 1, dWidth, dHeight, dThickness, nSwing, Headers, Values) m_DoorList.Add(NewDoor) Next nLineIndex += 1 @@ -329,41 +454,104 @@ Public Class DoorListPageVM MessageBox.Show("The following lines are not valid and have been skipped:" & sLineErrorList, "Error", MessageBoxButton.OK, MessageBoxImage.Error) End If End Using - Dim sCamExePath As String = "" - GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath) - Dim sMainLuaPath As String = "" - GetPluginPrivateProfileString(S_GENERAL, "MainPipeLUA", "", sMainLuaPath) - Dim bStartExecProcessManager As Boolean = False - If IsNothing(m_ExecProcessManager) Then - bStartExecProcessManager = True - m_ExecProcessManager = New ExecProcessManager(sCamExePath, """" & sMainLuaPath & """") - AddHandler m_ExecProcessManager.m_AllArgsProcessed, AddressOf ExecProcessManager_AllArgsProcessed - m_ExecProcessManager.SetMaxCamInstances(3) - End If - Dim sDDFDirPath As String = "" - GetPluginPrivateProfileString(S_GENERAL, K_DDFDIR, "", sDDFDirPath) - Dim sGenDDFDirPath As String = "" - GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath) - For Each Door In m_DoorList - If Door.nState = Door.DoorStates.LOADED_FROM_CSV Then - Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName & ".ddf" - Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & Door.sDDFName & "_" & Door.nId & ".ddf" - Try - File.Copy(sDDFFilePath, sGenDDFFilePath, True) - Catch ex As Exception - Map.refSupervisorFunction.PlgOutLog("Error: Copy file from " & sDDFFilePath & " to " & sGenDDFFilePath & " failed!") - End Try - m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sGenDDFFilePath)) - End If - Next - If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then - m_ExecProcessManager.StartExecutionThread() - SetExecButtonIsEnabled(False) - End If + Verify() + 'Dim sCamExePath As String = "" + 'GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath) + 'Dim sMainLuaPath As String = "" + 'GetPluginPrivateProfileString(S_GENERAL, "MainPipeLUA", "", sMainLuaPath) + 'Dim bStartExecProcessManager As Boolean = False + 'If IsNothing(m_ExecProcessManager) Then + ' bStartExecProcessManager = True + ' m_ExecProcessManager = New ExecProcessManager(sCamExePath, """" & sMainLuaPath & """") + ' AddHandler m_ExecProcessManager.m_AllArgsProcessed, AddressOf ExecProcessManager_AllArgsProcessed + ' m_ExecProcessManager.SetMaxCamInstances(3) + 'End If + 'Dim sDDFDirPath As String = "" + 'GetPluginPrivateProfileString(S_GENERAL, K_DDFDIR, "", sDDFDirPath) + 'Dim sGenDDFDirPath As String = "" + 'GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath) + 'For Each Door In m_DoorList + ' If Door.nState = Door.DoorStates.LOADED_FROM_CSV Then + ' Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName & ".ddf" + ' Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & Door.sDDFName & "_" & Door.nId & ".ddf" + ' Try + ' File.Copy(sDDFFilePath, sGenDDFFilePath, True) + ' Catch ex As Exception + ' Map.refSupervisorFunction.PlgOutLog("Error: Copy file from " & sDDFFilePath & " to " & sGenDDFFilePath & " failed!") + ' End Try + ' m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sGenDDFFilePath)) + ' End If + 'Next + 'If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then + ' m_ExecProcessManager.StartExecutionThread() + ' SetExecButtonIsEnabled(False) + 'End If End If WriteBackup() End Sub + Private Function CreateGenDdfFile(nId As Integer, sDDFName As String, dWidth As Double, dHeight As Double, dThickness As Double, nSwing As Integer, ByRef sErrMessage As String) As Boolean + ' verifico che ci sia il file ddf + Dim sDDTDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_DDTDIR, "", sDDTDirPath) + Dim sDDFDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_DDFDIR, "", sDDFDirPath) + Dim sGenDDFDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath) + Dim sExtension As String = Path.GetExtension(sDDFName) + If sExtension.ToLower() = ".ddf" Then + Dim sDDFFilePath As String = sDDFDirPath & "\" & sDDFName + If Not File.Exists(sDDFFilePath) Then + Dim sErr As String = "Il nome inserito (" & sDDFFilePath & ") non corrisponde a nessun file nella cartella dei Ddf (" & sDDFDirPath & ")" + Map.refSupervisorFunction.PlgOutLog(sErr) + sErrMessage &= "- " & sErr & Environment.NewLine + Dim ErrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = nId) + If Not IsNothing(ErrDoor) Then + ErrDoor.SetState(DoorStates.VERIFICATION_FAILED) + End If + NotifyPropertyChanged(NameOf(sDDFName)) + Return False + End If + ' copio il ddf nella cartella dei ddf + Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & If(Not String.IsNullOrWhiteSpace(Path.GetDirectoryName(sDDFName)), Path.GetDirectoryName(sDDFName) & "_", "") & Path.GetFileNameWithoutExtension(sDDFName) & "_" & nId & ".ddf" + Dim bCopy As Boolean = False + Try + File.Copy(sDDFFilePath, sGenDDFFilePath, True) + bCopy = True + Catch ex As Exception + Dim sErr As String = "Error: Copy file from " & sDDFFilePath & " to " & sGenDDFFilePath & " failed!" + Map.refSupervisorFunction.PlgOutLog(sErr) + sErrMessage &= "- " & sErr & Environment.NewLine + Dim ErrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = nId) + If Not IsNothing(ErrDoor) Then + ErrDoor.SetState(DoorStates.VERIFICATION_FAILED) + End If + End Try + If Not bCopy Then + Return False + End If + ElseIf sExtension.ToLower() = ".ddt" Then + ' se file generato + If Not Door.CreateDdfFromDdt(nId, sDDFName, dWidth, dHeight, dThickness, nSwing, sErrMessage) Then + Dim ErrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = nId) + If Not IsNothing(ErrDoor) Then + ErrDoor.SetState(DoorStates.VERIFICATION_FAILED) + End If + Return False + End If + Else + Dim sErr As String = "Estensione del file non riconosciuta!" + Map.refSupervisorFunction.PlgOutLog(sErr) + sErrMessage &= "- " & sErr & Environment.NewLine + Dim ErrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = nId) + If Not IsNothing(ErrDoor) Then + ErrDoor.SetState(DoorStates.VERIFICATION_FAILED) + End If + Return False + End If + Return True + End Function + Public Sub ExecProcessManager_AllArgsProcessed() m_ExecProcessManager.StopExecutionThread() End Sub @@ -395,6 +583,166 @@ Public Class DoorListPageVM #End Region ' OpenCSV +#Region "SaveCSV" + + Public ReadOnly Property SaveCSV_Command As ICommand + Get + If m_cmdSaveCSV Is Nothing Then + m_cmdSaveCSV = New Command(AddressOf SaveCSV) + End If + Return m_cmdSaveCSV + End Get + End Property + + Public Sub SaveCSV() + ' leggo nomi intestazioni da ini + Dim sDDFName As String = "" + Dim sQuantityName As String = "" + Dim sHeightName As String = "" + Dim sWidthName As String = "" + Dim sThicknessName As String = "" + Dim sSwingName As String = "" + Dim sStateName As String = "" + Dim sProgramSentName As String = "" + Dim sProgramStartName As String = "" + Dim sProgramEndName As String = "" + GetPluginPrivateProfileString(S_CSV, K_DDFNAME, K_DDFNAME, sDDFName) + GetPluginPrivateProfileString(S_CSV, K_QUANTITY, "", sQuantityName) + GetPluginPrivateProfileString(S_CSV, K_HEIGHT, "", sHeightName) + GetPluginPrivateProfileString(S_CSV, K_WIDTH, "", sWidthName) + GetPluginPrivateProfileString(S_CSV, K_THICKNESS, "", sThicknessName) + GetPluginPrivateProfileString(S_CSV, K_SWING, "", sSwingName) + GetPluginPrivateProfileString(S_CSV, K_STATE, "", sStateName) + GetPluginPrivateProfileString(S_CSV, K_PROGRAMSENT, "", sProgramSentName) + GetPluginPrivateProfileString(S_CSV, K_PROGRAMSTART, "", sProgramStartName) + GetPluginPrivateProfileString(S_CSV, K_PROGRAMEND, "", sProgramEndName) + ' recupero nomi csv presenti + Dim CSVFileList As List(Of String) = DoorList.Select(Function(x) x.sCSVName).Distinct().ToList() + CSVFileList.Remove(m_ManualAddedDoorName) + For Each CSVFile In CSVFileList + Dim CSVDoorList As List(Of Door) = (From Door In m_DoorList + Where Door.sCSVName = CSVFile).ToList() + Dim sCSVOutPath = m_sCSVOutDirPath & "\Output_" & DateTime.Now().ToString("yy-MM-dd-HH-mm-ss") & ".csv" + Dim sCSVFileList As New List(Of String) + Dim sHeaderRow As String = "" + For Each Parameter In CSVDoorList(0).CustomerParameters + ' evito di scrivere la quantita' + If Parameter.sHeader <> sQuantityName Then + sHeaderRow &= Parameter.sHeader & ";" + End If + Next + ' aggiungo titoli per tempi di produzione + sHeaderRow &= sStateName & ";" & sProgramSentName & ";" & sProgramStartName & ";" & sProgramEndName + sHeaderRow.TrimEnd(";"c) + sCSVFileList.Add(sHeaderRow) + For Each Door In CSVDoorList + Dim DDFNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sDDFName) + If Not IsNothing(DDFNameParameter) Then + DDFNameParameter.SetValue(Door.sDDFName) + End If + Dim HeightNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sHeightName) + If Not IsNothing(HeightNameParameter) Then + HeightNameParameter.SetValue(DoubleToString(Door.dHeight, 2)) + End If + Dim WidthNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sWidthName) + If Not IsNothing(WidthNameParameter) Then + WidthNameParameter.SetValue(DoubleToString(Door.dWidth, 2)) + End If + Dim ThicknessNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sThicknessName) + If Not IsNothing(ThicknessNameParameter) Then + ThicknessNameParameter.SetValue(DoubleToString(Door.dThickness, 2)) + End If + Dim SwingNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sSwingName) + If Not IsNothing(SwingNameParameter) Then + SwingNameParameter.SetValue(If(Door.nSwing = SWINGTYPE.LEFT, "S", "D")) + End If + + Dim sDoorRow As String = "" + For Each Parameter In Door.CustomerParameters + ' evito di scrivere la quantita' + If Parameter.sHeader <> sQuantityName Then + sDoorRow &= Parameter.sValue & ";" + End If + Next + ' aggiungo valori per tempi di produzione + Dim sState As String = "" + If Door.nState < DoorStates.MACHINE_1_START Then + sState = "DaProdurre" + ElseIf Door.nState = DoorStates.MACHINE_1_START Then + sState = "InProduzione" + Else + sState = "Prodotto" + End If + sDoorRow &= sState & ";" & Door.sLoadTime & ";" & Door.sMachining1Start & ";" & Door.sMachining1End + sCSVFileList.Add(sDoorRow) + Next + Try + File.WriteAllLines(sCSVOutPath, sCSVFileList) + 'MessageBox.Show("Csv salvato in " & m_sCSVOutDirPath, "Info", MessageBoxButton.OK, MessageBoxImage.Information) + Catch ex As Exception + MessageBox.Show("Creazione file csv fallita!" & Environment.NewLine & ex.Message, "Errore", MessageBoxButton.OK, MessageBoxImage.Error) + End Try + + + Next + + + + + 'Dim CSVDoorList As List(Of Door) = (From Door In m_DoorList + ' Where Door.sCSVName = m_SelDoor.sCSVName).ToList() + 'sCSVOutPath &= "\" & m_SelDoor.sCSVName + 'Dim sCSVFileList As New List(Of String) + 'Dim sHeaderRow As String = "" + 'For Each Parameter In m_SelDoor.CustomerParameters + ' ' evito di scrivere la quantita' + ' If Parameter.sHeader <> sQuantityName Then + ' sHeaderRow &= Parameter.sHeader & ";" + ' End If + 'Next + 'sHeaderRow.TrimEnd(";"c) + 'sCSVFileList.Add(sHeaderRow) + 'For Each Door In CSVDoorList + ' Dim DDFNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sDDFName) + ' If Not IsNothing(DDFNameParameter) Then + ' DDFNameParameter.SetValue(Door.sDDFName) + ' End If + ' Dim HeightNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sHeightName) + ' If Not IsNothing(HeightNameParameter) Then + ' HeightNameParameter.SetValue(DoubleToString(Door.dHeight, 2)) + ' End If + ' Dim WidthNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sWidthName) + ' If Not IsNothing(WidthNameParameter) Then + ' WidthNameParameter.SetValue(DoubleToString(Door.dWidth, 2)) + ' End If + ' Dim ThicknessNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sThicknessName) + ' If Not IsNothing(ThicknessNameParameter) Then + ' ThicknessNameParameter.SetValue(DoubleToString(Door.dThickness, 2)) + ' End If + ' Dim SwingNameParameter As CustomerParameter = Door.CustomerParameters.FirstOrDefault(Function(x) x.sHeader = sSwingName) + ' If Not IsNothing(SwingNameParameter) Then + ' SwingNameParameter.SetValue(If(Door.nSwing = SWINGTYPE.LEFT, "S", "D")) + ' End If + + ' Dim sDoorRow As String = "" + ' For Each Parameter In Door.CustomerParameters + ' ' evito di scrivere la quantita' + ' If Parameter.sHeader <> sQuantityName Then + ' sDoorRow &= Parameter.sValue & ";" + ' End If + ' Next + ' sCSVFileList.Add(sDoorRow) + 'Next + 'Try + ' File.WriteAllLines(sCSVOutPath, sCSVFileList) + ' MessageBox.Show("Csv salvato in " & sCSVOutPath, "Info", MessageBoxButton.OK, MessageBoxImage.Information) + 'Catch ex As Exception + ' MessageBox.Show("Creazione file csv fallita!", "Errore", MessageBoxButton.OK, MessageBoxImage.Error) + 'End Try + End Sub + +#End Region ' SaveCSV + #Region "SkipDoor" Public ReadOnly Property SkipDoor_Command As ICommand @@ -414,6 +762,112 @@ Public Class DoorListPageVM #End Region ' SkipDoor +#Region "NotProduceDoor" + + Public ReadOnly Property NotProduceDoor_Command As ICommand + Get + If m_cmdNotProduceDoor Is Nothing Then + m_cmdNotProduceDoor = New Command(AddressOf NotProduceDoor) + End If + Return m_cmdNotProduceDoor + End Get + End Property + + Public Sub NotProduceDoor() + If Not IsNothing(SelDoor) Then + If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then + If (SelDoor.nState <> Door.DoorStates.VERIFIED AndAlso SelDoor.nState <> Door.DoorStates.NOTPRODUCE) Then Return + Dim sSelCSVName As String = SelDoor.sCSVName + Dim SelDoorState As Door.DoorStates = SelDoor.nState + For Each CsvDoor In m_DoorList + If String.Compare(sSelCSVName, CsvDoor.sCSVName, True) = 0 Then + If CsvDoor.nState = DoorStates.VERIFIED OrElse CsvDoor.nState = DoorStates.NOTPRODUCE Then + CsvDoor.SetState(If(SelDoorState = Door.DoorStates.VERIFIED, Door.DoorStates.NOTPRODUCE, Door.DoorStates.VERIFIED)) + End If + End If + Next + Else + If (SelDoor.nState <> Door.DoorStates.VERIFIED AndAlso SelDoor.nState <> Door.DoorStates.NOTPRODUCE) Then Return + SelDoor.SetState(If(SelDoor.nState = Door.DoorStates.VERIFIED, Door.DoorStates.NOTPRODUCE, Door.DoorStates.VERIFIED)) + End If + End If + WriteBackup() + End Sub + +#End Region ' NotProduceDoor + +#Region "AddDoor" + + Public ReadOnly Property AddDoor_Command As ICommand + Get + If m_cmdAddDoor Is Nothing Then + m_cmdAddDoor = New Command(AddressOf AddDoor) + End If + Return m_cmdAddDoor + End Get + End Property + + Public Sub AddDoor() + Dim nId As Integer = NewDoorId() + m_DoorList.Add(New Door(nId, 0, "", m_ManualAddedDoorName, 1, 0, 0, 0, SWINGTYPE.RIGHT, {}, {})) + End Sub + +#End Region ' AddDoor + +#Region "CopyDoor" + + Public ReadOnly Property CopyDoor_Command As ICommand + Get + If m_cmdCopyDoor Is Nothing Then + m_cmdCopyDoor = New Command(AddressOf CopyDoorCmd) + End If + Return m_cmdCopyDoor + End Get + End Property + + Public Sub CopyDoorCmd() + If IsNothing(SelDoor) Then + MessageBox.Show("Nessuna porta selezionata!" & Environment.NewLine & "Selezionare la porta da copiare", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + CopyDoor() + End Sub + + Public Sub CopyDoor() + Dim nId As Integer = NewDoorId() + m_DoorList.Add(SelDoor.Copy(nId)) + End Sub + +#End Region ' CopyDoor + +#Region "MultipleCopyDoor" + + Public ReadOnly Property MultipleCopyDoor_Command As ICommand + Get + If m_cmdMultipleCopyDoor Is Nothing Then + m_cmdMultipleCopyDoor = New Command(AddressOf MultipleCopyDoor) + End If + Return m_cmdMultipleCopyDoor + End Get + End Property + + Public Sub MultipleCopyDoor() + If IsNothing(SelDoor) Then + MessageBox.Show("Nessuna porta selezionata!" & Environment.NewLine & "Selezionare la porta da copiare", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + ' apro finestra quantita' + Dim MultipleCopyWndVM As New MultipleCopyWndVM + Dim MultipleCopyWnd As New MultipleCopyWndV(Application.Current.MainWindow, MultipleCopyWndVM) + If MultipleCopyWnd.ShowDialog() Then + For Index = 1 To MultipleCopyWndVM.nCopyNumber + CopyDoor() + Next + End If + End Sub + +#End Region ' MultipleCopyDoor + #Region "MoveUp" Public ReadOnly Property MoveUp_Command As ICommand @@ -469,7 +923,11 @@ Public Class DoorListPageVM End Property Public Sub Delete() - If IsNothing(SelDoor) OrElse SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION 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 + If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then + If (SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.DoorStates.MACHINE_2_END) Then Return + End If If MessageBox.Show("Are you sure you want to delete the selected door?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then m_DoorList.Remove(SelDoor) WriteBackup() @@ -490,12 +948,31 @@ Public Class DoorListPageVM End Property Public Sub DeleteAll() - If m_DoorList.Count = 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 + If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then + If (SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.DoorStates.MACHINE_2_END) Then Return + End If + Dim sSelCSVName As String = SelDoor.sCSVName + ' verifico che tutte le porte del csv siano in stato prodotto o da non produrre + Dim bAllProduced As Boolean = True + For Each CsvDoor In m_DoorList + If String.Compare(sSelCSVName, CsvDoor.sCSVName, True) = 0 Then + If CsvDoor.nState <> DoorStates.MACHINE_2_END AndAlso CsvDoor.nState <> DoorStates.PRODUCED AndAlso CsvDoor.nState <> DoorStates.NOTPRODUCE AndAlso CsvDoor.nState <> DoorStates.VERIFICATION_FAILED Then + bAllProduced = False + End If + End If + Next + If Not bAllProduced Then + MessageBox.Show("Selected CSV delete impossible!" & Environment.NewLine & "To be able to delete it all the lines needs to be in state Produced or NotProduced", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning) + Return + End If If MessageBox.Show("Are you sure you want to delete all the doors?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then - For nDoorIndex = m_DoorList.Count - 1 To 0 Step -1 - Dim Door As Door = m_DoorList(nDoorIndex) - If Door.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Continue For - m_DoorList.Remove(Door) + For CsvDoorIndex = m_DoorList.Count - 1 To 0 Step -1 + Dim CsvDoor As Door = m_DoorList(CsvDoorIndex) + If String.Compare(sSelCSVName, CsvDoor.sCSVName, True) = 0 Then + m_DoorList.Remove(CsvDoor) + End If Next WriteBackup() End If @@ -521,6 +998,7 @@ Public Class DoorListPageVM Public Sub ProduceDoor(DoorToProduce As Door, Optional bWriteBackup As Boolean = True) If IsNothing(DoorToProduce) OrElse DoorToProduce.nState = Door.DoorStates.SKIPPED OrElse + 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 @@ -570,6 +1048,14 @@ Public Class DoorListPageVM WriteBackup() End Sub + Public Sub ResetProductionQueue() + For Each Door In m_DoorList + If Door.nState = Door.DoorStates.READY_FOR_PRODUCTION Then + Door.SetState(Door.DoorStates.VERIFIED) + End If + Next + End Sub + #End Region ' ResetProductionQueue #Region "Verify" @@ -583,6 +1069,9 @@ Public Class DoorListPageVM End Get End Property + Private m_DifferentDoorList As New List(Of Door) + Private m_AssociationList As New Dictionary(Of Integer, List(Of Integer)) + Public Sub Verify() Dim sCamExePath As String = "" GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath) @@ -596,18 +1085,40 @@ Public Class DoorListPageVM AddHandler m_ExecProcessManager.m_AllArgsProcessed, AddressOf ExecProcessManager_AllArgsProcessed m_ExecProcessManager.SetMaxCamInstances(3) End If - Dim sDDFDirPath As String = "" - GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath) + Dim sGenDDFDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath) + Dim sErrMessage As String = "" + m_DifferentDoorList.Clear() + m_AssociationList.Clear() For Each Door In m_DoorList If Door.nState = Door.DoorStates.LOADED_FROM_CSV Or Door.nState = Door.DoorStates.VERIFICATION_FAILED Then - Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName & ".ddf" - m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sDDFFilePath)) + ' creo file ddf + If CreateGenDdfFile(Door.nId, Door.sDDFName, Door.dWidth, Door.dHeight, Door.dThickness, Door.nSwing, sErrMessage) Then + ' verifico se ho gia' lanciato una porta con le stesse caratteristiche + Dim DifferentDoor As Door = Nothing + If Path.GetExtension(Door.sDDFName).ToLower() = ".ddf" Then + DifferentDoor = m_DifferentDoorList.FirstOrDefault(Function(x) Door.sDDFName = x.sDDFName) + ElseIf Path.GetExtension(Door.sDDFName).ToLower() = ".ddt" Then + DifferentDoor = m_DifferentDoorList.FirstOrDefault(Function(x) Door.sDDFName = x.sDDFName AndAlso Door.dWidth = x.dWidth AndAlso Door.dHeight = x.dHeight AndAlso Door.dThickness = x.dThickness AndAlso Door.nSwing = x.nSwing) + End If + If Not IsNothing(DifferentDoor) Then + m_AssociationList(DifferentDoor.nId).Add(Door.nId) + Else + m_DifferentDoorList.Add(Door) + m_AssociationList.Add(Door.nId, New List(Of Integer)) + Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & If(Not String.IsNullOrWhiteSpace(Path.GetDirectoryName(Door.sDDFName)), Path.GetDirectoryName(Door.sDDFName) & "_", "") & Path.GetFileNameWithoutExtension(Door.sDDFName) & "_" & Door.nId & ".ddf" + m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sGenDDFFilePath)) + End If + End If End If Next If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then m_ExecProcessManager.StartExecutionThread() SetExecButtonIsEnabled(False) End If + If Not String.IsNullOrWhiteSpace(sErrMessage) Then + MessageBox.Show("Impossible creating Ddf files for this doors:" & Environment.NewLine & sErrMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error) + End If WriteBackup() End Sub @@ -620,12 +1131,21 @@ End Class Public Class Door Inherits VMBase + Public Enum SWINGTYPE As Integer + UNDEFINED = 0 + RIGHT = 1 + LEFT = 2 + End Enum + + Private Shared m_refWriteBackup As Action + Public Enum DoorStates As Integer NULL = 0 LOADED_FROM_CSV = 1 VERIFIED = 10 VERIFICATION_FAILED = 11 SKIPPED = 20 + NOTPRODUCE = 21 READY_FOR_PRODUCTION = 30 ON_LOAD_STATION = 31 MACHINE_1_START = 33 @@ -663,10 +1183,82 @@ Public Class Door End Property Private m_sDDFName As String - Public ReadOnly Property sDDFName As String + Public Property sDDFName As String Get Return m_sDDFName End Get + Set(value As String) + ' verifico che ci sia il file ddf + Dim sDDTDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_DDTDIR, "", sDDTDirPath) + Dim sDDFDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_DDFDIR, "", sDDFDirPath) + Dim sGenDDFDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath) + Dim sExtension As String = Path.GetExtension(value) + If sExtension.ToLower() = ".ddf" Then + Dim sDDFFilePath As String = sDDFDirPath & "\" & value + If Not File.Exists(sDDFFilePath) Then + MessageBox.Show("Il nome inserito non corrisponde a nessun file nella cartella dei Ddf (" & sDDFDirPath & ") ", "File non trovato!", MessageBoxButton.OK, MessageBoxImage.Error) + NotifyPropertyChanged(NameOf(sDDFName)) + Return + End If + Me.m_sDDFName = value + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + + '' copio il ddf nella cartella dei ddf + 'Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & If(Not String.IsNullOrWhiteSpace(Path.GetDirectoryName(m_sDDFName)), Path.GetDirectoryName(m_sDDFName) & "_", "") & Path.GetFileNameWithoutExtension(m_sDDFName) & "_" & Me.nId & ".ddf" + 'Dim bCopy As Boolean = False + 'Try + ' File.Copy(sDDFFilePath, sGenDDFFilePath, True) + ' bCopy = True + 'Catch ex As Exception + ' Map.refSupervisorFunction.PlgOutLog("Error: Copy file from " & sDDFFilePath & " to " & sGenDDFFilePath & " failed!") + 'End Try + 'If bCopy Then + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + 'Else + ' NotifyPropertyChanged(NameOf(sDDFName)) + ' Return + 'End If + ElseIf sExtension.ToLower() = ".ddt" Then + Dim sDDTFilePath As String = sDDTDirPath & "\" & value + If Not File.Exists(sDDTFilePath) Then + MessageBox.Show("Il nome inserito non corrisponde a nessun file nella cartella dei Ddt (" & sDDTDirPath & ") ", "File non trovato!", MessageBoxButton.OK, MessageBoxImage.Error) + NotifyPropertyChanged(NameOf(sDDFName)) + Return + End If + m_sDDFName = value + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + Return + 'If m_dWidth = 0 OrElse m_dHeight = 0 OrElse m_dThickness = 0 Then + ' m_sDDFName = value + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + ' Return + ' ' se file generato + 'ElseIf CreateDdfFromDdt(m_nId, value, m_dWidth, m_dHeight, m_dThickness) Then + ' Me.m_sDDFName = value + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + 'Else + ' NotifyPropertyChanged(NameOf(sDDFName)) + ' Return + 'End If + Else + MessageBox.Show("Estensione del file non riconosciuta!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) + NotifyPropertyChanged(NameOf(sDDFName)) + Return + End If + End Set End Property Private m_nQuantity As Integer @@ -677,24 +1269,201 @@ Public Class Door End Property Private m_dWidth As Double - Public ReadOnly Property dWidth As Double + Public Property dWidth As String Get - Return m_dWidth + Return DoubleToString(m_dWidth, 2) End Get + Set(value As String) + Dim dValue As Double = 0 + If Not StringToDouble(value, dValue) Then + MessageBox.Show("Dimensione non valida!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) + NotifyPropertyChanged(NameOf(dWidth)) + Return + End If + ' verifico se file ddf o ddt + Dim sExtension As String = Path.GetExtension(m_sDDFName) + If String.IsNullOrWhiteSpace(sExtension) Then + Me.m_dWidth = dValue + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + Return + ElseIf sExtension.ToLower() = ".ddf" Then + MessageBox.Show("ATTENZIONE! Questa modifica non cambia realmente le dimensioni della porta perchè è selezionato un file ddf!", "Attenzione!", MessageBoxButton.OK, MessageBoxImage.Warning) + Me.m_dWidth = dValue + Return + ElseIf sExtension.ToLower() = ".ddt" Then + Me.m_dWidth = dValue + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + 'If String.IsNullOrWhiteSpace(m_sDDFName) OrElse m_dHeight = 0 OrElse m_dThickness = 0 Then + ' m_dWidth = dValue + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + ' Return + 'ElseIf CreateDdfFromDdt(m_nId, m_sDDFName, dValue, m_dHeight, m_dThickness) Then + ' m_dWidth = dValue + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + 'Else + ' NotifyPropertyChanged(NameOf(dWidth)) + ' Return + 'End If + End If + End Set End Property Private m_dHeight As Double - Public ReadOnly Property dHeight As Double + Public Property dHeight As String Get - Return m_dHeight + Return DoubleToString(m_dHeight, 2) End Get + Set(value As String) + Dim dValue As Double = 0 + If Not StringToDouble(value, dValue) Then + MessageBox.Show("Dimensione non valida!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) + NotifyPropertyChanged(NameOf(dHeight)) + Return + End If + ' verifico se file ddf o ddt + Dim sExtension As String = Path.GetExtension(m_sDDFName) + If String.IsNullOrWhiteSpace(sExtension) Then + Me.m_dHeight = dValue + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + Return + ElseIf sExtension.ToLower() = ".ddf" Then + MessageBox.Show("ATTENZIONE! Questa modifica non cambia realmente le dimensioni della porta perchè è selezionato un file ddf!", "Attenzione!", MessageBoxButton.OK, MessageBoxImage.Warning) + Me.m_dHeight = dValue + Return + ElseIf sExtension.ToLower() = ".ddt" Then + Me.m_dHeight = dValue + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + 'If String.IsNullOrWhiteSpace(m_sDDFName) OrElse m_dWidth = 0 OrElse m_dThickness = 0 Then + ' m_dHeight = dValue + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + ' Return + 'ElseIf CreateDdfFromDdt(m_nId, m_sDDFName, m_dWidth, dValue, m_dThickness) Then + ' m_dHeight = dValue + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + 'Else + ' NotifyPropertyChanged(NameOf(dHeight)) + ' Return + 'End If + End If + End Set End Property Private m_dThickness As Double - Public ReadOnly Property dThickness As Double + Public Property dThickness As String Get - Return m_dThickness + Return DoubleToString(m_dThickness, 2) End Get + Set(value As String) + Dim dValue As Double = 0 + If Not StringToDouble(value, dValue) Then + MessageBox.Show("Dimensione non valida!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) + NotifyPropertyChanged(NameOf(dThickness)) + Return + End If + ' verifico se file ddf o ddt + Dim sExtension As String = Path.GetExtension(m_sDDFName) + If String.IsNullOrWhiteSpace(sExtension) Then + Me.m_dThickness = dValue + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + Return + ElseIf sExtension.ToLower() = ".ddf" Then + MessageBox.Show("ATTENZIONE! Questa modifica non cambia realmente le dimensioni della porta perchè è selezionato un file ddf!", "Attenzione!", MessageBoxButton.OK, MessageBoxImage.Warning) + Me.m_dThickness = dValue + Return + ElseIf sExtension.ToLower() = ".ddt" Then + Me.m_dThickness = dValue + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + 'If String.IsNullOrWhiteSpace(m_sDDFName) OrElse m_dWidth = 0 OrElse m_dHeight = 0 Then + ' m_dThickness = dValue + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + ' Return + 'ElseIf CreateDdfFromDdt(m_nId, m_sDDFName, m_dWidth, m_dHeight, dValue) Then + ' m_dThickness = dValue + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + 'Else + ' NotifyPropertyChanged(NameOf(dThickness)) + ' Return + 'End If + End If + End Set + End Property + + Private m_SwingList As New List(Of IdNameStruct)({New IdNameStruct(SWINGTYPE.RIGHT, "Destra"), New IdNameStruct(SWINGTYPE.LEFT, "Sinistra")}) + Public ReadOnly Property SwingList As List(Of IdNameStruct) + Get + Return m_SwingList + End Get + End Property + + Private m_nSwing As Integer + Public ReadOnly Property nSwing As Integer + Get + Return m_nSwing + End Get + End Property + Public Property SelSwing As IdNameStruct + Get + Return m_SwingList.FirstOrDefault(Function(x) x.Id = m_nSwing) + End Get + Set(value As IdNameStruct) + ' verifico se file ddf o ddt + Dim sExtension As String = Path.GetExtension(m_sDDFName) + If String.IsNullOrWhiteSpace(sExtension) Then + Me.m_nSwing = value.Id + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + Return + ElseIf sExtension.ToLower() = ".ddf" Then + MessageBox.Show("ATTENZIONE! Questa modifica non cambia realmente lo swing della porta perchè è selezionato un file ddf!", "Attenzione!", MessageBoxButton.OK, MessageBoxImage.Warning) + Me.m_nSwing = value.Id + Return + ElseIf sExtension.ToLower() = ".ddt" Then + Me.m_nSwing = value.Id + ' riporto indietro stato a da verificare + Me.m_nState = DoorStates.LOADED_FROM_CSV + NotifyPropertyChanged(NameOf(nState)) + 'If String.IsNullOrWhiteSpace(m_sDDFName) OrElse m_dWidth = 0 OrElse m_dHeight = 0 Then + ' m_dThickness = dValue + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + ' Return + 'ElseIf CreateDdfFromDdt(m_nId, m_sDDFName, m_dWidth, m_dHeight, dValue) Then + ' m_dThickness = dValue + ' ' riporto indietro stato a da verificare + ' Me.m_nState = DoorStates.LOADED_FROM_CSV + ' NotifyPropertyChanged(NameOf(nState)) + 'Else + ' NotifyPropertyChanged(NameOf(dThickness)) + ' Return + 'End If + End If + End Set End Property Private m_sCSVName As String @@ -856,22 +1625,22 @@ Public Class Door Select Case m_nState Case DoorStates.LOADED_FROM_CSV Return Brushes.White + Case DoorStates.VERIFIED + Return Dictionary.Effector_Green_Status Case DoorStates.VERIFICATION_FAILED - Return Brushes.Red - Case DoorStates.SKIPPED - Return Brushes.Orange - Case DoorStates.READY_FOR_PRODUCTION - Return Brushes.LightSkyBlue - Case DoorStates.ON_LOAD_STATION - Return Brushes.SkyBlue + Return Dictionary.Effector_Red_Status + Case DoorStates.SKIPPED, DoorStates.NOTPRODUCE + Return Dictionary.Effector_Yellow_Status + Case DoorStates.READY_FOR_PRODUCTION, DoorStates.ON_LOAD_STATION + Return Dictionary.Effector_LightBlue_Status Case DoorStates.MACHINE_1_START - Return Brushes.DodgerBlue + Return Dictionary.Effector_Blue_Status Case DoorStates.MACHINE_1_END Return Brushes.Yellow Case DoorStates.MACHINE_2_START - Return Brushes.DodgerBlue + Return Dictionary.Effector_Blue_Status Case DoorStates.MACHINE_2_END, DoorStates.PRODUCED - Return Brushes.LightGray + Return Dictionary.Effector_Gray_Status Case DoorStates.SCRAP Return Brushes.MediumPurple Case Else @@ -880,7 +1649,9 @@ Public Class Door End Get End Property - Sub New(nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, HeaderList As String(), ValueList As String()) +#Region "CONSTRUCTOR" + + Sub New(nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nSwing As Integer, HeaderList As String(), ValueList As String()) m_nId = nId m_nCSVLine = nCSVLine m_sDDFName = sDDFName @@ -889,6 +1660,7 @@ Public Class Door m_dHeight = dHeight m_dWidth = dWidth m_dThickness = dThickness + m_nSwing = nSwing If Not IsNothing(HeaderList) AndAlso HeaderList.Count > 0 AndAlso Not IsNothing(ValueList) AndAlso ValueList.Count > 0 Then For nParamIndex = 0 To Math.Max(HeaderList.Count, ValueList.Count) - 1 m_CustomerParameters.Add(New CustomerParameter(If(HeaderList.Count > nParamIndex, HeaderList(nParamIndex), ""), If(ValueList.Count > nParamIndex, ValueList(nParamIndex), ""))) @@ -896,6 +1668,19 @@ Public Class Door End If End Sub + Sub New(nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nSwing As Integer, CustomerParameters As List(Of CustomerParameter)) + m_nId = nId + m_nCSVLine = nCSVLine + m_sDDFName = sDDFName + m_sCSVName = sCSVName + m_nQuantity = nQuantity + m_dHeight = dHeight + m_dWidth = dWidth + m_dThickness = dThickness + m_nSwing = nSwing + m_CustomerParameters = CustomerParameters + End Sub + Sub New(JsonDoor As JsonDoor) m_nId = JsonDoor.nId m_nCSVLine = JsonDoor.nCSVLine @@ -905,6 +1690,7 @@ Public Class Door m_dHeight = JsonDoor.dHeight m_dWidth = JsonDoor.dWidth m_dThickness = JsonDoor.dThickness + m_nSwing = JsonDoor.nSwing m_nState = JsonDoor.nState m_CustomerParameters = JsonDoor.CustomerParameters m_nProdState = JsonDoor.nProdState @@ -916,6 +1702,63 @@ Public Class Door m_dtUnloadTime = JsonDoor.dtUnloadTime End Sub +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Friend Function Copy(nId As Integer) As Door + Return New Door(nId, m_nCSVLine, m_sDDFName, Map.refDoorListPageVM.ManualAddedDoorName, m_nQuantity, m_dWidth, m_dHeight, m_dThickness, m_nSwing, m_CustomerParameters) + End Function + + Friend Shared Function CreateDdfFromDdt(nId As Integer, sDDFName As String, dWidth As Double, dHeight As Double, dThickness As Double, nSwing As Integer, ByRef sErrMessage As String) As Boolean + Dim sDoorCreatorExePath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_DOORCREATOREXEPATH, "", sDoorCreatorExePath) + Dim sDDTDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_DDTDIR, "", sDDTDirPath) + Dim sGenDDFDirPath As String = "" + GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath) + Dim sDDTFilePath As String = sDDTDirPath & "\" & sDDFName + 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) + Return False + 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 & ")" + Map.refSupervisorFunction.PlgOutLog(sErr) + sErrMessage &= "- " & sErr & Environment.NewLine + Return False + End If + ' creo il 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() + Proc.StartInfo.FileName = """" & sDoorCreatorExePath & """" + Proc.StartInfo.RedirectStandardInput = False + 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 + ' se file generato + If Not File.Exists(sGenDDFFilePath) Then + Dim sErr As String = "Errore! Generazione file ddf fallita! (" & sDDTDirPath & ")" + Map.refSupervisorFunction.PlgOutLog(sErr) + sErrMessage &= "- " & sErr & Environment.NewLine + Return False + End If + Return True + End Function + +#End Region ' METHODS + End Class Public Class CustomerParameter @@ -933,10 +1776,62 @@ Public Class CustomerParameter Return m_sValue End Get End Property + Friend Sub SetValue(value As String) + m_sValue = value + End Sub Sub New(sHeader As String, sValue As String) m_sHeader = sHeader m_sValue = sValue End Sub +End Class + +Public Class StateToSelColorConverter + Implements IValueConverter + + Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert + If Not TypeOf value Is DoorStates Then Return Brushes.Aqua + Select Case value + Case DoorStates.LOADED_FROM_CSV + Return Dictionary.Effector_White_SelStatus + Case DoorStates.VERIFIED + Return Dictionary.Effector_Green_SelStatus + Case DoorStates.VERIFICATION_FAILED + Return Dictionary.Effector_Red_SelStatus + Case DoorStates.SKIPPED + Return Dictionary.Effector_Yellow_SelStatus + Case DoorStates.READY_FOR_PRODUCTION, DoorStates.ON_LOAD_STATION + Return Dictionary.Effector_LightBlue_SelStatus + Case DoorStates.MACHINE_1_START, DoorStates.MACHINE_2_START + Return Dictionary.Effector_Blue_SelStatus + Case DoorStates.MACHINE_1_END + Return Dictionary.Effector_Blue_SelStatus + Case DoorStates.MACHINE_2_END, DoorStates.PRODUCED + Return Dictionary.Effector_Gray_SelStatus + Case DoorStates.SCRAP + Return Dictionary.Effector_White_SelStatus + Case Else + Return Dictionary.Effector_White_SelStatus + End Select + End Function + + Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack + Throw New NotImplementedException() + End Function + +End Class + +Public Class DDTListToBooleanConverter + Implements IValueConverter + + Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert + If Not TypeOf value Is ObservableCollection(Of String) Then Return False + Return DirectCast(value, ObservableCollection(Of String)).Count = 0 + End Function + + Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack + Throw New NotImplementedException() + End Function + End Class \ No newline at end of file diff --git a/Effector.Plugin.FiveLakes/Effector.Plugin.FiveLakes.vbproj b/Effector.Plugin.FiveLakes/Effector.Plugin.FiveLakes.vbproj index bb54b01..5975687 100644 --- a/Effector.Plugin.FiveLakes/Effector.Plugin.FiveLakes.vbproj +++ b/Effector.Plugin.FiveLakes/Effector.Plugin.FiveLakes.vbproj @@ -63,6 +63,9 @@ ..\packages\Google.Apis.Sheets.v4.1.68.0.3624\lib\net462\Google.Apis.Sheets.v4.dll + + ..\..\Effector.Plugin.Lib\Effector.Plugin.Lib\bin\Debug\Effector.Plugin.Lib.dll + ..\packages\KeraLua.1.4.1\lib\net46\KeraLua.dll @@ -114,9 +117,6 @@ DoorListPageV.xaml - - ProcessManagerV.xaml - FiveLakesUI.xaml @@ -132,7 +132,6 @@ MainMenuV.xaml - RestartWndV.xaml @@ -158,7 +157,6 @@ True - @@ -176,16 +174,14 @@ Settings.Designer.vb + + Designer MSBuild:Compile - - Designer - MSBuild:Compile - Designer MSBuild:Compile @@ -211,6 +207,27 @@ MSBuild:Compile + + + + + + + + + + + + + + + + + + + + + powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath) diff --git a/Effector.Plugin.FiveLakes/FiveLakesUI.xaml b/Effector.Plugin.FiveLakes/FiveLakesUI.xaml index 8367c04..bb10719 100644 --- a/Effector.Plugin.FiveLakes/FiveLakesUI.xaml +++ b/Effector.Plugin.FiveLakes/FiveLakesUI.xaml @@ -3,12 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Effector.Plugin.FiveLakes" DataContext="{StaticResource FiveLakesUIVM}"> - - - - + @@ -22,11 +18,4 @@ - diff --git a/Effector.Plugin.FiveLakes/FiveLakesUIVM.vb b/Effector.Plugin.FiveLakes/FiveLakesUIVM.vb index 4621e1b..6ec2da6 100644 --- a/Effector.Plugin.FiveLakes/FiveLakesUIVM.vb +++ b/Effector.Plugin.FiveLakes/FiveLakesUIVM.vb @@ -53,6 +53,7 @@ Public Class FiveLakesUIVM m_sConfigDir = m_sDataRoot & "\" & CONF_DIR ' Impostazione path Ini file IniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME) + Effector.Plugin.Lib.PluginIniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME) ' Impostazione path resources dir m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR End Sub diff --git a/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml b/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml index 293a78d..f4a1486 100644 --- a/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml +++ b/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml @@ -10,6 +10,7 @@ + @@ -43,7 +44,8 @@ + VerticalAlignment="Center" + Visibility="{Binding MachineCommands_Visibility}"> @@ -773,6 +775,17 @@ + + + + + + + 0 Then + m_dDdfCalcValue = 0 + End If + NotifyPropertyChanged(NameOf(dDdfCalcValue)) + NotifyPropertyChanged(NameOf(nDDfCalcState)) End If If LuaGetGlobVar("MACHINE1.NewDoorState", nState) Then SetNewDoorState(nState) @@ -962,6 +977,20 @@ Public Class StringToDDFCalcStateConverter End Class +Public Class DDFCalcStateToVisibilityConverter + Implements IValueConverter + + Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert + If TypeOf value IsNot Integer Then Return Visibility.Collapsed + Return If(value = 0, Visibility.Collapsed, Visibility.Visible) + End Function + + Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack + Throw New NotImplementedException() + End Function + +End Class + Public Class StringToNewDoorStateConverter Implements IValueConverter diff --git a/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml b/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml index 142cf0f..91bfaa3 100644 --- a/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml +++ b/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml @@ -14,19 +14,19 @@ - + Style="{StaticResource MainMenu_ToggleButton}"/> - + diff --git a/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml index d749df5..818bec2 100644 --- a/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml +++ b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml @@ -1,57 +1,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerVM.vb b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerVM.vb index 03ddb50..285111f 100644 --- a/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerVM.vb +++ b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerVM.vb @@ -1,5 +1,6 @@ Imports System.Windows.Threading Imports System.Collections.ObjectModel +Imports Effector.Plugin.Lib Public Class ProcessManagerVM Inherits VMBase diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/Add.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Add.png new file mode 100644 index 0000000..b634987 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Add.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/Copy.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Copy.png new file mode 100644 index 0000000..add0b01 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Copy.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/Delete.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Delete.png new file mode 100644 index 0000000..539802f Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Delete.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/DeleteCsv.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/DeleteCsv.png new file mode 100644 index 0000000..5096a59 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/DeleteCsv.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/MoveDown.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/MoveDown.png new file mode 100644 index 0000000..8769109 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/MoveDown.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/MoveUp.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/MoveUp.png new file mode 100644 index 0000000..46606d5 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/MoveUp.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/MultipleCopy.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/MultipleCopy.png new file mode 100644 index 0000000..6be8813 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/MultipleCopy.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/NotProduce.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/NotProduce.png new file mode 100644 index 0000000..63f6a8d Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/NotProduce.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/OpenCsv.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/OpenCsv.png new file mode 100644 index 0000000..c5e3518 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/OpenCsv.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/Produce.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Produce.png new file mode 100644 index 0000000..3b5e99f Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Produce.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/ProduceAll.old.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/ProduceAll.old.png new file mode 100644 index 0000000..322244c Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/ProduceAll.old.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/ProduceAll.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/ProduceAll.png new file mode 100644 index 0000000..ebd13b7 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/ProduceAll.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/ResetProduction.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/ResetProduction.png new file mode 100644 index 0000000..48976c9 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/ResetProduction.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/SaveCsv.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/SaveCsv.png new file mode 100644 index 0000000..d085eee Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/SaveCsv.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/SkipDoor.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/SkipDoor.png new file mode 100644 index 0000000..ef66656 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/SkipDoor.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/DoorListPage/Verify.png b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Verify.png new file mode 100644 index 0000000..e1305e8 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/DoorListPage/Verify.png differ diff --git a/Effector.Plugin.FiveLakes/Resources/Fonts/Roboto-Light.ttf b/Effector.Plugin.FiveLakes/Resources/Fonts/Roboto-Light.ttf new file mode 100644 index 0000000..d43e943 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/Fonts/Roboto-Light.ttf differ diff --git a/Effector.Plugin.FiveLakes/Resources/Fonts/Roboto-Regular.ttf b/Effector.Plugin.FiveLakes/Resources/Fonts/Roboto-Regular.ttf new file mode 100644 index 0000000..7d9a6c4 Binary files /dev/null and b/Effector.Plugin.FiveLakes/Resources/Fonts/Roboto-Regular.ttf differ diff --git a/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml b/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml index f206425..86534bd 100644 --- a/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml +++ b/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml @@ -16,43 +16,88 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - + - - + + + + + + + + + + + + @@ -65,6 +110,181 @@ 2 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - diff --git a/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml.vb b/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml.vb index a33f325..5af06c5 100644 --- a/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml.vb +++ b/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml.vb @@ -12,77 +12,125 @@ Public Class Dictionary #Region "Colors" - 'Private m_Omag_Red As SolidColorBrush = Brushes.Red - 'Public ReadOnly Property Omag_Red As SolidColorBrush + Private Shared m_Effector_LightBlue As SolidColorBrush = Application.Current.FindResource("Effector_LightBlue") + Public Shared ReadOnly Property Effector_LightBlue As SolidColorBrush + Get + Return m_Effector_LightBlue + End Get + End Property + + Private Shared m_Effector_Blue As SolidColorBrush = Application.Current.FindResource("Effector_Blue") + Public Shared ReadOnly Property Effector_Blue As SolidColorBrush + Get + Return m_Effector_Blue + End Get + End Property + + Private Shared m_Effector_DarkBlue As SolidColorBrush = Application.Current.FindResource("Effector_DarkBlue") + Public Shared ReadOnly Property Effector_DarkBlue As SolidColorBrush + Get + Return m_Effector_DarkBlue + End Get + End Property + + Private Shared m_Effector_LightBlue_Status As SolidColorBrush = Application.Current.FindResource("Effector_LightBlue_Status") + Public Shared ReadOnly Property Effector_LightBlue_Status As SolidColorBrush + Get + Return m_Effector_LightBlue_Status + End Get + End Property + + Private Shared m_Effector_Blue_Status As SolidColorBrush = Application.Current.FindResource("Effector_Blue_Status") + Public Shared ReadOnly Property Effector_Blue_Status As SolidColorBrush + Get + Return m_Effector_Blue_Status + End Get + End Property + + Private Shared m_Effector_Red_Status As SolidColorBrush = Application.Current.FindResource("Effector_Red_Status") + Public Shared ReadOnly Property Effector_Red_Status As SolidColorBrush + Get + Return m_Effector_Red_Status + End Get + End Property + + Private Shared m_Effector_Green_Status As SolidColorBrush = Application.Current.FindResource("Effector_Green_Status") + Public Shared ReadOnly Property Effector_Green_Status As SolidColorBrush + Get + Return m_Effector_Green_Status + End Get + End Property + + Private Shared m_Effector_Gray_Status As SolidColorBrush = Application.Current.FindResource("Effector_Gray_Status") + Public Shared ReadOnly Property Effector_Gray_Status As SolidColorBrush + Get + Return m_Effector_Gray_Status + End Get + End Property + + Private Shared m_Effector_Yellow_Status As SolidColorBrush = Application.Current.FindResource("Effector_Yellow_Status") + Public Shared ReadOnly Property Effector_Yellow_Status As SolidColorBrush + Get + Return m_Effector_Yellow_Status + End Get + End Property + + Private Shared m_Effector_LightBlue_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_LightBlue_SelStatus") + Public Shared ReadOnly Property Effector_LightBlue_SelStatus As SolidColorBrush + Get + Return m_Effector_LightBlue_SelStatus + End Get + End Property + + Private Shared m_Effector_Blue_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Blue_SelStatus") + Public Shared ReadOnly Property Effector_Blue_SelStatus As SolidColorBrush + Get + Return m_Effector_Blue_SelStatus + End Get + End Property + + Private Shared m_Effector_Red_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Red_SelStatus") + Public Shared ReadOnly Property Effector_Red_SelStatus As SolidColorBrush + Get + Return m_Effector_Red_SelStatus + End Get + End Property + + Private Shared m_Effector_Green_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Green_SelStatus") + Public Shared ReadOnly Property Effector_Green_SelStatus As SolidColorBrush + Get + Return m_Effector_Green_SelStatus + End Get + End Property + + Private Shared m_Effector_Gray_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Gray_SelStatus") + Public Shared ReadOnly Property Effector_Gray_SelStatus As SolidColorBrush + Get + Return m_Effector_Gray_SelStatus + End Get + End Property + + Private Shared m_Effector_Yellow_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Yellow_SelStatus") + Public Shared ReadOnly Property Effector_Yellow_SelStatus As SolidColorBrush + Get + Return m_Effector_Yellow_SelStatus + End Get + End Property + + Private Shared m_Effector_White_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_White_SelStatus") + Public Shared ReadOnly Property Effector_White_SelStatus As SolidColorBrush + Get + Return m_Effector_White_SelStatus + End Get + End Property + + 'Private Shared m_Effector_Orange As SolidColorBrush = Application.Current.FindResource("Effector_Orange") + 'Public Shared ReadOnly Property Effector_Orange As SolidColorBrush ' Get - ' Return m_Omag_Red + ' Return m_Effector_Orange ' End Get 'End Property - 'Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD") - 'Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush - ' Get - ' Return m_Button_Static_Background - ' End Get - 'End Property - - 'Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background") - 'Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush - ' Get - ' Return m_TabControl_Header_Background - ' End Get - 'End Property - - - 'Private Shared m_Icarus_Gray As SolidColorBrush = Application.Current.FindResource("Icarus_Gray") - 'Public Shared ReadOnly Property Icarus_Gray As SolidColorBrush - ' Get - ' Return m_Icarus_Gray - ' End Get - 'End Property - - 'Private Shared m_Icarus_LightBlue As SolidColorBrush = Application.Current.FindResource("Icarus_LightBlue") - 'Public Shared ReadOnly Property Icarus_LightBlue As SolidColorBrush - ' Get - ' Return m_Icarus_LightBlue - ' End Get - 'End Property - - 'Private Shared m_Icarus_Blue As SolidColorBrush = Application.Current.FindResource("Icarus_Blue") - 'Public Shared ReadOnly Property Icarus_Blue As SolidColorBrush - ' Get - ' Return m_Icarus_Blue - ' End Get - 'End Property - - 'Private Shared m_Icarus_Green As SolidColorBrush = Application.Current.FindResource("Icarus_Green") - 'Public Shared ReadOnly Property Icarus_Green As SolidColorBrush - ' Get - ' Return m_Icarus_Green - ' End Get - 'End Property - - 'Private Shared m_Icarus_Orange As SolidColorBrush = Application.Current.FindResource("Icarus_Orange") - 'Public Shared ReadOnly Property Icarus_Orange As SolidColorBrush - ' Get - ' Return m_Icarus_Orange - ' End Get - 'End Property - - 'Private Shared m_Icarus_Purple As SolidColorBrush = Application.Current.FindResource("Icarus_Purple") - 'Public Shared ReadOnly Property Icarus_Purple As SolidColorBrush - ' Get - ' Return m_Icarus_Purple - ' End Get - 'End Property - - ' - ' - ' - ' - ' - ' - #End Region ' Colors End Class diff --git a/Effector.Plugin.FiveLakes/Utility/ExecProcessManager.vb b/Effector.Plugin.FiveLakes/Utility/ExecProcessManager.vb index 23919df..cf8958c 100644 --- a/Effector.Plugin.FiveLakes/Utility/ExecProcessManager.vb +++ b/Effector.Plugin.FiveLakes/Utility/ExecProcessManager.vb @@ -3,6 +3,7 @@ Imports System.Threading Imports MS.Internal Imports Effector.Plugin.FiveLakes.ThreadData Imports System.Windows.Threading +Imports Effector.Plugin.Lib Public Class ExecProcessManager diff --git a/Effector.Plugin.FiveLakes/Utility/JsonUtility.vb b/Effector.Plugin.FiveLakes/Utility/JsonUtility.vb index 71965e4..226b531 100644 --- a/Effector.Plugin.FiveLakes/Utility/JsonUtility.vb +++ b/Effector.Plugin.FiveLakes/Utility/JsonUtility.vb @@ -61,6 +61,13 @@ Public Class JsonDoor End Get End Property + Private m_nSwing As Integer + Public ReadOnly Property nSwing As Integer + Get + Return m_nSwing + End Get + End Property + Private m_sCSVName As String Public ReadOnly Property sCSVName As String Get @@ -140,7 +147,7 @@ Public Class JsonDoor #End Region ' Statistics - Sub New(nListIndex As Integer, nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nState As DoorStates, CustomerParameters As List(Of CustomerParameter), + Sub New(nListIndex As Integer, nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nSwing As Integer, nState As DoorStates, CustomerParameters As List(Of CustomerParameter), nProdState As DoorProdStates, dtLoadTime As DateTime, dtMachining1Start As DateTime, dtMachining1End As DateTime, dtMachining2Start As DateTime, dtMachining2End As DateTime, dtUnloadTime As DateTime) m_nListIndex = nListIndex m_nId = nId @@ -151,6 +158,7 @@ Public Class JsonDoor m_dHeight = dHeight m_dWidth = dWidth m_dThickness = dThickness + m_nSwing = nSwing m_nState = nState m_CustomerParameters = CustomerParameters m_nProdState = nProdState @@ -172,6 +180,7 @@ Public Class JsonDoor m_dHeight = Door.dHeight m_dWidth = Door.dWidth m_dThickness = Door.dThickness + m_nSwing = Door.nSwing m_nState = Door.nState m_CustomerParameters = Door.CustomerParameters m_nProdState = Door.nProdState