3 Commits

Author SHA1 Message Date
Emmanuele Sassi 48699ea740 - aggiunta cancellazione completa di tutte le porte in lista 2025-10-13 19:38:11 +02:00
Emmanuele Sassi 0352b53972 - modifiche per aggiornare grafica
- modifiche per allineare a DoorArreda
2025-06-04 12:00:50 +02:00
Emmanuele Sassi 3d4609aea4 - corretta enum DoorStates
- riordinati bottoni DoorListPage
2025-01-08 19:18:01 +01:00
29 changed files with 605 additions and 277 deletions
@@ -22,8 +22,10 @@ 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_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"
@@ -45,6 +47,8 @@ Module ConstIni
Public Const K_VARIABLEONDRAW As String = "VariableOnDraw" Public Const K_VARIABLEONDRAW As String = "VariableOnDraw"
Public Const K_MACHINECOMMANDS As String = "MachineCommands" Public Const K_MACHINECOMMANDS As String = "MachineCommands"
Public Const K_DOORCIRCLIST As String = "DoorCircList" Public Const K_DOORCIRCLIST As String = "DoorCircList"
Public Const K_DOORPRESENCE As String = "DoorPresence"
Public Const K_DOORINDEX As String = "DoorIndex"
Public Const S_NC As String = "NC" Public Const S_NC As String = "NC"
Public Const K_NC_SIMULATE As String = "NcSimulate" Public Const K_NC_SIMULATE As String = "NcSimulate"
@@ -1,80 +1,131 @@
<Grid x:Class="DoorListPageV" <Grid x:Class="DoorListPageV"
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.DoorArreda"> xmlns:local="clr-namespace:Effector.Plugin.DoorArreda">
<Grid.Resources> <Grid.Resources>
<local:StateToSelColorConverter x:Key="StateToSelColorConverter"/> <local:StateToSelColorConverter x:Key="StateToSelColorConverter"/>
<local:DDTListToBooleanConverter x:Key="DDTListToBooleanConverter"/>
</Grid.Resources> </Grid.Resources>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="3"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" <Border BorderThickness="0"
IsEnabled="{Binding bExecButton_IsEnabled}"> Padding="3"
<Button Content="CSV" BorderBrush="Transparent"
ToolTip="Apri file CSV" Background="{StaticResource Effector_DarkBlue}">
Command="{Binding OpenCSV_Command}" <StackPanel Orientation="Horizontal"
IsEnabled="{Binding bExecButton_IsEnabled}" IsEnabled="{Binding bExecButton_IsEnabled}">
Style="{StaticResource DoorList_Button}"/> <Button ToolTip="Apri file CSV"
<Button Content="Salta Porta" Command="{Binding OpenCSV_Command}"
ToolTip="Blocca Porta selezionata, che non verrà mandata in produzione" IsEnabled="{Binding bExecButton_IsEnabled}"
Command="{Binding SkipDoor_Command}" Style="{StaticResource Button.DoorList}">
Style="{StaticResource DoorList_Button}"/> <Image Source="../Resources/DoorListPage/OpenCsv.png"
<Button Content="Porta da non produrre" Style="{StaticResource Button.Image.DoorList}"/>
ToolTip="Segna la Porta selezionatacome da non produrre" </Button>
Command="{Binding NotProduceDoor_Command}" <Button ToolTip="Cancella tutte le porte del csv della porta selezionata"
Style="{StaticResource DoorList_Button}"/> Command="{Binding DeleteCSV_Command}"
<Button Content="↑" IsEnabled="{Binding bExecButton_IsEnabled}"
ToolTip="Sposta su" Style="{StaticResource Button.DoorList}">
Command="{Binding MoveUp_Command}" <Image Source="../Resources/DoorListPage/DeleteCsv.png"
Style="{StaticResource DoorList_Button}"/> Style="{StaticResource Button.Image.DoorList}"/>
<Button Content="↓" </Button>
ToolTip="Sposta giù" <Button ToolTip="Cancella tutte le porte presenti in lista"
Command="{Binding MoveDown_Command}" Command="{Binding DeleteAll_Command}"
Style="{StaticResource DoorList_Button}"/> IsEnabled="{Binding bExecButton_IsEnabled}"
<Button Content="Cancella porta" Style="{StaticResource Button.DoorList}">
ToolTip="Cancella porta selezionata (se non appartenente ad un csv)" <Image Source="../Resources/DoorListPage/DeleteAll.png"
Command="{Binding Delete_Command}" Style="{StaticResource Button.Image.DoorList}"/>
Style="{StaticResource DoorList_Button}"/> </Button>
<Button Content="Cancella csv" <Button ToolTip="Mette in coda di produzione la porta selezionata"
ToolTip="Cancella tutte le porte del csv della porta selezionata" Command="{Binding Produce_Command}"
Command="{Binding DeleteAll_Command}" Style="{StaticResource Button.DoorList}">
Style="{StaticResource DoorList_Button}"/> <Image Source="../Resources/DoorListPage/Produce.png"
<Button Content="Produci" Style="{StaticResource Button.Image.DoorList}"/>
ToolTip="Mette in coda di produzione la porta selezionata" </Button>
Command="{Binding Produce_Command}" <Button ToolTip="Mette in coda di produzione tutte le porte"
Style="{StaticResource DoorList_Button}"/> Command="{Binding ProduceAll_Command}"
<Button Content="Produci Tutte" IsEnabled="{Binding bExecButton_IsEnabled}"
ToolTip="Mette in coda di produzione tutte le porte" Style="{StaticResource Button.DoorList}">
Command="{Binding ProduceAll_Command}" <Image Source="../Resources/DoorListPage/ProduceAll.png"
Style="{StaticResource DoorList_Button}"/> Style="{StaticResource Button.Image.DoorList}"/>
<Button Content="Reset Coda di Produzione" </Button>
ToolTip="Riporta tutte le porte pronte per essere lavorate allo stato Verificate state" <Button ToolTip="Riporta tutte le porte pronte per essere lavorate allo stato Verificate state"
Command="{Binding ResetProductionQueue_Command}" Command="{Binding ResetProductionQueue_Command}"
Style="{StaticResource DoorList_Button}"/> Style="{StaticResource Button.DoorList}">
<Button Content="Verifica" <Image Source="../Resources/DoorListPage/ResetProduction.png"
ToolTip="Verifica tutte le porte in stato Non Verificata" Style="{StaticResource Button.Image.DoorList}"/>
Command="{Binding Verify_Command}" </Button>
IsEnabled="{Binding bExecButton_IsEnabled}" <Button ToolTip="Sposta su"
Style="{StaticResource DoorList_Button}"/> Command="{Binding MoveUp_Command}"
<Button Content="Aggiungi" Style="{StaticResource Button.DoorList}">
ToolTip="Aggiunge una porta alla lista" <Image Source="../Resources/DoorListPage/MoveUp.png"
Command="{Binding AddDoor_Command}" Style="{StaticResource Button.Image.DoorList}"/>
Style="{StaticResource DoorList_Button}"/> </Button>
<Button Content="Copia" <Button ToolTip="Sposta giù"
ToolTip="Copia la porta selezionata" Command="{Binding MoveDown_Command}"
Command="{Binding CopyDoor_Command}" Style="{StaticResource Button.DoorList}">
Style="{StaticResource DoorList_Button}"/> <Image Source="../Resources/DoorListPage/MoveDown.png"
<Button Content="Copia Multipla" Style="{StaticResource Button.Image.DoorList}"/>
ToolTip="Copia Multipla della porta selezionata" </Button>
Command="{Binding MultipleCopyDoor_Command}" <Button ToolTip="Mark the selected door as not to be produced"
Style="{StaticResource DoorList_Button}"/> Command="{Binding NotProduceDoor_Command}"
<Button Content="Salva CSV" IsEnabled="{Binding bExecButton_IsEnabled}"
ToolTip="Salva un csv di produzione" Style="{StaticResource Button.DoorList}">
Command="{Binding SaveCSV_Command}" <Image Source="../Resources/DoorListPage/NotProduce.png"
Style="{StaticResource DoorList_Button}"/> Style="{StaticResource Button.Image.DoorList}"/>
</StackPanel> </Button>
<DataGrid Grid.Row="1" <Button ToolTip="Aggiunge una porta alla lista"
Command="{Binding AddDoor_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"
Style="{StaticResource Button.DoorList}">
<Image Source="../Resources/DoorListPage/Add.png"
Style="{StaticResource Button.Image.DoorList}"/>
</Button>
<Button ToolTip="Copia la porta selezionata"
Command="{Binding CopyDoor_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"
Style="{StaticResource Button.DoorList}">
<Image Source="../Resources/DoorListPage/Copy.png"
Style="{StaticResource Button.Image.DoorList}"/>
</Button>
<Button ToolTip="Copia Multipla della porta selezionata"
Command="{Binding MultipleCopyDoor_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"
Style="{StaticResource Button.DoorList}">
<Image Source="../Resources/DoorListPage/MultipleCopy.png"
Style="{StaticResource Button.Image.DoorList}"/>
</Button>
<Button ToolTip="Cancella porta selezionata (se non appartenente ad un csv)"
Command="{Binding Delete_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"
Style="{StaticResource Button.DoorList}">
<Image Source="../Resources/DoorListPage/Delete.png"
Style="{StaticResource Button.Image.DoorList}"/>
</Button>
<Button ToolTip="Verifica tutte le porte in stato Non Verificata"
Command="{Binding Verify_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"
Style="{StaticResource Button.DoorList}">
<Image Source="../Resources/DoorListPage/Verify.png"
Style="{StaticResource Button.Image.DoorList}"/>
</Button>
<TextBlock Text="{Binding sExecPercentage}"
VerticalAlignment="Center"
Margin="10,0,5,0"
Visibility="{Binding ExecPercentage_Visibility, Mode=OneWay}"/>
<ProgressBar Minimum="0"
Maximum="100"
Value="{Binding dExecPercentage, Mode=OneWay}"
Height="15"
Width="100"
Margin="5,0,0,0"
Visibility="{Binding ExecPercentage_Visibility}"/>
</StackPanel>
</Border>
<FrameworkElement x:Name="dummyElement" Visibility="Collapsed"/>
<DataGrid Grid.Row="2"
ItemsSource="{Binding DoorList}" ItemsSource="{Binding DoorList}"
SelectedItem="{Binding SelDoor}" SelectedItem="{Binding SelDoor}"
AutoGenerateColumns="False" AutoGenerateColumns="False"
@@ -93,7 +144,32 @@
FontSize="12" FontSize="12"
FontFamily="/Resources/Fonts/#Roboto" FontFamily="/Resources/Fonts/#Roboto"
FontWeight="Regular" FontWeight="Regular"
RowHeight="32"> RowHeight="32"
BorderThickness="0">
<DataGrid.Resources>
<DataTemplate x:Key="DDTTemplate">
<ComboBox IsEditable="True"
Text="{Binding DataContext.sDDFName, RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}, UpdateSourceTrigger=LostFocus}"
ItemsSource="{Binding DataContext.DDTList, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}"
Style="{StaticResource ComboBox.DataGridTemplateColumn.DoorList}"/>
</DataTemplate>
<DataTemplate x:Key="NoDDTTemplate">
<TextBox Text="{Binding DataContext.sDDFName, RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}"
Style="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
</DataTemplate>
<Style x:Key="DDTContentControl" TargetType="{x:Type ContentControl}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=DataContext.DDTList, Source={x:Reference dummyElement}, Converter={StaticResource DDTListToBooleanConverter}}"
Value="True">
<Setter Property="ContentTemplate" Value="{StaticResource NoDDTTemplate}" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=DataContext.DDTList, Source={x:Reference dummyElement}, Converter={StaticResource DDTListToBooleanConverter}}"
Value="False">
<Setter Property="ContentTemplate" Value="{StaticResource DDTTemplate}" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<DataGrid.ColumnHeaderStyle> <DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}"> <Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="{StaticResource Effector_DarkBlue}"/> <Setter Property="Background" Value="{StaticResource Effector_DarkBlue}"/>
@@ -108,46 +184,47 @@
Binding="{Binding nId}" Binding="{Binding nId}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTemplateColumn Header="DDF/DDT File Name" <DataGridTemplateColumn Header="DDF/DDT File Name"
Width="Auto"> Width="1*">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding sDDFName}" <TextBlock Text="{Binding sDDFName}"
Style="{StaticResource DataGridTextColumn_TextBlock}"/> Style="{StaticResource TextBlock.DataGridTextColumn.DoorList}"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate> <DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate> <DataTemplate>
<ComboBox IsEditable="True" <!--<ComboBox IsEditable="True"
Text="{Binding sDDFName}" Text="{Binding sDDFName}"
ItemsSource="{Binding DataContext.DDTList, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}" ItemsSource="{Binding DataContext.DDTList, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}"
Style="{StaticResource DataGridTemplateColumn_ComboBox}"/> Style="{StaticResource ComboBox.DataGridTemplateColumn.DoorList}"/>-->
<ContentControl Style="{StaticResource DDTContentControl}"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate> </DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn Header="Larghezza" <DataGridTextColumn Header="Larghezza"
Binding="{Binding dWidth}" Binding="{Binding dWidth}"
Width="Auto" Width="Auto"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTextColumn Header="Altezza" <DataGridTextColumn Header="Altezza"
Binding="{Binding dHeight}" Binding="{Binding dHeight}"
Width="Auto" Width="Auto"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTextColumn Header="Spessore" <DataGridTextColumn Header="Spessore"
Binding="{Binding dThickness}" Binding="{Binding dThickness}"
Width="Auto" Width="Auto"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTemplateColumn Header="Apertura" <DataGridTemplateColumn Header="Apertura"
Width="Auto"> Width="Auto">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding SelSwing.Name}" <TextBlock Text="{Binding SelSwing.Name}"
Style="{StaticResource DataGridTextColumn_TextBlock}"/> Style="{StaticResource TextBlock.DataGridTextColumn.DoorList}"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate> <DataGridTemplateColumn.CellEditingTemplate>
@@ -155,7 +232,7 @@
<ComboBox ItemsSource="{Binding SwingList}" <ComboBox ItemsSource="{Binding SwingList}"
SelectedItem="{Binding SelSwing}" SelectedItem="{Binding SelSwing}"
SelectedValuePath="Name" SelectedValuePath="Name"
Style="{StaticResource DataGridTemplateColumn_ComboBox}"/> Style="{StaticResource ComboBox.DataGridTemplateColumn.DoorList}"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate> </DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
@@ -163,50 +240,50 @@
Binding="{Binding nState}" Binding="{Binding nState}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTextColumn Header="CSV" <DataGridTextColumn Header="CSV"
Binding="{Binding sCSVName}" Binding="{Binding sCSVName}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTextColumn Header="Linea del CSV" <DataGridTextColumn Header="Linea del CSV"
Binding="{Binding nCSVLine}" Binding="{Binding nCSVLine}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTextColumn Header="Stato di produzione" <DataGridTextColumn Header="Stato di produzione"
Binding="{Binding nProdState}" Binding="{Binding nProdState}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTextColumn Header="Carico" <DataGridTextColumn Header="Carico"
Binding="{Binding sLoadTime}" Binding="{Binding sLoadTime}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTextColumn Header="Inizio lavorazione" <DataGridTextColumn Header="Inizio lavorazione"
Binding="{Binding sMachining1Start}" Binding="{Binding sMachining1Start}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<DataGridTextColumn Header="Fine lavorazione" <DataGridTextColumn Header="Fine lavorazione"
Binding="{Binding sMachining1End}" Binding="{Binding sMachining1End}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>
<!--<DataGridTextColumn Header="Scarico" <!--<DataGridTextColumn Header="Scarico"
Binding="{Binding sUnloadTime}" Binding="{Binding sUnloadTime}"
Width="Auto" Width="Auto"
IsReadOnly="True" IsReadOnly="True"
ElementStyle="{StaticResource DataGridTextColumn_TextBlock}" ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
EditingElementStyle="{StaticResource DataGridTextColumn_TextBox}"/>--> EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}"/>-->
</DataGrid.Columns> </DataGrid.Columns>
<!--<DataGrid.InputBindings> <!--<DataGrid.InputBindings>
<KeyBinding Key="Delete" Command="{Binding Tag.SelectedMachGroup.DeleteMachGroup_Command, <KeyBinding Key="Delete" Command="{Binding Tag.SelectedMachGroup.DeleteMachGroup_Command,
@@ -218,72 +295,5 @@
<Setter Property="BorderBrush" Value="{Binding nState, Converter={StaticResource StateToSelColorConverter}}" /> <Setter Property="BorderBrush" Value="{Binding nState, Converter={StaticResource StateToSelColorConverter}}" />
</Style> </Style>
</DataGrid.RowStyle> </DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<!--<Setter Property="VerticalAlignment" Value="Stretch"/>
--><!--<Setter Property="VerticalContentAlignment" Value="Center"/>-->
<!--<Setter Property="TextBlock.TextAlignment" Value="Center"/>
<Setter Property="TextBox.VerticalAlignment" Value="Stretch"/>--><!--
<Setter Property="TextBox.VerticalContentAlignment" Value="Center"/>-->
<!--<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid>
<TextBox Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Text}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
BorderThickness="0"
Background="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Background}"
VerticalContentAlignment="Center">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
</Style>
</TextBox.Style>
</TextBox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>-->
<!--<Setter Property="TextBlock.TextAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter>
<ContentPresenter.Style>
<Style TargetType="ContentPresenter">
<Setter Property="TextBox.VerticalAlignment" Value="Stretch"/>
<Setter Property="TextBox.VerticalContentAlignment" Value="Center"/>
</Style>
</ContentPresenter.Style>
</ContentPresenter>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>-->
<!--<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>-->
<!--<Style.Resources>
<Style TargetType="ContentPresenter">
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="TextBox.VerticalAlignment" Value="Center" />
</Style>
</Style.Resources>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
</Trigger>
</Style.Triggers>-->
</Style>
</DataGrid.CellStyle>
</DataGrid> </DataGrid>
</Grid> </Grid>
@@ -7,12 +7,12 @@ Imports System.Security.Cryptography
Imports Newtonsoft.Json.Linq Imports Newtonsoft.Json.Linq
Imports Effector.Plugin.DoorArreda.Door Imports Effector.Plugin.DoorArreda.Door
Imports System.Globalization Imports System.Globalization
Imports System.Diagnostics
Imports Effector.Plugin.Lib
Public Class DoorListPageVM Public Class DoorListPageVM
Inherits VMBase Inherits VMBase
Private m_ManualAddedDoorName As String = "ManualAddedDoor"
Private m_BackupTimer As New DispatcherTimer Private m_BackupTimer As New DispatcherTimer
Private m_WriteCSVTimer As New DispatcherTimer Private m_WriteCSVTimer As New DispatcherTimer
Private m_RefreshGraphicsTimer As New DispatcherTimer Private m_RefreshGraphicsTimer As New DispatcherTimer
@@ -41,6 +41,13 @@ Public Class DoorListPageVM
End Get End Get
End Property 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 Private m_bExecButton_IsEnabled As Boolean = True
Public ReadOnly Property bExecButton_IsEnabled As Boolean Public ReadOnly Property bExecButton_IsEnabled As Boolean
Get Get
@@ -57,6 +64,35 @@ Public Class DoorListPageVM
Private m_sCSVOutDirPath As String = "" 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 m_bCreatingDdfs Then
Return 5 / m_nTotCreatingDdf * m_nCurrCreatingDdf
End If
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) OrElse m_bCreatingDdfs, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Private m_bCreatingDdfs As Boolean
Private m_nTotCreatingDdf As Integer
Private m_nCurrCreatingDdf As Integer
' Definizione comandi ' Definizione comandi
Private m_cmdOpenCSV As ICommand Private m_cmdOpenCSV As ICommand
Private m_cmdSaveCSV As ICommand Private m_cmdSaveCSV As ICommand
@@ -68,6 +104,7 @@ 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
@@ -107,17 +144,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
@@ -224,13 +264,68 @@ Public Class DoorListPageVM
Dim CurrRequestDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = ArgumentsResult.ProcessArgs.nId) Dim CurrRequestDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = ArgumentsResult.ProcessArgs.nId)
If Not IsNothing(CurrRequestDoor) Then If Not IsNothing(CurrRequestDoor) Then
CurrRequestDoor.SetState(If(ArgumentsResult.nResult = 0, Door.DoorStates.VERIFIED, Door.DoorStates.VERIFICATION_FAILED)) CurrRequestDoor.SetState(If(ArgumentsResult.nResult = 0, Door.DoorStates.VERIFIED, Door.DoorStates.VERIFICATION_FAILED))
' elimino file generati
Dim sGenDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
Dim sDoorFileName As String = Path.GetFileNameWithoutExtension(CurrRequestDoor.sDDFName) & "_" & CurrRequestDoor.nId
Try
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".tok")
'File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.tok")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".cnc")
'File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_a.cnc")
'File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_b.cnc")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.cnc")
'File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2_a.cnc")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".html")
'File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.html")
'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")
'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
If CopyGenDdfFile(CurrRequestDoor, CurrDoor) Then
CurrDoor.SetState(If(ArgumentsResult.nResult = 0, Door.DoorStates.VERIFIED, Door.DoorStates.VERIFICATION_FAILED))
End If
End If
Next
End If End If
WriteBackup() WriteBackup()
ArgumentsResult = m_ExecProcessManager.ArgumentsResultDequeue ArgumentsResult = m_ExecProcessManager.ArgumentsResultDequeue
End While 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 If Not bExecButton_IsEnabled AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
SetExecButtonIsEnabled(True) SetExecButtonIsEnabled(True)
End If End If
NotifyPropertyChanged(NameOf(ExecPercentage_Visibility))
End Sub End Sub
Friend Function GetNextDoor() As Door Friend Function GetNextDoor() As Door
@@ -277,7 +372,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",
@@ -285,6 +380,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
@@ -360,6 +456,8 @@ Public Class DoorListPageVM
Else Else
nSwing = SWINGTYPE.RIGHT nSwing = SWINGTYPE.RIGHT
End If End If
Else
nSwing = SWINGTYPE.UNDEFINED
End If End If
'Dim sErrMessage As String = "" 'Dim sErrMessage As String = ""
'Dim sGDDFDirPath As String = "" 'Dim sGDDFDirPath As String = ""
@@ -395,7 +493,7 @@ Public Class DoorListPageVM
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
Dim sMessage As String = "Line " & ex.Message & "is not valid and will be skipped." Dim sMessage As String = "Line " & ex.Message & "is not valid and will be skipped."
' egtoutlog(sMessage) ' egtoutlog(sMessage)
sLineErrorList &= ex.Message & Environment.NewLine sLineErrorList &= Environment.NewLine & ex.Message
End Try End Try
End While End While
If Not String.IsNullOrWhiteSpace(sLineErrorList) Then If Not String.IsNullOrWhiteSpace(sLineErrorList) Then
@@ -442,7 +540,20 @@ Public Class DoorListPageVM
WriteBackup() WriteBackup()
End Sub End Sub
Private Function CreateGenDdfFile(nId As Integer, sDDFName As String, dWidth As Double, dHeight As Double, dThickness As Double, nSwing As Integer, sErrMessage As String) As Boolean Private Function CopyGenDdfFile(SouDoor As Door, CopyDoor As Door) As Boolean
Dim sGenDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & If(Not String.IsNullOrWhiteSpace(Path.GetDirectoryName(SouDoor.sDDFName)), Path.GetDirectoryName(SouDoor.sDDFName) & "_", "") & Path.GetFileNameWithoutExtension(SouDoor.sDDFName) & "_"
Try
File.Copy(sGenDDFFilePath & SouDoor.nId & ".ddf", sGenDDFFilePath & CopyDoor.nId & ".ddf", True)
Catch ex As Exception
Map.refSupervisorFunction.PlgOutLog("Error! Copy ddf file from " & sGenDDFFilePath & SouDoor.nId & ".ddf" & " to " & sGenDDFFilePath & CopyDoor.nId & ".ddf" & " failed!")
Return False
End Try
Return True
End Function
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 ' verifico che ci sia il file ddf
Dim sDDTDirPath As String = "" Dim sDDTDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_DDTDIR, "", sDDTDirPath) GetPluginPrivateProfileString(S_GENERAL, K_DDTDIR, "", sDDTDirPath)
@@ -454,7 +565,13 @@ 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
sErrMessage &= "Il nome inserito non corrisponde a nessun file nella cartella dei Ddf (" & sDDFDirPath & ")" & Environment.NewLine Dim sErr As String = "Il nome inserito non corrisponde a nessun file nella cartella dei Ddf (" & sDDFDirPath & ")" & Environment.NewLine
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)) NotifyPropertyChanged(NameOf(sDDFName))
Return False Return False
End If End If
@@ -465,18 +582,34 @@ Public Class DoorListPageVM
File.Copy(sDDFFilePath, sGenDDFFilePath, True) File.Copy(sDDFFilePath, sGenDDFFilePath, True)
bCopy = True bCopy = True
Catch ex As Exception Catch ex As Exception
sErrMessage &= "Error: Copy file from " & sDDFFilePath & " to " & sGenDDFFilePath & " failed!" 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 End Try
If Not bCopy Then If Not bCopy Then
Return False Return False
End If End If
ElseIf sExtension.ToLower() = ".ddt" Then ElseIf sExtension.ToLower() = ".ddt" Then
' se file generato ' se file generato
If Not Door.CreateDdfFromDdt(nId, sDDFName, dWidth, dHeight, dThickness, nSwing) Then 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 Return False
End If End If
Else Else
sErrMessage &= "Estensione del file non riconosciuta!" 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 Return False
End If End If
Return True Return True
@@ -704,8 +837,23 @@ Public Class DoorListPageVM
End Property End Property
Public Sub NotProduceDoor() Public Sub NotProduceDoor()
If IsNothing(SelDoor) OrElse (SelDoor.nState <> Door.DoorStates.VERIFIED AndAlso SelDoor.nState <> Door.DoorStates.NOTPRODUCE) Then Return If Not IsNothing(SelDoor) Then
SelDoor.SetState(If(SelDoor.nState = Door.DoorStates.VERIFIED, Door.DoorStates.NOTPRODUCE, Door.DoorStates.VERIFIED)) 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() WriteBackup()
End Sub End Sub
@@ -771,7 +919,7 @@ Public Class DoorListPageVM
MessageBox.Show("Nessuna porta selezionata!" & Environment.NewLine & "Selezionare la porta da copiare", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) MessageBox.Show("Nessuna porta selezionata!" & Environment.NewLine & "Selezionare la porta da copiare", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
Return Return
End If End If
' apro finestra quanitita' ' apro finestra quantita'
Dim MultipleCopyWndVM As New MultipleCopyWndVM Dim MultipleCopyWndVM As New MultipleCopyWndVM
Dim MultipleCopyWnd As New MultipleCopyWndV(Application.Current.MainWindow, MultipleCopyWndVM) Dim MultipleCopyWnd As New MultipleCopyWndV(Application.Current.MainWindow, MultipleCopyWndVM)
If MultipleCopyWnd.ShowDialog() Then If MultipleCopyWnd.ShowDialog() Then
@@ -851,25 +999,29 @@ 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
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 Dim sSelCSVName As String = SelDoor.sCSVName
' verifico che tutte le porte del csv siano in stato prodotto o da non produrre ' verifico che tutte le porte del csv siano in stato prodotto o da non produrre
Dim bAllProduced As Boolean = True Dim bAllProduced As Boolean = True
For Each CsvDoor In m_DoorList For Each CsvDoor In m_DoorList
If String.Compare(sSelCSVName, CsvDoor.sCSVName, True) = 0 Then If String.Compare(sSelCSVName, CsvDoor.sCSVName, True) = 0 Then
If CsvDoor.nState <> DoorStates.MACHINE_1_END AndAlso CsvDoor.nState <> DoorStates.PRODUCED AndAlso CsvDoor.nState <> DoorStates.NOTPRODUCE Then If CsvDoor.nState <> DoorStates.MACHINE_1_END AndAlso CsvDoor.nState <> DoorStates.PRODUCED AndAlso CsvDoor.nState <> DoorStates.NOTPRODUCE AndAlso CsvDoor.nState <> DoorStates.VERIFICATION_FAILED Then
bAllProduced = False bAllProduced = False
End If End If
End If End If
@@ -889,6 +1041,55 @@ 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 bReset As Boolean = True
If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then
MessageBox.Show("Impossibile cancellare tutte le porte!" & Environment.NewLine & "La macchina deve essere in stato Reset per poter cancellare tutte le porte!", "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_1_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("Impossibile cancellare tutte le porte!" & Environment.NewLine & "Per cancellare tutte le porte, devono essere tutte non in lavorazione!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
If MessageBox.Show("Sei sicuro di voler cancellare tutte le porte?", "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("Fallita cancellazione del file LuaBackup!")
End Try
End If
End Sub
#End Region ' DeleteAll #End Region ' DeleteAll
#Region "Produce" #Region "Produce"
@@ -908,10 +1109,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)
@@ -980,6 +1178,9 @@ Public Class DoorListPageVM
End Get End Get
End Property End Property
Private m_DifferentDoorList As New List(Of Door)
Private m_AssociationList As New Dictionary(Of Integer, List(Of Integer))
Public Sub Verify() Public Sub Verify()
Dim sCamExePath As String = "" Dim sCamExePath As String = ""
@@ -997,21 +1198,63 @@ Public Class DoorListPageVM
Dim sGenDDFDirPath As String = "" Dim sGenDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath) GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
Dim sErrMessage As String = "" Dim sErrMessage As String = ""
For Each Door In m_DoorList m_DifferentDoorList.Clear()
m_AssociationList.Clear()
' inizio Creazione ddf e quindi mostro caricamento
m_bCreatingDdfs = True
m_nTotCreatingDdf = m_DoorList.Count
For nDoorIndex = 0 To m_DoorList.Count - 1
Dim Door As Door = m_DoorList(nDoorIndex)
m_nCurrCreatingDdf = nDoorIndex
NotifyPropertyChanged(NameOf(dExecPercentage))
NotifyPropertyChanged(NameOf(sExecPercentage))
If Door.nState = Door.DoorStates.LOADED_FROM_CSV Or Door.nState = Door.DoorStates.VERIFICATION_FAILED Then If Door.nState = Door.DoorStates.LOADED_FROM_CSV Or Door.nState = Door.DoorStates.VERIFICATION_FAILED Then
' creo file ddf ' verifico se ho gia' lanciato una porta con le stesse caratteristiche
If CreateGenDdfFile(Door.nId, Door.sDDFName, Door.dWidth, Door.dHeight, Door.dThickness, Door.nSwing, sErrMessage) Then Dim DifferentDoor As Door = Nothing
Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & If(Not String.IsNullOrWhiteSpace(Path.GetDirectoryName(Door.sDDFName)), Path.GetDirectoryName(Door.sDDFName) & "_", "") & Path.GetFileNameWithoutExtension(Door.sDDFName) & "_" & Door.nId & ".ddf" If Path.GetExtension(Door.sDDFName).ToLower() = ".ddf" Then
m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sGenDDFFilePath)) 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 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))
' creo file ddf
If CreateGenDdfFile(Door.nId, Door.sDDFName, Door.dWidth, Door.dHeight, Door.dThickness, Door.nSwing, sErrMessage) Then
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
'' 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 End If
Next Next
m_bCreatingDdfs = False
If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
m_ExecProcessManager.StartExecutionThread() m_ExecProcessManager.StartExecutionThread()
SetExecButtonIsEnabled(False) SetExecButtonIsEnabled(False)
End If End If
If Not String.IsNullOrWhiteSpace(sErrMessage) Then If Not String.IsNullOrWhiteSpace(sErrMessage) Then
MessageBox.Show("Impossible creating Ddf files for this doors:" & sErrMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error) MessageBox.Show("Impossible creating Ddf files for this doors:" & Environment.NewLine & sErrMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If End If
WriteBackup() WriteBackup()
End Sub End Sub
@@ -1026,6 +1269,7 @@ Public Class Door
Inherits VMBase Inherits VMBase
Public Enum SWINGTYPE As Integer Public Enum SWINGTYPE As Integer
UNDEFINED = 0
RIGHT = 1 RIGHT = 1
LEFT = 2 LEFT = 2
End Enum End Enum
@@ -1044,8 +1288,8 @@ Public Class Door
MACHINE_1_START = 33 MACHINE_1_START = 33
MACHINE_1_END = 34 MACHINE_1_END = 34
MACHINE_2_START = 35 MACHINE_2_START = 35
MACHINE_2_END = 35 MACHINE_2_END = 36
PRODUCED = 36 PRODUCED = 37
SCRAP = 40 SCRAP = 40
End Enum End Enum
@@ -1151,6 +1395,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
@@ -1206,6 +1452,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
@@ -1254,6 +1502,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
@@ -1302,6 +1552,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
@@ -1356,6 +1608,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
@@ -1421,7 +1675,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)
@@ -1437,7 +1691,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)
@@ -1453,7 +1707,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)
@@ -1469,7 +1723,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)
@@ -1485,7 +1739,7 @@ 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)
@@ -1501,7 +1755,7 @@ 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)
@@ -1592,10 +1846,10 @@ Public Class Door
#Region "METHODS" #Region "METHODS"
Friend Function Copy(nId As Integer) As Door Friend Function Copy(nId As Integer) As Door
Return New Door(nId, m_nCSVLine, m_sDDFName, m_sCSVName, m_nQuantity, m_dWidth, m_dHeight, m_dThickness, m_nSwing, m_CustomerParameters) 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 End Function
Friend Shared Function CreateDdfFromDdt(nId As Integer, sDDFName As String, dWidth As Double, dHeight As Double, dThickness As Double, nSwing As Integer) As Boolean 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 = "" Dim sDoorCreatorExePath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_DOORCREATOREXEPATH, "", sDoorCreatorExePath) GetPluginPrivateProfileString(S_GENERAL, K_DOORCREATOREXEPATH, "", sDoorCreatorExePath)
Dim sDDTDirPath As String = "" Dim sDDTDirPath As String = ""
@@ -1607,32 +1861,48 @@ Public Class Door
MessageBox.Show("Path del programma di calcolo del ddf mancante o errata!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) MessageBox.Show("Path del programma di calcolo del ddf mancante o errata!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
Return False Return False
ElseIf Not File.Exists(sDDTFilePath) Then ElseIf 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) 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 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 >= 300 Then
Map.refSupervisorFunction.PlgOutLog("Kill del processo!!")
Proc.Kill()
Exit While
End If
Threading.Thread.Sleep(100)
ExecCounter += 1
End While
End If
Map.refSupervisorFunction.PlgOutLog(Proc.ExitCode)
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
MessageBox.Show("Generazione file ddf fallita!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error) Dim sErr As String = "Errore! Generazione file ddf fallita! (" & sDDTDirPath & ")"
Map.refSupervisorFunction.PlgOutLog(sErr)
sErrMessage &= "- " & sErr & Environment.NewLine
Return False Return False
End If End If
Return True Return True
@@ -1697,4 +1967,18 @@ Public Class StateToSelColorConverter
Throw New NotImplementedException() Throw New NotImplementedException()
End Function 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 End Class
@@ -51,6 +51,12 @@
<Reference Include="Effector.Plugin.Interface"> <Reference Include="Effector.Plugin.Interface">
<HintPath>..\..\Effector.Main\Effector.Plugin.Interface\bin\Debug\Effector.Plugin.Interface.dll</HintPath> <HintPath>..\..\Effector.Main\Effector.Plugin.Interface\bin\Debug\Effector.Plugin.Interface.dll</HintPath>
</Reference> </Reference>
<Reference Include="Effector.Plugin.Lib">
<HintPath>..\..\Effector.Plugin.Lib\Effector.Plugin.Lib\bin\Debug\Effector.Plugin.Lib.dll</HintPath>
</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>
@@ -98,13 +104,6 @@
<DependentUpon>DoorListPageV.xaml</DependentUpon> <DependentUpon>DoorListPageV.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="DoorListPage\DoorListPageVM.vb" /> <Compile Include="DoorListPage\DoorListPageVM.vb" />
<Compile Include="MultipleCopyWnd\MultipleCopyWndV.xaml.vb">
<DependentUpon>MultipleCopyWndV.xaml</DependentUpon>
</Compile>
<Compile Include="MultipleCopyWnd\MultipleCopyWndVM.vb" />
<Compile Include="ProcessManager\ProcessManagerV.xaml.vb">
<DependentUpon>ProcessManagerV.xaml</DependentUpon>
</Compile>
<Compile Include="FiveLakesUI.xaml.vb"> <Compile Include="FiveLakesUI.xaml.vb">
<DependentUpon>FiveLakesUI.xaml</DependentUpon> <DependentUpon>FiveLakesUI.xaml</DependentUpon>
</Compile> </Compile>
@@ -120,7 +119,6 @@
<DependentUpon>MainMenuV.xaml</DependentUpon> <DependentUpon>MainMenuV.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="MainMenu\MainMenuVM.vb" /> <Compile Include="MainMenu\MainMenuVM.vb" />
<Compile Include="ProcessManager\ProcessManagerVM.vb" />
<Compile Include="RestartWnd\RestartWndV.xaml.vb"> <Compile Include="RestartWnd\RestartWndV.xaml.vb">
<DependentUpon>RestartWndV.xaml</DependentUpon> <DependentUpon>RestartWndV.xaml</DependentUpon>
</Compile> </Compile>
@@ -145,15 +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\ExecProcessManager.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>
@@ -172,14 +163,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="MultipleCopyWnd\MultipleCopyWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProcessManager\ProcessManagerV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="FiveLakesUI.xaml"> <Page Include="FiveLakesUI.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -205,6 +188,28 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Resources\DoorListPage\Add.png" />
<Resource Include="Resources\DoorListPage\Copy.png" />
<Resource Include="Resources\DoorListPage\Delete.png" />
<Resource Include="Resources\DoorListPage\DeleteCsv.png" />
<Resource Include="Resources\DoorListPage\MoveDown.png" />
<Resource Include="Resources\DoorListPage\MoveUp.png" />
<Resource Include="Resources\DoorListPage\MultipleCopy.png" />
<Resource Include="Resources\DoorListPage\NotProduce.png" />
<Resource Include="Resources\DoorListPage\OpenCsv.png" />
<Resource Include="Resources\DoorListPage\OpenProduction.png" />
<Resource Include="Resources\DoorListPage\Produce.png" />
<Resource Include="Resources\DoorListPage\ProduceAll.old.png" />
<Resource Include="Resources\DoorListPage\ProduceAll.png" />
<Resource Include="Resources\DoorListPage\ResetProduction.png" />
<Resource Include="Resources\DoorListPage\SaveCsv.png" />
<Resource Include="Resources\DoorListPage\SkipDoor.png" />
<Resource Include="Resources\DoorListPage\Verify.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>
+2 -2
View File
@@ -1,5 +1,6 @@
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 FiveLakesUIVM
Inherits VMBase Inherits VMBase
@@ -52,10 +53,9 @@ 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)
' Impostazione path resources dir ' Impostazione path resources dir
m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
End Sub End Sub
End Class End Class
@@ -1,5 +1,6 @@
Imports System.IO Imports System.IO
Imports KeraLua Imports KeraLua
Imports Effector.Plugin.Lib
Public Module Lua_General Public Module Lua_General
@@ -6,6 +6,7 @@ Imports System.Windows.Threading
Imports Newtonsoft.Json.Linq Imports Newtonsoft.Json.Linq
Imports Effector.Plugin.DoorArreda.Variable Imports Effector.Plugin.DoorArreda.Variable
Imports Effector.Plugin.Interface Imports Effector.Plugin.Interface
Imports Effector.Plugin.Lib
Public Class MachinePageVM Public Class MachinePageVM
Inherits VMBase Inherits VMBase
@@ -44,6 +45,13 @@ Public Class MachinePageVM
NotifyPropertyChanged(NameOf(nDDfCalcState)) NotifyPropertyChanged(NameOf(nDDfCalcState))
End Sub End Sub
Private m_dDdfCalcValue As Double = 0
Public ReadOnly Property dDdfCalcValue As Double
Get
Return m_dDdfCalcValue
End Get
End Property
Private m_nNewDoorState As Integer = -1 Private m_nNewDoorState As Integer = -1
Public ReadOnly Property nNewDoorState As Integer Public ReadOnly Property nNewDoorState As Integer
Get Get
@@ -222,6 +230,14 @@ Public Class MachinePageVM
Dim nState As Integer = -1 Dim nState As Integer = -1
If LuaGetGlobVar("MACHINE1.DDfCalcState", nState) Then If LuaGetGlobVar("MACHINE1.DDfCalcState", nState) Then
SetDDfCalcState(nState) SetDDfCalcState(nState)
If nState = 1 Then
m_dDdfCalcValue += 100 / 250
m_dDdfCalcValue = Math.Min(100, m_dDdfCalcValue)
ElseIf m_dDdfCalcValue <> 0 Then
m_dDdfCalcValue = 0
End If
NotifyPropertyChanged(NameOf(dDdfCalcValue))
NotifyPropertyChanged(NameOf(nDDfCalcState))
End If End If
If LuaGetGlobVar("MACHINE1.NewDoorState", nState) Then If LuaGetGlobVar("MACHINE1.NewDoorState", nState) Then
SetNewDoorState(nState) SetNewDoorState(nState)
@@ -778,42 +794,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
Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

@@ -1,4 +1,5 @@
Imports Newtonsoft.Json Imports Effector.Plugin.Lib
Imports Newtonsoft.Json
Imports System.Collections.ObjectModel Imports System.Collections.ObjectModel
Imports System.Globalization Imports System.Globalization
Imports System.IO Imports System.IO
@@ -4,6 +4,10 @@
xmlns:local="clr-namespace:Effector.Plugin.DoorArreda" xmlns:local="clr-namespace:Effector.Plugin.DoorArreda"
xmlns:sys="clr-namespace:System;assembly=mscorlib"> xmlns:sys="clr-namespace:System;assembly=mscorlib">
<!--<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Effector.Plugin.Lib;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>-->
<!-- <!--
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).
@@ -110,7 +114,7 @@
<!--Button--> <!--Button-->
<Style TargetType="{x:Type Button}"> <!--<Style TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/> <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/> <Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/> <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
@@ -146,12 +150,12 @@
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>-->
<Style x:Key="DoorList_Button" TargetType="{x:Type Button}"> <!--<Style x:Key="DoorList_Button" TargetType="{x:Type Button}">
<Setter Property="Height" Value="30"/> <Setter Property="Height" Value="30"/>
<Setter Property="Padding" Value="10,0,10,0"/> <Setter Property="Padding" Value="10,0,10,0"/>
</Style> </Style>-->
<!--ToggleButton--> <!--ToggleButton-->
@@ -213,12 +217,12 @@
<!-- Custom SelectedItem colors for DataGrid --> <!-- Custom SelectedItem colors for DataGrid -->
<Style x:Key="RowDataGrid_CustomHighLight" TargetType="{x:Type DataGridRow}"> <!--<Style x:Key="RowDataGrid_CustomHighLight" TargetType="{x:Type DataGridRow}">
<Setter Property="BorderBrush" Value="LightGray" /> <Setter Property="BorderBrush" Value="LightGray" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsSelected" Value="True"> <Trigger Property="IsSelected" Value="True">
<Setter Property="BorderThickness" Value="2,2,2,2" /> <Setter Property="BorderThickness" Value="2,2,2,2" />
<!--<Setter Property="BorderBrush" Value="Cyan" />--> --><!--<Setter Property="BorderBrush" Value="Cyan" />--><!--
<Setter Property="Padding" Value="0,0,0,0" /> <Setter Property="Padding" Value="0,0,0,0" />
<Setter Property="Margin" Value="-2,0,-2,0" /> <Setter Property="Margin" Value="-2,0,-2,0" />
<Setter Property="Foreground" Value="Blue" /> <Setter Property="Foreground" Value="Blue" />
@@ -230,7 +234,7 @@
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="Transparent" /> <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="Black" /> <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="Black" />
</Style.Resources> </Style.Resources>
</Style> </Style>-->
<!--Styles for DataGrid columns--> <!--Styles for DataGrid columns-->
@@ -2,6 +2,7 @@
Imports Newtonsoft.Json Imports Newtonsoft.Json
Imports Newtonsoft.Json.Converters Imports Newtonsoft.Json.Converters
Imports Effector.Plugin.DoorArreda.Door Imports Effector.Plugin.DoorArreda.Door
Imports Effector.Plugin.Lib
Public Class JsonDoor Public Class JsonDoor