Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9eb30b0697 | |||
| 0c73db4f52 | |||
| 23b2606cbc | |||
| 1f36c9a5b0 | |||
| ce20fa0eb3 | |||
| c32715a4b5 | |||
| 52c0b6b194 | |||
| a83752e565 | |||
| 60e72aaf22 | |||
| ec2ce96b3b | |||
| d131e0b42d | |||
| efea14db89 | |||
| c09d8a6b0f | |||
| 946ad1d29c | |||
| c5f1d1669f | |||
| 689e81219b | |||
| 05ec565f84 | |||
| 0e7866922d | |||
| fb92f9faea | |||
| f65d07ab22 | |||
| f140b6df54 | |||
| 441ddc4397 | |||
| 9f16294994 | |||
| fd4e961b39 | |||
| 7156ca93d0 | |||
| 8c42493382 | |||
| 7a6eebcdab | |||
| e1b4dc52cb | |||
| 99ea410056 | |||
| ae19eae94d | |||
| 5f321fba3a | |||
| 3401bb7557 | |||
| b7a127c1cd | |||
| 8f6eaf5a53 | |||
| 80150b508a | |||
| 34089f946f | |||
| 7bc58a74e1 | |||
| 92f347cd7e | |||
| 1817870dfe | |||
| 7def088b9d | |||
| 810a61ea0d | |||
| 70cbef0efb | |||
| ec6c44d036 | |||
| 5d42576da1 | |||
| 227ded2e88 | |||
| 1c81e7fdb4 | |||
| d37014272f | |||
| dc8fcae112 | |||
| 79db35220b | |||
| d7ba34527f | |||
| 7622117281 | |||
| b331126f8a | |||
| 88b9226bcb | |||
| dd2f75abf1 | |||
| 2922c0e6ef |
@@ -554,7 +554,7 @@ Public Class BTLFeatureM
|
||||
' Impossibile creare una feature con questi valori - ERRORE
|
||||
MessageBox.Show(EgtMsg(61852), EgtMsg(30007))
|
||||
nFeatureId = EgtBeamModifyProcess(Me.nFeatureId, Me.nSelGRP, Me.nPRC, Me.nSelSIDE, "", Me.nPRID,
|
||||
New Frame3d(), vPar, sPar, vParQ, nCrvId, nCrv2Id)
|
||||
Me.frFRAME, vPar, sPar, vParQ, nCrvId, nCrv2Id)
|
||||
SetFeatureId(nFeatureId)
|
||||
bOk = False
|
||||
End If
|
||||
|
||||
@@ -17,5 +17,14 @@
|
||||
Public Const COL_DESCRIPTION As String = "colDESCRIPTION"
|
||||
Public Const COL_SUPERVISORID As String = "colSUPERVISORID"
|
||||
Public Const COL_PRIORITY As String = "colPRIORITY"
|
||||
Public Const COL_NAME As String = "colNAME"
|
||||
Public Const COL_H As String = "colH"
|
||||
Public Const COL_MATERIAL As String = "colMATERIAL"
|
||||
Public Const COL_USAGE As String = "colUSAGE"
|
||||
Public Const COL_WASTE As String = "colWASTE"
|
||||
Public Const COL_ARCHIVED As String = "colARCHIVED"
|
||||
Public Const COL_PROJID As String = "colPROJID"
|
||||
Public Const COL_PRODID As String = "colPRODID"
|
||||
Public Const COL_CREATEDATE As String = "colCRTDATE"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
Public Const S_FEATURELIST As String = "DG_FeatureList"
|
||||
Public Const S_OPENPROJFILEDLG_PROJ As String = "DG_OpenProjectFileDialog_PROJ"
|
||||
Public Const S_OPENPROJFILEDLG_PROD As String = "DG_OpenProjectFileDialog_PROD"
|
||||
Public Const S_NEWOPENPROJFILEDLG_PROD As String = "DG_NewOpenProjectFileDialog_PROD"
|
||||
Public Const S_RAWPARTLIST_BEAM As String = "DG_RawPartList_BEAM"
|
||||
Public Const S_RAWPARTLIST_WALL As String = "DG_RawPartList_WALL"
|
||||
Public Const S_PARTINRAWPARTLIST_BEAM As String = "DG_PartInRawPartList_BEAM"
|
||||
|
||||
@@ -46,6 +46,7 @@ Public Module ConstIni
|
||||
Public Const K_ENABLEEDIT As String = "EnableEdit"
|
||||
Public Const K_FASTPRODUCE As String = "FastProduce"
|
||||
Public Const K_ADDPROJ As String = "AddProj"
|
||||
Public Const K_PROJECTMODE As String = "ProjectMode"
|
||||
|
||||
'Public Const S_LANGUAGES As String = "Languages"
|
||||
'Public Const K_LANGUAGE As String = "Language"
|
||||
@@ -128,6 +129,7 @@ Public Module ConstIni
|
||||
Public Const K_ENDDATE As String = "EndDate"
|
||||
|
||||
Public Const S_OPENFILEDIALOG As String = "OpenFileDialog"
|
||||
Public Const K_VIEWARCHIVED As String = "ViewArchived"
|
||||
|
||||
'Public Const S_NEST As String = "Nest"
|
||||
Public Const K_NESTEXEC As String = "NestExec"
|
||||
|
||||
@@ -112,6 +112,11 @@
|
||||
<DependentUpon>LoadingWndV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LoadingWnd\LoadingWndVM.vb" />
|
||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogV.xaml.vb">
|
||||
<DependentUpon>NewOpenProjectFileDialogV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogVM.vb" />
|
||||
<Compile Include="ProjectFileVM\ProdItem.vb" />
|
||||
<Compile Include="Utility\DimensionsIniFile.vb" />
|
||||
<Compile Include="Utility\Enum.vb" />
|
||||
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
||||
@@ -190,6 +195,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>XamlIntelliSenseFileGenerator</Generator>
|
||||
</Page>
|
||||
<Page Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -12,6 +12,8 @@ Imports EgtWPFLib5
|
||||
|
||||
Public Class EgtDataGrid
|
||||
|
||||
Public Event ResetSort()
|
||||
|
||||
' vecchio indice da salvare per il Reorder delle colonne
|
||||
Public OldIndex As Integer = 0
|
||||
' indice header su cui è aperto il ContextMenu per gestione check/uncheck LockTable
|
||||
@@ -361,6 +363,7 @@ Public Class EgtDataGrid
|
||||
' resetto graficamente anche l'header della colonna
|
||||
CurrDataGrid.Columns(column.DisplayIndex).SortDirection = Nothing
|
||||
Next
|
||||
RaiseEvent ResetSort()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -562,8 +562,9 @@ Public MustInherit Class PartVM
|
||||
|
||||
Public Sub CalcFallUpdate(FALL As Integer)
|
||||
EgtSetInfo(nPartId, ITG_PROD_FALL, FALL, True)
|
||||
m_PartM.nCALC_FALL = 0
|
||||
m_PartM.nCALC_FALL = FALL
|
||||
NotifyPropertyChanged(NameOf(nCALC_FALL))
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
End Sub
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
|
||||
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.5.6.2")>
|
||||
<Assembly: AssemblyFileVersion("2.5.6.2")>
|
||||
<Assembly: AssemblyVersion("2.5.8.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.8.1")>
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
<EgtWPFLib5:EgtCustomWindow x:Class="NewOpenProjectFileDialogV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
|
||||
Title="{Binding Title}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
|
||||
IsClosable="False"
|
||||
MinHeight="500" MinWidth="500"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
|
||||
<EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
<EgtWPFLib5:FileNameConverter x:Key="FileNameConverter"/>
|
||||
</EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="5*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Header="{Binding Filters_Msg}"
|
||||
Margin="5"
|
||||
Visibility="{Binding Filters_Visibility}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding BTLDateTypeList}"
|
||||
SelectedIndex="{Binding SelBTLDateType}"
|
||||
Width="105"
|
||||
Margin="5"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<ComboBox ItemsSource="{Binding DayTypeList}"
|
||||
SelectedIndex="{Binding SelDayType}"
|
||||
Width="105"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
|
||||
<TextBlock Text="{Binding From_Msg}"
|
||||
Style="{StaticResource Filter_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtStartDate}"
|
||||
Style="{StaticResource Filter_DatePicker}"/>
|
||||
<TextBlock Text="{Binding To_Msg}"
|
||||
Style="{StaticResource Filter_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtEndDate}"
|
||||
Style="{StaticResource Filter_DatePicker}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<CheckBox Grid.Column="2"
|
||||
IsChecked="{Binding bViewArchived}"
|
||||
Content="{Binding ViewArchived_Msg}"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding FilterTypeList}"
|
||||
SelectedItem="{Binding SelFilterType}"
|
||||
Width="105"
|
||||
Margin="5"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<EgtWPFLib5:EgtTextBox Grid.Column="1"
|
||||
Text="{Binding SearchText}"
|
||||
Margin="5"
|
||||
Visibility="{Binding SearchText_Visibility}"/>
|
||||
<StackPanel Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="Page index"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<Button Content="<"
|
||||
Command="{Binding PrevPage_Command}" />
|
||||
<TextBlock Text="{Binding nPageIndex}"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<Button Content=">"
|
||||
Command="{Binding NextPage_Command}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="3"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Rows_Msg}"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding RowQuantityList}"
|
||||
SelectedIndex="{Binding SelRowQuantity}"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<EgtBEAMWALL:EgtDataGrid x:Name="MainDataGrid"
|
||||
Grid.Row="1"
|
||||
ItemsSource="{Binding PageList}"
|
||||
SelectedItem="{Binding SelProject}"
|
||||
CanUserAddRows="False"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserResizeRows="False"
|
||||
SelectionMode="Single"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
Margin="5"
|
||||
RowDetailsVisibilityMode="Visible"
|
||||
CellEditEnding="MainDataGrid_CellEditEnding"
|
||||
BindingColumns="{Binding ProdColumns}"
|
||||
Sorting="MainDataGrid_Sorting">
|
||||
<DataGrid.Resources>
|
||||
<!-- ProdId -->
|
||||
<DataGridTextColumn x:Key="colPRODID"
|
||||
Binding="{Binding sProdId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Id_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--Name-->
|
||||
<DataGridTextColumn x:Key="colNAME"
|
||||
Binding="{Binding sName}">
|
||||
<DataGridTextColumn.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
<ToggleButton Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
IsChecked="{Binding Path=DataContext.bIsEditNameActive,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource ToolBar_SmallToggleButton}">
|
||||
<Image Source="\Resources\CalcPanel\Edit.png"
|
||||
Style="{StaticResource LockImage}"/>
|
||||
</ToggleButton>
|
||||
</Grid>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Creation date -->
|
||||
<DataGridTextColumn x:Key="colCRTDATE"
|
||||
Binding="{Binding dtCreateDate}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.CreateDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Machine -->
|
||||
<DataGridTextColumn x:Key="colMACHINE"
|
||||
Binding="{Binding sMachine}"
|
||||
CanUserSort="False">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.Machine_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Archived -->
|
||||
<DataGridTemplateColumn x:Key="colARCHIVED"
|
||||
CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="\Resources\OpenProjectFileDialog\Archived.png"
|
||||
Visibility="{Binding Archived_Visibility}"
|
||||
Height="15"
|
||||
Width="15"
|
||||
Stretch="UniformToFill"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.Archived_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTemplateColumn.Header>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="FontWeight" Value="DemiBold"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.RowDetailsTemplate>
|
||||
<DataTemplate>
|
||||
<ItemsControl ItemsSource="{Binding ProjFileList}"
|
||||
BorderThickness="0"
|
||||
Margin="0,-1,0,0"
|
||||
Padding="0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid TextBlock.FontSize="12"
|
||||
TextBlock.FontWeight="Normal">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=DataContext.ProdColumns[0].ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Gray"
|
||||
Margin="40,0,40,0"/>
|
||||
<Grid Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Margin="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding sBTLFileName}"/>
|
||||
<TextBlock Grid.Row="1"
|
||||
Text="{Binding Path=DataContext.ListName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Text="{Binding sListName}"/>
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding Path=DataContext.ExportDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="3"
|
||||
Text="{Binding dtExportDate}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</DataTemplate>
|
||||
</DataGrid.RowDetailsTemplate>
|
||||
</EgtBEAMWALL:EgtDataGrid>
|
||||
|
||||
<UniformGrid Columns="4" Grid.Row="2" Margin="0,0,0,5">
|
||||
<Button IsDefault="True" Name="OpenBtn"
|
||||
Content="{Binding Open_Msg}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Content="{Binding Archive_Msg}"
|
||||
Command="{Binding Archive_Command}"
|
||||
IsEnabled="{Binding bArchived_IsEnabled}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Content="{Binding Delete_Msg}"
|
||||
Command="{Binding Delete_Command}"
|
||||
IsEnabled="{Binding bDelete_IsEnabled}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Command="{Binding Cancel_Command}"
|
||||
Content="{Binding Cancel_Msg}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
</UniformGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</EgtWPFLib5:EgtCustomWindow>
|
||||
@@ -0,0 +1,264 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL
|
||||
Imports System.Windows.Media
|
||||
|
||||
Public Class NewOpenProjectFileDialogV
|
||||
|
||||
Private WithEvents m_OpenProjFileDialogVM As NewOpenProjectFileDialogVM
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(Owner As Window, OpenProjFileDialogVM As NewOpenProjectFileDialogVM)
|
||||
' Funzione che interpreta l'xaml
|
||||
InitializeComponent()
|
||||
Me.Owner = Owner
|
||||
Me.DataContext = OpenProjFileDialogVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_OpenProjFileDialogVM = OpenProjFileDialogVM
|
||||
AddHandler Me.Loaded, AddressOf OpenProjectFileDialog_Loaded
|
||||
AddHandler Me.Closing, AddressOf OpenProjectFileDialog_Closing
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType, ProjectList As List(Of ProjectFileVM)) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType, ProjectList)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType, GoToProd As Boolean) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType, Nothing, GoToProd)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
Private Sub OpenProjectFileDialog_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' Carico e imposto posizione finestra
|
||||
WinPosFromIniToWindow(S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE, Me)
|
||||
End Sub
|
||||
|
||||
Private Sub OpenProjectFileDialog_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
||||
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
||||
e.Cancel = True
|
||||
Return
|
||||
End If
|
||||
' Salvo posizione finestra (se non minimizzata)
|
||||
WinPosFromWindowToIni(Me, S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub ProjectList_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
|
||||
m_OpenProjFileDialogVM.ProjDoubleClick()
|
||||
End Sub
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
|
||||
DialogResult = m_OpenProjFileDialogVM.VerifySelected()
|
||||
End Sub
|
||||
|
||||
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_OpenProjFileDialogVM.m_CloseWindow
|
||||
Me.DialogResult = bDialogResult
|
||||
End Sub
|
||||
|
||||
Private Sub MainDataGrid_CellEditEnding(sender As Object, e As DataGridCellEditEndingEventArgs)
|
||||
'm_OpenProjFileDialogVM.SetIsEditNameActive(False)
|
||||
End Sub
|
||||
|
||||
Private Sub MainDataGrid_Sorting(sender As Object, e As DataGridSortingEventArgs)
|
||||
' aggiorno direziona colonna
|
||||
Dim column As DataGridColumn = e.Column
|
||||
column.SortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
|
||||
'' ricalcolo colonne sort
|
||||
'Dim datagrid As DataGrid = sender
|
||||
'ProdItemComparer.RefreshColumns()
|
||||
'' lancio sort custom
|
||||
'm_OpenProjFileDialogVM.RefreshProdItemSort()
|
||||
m_OpenProjFileDialogVM.SortPageList()
|
||||
m_OpenProjFileDialogVM.UpdatePageList()
|
||||
e.Handled = True
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Friend Class ProdItemComparer
|
||||
Implements IComparer
|
||||
|
||||
Private Shared DataGrid As DataGrid
|
||||
Friend Shared Sub SetDataGrid(value As DataGrid)
|
||||
DataGrid = value
|
||||
End Sub
|
||||
|
||||
Private Shared m_OpenProjFileDialogVM As NewOpenProjectFileDialogVM
|
||||
Friend Shared Sub SetOpenProjFileDialogVM(value As NewOpenProjectFileDialogVM)
|
||||
m_OpenProjFileDialogVM = value
|
||||
End Sub
|
||||
|
||||
Private Shared m_ColumnList As New List(Of DataGridColumn)
|
||||
Private Shared m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
|
||||
Friend Shared Sub RefreshColumns()
|
||||
m_ColumnList.Clear()
|
||||
m_EgtColumnList.Clear()
|
||||
For Each col In DataGrid.Columns
|
||||
If Not IsNothing(col.SortDirection) Then
|
||||
m_ColumnList.Add(col)
|
||||
m_EgtColumnList.Add(m_OpenProjFileDialogVM.ProdColumns(col.DisplayIndex))
|
||||
End If
|
||||
Next
|
||||
' Map.refRawPartListVM.SetRawPartListSorted(m_ColumnList.Count > 0)
|
||||
End Sub
|
||||
|
||||
|
||||
Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
' Dim bFirstInQueue As Boolean = First.bToBeProduced
|
||||
' Dim bSecondInQueue As Boolean = Second.bToBeProduced
|
||||
' ' verifico se gia' prodotti
|
||||
' If bFirstProduced AndAlso bSecondProduced Then
|
||||
' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' Return 1
|
||||
' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' Return -1
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' ElseIf bFirstProduced Then
|
||||
' Return -1
|
||||
' ElseIf bSecondProduced Then
|
||||
' Return 1
|
||||
' ElseIf bFirstInQueue AndAlso bSecondInQueue Then
|
||||
' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' Return 1
|
||||
' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' Return -1
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' ElseIf bFirstInQueue Then
|
||||
' Return -1
|
||||
' ElseIf bSecondInQueue Then
|
||||
' Return 1
|
||||
' Else
|
||||
' ' verifico ordine per colonne
|
||||
' Dim ColumnIndex = 0
|
||||
' While ColumnIndex <= m_EgtColumnList.Count - 1
|
||||
' Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
|
||||
' Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
|
||||
' If nCheck <> 0 Then
|
||||
' Return nCheck
|
||||
' End If
|
||||
' ColumnIndex += 1
|
||||
' End While
|
||||
' ' se non trovo colonne, metto in ordine indice di produzione
|
||||
' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' Return 1
|
||||
' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' Return -1
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' End If
|
||||
End Function
|
||||
|
||||
Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
|
||||
Select Case Column.Name
|
||||
Case COL_NAME
|
||||
If First.nName > Second.nName Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.nName < Second.nName Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_STARTCUT
|
||||
If First.Id > Second.Id Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.Id < Second.Id Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_W
|
||||
If First.dW > Second.dW Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dW < Second.dW Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_H
|
||||
If First.dH > Second.dH Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dH < Second.dH Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_L
|
||||
If First.dL > Second.dL Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dL < Second.dL Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_POSZ
|
||||
'If First.posz > Second.dL Then
|
||||
' Return 1 * nDirection
|
||||
'ElseIf First.dL < Second.dL Then
|
||||
' Return -1 * nDirection
|
||||
'Else
|
||||
' Return 0
|
||||
'End If
|
||||
Case COL_MATERIAL
|
||||
If First.sMATERIAL > Second.sMATERIAL Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_USAGE
|
||||
If First.dUsage > Second.dUsage Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dUsage < Second.dUsage Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_WASTE
|
||||
If First.dWaste > Second.dWaste Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dWaste < Second.dWaste Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
End Select
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,982 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Public Enum BTLDateTypes As Integer
|
||||
CREATEDATE = 0
|
||||
EXPORTDATE = 1
|
||||
End Enum
|
||||
|
||||
Protected Enum FilterTypes As Integer
|
||||
NULL = 0
|
||||
ID = 1
|
||||
BTLFILENAME = 2
|
||||
LISTNAME = 3
|
||||
MACHINE = 4
|
||||
End Enum
|
||||
|
||||
Public Enum DayTypes As Integer
|
||||
LASTMONTH = 0
|
||||
LAST3MONTHS = 1
|
||||
LAST6MONTHS = 2
|
||||
PERIOD = 3
|
||||
ALWAYS = 4
|
||||
End Enum
|
||||
|
||||
Public Enum RowQuantities As Integer
|
||||
TEN = 0
|
||||
TWENTY = 1
|
||||
THIRTY = 2
|
||||
End Enum
|
||||
|
||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
Protected m_ProdColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProdColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return m_ProdColumns
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
m_ProdColumns = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_colProdFile_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colProdFile_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colProdFile_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_colArchived_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colArchived_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colArchived_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_colProjId_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colProjId_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colProjId_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_colProdId_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colProdId_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colProdId_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_colCreateDate_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colCreateDate_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colCreateDate_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_ProjColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProjColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return m_ProjColumns
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
m_ProjColumns = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_ProjectType As ProjectType
|
||||
|
||||
Protected m_sFilter As String
|
||||
Public Property Filter As String
|
||||
Get
|
||||
Return m_sFilter
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sFilter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sFileNameFilter As Predicate(Of String)
|
||||
Public Property FileNameFilter As Predicate(Of String)
|
||||
Get
|
||||
Return m_sFileNameFilter
|
||||
End Get
|
||||
Set(value As Predicate(Of String))
|
||||
m_sFileNameFilter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sExtensions As New List(Of String)
|
||||
Public ReadOnly Property Extensions As List(Of String)
|
||||
Get
|
||||
Return m_sExtensions
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_ProjectList_View As CollectionView = Nothing
|
||||
Public ReadOnly Property ProjectList_View As CollectionView
|
||||
Get
|
||||
Return m_ProjectList_View
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_ProjectList As New ObservableCollection(Of ProdItem)
|
||||
Public ReadOnly Property ProjectList As ObservableCollection(Of ProdItem)
|
||||
Get
|
||||
Return m_ProjectList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nSelProjIndex As Integer
|
||||
Public ReadOnly Property nSelProjIndex As Integer
|
||||
Get
|
||||
Return m_nSelProjIndex
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelProject As ProdItem
|
||||
Public Property SelProject As ProdItem
|
||||
Get
|
||||
Return m_SelProject
|
||||
End Get
|
||||
Set(value As ProdItem)
|
||||
m_SelProject = value
|
||||
' verifico se abilitare il bottone Delete
|
||||
If IsNothing(m_SelProject) Then
|
||||
SetDeleteIsEnabled(False)
|
||||
SetArchivedIsEnabled(False)
|
||||
ElseIf IsNothing(m_SelProject.ProdFileVM) Then
|
||||
SetDeleteIsEnabled(True)
|
||||
SetArchivedIsEnabled(False)
|
||||
Else
|
||||
SetDeleteIsEnabled(Not SelProject.ProdFileVM.bIsProduced)
|
||||
SetArchivedIsEnabled(True)
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Archive_Msg))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_FileName As String
|
||||
Public Property FileName As String
|
||||
Get
|
||||
Return m_FileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_FileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bFixedProjectList As Boolean
|
||||
Public ReadOnly Property bFixedProjectList As Boolean
|
||||
Get
|
||||
Return m_bFixedProjectList
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetFixedProjectList(bValue As Boolean)
|
||||
m_bFixedProjectList = bValue
|
||||
NotifyPropertyChanged(NameOf(Filters_Visibility))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Filters_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_bFixedProjectList, Visibility.Collapsed, Visibility.Visible)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_BTLDateTypeList As New List(Of String)
|
||||
Public ReadOnly Property BTLDateTypeList As List(Of String)
|
||||
Get
|
||||
Return m_BTLDateTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelBTLDateType As BTLDateTypes = Nothing
|
||||
Public Property SelBTLDateType As Integer
|
||||
Get
|
||||
Return m_SelBTLDateType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
'm_ProjectList_View.Refresh()
|
||||
UpdatePageList()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
|
||||
Public Overridable ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Return m_DayTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelDayType As DayTypes = DayTypes.LASTMONTH
|
||||
Public Property SelDayType As Integer
|
||||
Get
|
||||
Return m_SelDayType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
Dim PrevSelDayType As DayTypes = m_SelDayType
|
||||
m_SelDayType = value
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_DAYTYPE, Convert.ToInt32(m_SelDayType))
|
||||
m_Date_Visibility = If(m_SelDayType = DayTypes.PERIOD, Visibility.Visible, Visibility.Collapsed)
|
||||
If m_SelDayType = DayTypes.PERIOD Then
|
||||
Select Case PrevSelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.ALWAYS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = New DateTime(2020, 1, 1)
|
||||
End Select
|
||||
NotifyPropertyChanged(NameOf(dtStartDate))
|
||||
NotifyPropertyChanged(NameOf(dtEndDate))
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Date_Visibility))
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
' m_ProjectList_View.Refresh()
|
||||
UpdatePageList()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtStartDate As DateTime = DateTime.Today
|
||||
Public Property dtStartDate As DateTime
|
||||
Get
|
||||
Return m_dtStartDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtStartDate = value
|
||||
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, lStartDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
' m_ProjectList_View.Refresh()
|
||||
UpdatePageList()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtEndDate As DateTime = DateTime.Today
|
||||
Public Property dtEndDate As DateTime
|
||||
Get
|
||||
Return m_dtEndDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtEndDate = value
|
||||
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, lEndDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
' m_ProjectList_View.Refresh()
|
||||
UpdatePageList()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Date_Visibility As Visibility = Visibility.Collapsed
|
||||
Public ReadOnly Property Date_Visibility As Visibility
|
||||
Get
|
||||
Return m_Date_Visibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_RowQuantityList As New List(Of String)({50, 100, 150})
|
||||
Public ReadOnly Property RowQuantityList As List(Of String)
|
||||
Get
|
||||
Return m_RowQuantityList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelRowQuantity As RowQuantities
|
||||
Public Property SelRowQuantity As Integer
|
||||
Get
|
||||
Return m_SelRowQuantity
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelRowQuantity = value
|
||||
RefreshProjectList()
|
||||
' m_ProjectList_View.Refresh()
|
||||
UpdatePageList()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista campi per ricerca testuale e con datepicker
|
||||
Protected m_FilterTypeList As New ObservableCollection(Of IdNameStruct)
|
||||
Public ReadOnly Property FilterTypeList As ObservableCollection(Of IdNameStruct)
|
||||
Get
|
||||
Return m_FilterTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelFilterType As IdNameStruct = Nothing
|
||||
Public Property SelFilterType As IdNameStruct
|
||||
Get
|
||||
Return m_SelFilterType
|
||||
End Get
|
||||
Set(value As IdNameStruct)
|
||||
' resetto il contenuto della barra di ricerca testuale
|
||||
m_SearchText = ""
|
||||
NotifyPropertyChanged(NameOf(SearchText))
|
||||
' resetto le selezioni sul calendario
|
||||
If Not IsNothing(SearchDate) Then SearchDate.Clear()
|
||||
' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
'm_ProjectList_View.Refresh()
|
||||
UpdatePageList()
|
||||
' ora setto il valore scelto come Tipo Filtro
|
||||
m_SelFilterType = value
|
||||
Select Case m_SelFilterType.Id
|
||||
Case FilterTypes.ID, FilterTypes.BTLFILENAME, FilterTypes.LISTNAME, FilterTypes.MACHINE
|
||||
SearchText_Visibility = Visibility.Visible
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
Case BTLDateTypes.EXPORTDATE, BTLDateTypes.CREATEDATE
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Visible
|
||||
Case Else
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
End Select
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SearchText As String = ""
|
||||
Public Property SearchText As String
|
||||
Get
|
||||
Return m_SearchText
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_SearchText = value
|
||||
'm_ProjectList_View.Refresh()
|
||||
UpdatePageList()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Friend m_SearchDate As SelectedDatesCollection = Nothing
|
||||
Public ReadOnly Property SearchDate As SelectedDatesCollection
|
||||
Get
|
||||
Return m_SearchDate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SearchText_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property SearchText_Visibility As Visibility
|
||||
Get
|
||||
Return m_SearchText_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_SearchText_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(SearchText_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SearchDate_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property SearchDate_Visibility As Visibility
|
||||
Get
|
||||
Return m_SearchDate_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_SearchDate_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(SearchDate_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property bIsEditNameActive As Boolean
|
||||
Get
|
||||
Return Not m_colProdFile_Name.IsReadOnly
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If Not IsNothing(m_colProdFile_Name) Then
|
||||
m_colProdFile_Name.IsReadOnly = Not value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public Sub SetIsEditNameActive(value As Boolean)
|
||||
If Not IsNothing(m_colProdFile_Name) Then
|
||||
m_colProdFile_Name.IsReadOnly = Not value
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(bIsEditNameActive))
|
||||
End Sub
|
||||
|
||||
Private m_bViewArchived As Boolean
|
||||
Public Property bViewArchived As Boolean
|
||||
Get
|
||||
Return m_bViewArchived
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bViewArchived = value
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_VIEWARCHIVED, If(bViewArchived, 1, 0))
|
||||
If Not IsNothing(m_colArchived_Name) Then
|
||||
m_colArchived_Name.Visible = value
|
||||
RefreshProjectList()
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bArchived_IsEnabled As Boolean
|
||||
Public ReadOnly Property bArchived_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_bArchived_IsEnabled
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetArchivedIsEnabled(bValue As Boolean)
|
||||
m_bArchived_IsEnabled = bValue
|
||||
NotifyPropertyChanged(NameOf(bArchived_IsEnabled))
|
||||
End Sub
|
||||
|
||||
Private m_bDelete_IsEnabled As Boolean
|
||||
Public ReadOnly Property bDelete_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_bDelete_IsEnabled
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetDeleteIsEnabled(bValue As Boolean)
|
||||
m_bDelete_IsEnabled = bValue
|
||||
NotifyPropertyChanged(NameOf(bDelete_IsEnabled))
|
||||
End Sub
|
||||
|
||||
Private m_PageList_View As ListCollectionView = Nothing
|
||||
Public ReadOnly Property PageList_View As ListCollectionView
|
||||
Get
|
||||
Return m_PageList_View
|
||||
End Get
|
||||
End Property
|
||||
Protected m_PageList As New ObservableCollection(Of ProdItem)
|
||||
Public Property PageList As ObservableCollection(Of ProdItem)
|
||||
Get
|
||||
Return m_PageList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of ProdItem))
|
||||
m_PageList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nPageIndex As Integer = 1
|
||||
Public ReadOnly Property nPageIndex As Integer
|
||||
Get
|
||||
Return m_nPageIndex
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
Protected m_ChangeOpenedProjectOnCancel As Boolean = False
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Return EgtMsg(61986)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Filters_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61985)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property FilterType_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61836)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Search_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61837)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Id_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61815)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property BTLFileName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61819)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ListName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61820)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ExportDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61821)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CreateDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61822)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Machine_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61886)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Name_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61808)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Open_Msg As String
|
||||
Get
|
||||
Return EgtMsg(30006)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archived_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61983)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archive_Msg As String
|
||||
Get
|
||||
If Not IsNothing(m_SelProject) AndAlso m_SelProject.bIsArchived Then
|
||||
Return EgtMsg(61984)
|
||||
Else
|
||||
Return EgtMsg(61981)
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Delete_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61823)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Cancel_Msg As String
|
||||
Get
|
||||
Return EgtMsg(30002)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property From_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62523)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property To_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62524)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ViewArchived_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61982)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Rows_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61995)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdProjectDoubleClick As ICommand
|
||||
Private m_cmdDelete As ICommand
|
||||
Private m_cmdArchive As ICommand
|
||||
Private m_cmdCancel As ICommand
|
||||
Private m_cmdPrevPage As ICommand
|
||||
Private m_cmdNextPage As ICommand
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
Sub New()
|
||||
' assegno delegato a elementi lista
|
||||
ProdItem.m_delIsModifiedSetUp = AddressOf SetIsEditNameActive
|
||||
' carico colonne
|
||||
LoadColumns()
|
||||
m_colProdFile_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_NAME)
|
||||
m_colArchived_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_ARCHIVED)
|
||||
m_colProjId_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_PROJID)
|
||||
m_colProdId_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_PRODID)
|
||||
m_colCreateDate_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_CREATEDATE)
|
||||
' leggo valori per filtri
|
||||
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, 0, sStartDate)
|
||||
Long.TryParse(sStartDate, lStartDate)
|
||||
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
|
||||
Dim sEndDate As String = "0"
|
||||
Dim lEndDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, 0, sEndDate)
|
||||
Long.TryParse(sEndDate, lEndDate)
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
m_bViewArchived = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_VIEWARCHIVED, 0) <> 0
|
||||
End Sub
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
End Sub
|
||||
|
||||
|
||||
Private m_ProdItemComparer As ProdItemComparer
|
||||
Friend ReadOnly Property ProdItemComparer As ProdItemComparer
|
||||
Get
|
||||
Return m_ProdItemComparer
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend Sub SetPageListView()
|
||||
m_PageList_View = CollectionViewSource.GetDefaultView(m_PageList)
|
||||
m_ProdItemComparer = New ProdItemComparer
|
||||
m_PageList_View.CustomSort = m_ProdItemComparer
|
||||
NotifyPropertyChanged(NameOf(PageList_View))
|
||||
End Sub
|
||||
|
||||
Friend Sub RefreshProdItemSort()
|
||||
m_PageList_View.CustomSort = m_ProdItemComparer
|
||||
End Sub
|
||||
|
||||
Friend Sub SortPageList()
|
||||
' m_ProjectList = New ObservableCollection(Of ProdItem)(m_ProjectList.OrderBy(Of Integer)(Function(x) If(String.IsNullOrWhiteSpace(x.sProdId), 0, CInt(x.sProdId))))
|
||||
End Sub
|
||||
|
||||
Protected Sub LoadColumns()
|
||||
'If ProjectType = ProjectType.PROJ Then
|
||||
' carico le colonne della datagrid
|
||||
' GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjColumns)
|
||||
' ' carico campi su cui eseguire il filtro di ricerca
|
||||
' m_BTLDateTypeList = New List(Of String)({CreateDate_Msg, ExportDate_Msg})
|
||||
' m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
' NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
' NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
' m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
' New IdNameStruct(FilterTypes.ID, Id_Msg),
|
||||
' New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
' New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
|
||||
' New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
' m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
' NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
'ElseIf ProjectType = ProjectType.PROD Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_NEWOPENPROJFILEDLG_PROD, ProdColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
|
||||
m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
|
||||
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
'End If
|
||||
' setto la visibilità delle colonne delle EgtDataGrid
|
||||
For Each col In ProjColumns
|
||||
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||
Next
|
||||
For Each col In ProdColumns
|
||||
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Function VerifySelected() As Boolean
|
||||
If IsNothing(SelProject) Then Return False
|
||||
Dim AllFilesInDir As IEnumerable(Of String) = Nothing
|
||||
If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then
|
||||
If Not IsNothing(SelProject.ProdFileVM) Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProdFileVM.sProdDirPath) OrElse Not Directory.Exists(SelProject.ProdFileVM.sProdDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProdFileVM.sProdDirPath)
|
||||
ElseIf SelProject.ProjFileList.Count > 0 Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProjFileList(0).sProjDirPath) OrElse Not Directory.Exists(SelProject.ProjFileList(0).sProjDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProjFileList(0).sProjDirPath)
|
||||
Else Return False
|
||||
End If
|
||||
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProdFileVM.sProdDirPath) OrElse Not Directory.Exists(SelProject.ProdFileVM.sProdDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProdFileVM.sProdDirPath)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Return AllFilesInDir.Any(Function(x) Path.GetExtension(x).ToLower() = ".nge")
|
||||
End Function
|
||||
|
||||
'Protected Function ProjectFilter(Proj As Object) As Boolean
|
||||
' Dim bProjectOk As Boolean = True
|
||||
' 'If TypeOf Proj Is ProjFileVM Then
|
||||
' Dim CurrProj As ProdItem = DirectCast(Proj, ProdItem)
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
' (m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not CurrProj.ProjFileList.Any(Function(x) SearchDate.Contains(DirectCast(x, ProjFileVM).dtExportDate.Date))) OrElse
|
||||
' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
' 'ElseIf TypeOf Proj Is ProdFileVM Then
|
||||
' ' Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||
' ' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
' ' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
' ' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
' ' (m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' ' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' ' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
' 'End If
|
||||
' Return bProjectOk
|
||||
'End Function
|
||||
|
||||
Public Overridable Function UpdatePageList() As Boolean
|
||||
Dim FilteredList As IEnumerable(Of ProdItem) = m_ProjectList.Where(Function(x)
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso
|
||||
((m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso x.ProjFileList.Any(Function(y) DirectCast(y, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso x.ProjFileList.Any(Function(y) DirectCast(y, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso x.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then Return False
|
||||
Return True
|
||||
End Function)
|
||||
Dim nPageRowQty As Integer = 0
|
||||
Select Case m_SelRowQuantity
|
||||
Case RowQuantities.TEN
|
||||
nPageRowQty = 10
|
||||
Case RowQuantities.TWENTY
|
||||
nPageRowQty = 20
|
||||
Case RowQuantities.THIRTY
|
||||
nPageRowQty = 30
|
||||
End Select
|
||||
Dim nStart = nPageIndex * nPageRowQty
|
||||
If (nPageIndex - 1) * nPageRowQty + 1 > FilteredList.Count() Then
|
||||
Return False
|
||||
End If
|
||||
' FilteredList = FilteredList.OrderBy(Of ProdItem)()
|
||||
' m_PageList = New ObservableCollection(Of ProdItem)(FilteredList.Skip((nPageIndex - 1) * nPageRowQty + 1).Take(nPageIndex * nPageRowQty).Select(Function(x) x))
|
||||
m_PageList.Clear()
|
||||
For Index = (nPageIndex - 1) * nPageRowQty + 1 To nPageIndex * nPageRowQty
|
||||
m_PageList.Add(FilteredList(Index))
|
||||
Next
|
||||
NotifyPropertyChanged(NameOf(PageList))
|
||||
Return True
|
||||
|
||||
'Dim bProjectOk As Boolean = True
|
||||
''If TypeOf Proj Is ProjFileVM Then
|
||||
'Dim CurrProj As ProdItem = DirectCast(PROJ, ProdItem)
|
||||
'If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
' (m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not CurrProj.ProjFileList.Any(Function(x) SearchDate.Contains(DirectCast(x, ProjFileVM).dtExportDate.Date))) OrElse
|
||||
' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
'If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
'ElseIf TypeOf Proj Is ProdFileVM Then
|
||||
' Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
' (m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
'End If
|
||||
' Return bProjectOk
|
||||
End Function
|
||||
|
||||
Protected Function ProjectFilter(CurrProj As ProdItem) As Boolean
|
||||
Dim bProjectOk As Boolean = True
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
Return bProjectOk
|
||||
End Function
|
||||
|
||||
Protected Sub CloseWindow(bDialogResult As Boolean)
|
||||
RaiseEvent m_CloseWindow(bDialogResult)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "ProjectDoubleClick"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property ProjectDoubleClick_Command As ICommand
|
||||
Get
|
||||
If m_cmdProjectDoubleClick Is Nothing Then
|
||||
m_cmdProjectDoubleClick = New Command(AddressOf ProjDoubleClick)
|
||||
End If
|
||||
Return m_cmdProjectDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Friend Sub ProjDoubleClick()
|
||||
' verifico se non e' attivo edit del nome
|
||||
If bIsEditNameActive Then Return
|
||||
' verifico validita' selezionato
|
||||
If VerifySelected() Then
|
||||
RaiseEvent m_CloseWindow(True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' ProjectDoubleClick
|
||||
|
||||
#Region "Archive"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Archive_Command As ICommand
|
||||
Get
|
||||
If m_cmdArchive Is Nothing Then
|
||||
m_cmdArchive = New Command(AddressOf Archive)
|
||||
End If
|
||||
Return m_cmdArchive
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Archive()
|
||||
End Sub
|
||||
|
||||
#End Region ' Archive
|
||||
|
||||
#Region "Delete"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Delete_Command As ICommand
|
||||
Get
|
||||
If m_cmdDelete Is Nothing Then
|
||||
m_cmdDelete = New Command(AddressOf Delete)
|
||||
End If
|
||||
Return m_cmdDelete
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Delete()
|
||||
End Sub
|
||||
|
||||
#End Region ' Delete
|
||||
|
||||
#Region "Cancel"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Cancel_Command As ICommand
|
||||
Get
|
||||
If m_cmdCancel Is Nothing Then
|
||||
m_cmdCancel = New Command(AddressOf Cancel)
|
||||
End If
|
||||
Return m_cmdCancel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Cancel()
|
||||
End Sub
|
||||
|
||||
#End Region ' Cancel
|
||||
|
||||
#Region "PrevPage"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property PrevPage_Command As ICommand
|
||||
Get
|
||||
If m_cmdPrevPage Is Nothing Then
|
||||
m_cmdPrevPage = New Command(AddressOf PrevPage)
|
||||
End If
|
||||
Return m_cmdPrevPage
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub PrevPage()
|
||||
If m_nPageIndex > 1 Then
|
||||
m_nPageIndex -= 1
|
||||
End If
|
||||
UpdatePageList()
|
||||
NotifyPropertyChanged(NameOf(nPageIndex))
|
||||
End Sub
|
||||
|
||||
#End Region ' PrevPage
|
||||
|
||||
#Region "NextPage"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NextPage_Command As ICommand
|
||||
Get
|
||||
If m_cmdNextPage Is Nothing Then
|
||||
m_cmdNextPage = New Command(AddressOf NextPage)
|
||||
End If
|
||||
Return m_cmdNextPage
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub NextPage()
|
||||
m_nPageIndex += 1
|
||||
If Not UpdatePageList() Then
|
||||
m_nPageIndex -= 1
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(nPageIndex))
|
||||
End Sub
|
||||
|
||||
#End Region ' NextPage
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
End Class
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
|
||||
MinHeight="500" MinWidth="500" Topmost="True"
|
||||
MinHeight="500" MinWidth="500"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
|
||||
<EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
@@ -22,7 +22,8 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Header="Filters"
|
||||
Margin="5">
|
||||
Margin="5"
|
||||
Visibility="{Binding Filters_Visibility}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
|
||||
@@ -42,6 +42,8 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
|
||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
Protected m_GoToProd As Boolean = False
|
||||
|
||||
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProjectColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
@@ -109,6 +111,23 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bFixedProjectList As Boolean
|
||||
Public ReadOnly Property bFixedProjectList As Boolean
|
||||
Get
|
||||
Return m_bFixedProjectList
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetFixedProjectList(bValue As Boolean)
|
||||
m_bFixedProjectList = bValue
|
||||
NotifyPropertyChanged(NameOf(Filters_Visibility))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Filters_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_bFixedProjectList, Visibility.Collapsed, Visibility.Visible)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_BTLDateTypeList As New List(Of String)
|
||||
Public ReadOnly Property BTLDateTypeList As List(Of String)
|
||||
Get
|
||||
@@ -129,7 +148,7 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
End Property
|
||||
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({"Last Month", "Last 3 Months", "Last 6 Months", EgtMsg(62531)})
|
||||
Private m_DayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
|
||||
Public ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Return m_DayTypeList
|
||||
@@ -150,7 +169,7 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
Select Case PrevSelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtStartDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtEndDate = m_dtStartDate - TimeSpan.FromDays(31)
|
||||
m_dtEndDate = m_dtStartDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
|
||||
Case DayTypes.LAST6MONTHS
|
||||
@@ -174,7 +193,7 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
Set(value As DateTime)
|
||||
m_dtStartDate = value
|
||||
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_STARTDATE, lStartDate.ToString())
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, lStartDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
@@ -189,7 +208,7 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
Set(value As DateTime)
|
||||
m_dtEndDate = value
|
||||
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_ENDDATE, lEndDate.ToString())
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, lEndDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
@@ -391,12 +410,37 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
Sub New()
|
||||
' leggo valori per filtri
|
||||
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, 0, sStartDate)
|
||||
Long.TryParse(sStartDate, lStartDate)
|
||||
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
|
||||
Dim sEndDate As String = "0"
|
||||
Dim lEndDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, 0, sEndDate)
|
||||
Long.TryParse(sEndDate, lEndDate)
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
Public Overridable Sub RefreshProjectList()
|
||||
End Sub
|
||||
|
||||
Protected Sub LoadColumns(ProjectType As ProjectType)
|
||||
|
||||
@@ -14,11 +14,31 @@ Public Class ProdFileM
|
||||
m_nProjIdList = value
|
||||
End Sub
|
||||
|
||||
Protected m_ProjMList As List(Of ProjFileM)
|
||||
Public ReadOnly Property ProjMList As List(Of ProjFileM)
|
||||
Get
|
||||
Return m_ProjMList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
Public Property sName As String
|
||||
Get
|
||||
Return m_sName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsProduced As Boolean
|
||||
Public Property bIsProduced As Boolean
|
||||
Get
|
||||
Return m_bIsProduced
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsProduced = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
@@ -31,7 +51,7 @@ Public Class ProdFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime) As ProdFileM
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
@@ -41,6 +61,27 @@ Public Class ProdFileM
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||
NewProjectFileM.m_dtLock = dtLock
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsProduced = bIsProduced
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_sName = sName
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||
NewProjectFileM.m_dtLock = dtLock
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsProduced = bIsProduced
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
NewProjectFileM.m_ProjMList = ProjMList
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
|
||||
Imports EgtWPFLib5
|
||||
Imports System.Windows
|
||||
|
||||
Public Class ProdItem
|
||||
Inherits VMBase
|
||||
|
||||
Public Shared m_delUpdateNameInDb As Action(Of Integer, String)
|
||||
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
|
||||
|
||||
Protected m_ProdFileVM As ProdFileVM
|
||||
Public ReadOnly Property ProdFileVM As ProdFileVM
|
||||
Get
|
||||
Return m_ProdFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_ProjFileList As New List(Of ProjectFileVM)
|
||||
Public ReadOnly Property ProjFileList As List(Of ProjectFileVM)
|
||||
Get
|
||||
Return m_ProjFileList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sProdId As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sProdId, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property sName As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
|
||||
End Get
|
||||
Set(value As String)
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
m_delUpdateNameInDb(m_ProdFileVM.nProdId, value)
|
||||
m_ProdFileVM.sName = value
|
||||
m_delIsModifiedSetUp(False)
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dtCreateDate As Date
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sCreateDate As String
|
||||
Get
|
||||
Return dtCreateDate.ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sMachine As String
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.sMachine
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).sMachine
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsArchived As Boolean
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.bIsArchived
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).bIsArchived
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archived_Visibility As Visibility
|
||||
Get
|
||||
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList.Add(ProjFileVM)
|
||||
End Sub
|
||||
|
||||
Sub New(ProjFileVM As ProjFileVM)
|
||||
m_ProjFileList = New List(Of ProjectFileVM)({ProjFileVM})
|
||||
End Sub
|
||||
|
||||
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList = ProjFileVMList
|
||||
End Sub
|
||||
|
||||
|
||||
Public Shared Function CreateProdItem(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdItem
|
||||
|
||||
|
||||
Dim NewProdFileM = ProdFileM.CreateProdFileM(nProdId, nProjIdList, dtCreateProjDate, sName, nType, sMachine, sLockedBy, dtLock, bIsActive, bIsProduced, bIsArchived)
|
||||
Dim NewProdFileVM = New ProdFileVM(NewProdFileM)
|
||||
Dim NewProjFileVM As IEnumerable(Of ProjectFileVM)
|
||||
NewProjFileVM = ProjMList.Select(Of ProjFileVM)(Function(j) New ProjFileVM(j)).ToList
|
||||
Dim NewProdItem = New ProdItem(NewProdFileVM, NewProjFileVM.ToList)
|
||||
|
||||
Return NewProdItem
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdItem(ProjFileM As ProjFileM) As ProdItem
|
||||
|
||||
Dim NewProdItem = New ProdItem(New ProjFileVM(ProjFileM))
|
||||
|
||||
Return NewProdItem
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -47,21 +47,23 @@ Public Class ProjFileM
|
||||
Return New ProjFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String, sBTLFileName As String, sDescription As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String) As ProjFileM
|
||||
Dim NewProjectFileM As New ProjFileM
|
||||
NewProjectFileM.m_nProjId = nProjId
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_dtExportDate = dtExportDate
|
||||
NewProjectFileM.m_sListName = sListName
|
||||
NewProjectFileM.m_sBTLFileName = sBTLFileName
|
||||
NewProjectFileM.m_sDescription = sDescription
|
||||
NewProjectFileM.m_bIsNew = IsNew
|
||||
NewProjectFileM.m_bIsLocked = IsLocked
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String, sBTLFileName As String, sDescription As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String, bIsActive As Boolean, bIsArchived As Boolean) As ProjFileM
|
||||
Dim NewProjectFileM As New ProjFileM
|
||||
NewProjectFileM.m_nProjId = nProjId
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_dtExportDate = dtExportDate
|
||||
NewProjectFileM.m_sListName = sListName
|
||||
NewProjectFileM.m_sBTLFileName = sBTLFileName
|
||||
NewProjectFileM.m_sDescription = sDescription
|
||||
NewProjectFileM.m_bIsNew = IsNew
|
||||
NewProjectFileM.m_bIsLocked = IsLocked
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
|
||||
@@ -94,6 +94,26 @@ Public Class ProjectFileM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsActive As Boolean
|
||||
Public Property bIsActive As Boolean
|
||||
Get
|
||||
Return m_bIsActive
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsActive = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsArchived As Boolean
|
||||
Public Property bIsArchived As Boolean
|
||||
Get
|
||||
Return m_bIsArchived
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsArchived = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
@@ -47,10 +47,13 @@ Public Class ProdFileVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sName As String
|
||||
Public Property sName As String
|
||||
Get
|
||||
Return ProdFileM.sName
|
||||
End Get
|
||||
Set(value As String)
|
||||
ProdFileM.sName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_sBTLFileName As String
|
||||
@@ -63,6 +66,12 @@ Public Class ProdFileVM
|
||||
m_sBTLFileName = value
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property bIsProduced As Boolean
|
||||
Get
|
||||
Return ProdFileM.bIsProduced
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New(ProdFileM As ProdFileM)
|
||||
|
||||
@@ -117,6 +117,18 @@ Public Class ProjectFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsActive As Boolean
|
||||
Get
|
||||
Return m_ProjectFileM.bIsActive
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsArchived As Boolean
|
||||
Get
|
||||
Return m_ProjectFileM.bIsArchived
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Id_Msg As String
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
|
||||
Public ReadOnly Property sPROD As String
|
||||
Get
|
||||
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
@@ -57,10 +58,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
public bool DeleteProd(int ProdId)
|
||||
/// <summary>
|
||||
/// Delete Prod(+proj...) logically / on DB by ProdId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="IsLogical"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteProd(int ProdId, bool IsLogical)
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var currProd = localDbCtx
|
||||
@@ -68,50 +74,78 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
|
||||
// sel dei proj da aggiornare...
|
||||
var proj2update = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// sel dei MachGroup da prod
|
||||
var machGroup2del = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// selezione dei part da machgroup
|
||||
var part2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
try
|
||||
// procedo SOLO SE NON è stato prodotto (se è stato prodotto --> NON permetto la
|
||||
// cancellazione ed esco con false...)
|
||||
if (!currProd.IsProduced)
|
||||
{
|
||||
// update proj...
|
||||
foreach (var item in proj2update)
|
||||
// sel dei proj da aggiornare...
|
||||
var proj2update = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// se richiesta cancellazione logica o cmq se fosse stato taggato come prodotto
|
||||
if (IsLogical)
|
||||
{
|
||||
item.ProdDbId = null;
|
||||
try
|
||||
{
|
||||
// segno eliminazione logica al/ai PROJ...
|
||||
foreach (var item in proj2update)
|
||||
{
|
||||
item.IsActive = false;
|
||||
}
|
||||
// segno eliminazione logica al prod
|
||||
currProd.IsActive = false;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.DeleteProd (logical only): {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// sel dei MachGroup da prod
|
||||
var machGroup2del = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// selezione dei part da machgroup
|
||||
var part2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
try
|
||||
{
|
||||
// update proj...
|
||||
foreach (var item in proj2update)
|
||||
{
|
||||
item.ProdDbId = null;
|
||||
}
|
||||
// remove from database
|
||||
localDbCtx.PartList.RemoveRange(part2del);
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
localDbCtx.MachGroupList.RemoveRange(machGroup2del);
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
localDbCtx.ProdList.Remove(currProd);
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.DeleteProd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
// remove from database
|
||||
localDbCtx.PartList.RemoveRange(part2del);
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
localDbCtx.MachGroupList.RemoveRange(machGroup2del);
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
localDbCtx.ProdList.Remove(currProd);
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.DeleteProd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -169,16 +203,17 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate);
|
||||
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="numRecord">Num max record da recuperare</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdFileM> GetLastDesc(int numRecord, bool OnlyActive)
|
||||
public List<Core.ProdFileM> GetLastDesc(int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
||||
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
|
||||
@@ -186,37 +221,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (numRecord == 0)
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
numRecord = localDbCtx.ProdList.Count();
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResult = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x=> x.IsActive || !OnlyActive),
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e=> e.ProdDbId,
|
||||
(p,e) => p)
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(numRecord)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// conversione
|
||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate)).ToList();
|
||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived)).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="dtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="dtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="numRecord">Num max record da recuperare</param>
|
||||
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive)
|
||||
public List<Core.ProdFileM> GetLastDesc(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
||||
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
|
||||
@@ -224,26 +262,204 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (numRecord == 0)
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
numRecord = localDbCtx.ProdList.Count();
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResult = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.DtCreated >= dtStart && x.DtCreated <= dtEnd)
|
||||
.Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(numRecord)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// conversione
|
||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate)).ToList();
|
||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived)).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
// elenco prod completi
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// recupero PROD + proj relativi
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => (!x.IsArchived || ShowArchived))
|
||||
//.Include(j => j.)
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null)
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
// elenco prod completi
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="DtIsCreation">Ture: usa data creazione / False: usa data export</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="Machine">Nome Macchina (default vuoto = non usato)</param>
|
||||
/// <param name="BtlFileName">Nome file BTL (default vuoto = non usato)</param>
|
||||
/// <param name="ListName">Nome List (default vuoto = non usato)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(DateTime DtStart, DateTime DtEnd, bool DtIsCreation, int NumRecord, bool OnlyActive, string Machine = "", string BtlFileName = "", string ListName = "", bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x =>
|
||||
(x.IsActive || !OnlyActive)
|
||||
&& (string.IsNullOrEmpty(Machine) || x.Machine.ToLower().Contains(Machine.ToLower()))
|
||||
&& (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName.ToLower().Contains( BtlFileName.ToLower()))
|
||||
&& (string.IsNullOrEmpty(ListName) || x.ListName.ToLower().Contains(ListName.ToLower()))
|
||||
&& ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd)))
|
||||
),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x =>
|
||||
(x.IsActive || !OnlyActive)
|
||||
&& x.Prod == null
|
||||
&& (string.IsNullOrEmpty(Machine) || x.Machine.ToLower().Contains(Machine.ToLower()))
|
||||
&& (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName.ToLower().Contains(BtlFileName.ToLower()))
|
||||
&& (string.IsNullOrEmpty(ListName) || x.ListName.ToLower().Contains(ListName.ToLower()))
|
||||
&& ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd))))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -445,6 +661,105 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x campo IsArchived
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="IsArchived"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateArchived(int ProdId, bool IsArchived)
|
||||
{
|
||||
bool fatto = false;
|
||||
// cerco specifico Prod
|
||||
ProdModel currData = new ProdModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
// sel dei proj da aggiornare...
|
||||
var proj2update = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currData.ProdDbId)
|
||||
.ToList();
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currData.IsArchived = IsArchived;
|
||||
|
||||
// update dei proj relativi
|
||||
foreach (var item in proj2update)
|
||||
{
|
||||
item.IsArchived = IsArchived;
|
||||
}
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateArchived:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateArchived: req item was not found | ProdId {ProdId} | IsArchived {IsArchived}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x Description
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="Description"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateDescription(int ProdId, string Description)
|
||||
{
|
||||
bool fatto = false;
|
||||
// cerco specifico Prod
|
||||
ProdModel currData = new ProdModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currData.Description = Description;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateDescription:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateDescription: req item was not found | ProdId {ProdId} | Description {Description}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x elenco MachGroup:
|
||||
/// - NON vengono eliminati record (se ce ne son altri sul DB non saranno toccati)
|
||||
@@ -772,34 +1087,32 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
protected Core.ProdFileM coreConv(ProdModel currProd)
|
||||
{
|
||||
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate);
|
||||
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived);
|
||||
//Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProjId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
|
||||
return answ;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Get LAST paginated data from DB (DESC ordered)
|
||||
/// Helper conversione modelli verso prodItem
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="currProd"></param>
|
||||
/// <returns></returns>
|
||||
protected List<ProdModel> GetLastDbModelDesc(int numRecord)
|
||||
protected Core.ProdItem coreItemConv(ProdModel currProd)
|
||||
{
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (numRecord == 0)
|
||||
{
|
||||
numRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.ProdList
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Core.ProdItem answ = Core.ProdItem.CreateProdItem(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProjId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione modelli verso prodItem da singolo proj
|
||||
/// </summary>
|
||||
/// <param name="currProd"></param>
|
||||
/// <returns></returns>
|
||||
protected Core.ProdItem coreItemConv(ProjModel currProj)
|
||||
{
|
||||
Core.ProdItem answ = Core.ProdItem.CreateProdItem(Core.ProjFileM.CreateProjFileM(currProj.ProjId, 0, currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.ProjDescription, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine, currProj.IsActive, currProj.IsActive));
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected List<int> ProjIdByProd(int ProdId)
|
||||
{
|
||||
@@ -818,5 +1131,54 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x campo IsProduced lasciato private se servisse in futuro x ora NON
|
||||
/// esposto e fatto implicitamente in StatusMapController.StartProd
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="IsProduced"></param>
|
||||
/// <returns></returns>
|
||||
private bool UpdateProduced(int ProdId, bool IsProduced)
|
||||
{
|
||||
bool fatto = false;
|
||||
// cerco specifico Prod
|
||||
ProdModel currData = new ProdModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currData.IsProduced = IsProduced;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateProduced:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateProduced: req item was not found | ProdId {ProdId} | IsProduced {IsProduced}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
var dbResult = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.BTLFileName == BTLFileName)
|
||||
//valutare se usare solo attivi...
|
||||
//.Where(x => x.BTLFileName == BTLFileName && x.IsActive == true)
|
||||
.FirstOrDefault();
|
||||
|
||||
//se avesse trovato-- > riporto id...
|
||||
@@ -306,8 +308,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="dtEnd">Fine periodo estrazione (per export date)</param>
|
||||
/// <param name="numRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProjFileM> GetLastByExpDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive)
|
||||
public List<Core.ProjFileM> GetLastByExpDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||
|
||||
@@ -321,7 +324,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// retrieve
|
||||
var dbRes = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (x.DtExported >= dtStart && x.DtExported <= dtEnd) && (!OnlyActive || x.IsActive))
|
||||
.Where(x => (!x.IsArchived || ShowArchived) && (x.DtExported >= dtStart && x.DtExported <= dtEnd) && (!OnlyActive || x.IsActive))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
@@ -336,8 +339,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// </summary>
|
||||
/// <param name="numRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProjFileM> GetLastDesc(int numRecord, bool OnlyActive)
|
||||
public List<Core.ProjFileM> GetLastDesc(int numRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||
|
||||
@@ -351,7 +355,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// retrieve
|
||||
var dbRes = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (!OnlyActive || x.IsActive))
|
||||
.Where(x => (!x.IsArchived || ShowArchived) && (!OnlyActive || x.IsActive))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
@@ -368,8 +372,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="dtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="numRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProjFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive)
|
||||
public List<Core.ProjFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||
|
||||
@@ -383,7 +388,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// retrieve
|
||||
var dbRes = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (x.DtCreated >= dtStart && x.DtCreated <= dtEnd) && (!OnlyActive || x.IsActive))
|
||||
.Where(x => (!x.IsArchived || ShowArchived) && (x.DtCreated >= dtStart && x.DtCreated <= dtEnd) && (!OnlyActive || x.IsActive))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
@@ -578,7 +583,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// Update record su DB x elenco BTLParts
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="newBTLFileName"></param>
|
||||
/// <param name="BtlPartList"></param>
|
||||
/// <returns></returns>
|
||||
public ProjModel UpdateBtlParts(int ProjId, List<Core.BTLPartM> BtlPartList)
|
||||
{
|
||||
@@ -694,7 +699,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.UpdateDescription:{Environment.NewLine}{exc}";
|
||||
string errMessage = $"EXCEPTION on Proj.UpdateDescription:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
@@ -900,7 +905,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
Core.ProjFileM answ = null;
|
||||
if (currProj != null)
|
||||
{
|
||||
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.ProjDescription, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine);
|
||||
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.ProjDescription, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine, currProj.IsActive, currProj.IsArchived);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// Initialize database context
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// aggiungo
|
||||
// per prima cosa indico come prodotto il PROD...
|
||||
var currProdData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currProdData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currProdData.IsProduced = true;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateProduced:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateProduced: req item was not found | ProdId {ProdId} | IsProduced: true";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
// resetto done
|
||||
done = false;
|
||||
// aggiungo in StatusMap
|
||||
localDbCtx.StatusMapList.Add(prodSMRecord);
|
||||
|
||||
// recupero MachGroup da PROD
|
||||
@@ -185,8 +215,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella deiu raggruppamenti PROJ in forma di PROD
|
||||
/// </summary>
|
||||
@@ -16,12 +19,24 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public ProdModel()
|
||||
{
|
||||
ProjListNav = new HashSet<ProjModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca DB
|
||||
/// </summary>
|
||||
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProdDbId { get; set; }
|
||||
|
||||
[Column("Description")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data Creazione
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("DtCreated")]
|
||||
public DateTime DtCreated { get; set; }
|
||||
|
||||
@@ -37,6 +52,24 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca per EgtBM
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
[Index]
|
||||
public int ProdId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
@@ -50,27 +83,30 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
[Index]
|
||||
[Column("IsActive")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca DB
|
||||
/// Stato Prodotto = inviato ALMENO UNA VOLTA al supervisore --> NON eliminabile se non in modo logico
|
||||
/// </summary>
|
||||
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProdDbId { get; set; }
|
||||
[Index]
|
||||
[Column("IsProduced")]
|
||||
public bool IsProduced { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// chiave univoca per EgtBM
|
||||
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public int ProdId { get; set; }
|
||||
[Index]
|
||||
[Column("IsArchived")]
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// Collezione oggetti Proj associati (almeno 1 by design)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
public virtual ICollection<ProjModel> ProjListNav { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella dei PROJ caricati dal BTL
|
||||
/// </summary>
|
||||
@@ -13,6 +16,9 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
[Column("BTLFileName")]
|
||||
public string BTLFileName { get; set; } = "";
|
||||
|
||||
@@ -20,23 +26,20 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
/// Data Creazione
|
||||
/// </summary>
|
||||
[Column("DtCreated")]
|
||||
[Index]
|
||||
public DateTime DtCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data Esportazione
|
||||
/// </summary>
|
||||
[Column("DtExported")]
|
||||
[Index]
|
||||
public DateTime DtExported { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
[Column("IsActive")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Stato NEW = creato ma NON salvato
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsNew")]
|
||||
public bool IsNew { get; set; } = true;
|
||||
|
||||
@@ -46,19 +49,33 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("ListName")]
|
||||
public string ListName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un
|
||||
/// dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Stato locked (quando aperto da un dispositivo in rete)
|
||||
/// </summary>
|
||||
[Column("Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
[Column("ProdDbId")]
|
||||
public int? ProdDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ID da modello ext
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
[Index]
|
||||
public int ProjId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
@@ -66,33 +83,33 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public string LockedBy { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un
|
||||
/// dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public virtual ProdModel Prod { get; set; }
|
||||
|
||||
[Column("ProdDbId")]
|
||||
public int? ProdDbId { get; set; }
|
||||
|
||||
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProjDbId { get; set; }
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsActive")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Descrizione progetto (copiata da BTLFileName inizialmente)
|
||||
/// </summary>
|
||||
[Column("ProjDescription")]
|
||||
public string ProjDescription { get; set; } = "";
|
||||
|
||||
[Column("Id")]
|
||||
public int ProjId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
[Index]
|
||||
[Column("IsArchived")]
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public virtual ProdModel Prod { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace EgtBEAMWALL.DataLayer
|
||||
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato
|
||||
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato (server=localhost;port=3306;database=EgtBwDb_000102;)
|
||||
/// </summary>
|
||||
public static string CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
|
||||
@@ -179,6 +179,14 @@
|
||||
<Compile Include="Migrations\202306081452095_UpdateProjModel.designer.cs">
|
||||
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202308241516227_AddProdStatusVarAndIndex.cs" />
|
||||
<Compile Include="Migrations\202308241516227_AddProdStatusVarAndIndex.designer.cs">
|
||||
<DependentUpon>202308241516227_AddProdStatusVarAndIndex.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202308250853396_AddProjArchivedField.cs" />
|
||||
<Compile Include="Migrations\202308250853396_AddProjArchivedField.designer.cs">
|
||||
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
@@ -221,6 +229,12 @@
|
||||
<EmbeddedResource Include="Migrations\202306081452095_UpdateProjModel.resx">
|
||||
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202308241516227_AddProdStatusVarAndIndex.resx">
|
||||
<DependentUpon>202308241516227_AddProdStatusVarAndIndex.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202308250853396_AddProjArchivedField.resx">
|
||||
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddProdStatusVarAndIndex : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProdStatusVarAndIndex));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202308241516227_AddProdStatusVarAndIndex"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddProdStatusVarAndIndex : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProdList", "IsActive", c => c.Boolean(nullable: false));
|
||||
AddColumn("dbo.ProdList", "IsProduced", c => c.Boolean(nullable: false));
|
||||
AddColumn("dbo.ProdList", "IsArchived", c => c.Boolean(nullable: false));
|
||||
CreateIndex("dbo.ProjList", "DtCreated");
|
||||
CreateIndex("dbo.ProjList", "DtExported");
|
||||
CreateIndex("dbo.ProjList", "IsActive");
|
||||
CreateIndex("dbo.ProjList", "IsNew");
|
||||
CreateIndex("dbo.ProjList", "Id");
|
||||
CreateIndex("dbo.ProdList", "DtCreated");
|
||||
CreateIndex("dbo.ProdList", "Id");
|
||||
CreateIndex("dbo.ProdList", "IsActive");
|
||||
CreateIndex("dbo.ProdList", "IsProduced");
|
||||
CreateIndex("dbo.ProdList", "IsArchived");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.ProdList", new[] { "IsArchived" });
|
||||
DropIndex("dbo.ProdList", new[] { "IsProduced" });
|
||||
DropIndex("dbo.ProdList", new[] { "IsActive" });
|
||||
DropIndex("dbo.ProdList", new[] { "Id" });
|
||||
DropIndex("dbo.ProdList", new[] { "DtCreated" });
|
||||
DropIndex("dbo.ProjList", new[] { "Id" });
|
||||
DropIndex("dbo.ProjList", new[] { "IsNew" });
|
||||
DropIndex("dbo.ProjList", new[] { "IsActive" });
|
||||
DropIndex("dbo.ProjList", new[] { "DtExported" });
|
||||
DropIndex("dbo.ProjList", new[] { "DtCreated" });
|
||||
DropColumn("dbo.ProdList", "IsArchived");
|
||||
DropColumn("dbo.ProdList", "IsProduced");
|
||||
DropColumn("dbo.ProdList", "IsActive");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddProjArchivedField : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProjArchivedField));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202308250853396_AddProjArchivedField"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddProjArchivedField : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "IsArchived", c => c.Boolean(nullable: false));
|
||||
CreateIndex("dbo.ProjList", "IsArchived");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.ProjList", new[] { "IsArchived" });
|
||||
DropColumn("dbo.ProjList", "IsArchived");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.5.6.2")]
|
||||
[assembly: AssemblyFileVersion("2.5.6.2")]
|
||||
[assembly: AssemblyVersion("2.5.8.1")]
|
||||
[assembly: AssemblyFileVersion("2.5.8.1")]
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
|
||||
xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
|
||||
<!--<ToggleButton IsChecked="{Binding DataContext.bL_IsReadOnly, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>-->
|
||||
<EgtBEAMWALLCORE:EgtDataGrid ItemsSource="{Binding Tag.MachGroupVMList,
|
||||
<EgtBEAMWALLCORE:EgtDataGrid x:Name="MachGroupDataGrid"
|
||||
ItemsSource="{Binding Tag.MachGroupVMList_View,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"
|
||||
SelectedItem="{Binding Tag.SelectedMachGroup,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserDeleteRows="False"
|
||||
CanUserResizeRows="False"
|
||||
@@ -17,6 +19,7 @@
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
Margin="0,0,0,5"
|
||||
BindingColumns="{Binding RawPartColumns}"
|
||||
Sorting="MachGroupVMList_Sorting"
|
||||
Style="{StaticResource DataGrid_CustomHighLight}">
|
||||
<DataGrid.Resources>
|
||||
<!--ID - Id gruppo-->
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
Public Class RawPartListV
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports Mysqlx
|
||||
Imports Org.BouncyCastle.Crypto
|
||||
Imports System.ComponentModel
|
||||
|
||||
Public Class RawPartListV
|
||||
|
||||
Sub New()
|
||||
|
||||
' This call is required by the designer.
|
||||
InitializeComponent()
|
||||
|
||||
' Add any initialization after the InitializeComponent() call.
|
||||
MyComparer.SetDataGrid(MachGroupDataGrid)
|
||||
AddHandler MachGroupDataGrid.ResetSort, AddressOf MachGroupDataGrid_ResetSort
|
||||
End Sub
|
||||
|
||||
' funzione che permette di selezionare un RawPart anche quando gia' selezionato
|
||||
Private Sub RawPartRow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
|
||||
@@ -12,4 +27,431 @@
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MachGroupVMList_Sorting(sender As Object, e As DataGridSortingEventArgs)
|
||||
' aggiorno direziona colonna
|
||||
Dim column As DataGridColumn = e.Column
|
||||
column.SortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
|
||||
' ricalcolo colonne sort
|
||||
Dim datagrid As DataGrid = sender
|
||||
MyComparer.RefreshColumns()
|
||||
' lancio sort custom
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
e.Handled = True
|
||||
End Sub
|
||||
|
||||
'Private Sub MachGroupVMList_Sorting(sender As Object, e As DataGridSortingEventArgs)
|
||||
' Dim column As DataGridColumn = e.Column
|
||||
' Dim datagrid As DataGrid = sender
|
||||
' Dim comparer As IComparer = Nothing
|
||||
' e.Handled = True
|
||||
' Dim direction As ListSortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
|
||||
' column.SortDirection = direction
|
||||
' Dim m_ColumnList As New List(Of DataGridColumn)
|
||||
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
' For Each col In datagrid.Columns
|
||||
' If Not IsNothing(col.SortDirection) Then
|
||||
' m_ColumnList.Add(col)
|
||||
' m_EgtColumnList.Add(Map.refRawPartListVM.RawPartColumns(col.DisplayIndex))
|
||||
' End If
|
||||
' Next
|
||||
' Dim lcv As ListCollectionView = CType(CollectionViewSource.GetDefaultView(datagrid.ItemsSource), ListCollectionView)
|
||||
' comparer = New MyComparer(Map.refRawPartListVM.RawPartColumns(column.DisplayIndex), m_ColumnList, m_EgtColumnList, direction)
|
||||
' lcv.CustomSort = comparer
|
||||
'End Sub
|
||||
|
||||
Private Sub MachGroupDataGrid_ResetSort()
|
||||
MyComparer.RefreshColumns()
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Friend Class MyComparer
|
||||
Implements IComparer
|
||||
|
||||
Private Shared DataGrid As DataGrid
|
||||
Friend Shared Sub SetDataGrid(value As DataGrid)
|
||||
DataGrid = value
|
||||
End Sub
|
||||
|
||||
Private Shared m_ColumnList As New List(Of DataGridColumn)
|
||||
Private Shared m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
|
||||
Friend Shared Sub RefreshColumns()
|
||||
m_ColumnList.Clear()
|
||||
m_EgtColumnList.Clear()
|
||||
For Each col In DataGrid.Columns
|
||||
If Not IsNothing(col.SortDirection) Then
|
||||
m_ColumnList.Add(col)
|
||||
m_EgtColumnList.Add(Map.refRawPartListVM.RawPartColumns(col.DisplayIndex))
|
||||
End If
|
||||
Next
|
||||
Map.refRawPartListVM.SetRawPartListSorted(m_ColumnList.Count > 0)
|
||||
End Sub
|
||||
|
||||
|
||||
Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
Dim bFirstInQueue As Boolean = First.bToBeProduced
|
||||
Dim bSecondInQueue As Boolean = Second.bToBeProduced
|
||||
' verifico se gia' prodotti
|
||||
If bFirstProduced AndAlso bSecondProduced Then
|
||||
If First.nProductionIndex > Second.nProductionIndex Then
|
||||
Return 1
|
||||
ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
Return -1
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
ElseIf bFirstProduced Then
|
||||
Return -1
|
||||
ElseIf bSecondProduced Then
|
||||
Return 1
|
||||
ElseIf bFirstInQueue AndAlso bSecondInQueue Then
|
||||
If First.nProductionIndex > Second.nProductionIndex Then
|
||||
Return 1
|
||||
ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
Return -1
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
ElseIf bFirstInQueue Then
|
||||
Return -1
|
||||
ElseIf bSecondInQueue Then
|
||||
Return 1
|
||||
Else
|
||||
' verifico ordine per colonne
|
||||
Dim ColumnIndex = 0
|
||||
While ColumnIndex <= m_EgtColumnList.Count - 1
|
||||
Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
|
||||
Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
|
||||
If nCheck <> 0 Then
|
||||
Return nCheck
|
||||
End If
|
||||
ColumnIndex += 1
|
||||
End While
|
||||
' se non trovo colonne, metto in ordine indice di produzione
|
||||
If First.nProductionIndex > Second.nProductionIndex Then
|
||||
Return 1
|
||||
ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
Return -1
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
|
||||
Select Case Column.Name
|
||||
Case COL_NAME
|
||||
If First.nName > Second.nName Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.nName < Second.nName Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_STARTCUT
|
||||
If First.Id > Second.Id Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.Id < Second.Id Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_W
|
||||
If First.dW > Second.dW Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dW < Second.dW Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_H
|
||||
If First.dH > Second.dH Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dH < Second.dH Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_L
|
||||
If First.dL > Second.dL Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dL < Second.dL Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_POSZ
|
||||
'If First.posz > Second.dL Then
|
||||
' Return 1 * nDirection
|
||||
'ElseIf First.dL < Second.dL Then
|
||||
' Return -1 * nDirection
|
||||
'Else
|
||||
' Return 0
|
||||
'End If
|
||||
Case COL_MATERIAL
|
||||
If First.sMATERIAL > Second.sMATERIAL Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_USAGE
|
||||
If First.dUsage > Second.dUsage Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dUsage < Second.dUsage Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_WASTE
|
||||
If First.dWaste > Second.dWaste Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dWaste < Second.dWaste Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
End Select
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
'Friend Class MyComparer
|
||||
' Implements IComparer
|
||||
|
||||
' Dim m_Direction As ListSortDirection
|
||||
' Dim m_Column As EgtDataGridColumn
|
||||
' Dim m_ColumnList As List(Of DataGridColumn)
|
||||
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
|
||||
' Sub New(Column As EgtDataGridColumn, ColumnList As List(Of DataGridColumn), EgtColumnList As List(Of EgtDataGridColumn), Direction As ListSortDirection)
|
||||
' m_Column = Column
|
||||
' m_ColumnList = ColumnList
|
||||
' m_EgtColumnList = EgtColumnList
|
||||
' m_Direction = Direction
|
||||
' End Sub
|
||||
|
||||
' Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
' Dim nDirection As Integer = If(m_Direction, 1, -1)
|
||||
' If bFirstProduced AndAlso bSecondProduced Then
|
||||
' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' Return 1
|
||||
' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' Return -1
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' ElseIf bFirstProduced Then
|
||||
' Return -1
|
||||
' ElseIf bSecondProduced Then
|
||||
' Return 1
|
||||
' Else
|
||||
' Dim ColumnIndex = 0
|
||||
' While ColumnIndex <= m_EgtColumnList.Count - 1
|
||||
' Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
|
||||
' Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
|
||||
' If nCheck <> 0 Then
|
||||
' Return nCheck
|
||||
' End If
|
||||
' ColumnIndex += 1
|
||||
' End While
|
||||
' Return 0
|
||||
' End If
|
||||
' End Function
|
||||
|
||||
' Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
|
||||
' Select Case Column.Name
|
||||
' Case COL_NAME
|
||||
' If First.nName > Second.nName Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.nName < Second.nName Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_STARTCUT
|
||||
' If First.Id > Second.Id Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.Id < Second.Id Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_W
|
||||
' If First.dW > Second.dW Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dW < Second.dW Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_H
|
||||
' If First.dH > Second.dH Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dH < Second.dH Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_L
|
||||
' If First.dL > Second.dL Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dL < Second.dL Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_POSZ
|
||||
' 'If First.posz > Second.dL Then
|
||||
' ' Return 1 * nDirection
|
||||
' 'ElseIf First.dL < Second.dL Then
|
||||
' ' Return -1 * nDirection
|
||||
' 'Else
|
||||
' ' Return 0
|
||||
' 'End If
|
||||
' Case COL_MATERIAL
|
||||
' If First.sMATERIAL > Second.sMATERIAL Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_USAGE
|
||||
' If First.dUsage > Second.dUsage Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dUsage < Second.dUsage Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_WASTE
|
||||
' If First.dWaste > Second.dWaste Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dWaste < Second.dWaste Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' End Select
|
||||
' End Function
|
||||
|
||||
' 'Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
' ' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
' ' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
' ' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
' ' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
' ' Dim nDirection As Integer = If(m_Direction, 1, -1)
|
||||
' ' If bFirstProduced AndAlso bSecondProduced Then
|
||||
' ' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' ' Return 1
|
||||
' ' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' ' Return -1
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' ElseIf bFirstProduced Then
|
||||
' ' Return -1
|
||||
' ' ElseIf bSecondProduced Then
|
||||
' ' Return 1
|
||||
' ' Else
|
||||
' ' Select Case m_Column.Name
|
||||
' ' Case COL_NAME
|
||||
' ' If First.nName > Second.nName Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.nName < Second.nName Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_STARTCUT
|
||||
' ' If First.Id > Second.Id Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.Id < Second.Id Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_W
|
||||
' ' If First.dW > Second.dW Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dW < Second.dW Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_H
|
||||
' ' If First.dH > Second.dH Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dH < Second.dH Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_L
|
||||
' ' If First.dL > Second.dL Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dL < Second.dL Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_POSZ
|
||||
' ' 'If First.posz > Second.dL Then
|
||||
' ' ' Return 1 * nDirection
|
||||
' ' 'ElseIf First.dL < Second.dL Then
|
||||
' ' ' Return -1 * nDirection
|
||||
' ' 'Else
|
||||
' ' ' Return 0
|
||||
' ' 'End If
|
||||
' ' Case COL_MATERIAL
|
||||
' ' If First.sMATERIAL > Second.sMATERIAL Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_USAGE
|
||||
' ' If First.dUsage > Second.dUsage Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dUsage < Second.dUsage Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_WASTE
|
||||
' ' If First.dWaste > Second.dWaste Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dWaste < Second.dWaste Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' End Select
|
||||
' ' 'Dim dFirstValue As Double
|
||||
' ' 'If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' ' ' Return 1 * nDirection
|
||||
' ' 'ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' ' ' Return -1 * nDirection
|
||||
' ' 'Else
|
||||
' ' ' Return 0
|
||||
' ' 'End If
|
||||
' ' End If
|
||||
|
||||
' ' Throw New NotImplementedException()
|
||||
' 'End Function
|
||||
|
||||
'End Class
|
||||
|
||||
@@ -6,6 +6,17 @@ Public Class RawPartListVM
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Private m_bRawPartListSorted As Boolean
|
||||
Public ReadOnly Property bRawPartListSorted As Boolean
|
||||
Get
|
||||
Return m_bRawPartListSorted
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetRawPartListSorted(value As Boolean)
|
||||
m_bRawPartListSorted = value
|
||||
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.MoveRawPart_IsEnabled))
|
||||
End Sub
|
||||
|
||||
Private m_colRawPart_StartCut As EgtDataGridColumn
|
||||
Public ReadOnly Property colRawPart_StartCut As EgtDataGridColumn
|
||||
Get
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.ComponentModel
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports System.Windows.Threading
|
||||
@@ -198,6 +199,8 @@ Public Class LeftPanelVM
|
||||
Return False
|
||||
ElseIf IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then
|
||||
Return False
|
||||
ElseIf Map.refRawPartListVM.bRawPartListSorted Then
|
||||
Return False
|
||||
ElseIf Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then
|
||||
Dim SelMachgroup As MyMachGroupVM = DirectCast(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup, MyMachGroupVM)
|
||||
Return SelMachgroup.nProduction_State <= ItemState.Confirmed AndAlso Not SelMachgroup.bToBeProduced
|
||||
@@ -512,7 +515,8 @@ Public Class LeftPanelVM
|
||||
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList) OrElse Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0 Then Return
|
||||
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.nProduction_State <= ItemState.Confirmed) Then Return
|
||||
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.dtStartTime = DateTime.MinValue) Then Return
|
||||
Dim ToDoList As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
|
||||
Dim View As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList_View.Cast(Of MachGroupVM).ToList()
|
||||
Dim ToDoList As List(Of MachGroupVM) = View.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
|
||||
If Not IsNothing(ToDoList) AndAlso ToDoList.Count > 0 Then
|
||||
MyMachGroupVM.Produce(ToDoList)
|
||||
End If
|
||||
@@ -561,6 +565,8 @@ Public Class LeftPanelVM
|
||||
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
End If
|
||||
' aggiorno log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
#End Region ' DoneRawPart
|
||||
@@ -800,6 +806,8 @@ Public Class LeftPanelVM
|
||||
Next
|
||||
SetDonePart(SelMachGroup, SelMachGroup.SelPart)
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
|
||||
' aggiorno log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
Public Sub SetDonePart(MachGroup As MyMachGroupVM, Part As PartVM)
|
||||
@@ -815,8 +823,9 @@ Public Class LeftPanelVM
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(Time - TimeSpan.FromSeconds(1), Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, 1, DbControllers.SupervisorId))
|
||||
' se e' il primo ad essere lavorato
|
||||
If Not MachGroup.PartVMList.Any(Function(x) x IsNot Part AndAlso x.dtStartTime > DateTime.MinValue) Then
|
||||
Dim bCurrToBeProduced As Boolean = MachGroup.bToBeProduced Or MachGroup.bReadyForMachining Or MachGroup.bSentToMachine
|
||||
' se non e' gia' in coda per essere prodotto
|
||||
If Not (MachGroup.bToBeProduced Or MachGroup.bReadyForMachining Or MachGroup.bSentToMachine) Then
|
||||
If Not bCurrToBeProduced Then
|
||||
' riposiziono il gruppo come primo dei non lavorati assegnandogli indice corretto
|
||||
' cerco primo indice di pezzo non in produzione
|
||||
Dim NewIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) DirectCast(x, MyMachGroupVM).dtStartTime = DateTime.MinValue AndAlso DirectCast(x, MyMachGroupVM).bToBeProduced = False))
|
||||
@@ -840,6 +849,10 @@ Public Class LeftPanelVM
|
||||
MachGroup.dtStartTime = Time
|
||||
MachGroup.nProduction_State = ItemState.WIP
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
|
||||
' aggiorno sort custom dei MachGroup
|
||||
If Not bCurrToBeProduced Then
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End If
|
||||
' scrivo evento inizio MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(Time - TimeSpan.FromSeconds(1), Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, 1, DbControllers.SupervisorId))
|
||||
' blocco produzione di tutti gli altri perche' iniziato questo
|
||||
@@ -907,7 +920,13 @@ Public Class LeftPanelVM
|
||||
If nSelMGIndex = 0 Then Return
|
||||
Dim PreviousMG As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList(nSelMGIndex - 1)
|
||||
If PreviousMG.nProduction_State >= ItemState.WIP Or PreviousMG.bReadyForMachining Then Return
|
||||
' scambio indici
|
||||
Dim nSelMGProdIndex As Integer = SelMachGroup.nProductionIndex
|
||||
SelMachGroup.SetProductionIndex(PreviousMG.nProductionIndex)
|
||||
PreviousMG.SetProductionIndex(nSelMGProdIndex)
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(nSelMGIndex, nSelMGIndex - 1)
|
||||
' lancio sort custom
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End Sub
|
||||
|
||||
#End Region ' MoveUpRawPart
|
||||
@@ -936,7 +955,14 @@ Public Class LeftPanelVM
|
||||
If SelMachGroup.nProduction_State >= ItemState.WIP Or SelMachGroup.bReadyForMachining Then Return
|
||||
Dim nSelMGIndex = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(SelMachGroup)
|
||||
If nSelMGIndex = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count - 1 Then Return
|
||||
' scambio indici
|
||||
Dim NextMG As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList(nSelMGIndex + 1)
|
||||
Dim nSelMGProdIndex As Integer = SelMachGroup.nProductionIndex
|
||||
SelMachGroup.SetProductionIndex(NextMG.nProductionIndex)
|
||||
NextMG.SetProductionIndex(nSelMGProdIndex)
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(nSelMGIndex, nSelMGIndex + 1)
|
||||
' lancio sort custom
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End Sub
|
||||
|
||||
#End Region ' MoveDownRawPart
|
||||
|
||||
@@ -467,6 +467,9 @@ Public Class MachCommandMessagePanelVM
|
||||
MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.RESET))
|
||||
' annullo stato di pronto ad essere lavorato di tutti i programmi
|
||||
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then Map.refProjectVM.SupervisorMachGroupPanelVM.ResetAllMachGroups()
|
||||
' rifaccio sort lista grezzi
|
||||
' lancio sort custom
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Step_Command As ICommand
|
||||
|
||||
@@ -21,6 +21,13 @@ Public Class SupervisorMachGroupPanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_MachGroupVMList_View As ListCollectionView = Nothing
|
||||
Public ReadOnly Property MachGroupVMList_View As ListCollectionView
|
||||
Get
|
||||
Return m_MachGroupVMList_View
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' lock per aggiunta elemento a lista MachGroup
|
||||
Private m_Lock_AddMachGroup As New Object
|
||||
|
||||
@@ -40,6 +47,24 @@ Public Class SupervisorMachGroupPanelVM
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Private m_MachGroupVMListComparer As MyComparer
|
||||
Friend ReadOnly Property MachGroupVMListComparer As MyComparer
|
||||
Get
|
||||
Return m_MachGroupVMListComparer
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend Sub SetMachGroupVMListView()
|
||||
m_MachGroupVMList_View = CollectionViewSource.GetDefaultView(m_MachGroupVMList)
|
||||
m_MachGroupVMListComparer = New MyComparer
|
||||
m_MachGroupVMList_View.CustomSort = m_MachGroupVMListComparer
|
||||
NotifyPropertyChanged(NameOf(MachGroupVMList_View))
|
||||
End Sub
|
||||
|
||||
Friend Sub RefreshMachGroupVMSort()
|
||||
m_MachGroupVMList_View.CustomSort = m_MachGroupVMListComparer
|
||||
End Sub
|
||||
|
||||
Sub New(MachGroupPanelM As MachGroupPanelM)
|
||||
MyBase.New(MachGroupPanelM)
|
||||
' riferimento su map
|
||||
@@ -166,3 +191,151 @@ Public Class SupervisorMachGroupPanelVM
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
|
||||
'Friend Class MachGroupVMListComparer
|
||||
' Implements IComparer
|
||||
|
||||
' Dim m_Direction As ListSortDirection
|
||||
' Dim m_Column As EgtDataGridColumn
|
||||
' Dim m_ColumnList As List(Of DataGridColumn)
|
||||
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
|
||||
' Sub New()
|
||||
' m_Column = column
|
||||
' m_ColumnList = ColumnList
|
||||
' m_EgtColumnList = EgtColumnList
|
||||
' m_Direction = direction
|
||||
|
||||
|
||||
' Dim column As DataGridColumn = e.Column
|
||||
' Dim datagrid As DataGrid = sender
|
||||
' Dim comparer As IComparer = Nothing
|
||||
' e.Handled = True
|
||||
' Dim direction As ListSortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
|
||||
' column.SortDirection = direction
|
||||
' Dim m_ColumnList As New List(Of DataGridColumn)
|
||||
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
' For Each col In datagrid.Columns
|
||||
' If Not IsNothing(col.SortDirection) Then
|
||||
' m_ColumnList.Add(col)
|
||||
' m_EgtColumnList.Add(Map.refRawPartListVM.RawPartColumns(col.DisplayIndex))
|
||||
' End If
|
||||
' Next
|
||||
' Dim lcv As ListCollectionView = CType(CollectionViewSource.GetDefaultView(datagrid.ItemsSource), ListCollectionView)
|
||||
' comparer = New MyComparer(Map.refRawPartListVM.RawPartColumns(column.DisplayIndex), m_ColumnList, m_EgtColumnList, direction)
|
||||
' lcv.CustomSort = comparer
|
||||
|
||||
|
||||
|
||||
' End Sub
|
||||
|
||||
' Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
' Dim nDirection As Integer = If(m_Direction, 1, -1)
|
||||
' If bFirstProduced AndAlso bSecondProduced Then
|
||||
' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' Return 1
|
||||
' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' Return -1
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' ElseIf bFirstProduced Then
|
||||
' Return -1
|
||||
' ElseIf bSecondProduced Then
|
||||
' Return 1
|
||||
' Else
|
||||
' Dim ColumnIndex = 0
|
||||
' While ColumnIndex <= m_EgtColumnList.Count - 1
|
||||
' Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
|
||||
' Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
|
||||
' If nCheck <> 0 Then
|
||||
' Return nCheck
|
||||
' End If
|
||||
' ColumnIndex += 1
|
||||
' End While
|
||||
' Return 0
|
||||
' End If
|
||||
' End Function
|
||||
|
||||
' Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
|
||||
' Select Case Column.Name
|
||||
' Case COL_NAME
|
||||
' If First.nName > Second.nName Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.nName < Second.nName Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_STARTCUT
|
||||
' If First.Id > Second.Id Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.Id < Second.Id Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_W
|
||||
' If First.dW > Second.dW Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dW < Second.dW Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_H
|
||||
' If First.dH > Second.dH Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dH < Second.dH Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_L
|
||||
' If First.dL > Second.dL Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dL < Second.dL Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_POSZ
|
||||
' 'If First.posz > Second.dL Then
|
||||
' ' Return 1 * nDirection
|
||||
' 'ElseIf First.dL < Second.dL Then
|
||||
' ' Return -1 * nDirection
|
||||
' 'Else
|
||||
' ' Return 0
|
||||
' 'End If
|
||||
' Case COL_MATERIAL
|
||||
' If First.sMATERIAL > Second.sMATERIAL Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_USAGE
|
||||
' If First.dUsage > Second.dUsage Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dUsage < Second.dUsage Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_WASTE
|
||||
' If First.dWaste > Second.dWaste Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dWaste < Second.dWaste Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' End Select
|
||||
' End Function
|
||||
|
||||
'End Class
|
||||
|
||||
@@ -588,6 +588,8 @@ Public Class MachManaging
|
||||
' scrivo evento inizio MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(dtStart, nP_Prod, nP_Machgroup, nP_State, DbControllers.SupervisorId))
|
||||
End If
|
||||
' flag di aggiornamento log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
ElseIf nP_State = PartState.END_ Then
|
||||
@@ -697,6 +699,8 @@ Public Class MachManaging
|
||||
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
|
||||
End If
|
||||
End If
|
||||
' flag di aggiornamento log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
End If
|
||||
|
||||
@@ -9,6 +9,10 @@ Imports EgtBEAMWALL.Core.MachLog
|
||||
Public Class MachineLogPageVM
|
||||
Inherits VMBase
|
||||
|
||||
Private m_Lock_LogList As New Object
|
||||
|
||||
Private m_MachineLog_Timer As New DispatcherTimer
|
||||
|
||||
Private Enum DayTypes As Integer
|
||||
TODAY = 0
|
||||
YESTERDAY = 1
|
||||
@@ -131,7 +135,7 @@ Public Class MachineLogPageVM
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Date_Visibility))
|
||||
' aggiorno lista da Db
|
||||
UpdateMachineLogList()
|
||||
UpdateMachineLogList(True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -145,7 +149,7 @@ Public Class MachineLogPageVM
|
||||
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_STARTDATE, lStartDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
UpdateMachineLogList()
|
||||
UpdateMachineLogList(True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -159,7 +163,7 @@ Public Class MachineLogPageVM
|
||||
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_ENDDATE, lEndDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
UpdateMachineLogList()
|
||||
UpdateMachineLogList(True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -292,6 +296,9 @@ Public Class MachineLogPageVM
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
m_MachineLog_Timer.Interval = TimeSpan.FromMilliseconds(100)
|
||||
AddHandler m_MachineLog_Timer.Tick, AddressOf MachineLog_Timer_Tick
|
||||
m_MachineLog_Timer.Start()
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
@@ -334,21 +341,69 @@ Public Class MachineLogPageVM
|
||||
m_colMachineLog_Description.ColumnVisibility = Visibility.Collapsed
|
||||
m_colMachineLog_SupervisorId.ColumnVisibility = Visibility.Collapsed
|
||||
End If
|
||||
UpdateMachineLogList()
|
||||
UpdateMachineLogList(True)
|
||||
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
|
||||
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
|
||||
End Sub
|
||||
|
||||
Friend Sub UpdateMachineLogList()
|
||||
' indice di aggiornamento della lista rispetto a Db
|
||||
Private m_nUpdateIndex As Integer
|
||||
' indice di ricaricamento completo della lista dal Db
|
||||
Private m_nRefreshIndex As Integer
|
||||
' indice dell'ultimo update/refresh
|
||||
Private m_nLastLogUpdate As Integer
|
||||
|
||||
Friend Sub UpdateMachineLogList(bRefresh As Boolean)
|
||||
Dim nMaxIndex As Integer = Math.Max(m_nUpdateIndex, m_nRefreshIndex)
|
||||
If bRefresh Then
|
||||
m_nRefreshIndex = nMaxIndex + 1
|
||||
Else
|
||||
m_nUpdateIndex = nMaxIndex + 1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MachineLog_Timer_Tick(sender As Object, e As EventArgs)
|
||||
SyncLock m_Lock_LogList
|
||||
Dim nRefresh As Integer = m_nRefreshIndex
|
||||
Dim nUpdate As Integer = m_nUpdateIndex
|
||||
If nRefresh > m_nLastLogUpdate Then
|
||||
m_nLastLogUpdate = nRefresh
|
||||
UpdateFromDb(True)
|
||||
ElseIf nUpdate > m_nLastLogUpdate Then
|
||||
m_nLastLogUpdate = nUpdate
|
||||
UpdateFromDb(False)
|
||||
End If
|
||||
End SyncLock
|
||||
End Sub
|
||||
|
||||
Friend Sub UpdateFromDb(bRefresh As Boolean)
|
||||
'm_MachineLogList = New ObservableCollection(Of LogEvent)(DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Now - TimeSpan.FromDays(300), DateTime.Now).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList())
|
||||
Dim DbList As List(Of LogEvent)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.TODAY
|
||||
m_MachineLogList = New ObservableCollection(Of LogEvent)(DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today, DateTime.Today + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList())
|
||||
Case DayTypes.YESTERDAY
|
||||
m_MachineLogList = New ObservableCollection(Of LogEvent)(DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today - TimeSpan.FromDays(1), DateTime.Today).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList())
|
||||
Case DayTypes.PERIOD
|
||||
m_MachineLogList = New ObservableCollection(Of LogEvent)(DbControllers.m_LogMachineController.GetCoreDesc(m_dtStartDate, m_dtEndDate + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList())
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(m_dtStartDate, m_dtEndDate + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
Case DayTypes.YESTERDAY
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today - TimeSpan.FromDays(1), DateTime.Today).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
Case Else ' DayTypes.TODAY
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today, DateTime.Today + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
End Select
|
||||
If bRefresh OrElse m_MachineLogList.Count < 1 Then
|
||||
m_MachineLogList = New ObservableCollection(Of LogEvent)(DbList)
|
||||
Else
|
||||
' cerco in lista Db ultimo elemento della mia lista
|
||||
Dim LastItem As LogEvent = m_MachineLogList(0)
|
||||
Dim CommonItem As LogEvent = DbList.FirstOrDefault(Function(x) x.EventDateTime = LastItem.EventDateTime AndAlso x.EventType = LastItem.EventType AndAlso x.SupervisorId = LastItem.SupervisorId AndAlso x.Value = LastItem.Value)
|
||||
Dim nCommonItemIndex As Integer
|
||||
If Not IsNothing(CommonItem) Then
|
||||
nCommonItemIndex = DbList.IndexOf(CommonItem)
|
||||
End If
|
||||
' aggiorno i successivi
|
||||
If nCommonItemIndex >= 0 Then
|
||||
For Index = nCommonItemIndex - 1 To 0 Step -1
|
||||
m_MachineLogList.Insert(0, DbList(Index))
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(MachineLogList))
|
||||
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
|
||||
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
|
||||
@@ -376,7 +431,7 @@ Public Class MachineLogPageVM
|
||||
''' Execute the Open. This method is invoked by the OpenCommand.
|
||||
''' </summary>
|
||||
Friend Sub Refresh()
|
||||
UpdateMachineLogList()
|
||||
UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
#End Region ' Refresh
|
||||
|
||||
@@ -248,8 +248,8 @@ Public Class MainWindowM
|
||||
EgtSetLockId( sLockId)
|
||||
End If
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2506, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2506, 1, m_nKeyOptions)
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2508, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2508, 1, m_nKeyOptions)
|
||||
' Inizializzazione generale di EgtInterface
|
||||
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
m_sLogFile = m_sTempDir & "\" & SUPGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
|
||||
@@ -70,5 +70,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.5.6.2")>
|
||||
<Assembly: AssemblyFileVersion("2.5.6.2")>
|
||||
<Assembly: AssemblyVersion("2.5.8.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.8.1")>
|
||||
|
||||
@@ -11,13 +11,14 @@ Public Class OpenProjectFileDialogVM
|
||||
|
||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
m_ProjectType = ProjectType
|
||||
m_GoToProd = GoToProd
|
||||
' carico colonne
|
||||
LoadColumns(m_ProjectType)
|
||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
' carico lista progetti
|
||||
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
||||
RefreshProjectList(GoToProd)
|
||||
RefreshProjectList()
|
||||
Else
|
||||
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
||||
NotifyPropertyChanged(NameOf(ProjectList))
|
||||
@@ -26,7 +27,7 @@ Public Class OpenProjectFileDialogVM
|
||||
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
||||
End Function
|
||||
|
||||
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
Public Overrides Sub RefreshProjectList()
|
||||
m_ProjectList.Clear()
|
||||
' calcolo periodo e righe
|
||||
Dim dtStart As DateTime
|
||||
@@ -43,13 +44,13 @@ Public Class OpenProjectFileDialogVM
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(31)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(31 * 3)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(31 * 6)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
dtStart = dtStartDate + TimeSpan.FromDays(1)
|
||||
dtEnd = dtEndDate
|
||||
|
||||
@@ -77,21 +77,24 @@ Public Class SupervisorManagerVM
|
||||
'Private m_cmdSave As ICommand
|
||||
Private m_cmdGoToProd As ICommand
|
||||
|
||||
#Region "ToolTip"
|
||||
#Region "ToolTip"
|
||||
|
||||
'Proprietà ToolTip
|
||||
Public ReadOnly Property OpenToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property GoToProd_ToolTip As String
|
||||
Get
|
||||
Return EgtMsg(61835)
|
||||
End Get
|
||||
End Property
|
||||
'Proprietà ToolTip
|
||||
Public ReadOnly Property OpenToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property GoToProd_ToolTip As String
|
||||
Get
|
||||
Return EgtMsg(61835)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' ToolTip
|
||||
|
||||
|
||||
|
||||
#End Region ' ToolTip
|
||||
|
||||
#End Region ' Fields & Properties
|
||||
|
||||
@@ -297,6 +300,11 @@ Public Class SupervisorManagerVM
|
||||
End If
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList))
|
||||
m_bLoadingProd = False
|
||||
|
||||
MyComparer.RefreshColumns()
|
||||
Map.refSupervisorMachGroupPanelVM.SetMachGroupVMListView()
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
|
||||
NotifyPropertyChanged(NameOf(MruFileNames))
|
||||
LoadingWndHelper.CloseLoadingWnd(ActiveIds.OPENPROD)
|
||||
End Sub
|
||||
|
||||
@@ -200,7 +200,7 @@ Public Class ConfigurationPageVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ReminderList As New List(Of IdNameStruct)({New IdNameStruct(0, "Never"), New IdNameStruct(1, "1 day"), New IdNameStruct(2, "2 days"), New IdNameStruct(7, "1 week"), New IdNameStruct(14, "2 weeks"), New IdNameStruct(30, "1 month")})
|
||||
Private m_ReminderList As New List(Of IdNameStruct)({New IdNameStruct(0, EgtMsg(61988)), New IdNameStruct(1, EgtMsg(61989)), New IdNameStruct(2, EgtMsg(61990)), New IdNameStruct(7, EgtMsg(61991)), New IdNameStruct(14, EgtMsg(61992)), New IdNameStruct(30, EgtMsg(61993))})
|
||||
Public ReadOnly Property ReminderList As List(Of IdNameStruct)
|
||||
Get
|
||||
Return m_ReminderList
|
||||
@@ -556,17 +556,17 @@ Public Class ConfigurationPageVM
|
||||
sBackupFolder &= "\" & DateTime.Now().ToString("yyyyMMddHHmmss") & ".bwbck"
|
||||
Dim sBackupZipPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\DbBackup.zip"
|
||||
' apro finestra di caricamento
|
||||
If bLoadingWindow Then LoadingWndHelper.OpenLoadingWnd(ActiveIds.BACKUP, 2, "Backup", "Database backup", 15) ' Backup ' Database backup
|
||||
If bLoadingWindow Then LoadingWndHelper.OpenLoadingWnd(ActiveIds.BACKUP, 2, EgtMsg(63022), EgtMsg(63023), 15) ' Backup ' Database backup
|
||||
Dim bOk As Boolean = True
|
||||
' backup del Db corrente
|
||||
Try
|
||||
DataLayer.DbConfig.DataBaseDumpToFile(sBackupZipPath)
|
||||
Catch ex As Exception
|
||||
MessageBox.Show("Backup failed! Impossible to create the backup package!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
MessageBox.Show(EgtMsg(62103), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
bOk = False
|
||||
End Try
|
||||
If bOk AndAlso File.Exists(sBackupZipPath) Then
|
||||
If bLoadingWindow Then LoadingWndHelper.UpdateLoadingWnd(ActiveIds.BACKUP, 2, "Projects backup", 15, 100) ' Projects backup
|
||||
If bLoadingWindow Then LoadingWndHelper.UpdateLoadingWnd(ActiveIds.BACKUP, 2, EgtMsg(63024), 15, 100) ' Projects backup
|
||||
' backup dei progetti correnti
|
||||
Try
|
||||
Using zip As New Ionic.Zip.ZipFile(sBackupFolder, Console.Out)
|
||||
@@ -590,7 +590,7 @@ Public Class ConfigurationPageVM
|
||||
zip.Save()
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
MessageBox.Show("Backup failed! Impossible to create the backup package!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
MessageBox.Show(EgtMsg(62103), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
bOk = False
|
||||
End Try
|
||||
End If
|
||||
@@ -603,7 +603,7 @@ Public Class ConfigurationPageVM
|
||||
If Directory.Exists(m_ExternalBackupFolderPath) Then
|
||||
CopyForExternalBackup(sBackupFolder, m_ExternalBackupFolderPath)
|
||||
Else
|
||||
MessageBox.Show("External folder does not exist or is not reachable! Copy to external folder impossible!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
MessageBox.Show(EgtMsg(62104), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' External folder does not exist or is not reachable! Copy to external folder impossible!
|
||||
End If
|
||||
End If
|
||||
'chiudo finestra di caricamento
|
||||
@@ -645,7 +645,7 @@ Public Class ConfigurationPageVM
|
||||
Dim localProc As Process() = Process.GetProcessesByName(sSupervisorName)
|
||||
' verifico che sia chiuso
|
||||
If localProc.Length > 0 Then
|
||||
MessageBox.Show("Please verify the machine is stoped and close the supervisor before proceding with the restore operation!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
MessageBox.Show(EgtMsg(62105), EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Please verify the machine is stoped and close the supervisor before proceding with the restore operation!
|
||||
Return
|
||||
End If
|
||||
m_bRestoreRunning = True
|
||||
@@ -684,22 +684,25 @@ Public Class ConfigurationPageVM
|
||||
Next
|
||||
End If
|
||||
If String.IsNullOrEmpty(sRestorePath) Then
|
||||
MessageBox.Show("Restore impossible! Last backup not found!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
MessageBox.Show(EgtMsg(62106), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' Restore impossible! Last backup not found!
|
||||
End If
|
||||
If MessageBox.Show(String.Format(EgtMsg(62107), nYear, nMonth, nDay), EgtMsg(15002), MessageBoxButton.OKCancel, MessageBoxImage.Warning) <> MessageBoxResult.OK Then 'Are you sure you want to restore the last backup from {0}\{1}\{2}? If you proceed you will lose actual data!
|
||||
m_bRestoreRunning = False
|
||||
Return
|
||||
End If
|
||||
If MessageBox.Show("Are you sure you want to restore the last backup from " & nYear & "\" & nMonth & "\" & nDay & "? If you proceed you will lose actual data!", "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Warning) <> MessageBoxResult.OK Then Return
|
||||
Dim bDoBackup = False
|
||||
Select Case MessageBox.Show("Do you want to do a backup of the current project before proceding with the restore?", "Information", MessageBoxButton.YesNoCancel, MessageBoxImage.Information)
|
||||
Select Case MessageBox.Show(EgtMsg(62108), EgtMsg(15003), MessageBoxButton.YesNoCancel, MessageBoxImage.Information) ' Do you want to do a backup of the current project before proceding with the restore?
|
||||
Case MessageBoxResult.Yes
|
||||
bDoBackup = True
|
||||
Case MessageBoxResult.No
|
||||
bDoBackup = False
|
||||
Case MessageBoxResult.Cancel
|
||||
MessageBox.Show("Restore operation aborted!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
MessageBox.Show(EgtMsg(62109), EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
m_bRestoreRunning = False
|
||||
Return
|
||||
End Select
|
||||
' apro finestra di caricamento
|
||||
LoadingWndHelper.OpenLoadingWnd(ActiveIds.RESTORE, 3, "Restore", "Backup current", If(bDoBackup, 40, 10)) ' Restore ' Database Restore
|
||||
LoadingWndHelper.OpenLoadingWnd(ActiveIds.RESTORE, 3, EgtMsg(63025), EgtMsg(63026), If(bDoBackup, 40, 10)) ' Restore ' Database Restore
|
||||
If bDoBackup Then
|
||||
Backup(False)
|
||||
End If
|
||||
@@ -713,18 +716,10 @@ Public Class ConfigurationPageVM
|
||||
sUserFolder = sKey.Substring(3, 6)
|
||||
End If
|
||||
If Directory.Exists(sProjectFolder & "\" & sUserFolder) Then
|
||||
' se faccio backup elimino cartella dei progetti
|
||||
If bDoBackup Then
|
||||
Directory.Delete(sProjectFolder & "\" & sUserFolder, True)
|
||||
Else
|
||||
' altrimenti la rinomino old
|
||||
If Directory.Exists(sProjectFolder & "\" & sUserFolder & ".old") Then
|
||||
Directory.Delete(sProjectFolder & "\" & sUserFolder & ".old", True)
|
||||
End If
|
||||
Directory.Move(sProjectFolder & "\" & sUserFolder, sProjectFolder & "\" & sUserFolder & ".old")
|
||||
End If
|
||||
' elimino cartella dei progetti
|
||||
Directory.Delete(sProjectFolder & "\" & sUserFolder, True)
|
||||
End If
|
||||
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.RESTORE, 2, "Restore data extraction", If(bDoBackup, 40, 10), 80) ' Restore data extraction
|
||||
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.RESTORE, 2, EgtMsg(63027), If(bDoBackup, 40, 10), 80) ' Restore data extraction
|
||||
' estraggo lo zip nella cartella Temp
|
||||
Dim sRestoreDir As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Restore"
|
||||
If Directory.Exists(sRestoreDir) Then
|
||||
@@ -741,17 +736,17 @@ Public Class ConfigurationPageVM
|
||||
Catch ex1 As Exception
|
||||
EgtOutLog("Error! Impossible importing Recovery file " & sRestorePath & "!")
|
||||
EgtOutLog("Exception in zip: " & ex1.ToString())
|
||||
MessageBox.Show("Impossible importing Recovery file!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
MessageBox.Show(EgtMsg(62110), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' Impossible importing Recovery file!
|
||||
bOk = False
|
||||
End Try
|
||||
Dim sBackupTempPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\DbRestore"
|
||||
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.RESTORE, 3, "Database restore", 80, 100) ' Database restore
|
||||
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.RESTORE, 3, EgtMsg(63028), 80, 100) ' Database restore
|
||||
If bOk Then
|
||||
' restore del Db
|
||||
Try
|
||||
DataLayer.DbConfig.DataBaseRestoreFromFile(sRestoreDir & "\DbBackup.zip", "", sBackupTempPath)
|
||||
Catch ex As Exception
|
||||
MessageBox.Show("Restore failed! Impossible to restore the backup Database!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
MessageBox.Show(EgtMsg(62111), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' Restore failed! Impossible to restore the backup Database
|
||||
bOk = False
|
||||
End Try
|
||||
End If
|
||||
@@ -1080,21 +1075,17 @@ Public Class MachParam
|
||||
Dim dNewValue As Double
|
||||
' verifico se valore immesso è diverso dall'originale
|
||||
If nParentTable > 0 Then
|
||||
Dim sOrigValue As String = String.Empty
|
||||
Dim dOrigValue As Double
|
||||
MachParamIniFile.GetMachPrivateProfileParamValue(nParentTable, nParamIndex, sOrigValue)
|
||||
' trasformo valori
|
||||
Select Case nType
|
||||
Case MachParamType.DOUBLE_
|
||||
StringToDoubleAdv(value, dNewValue, True)
|
||||
StringToDoubleAdv(sOrigValue, dOrigValue, True)
|
||||
m_IsModifiedValue = Math.Abs(dNewValue - m_dValue) > EPS_SMALL
|
||||
Case MachParamType.LENGTH
|
||||
StringToLenAdv(value, dNewValue, True)
|
||||
StringToLenAdv(sOrigValue, dOrigValue, True)
|
||||
m_IsModifiedValue = Math.Abs(dNewValue - m_dValue) > EPS_SMALL
|
||||
Case Else
|
||||
' per string non faccio nulla
|
||||
m_IsModifiedValue = String.Compare(value, m_sValue) <> 0
|
||||
End Select
|
||||
m_IsModifiedValue = dNewValue <> dOrigValue
|
||||
End If
|
||||
' se valore immesso è diverso e password non inserita
|
||||
If m_IsModifiedValue AndAlso Not Map.refConfigurationPageVM.bModifyMachParam Then
|
||||
|
||||
@@ -327,6 +327,7 @@
|
||||
<DependentUpon>NestingRunningWndV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NestingRunningWnd\NestingRunningWndVM.vb" />
|
||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogVM.vb" />
|
||||
<Compile Include="ProjectTypeWnd\ProjectTypeWndV.xaml.vb">
|
||||
<DependentUpon>ProjectTypeWndV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -996,6 +997,9 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ProjectManager\AddProj.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\OpenProjectFileDialog\Archived.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\EgtBEAMWALL.ViewerOptimizerR32.exe
|
||||
|
||||
@@ -609,15 +609,7 @@ Public Class LeftPanelVM
|
||||
sW = LenToString(CurrSParam.dW, 3)
|
||||
sL = LenToString(CurrSParam.dL, 3)
|
||||
' ricavo l'indice del SecionXMaterial dalla Wall_List
|
||||
Dim SectXMatIndex As Integer = 1
|
||||
Dim sSxMValue As String = ""
|
||||
While EgtUILib.GetPrivateProfileString(S_WALL_LIST, SectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
|
||||
If sSxMValue = CurrSParam.sValue Then
|
||||
' se l'ho trovato esco dal while, il SectXMatIndex è l'indice che cercavamo
|
||||
Exit While
|
||||
End If
|
||||
SectXMatIndex += 1
|
||||
End While
|
||||
Dim SectXMatIndex As Integer = GetSectIndexFromSection(MachineType.WALL, CurrSParam.SectXMat)
|
||||
' ricavo nuovo indice materiale
|
||||
Dim ParamIndex As Integer = 1
|
||||
Dim sParam As String = ""
|
||||
|
||||
@@ -235,8 +235,8 @@ Public Class MainWindowM
|
||||
EgtSetLockId( sLockId)
|
||||
End If
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2506, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2506, 1, m_nKeyOptions)
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2508, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2508, 1, m_nKeyOptions)
|
||||
' Inizializzazione generale di EgtInterface
|
||||
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
m_sLogFile = m_sTempDir & "\" & VWOPTGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
|
||||
@@ -88,14 +88,31 @@ Public Class MainWindowVM
|
||||
m_Title = ""
|
||||
Select Case Map.refMainMenuVM.SelPage
|
||||
Case Pages.VIEW
|
||||
If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
|
||||
If Map.refProjManagerVM.CurrProj.bIsNew Then m_Title = "New - "
|
||||
m_Title &= Map.refProjManagerVM.CurrProj.nProjId.ToString("0000") & " - " & Map.refProjManagerVM.CurrProj.sBTLFileName
|
||||
If GetMainPrivateProfileInt(S_GENERAL, K_PROJECTMODE, 0) = 1 Then
|
||||
If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
|
||||
If Map.refProjManagerVM.CurrProj.bIsNew Then m_Title = "New - "
|
||||
If Not IsNothing(Map.refProjManagerVM.CurrProj.nProdId) AndAlso Map.refProjManagerVM.CurrProj.nProdId > 0 Then
|
||||
m_Title &= Map.refProjManagerVM.CurrProj.nProdId.ToString("0000") & " - "
|
||||
End If
|
||||
m_Title &= Map.refProjManagerVM.CurrProj.sBTLFileName
|
||||
End If
|
||||
Else
|
||||
If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
|
||||
If Map.refProjManagerVM.CurrProj.bIsNew Then m_Title = "New - "
|
||||
m_Title &= Map.refProjManagerVM.CurrProj.nProjId.ToString("0000") & " - " & Map.refProjManagerVM.CurrProj.sBTLFileName
|
||||
End If
|
||||
End If
|
||||
Case Pages.MACHINING
|
||||
If Not IsNothing(Map.refProdManagerVM.CurrProd) Then
|
||||
If Map.refProdManagerVM.CurrProd.bIsNew Then m_Title = "New - "
|
||||
m_Title &= Map.refProdManagerVM.CurrProd.nProdId.ToString("0000") & " - " & Map.refProdManagerVM.CurrProd.sBTLFileName
|
||||
If GetMainPrivateProfileInt(S_GENERAL, K_PROJECTMODE, 0) = 1 Then
|
||||
If Not IsNothing(Map.refProdManagerVM.CurrProd) Then
|
||||
If Map.refProdManagerVM.CurrProd.bIsNew Then m_Title = "New - "
|
||||
m_Title &= Map.refProdManagerVM.CurrProd.nProdId.ToString("0000") & " - " & Map.refProdManagerVM.CurrProd.sName
|
||||
End If
|
||||
Else
|
||||
If Not IsNothing(Map.refProdManagerVM.CurrProd) Then
|
||||
If Map.refProdManagerVM.CurrProd.bIsNew Then m_Title = "New - "
|
||||
m_Title &= Map.refProdManagerVM.CurrProd.nProdId.ToString("0000") & " - " & Map.refProdManagerVM.CurrProd.sBTLFileName
|
||||
End If
|
||||
End If
|
||||
Case Pages.CONFIG
|
||||
m_Title = "Configuration Page"
|
||||
@@ -154,6 +171,51 @@ Public Class MainWindowVM
|
||||
' avvio thread di gestione della macchina che avvia la connessione
|
||||
m_SupervisorCommThread.Start()
|
||||
|
||||
' verifico se richiedere di fare backup
|
||||
If Map.refConfigurationPageVM.SelReminder.Id <> 0 Then
|
||||
Dim sBackupFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\Backup"
|
||||
Dim nYear As Integer = 0
|
||||
Dim nMonth As Integer = 0
|
||||
Dim nDay As Integer = 0
|
||||
Dim LastBackupDate As Date = Date.MinValue
|
||||
' verifico se esiste backup
|
||||
If Directory.Exists(sBackupFolder) Then
|
||||
' cerco ultimo backup
|
||||
Dim YearDirList() As String = Directory.GetDirectories(sBackupFolder)
|
||||
For YearIndex = YearDirList.Length - 1 To 0 Step -1
|
||||
nYear = 0
|
||||
Integer.TryParse(Path.GetFileName(YearDirList(YearIndex)), nYear)
|
||||
Dim sYearDir As String = sBackupFolder & "\" & nYear
|
||||
Dim MonthDirList() As String = Directory.GetDirectories(sYearDir)
|
||||
For MonthIndex = MonthDirList.Length - 1 To 0 Step -1
|
||||
nMonth = 0
|
||||
Integer.TryParse(Path.GetFileName(MonthDirList(MonthIndex)), nMonth)
|
||||
Dim sMonthDir As String = sYearDir & "\" & nMonth
|
||||
Dim DayDirList() As String = Directory.GetDirectories(sMonthDir)
|
||||
For DayIndex = DayDirList.Length - 1 To 0 Step -1
|
||||
nDay = 0
|
||||
Integer.TryParse(Path.GetFileName(DayDirList(DayIndex)), nDay)
|
||||
Dim sDayDir As String = sMonthDir & "\" & nDay
|
||||
Dim VersionList() As String = Directory.GetFiles(sDayDir)
|
||||
If VersionList.Length > 0 Then
|
||||
Dim nMaxVersion As Int64 = VersionList.Max(Function(x) Int64.Parse(Path.GetFileNameWithoutExtension(x)))
|
||||
LastBackupDate = New Date(nYear, nMonth, nDay)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If LastBackupDate <> Date.MinValue Then Exit For
|
||||
Next
|
||||
If LastBackupDate <> Date.MinValue Then Exit For
|
||||
Next
|
||||
End If
|
||||
Dim TimeFromLastBackup As TimeSpan = DateTime.Now - LastBackupDate
|
||||
If TimeFromLastBackup > TimeSpan.FromDays(Map.refConfigurationPageVM.SelReminder.Id) Then
|
||||
If MessageBox.Show(String.Format(EgtMsg(61987), Map.refConfigurationPageVM.SelReminder.Name), EgtMsg(15002), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.Yes Then
|
||||
Map.refConfigurationPageVM.Backup(True)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Friend Function ProcessCommandLine(ByRef nCommandType As Integer, ByRef nPage As Pages, ByRef nProdId As Integer) As Boolean
|
||||
@@ -266,67 +328,25 @@ Public Class MainWindowVM
|
||||
End If
|
||||
' verifico se sono in modifica percorso libero
|
||||
If Map.refFreeContourManagerVM.bIsActive Then
|
||||
MessageBox.Show("Exit from path modification before closing software!")
|
||||
MessageBox.Show(EgtMsg(61994))
|
||||
Return
|
||||
End If
|
||||
' verifico se sto facendo backup
|
||||
If Map.refConfigurationPageVM.bBackupRunning Then
|
||||
MessageBox.Show("Backup running! Impossible closing the software until finish the backup process!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
MessageBox.Show(EgtMsg(62101), EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) 'Backup running! Impossible closing the software until finish the backup process!
|
||||
Return
|
||||
End If
|
||||
If Map.refConfigurationPageVM.bRestoreRunning Then
|
||||
MessageBox.Show("Restore running! Impossible closing the software until finish the restore process!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
MessageBox.Show(EgtMsg(62102), EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) 'Restore running! Impossible closing the software until finish the restore process!
|
||||
Return
|
||||
End If
|
||||
If Map.refConfigurationPageVM.SelReminder.Id <> 0 Then
|
||||
Dim sBackupFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\Backup"
|
||||
Dim nYear As Integer = 0
|
||||
Dim nMonth As Integer = 0
|
||||
Dim nDay As Integer = 0
|
||||
Dim LastBackupDate As Date = Date.MinValue
|
||||
' verifico se esiste backup
|
||||
If Directory.Exists(sBackupFolder) Then
|
||||
' cerco ultimo backup
|
||||
Dim YearDirList() As String = Directory.GetDirectories(sBackupFolder)
|
||||
For YearIndex = YearDirList.Length - 1 To 0 Step -1
|
||||
nYear = 0
|
||||
Integer.TryParse(Path.GetFileName(YearDirList(YearIndex)), nYear)
|
||||
Dim sYearDir As String = sBackupFolder & "\" & nYear
|
||||
Dim MonthDirList() As String = Directory.GetDirectories(sYearDir)
|
||||
For MonthIndex = MonthDirList.Length - 1 To 0 Step -1
|
||||
nMonth = 0
|
||||
Integer.TryParse(Path.GetFileName(MonthDirList(MonthIndex)), nMonth)
|
||||
Dim sMonthDir As String = sYearDir & "\" & nMonth
|
||||
Dim DayDirList() As String = Directory.GetDirectories(sMonthDir)
|
||||
For DayIndex = DayDirList.Length - 1 To 0 Step -1
|
||||
nDay = 0
|
||||
Integer.TryParse(Path.GetFileName(DayDirList(DayIndex)), nDay)
|
||||
Dim sDayDir As String = sMonthDir & "\" & nDay
|
||||
Dim VersionList() As String = Directory.GetFiles(sDayDir)
|
||||
If VersionList.Length > 0 Then
|
||||
Dim nMaxVersion As Int64 = VersionList.Max(Function(x) Int64.Parse(Path.GetFileNameWithoutExtension(x)))
|
||||
LastBackupDate = New Date(nYear, nMonth, nDay)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If LastBackupDate <> Date.MinValue Then Exit For
|
||||
Next
|
||||
If LastBackupDate <> Date.MinValue Then Exit For
|
||||
Next
|
||||
End If
|
||||
Dim TimeFromLastBackup As TimeSpan = DateTime.Now - LastBackupDate
|
||||
If TimeFromLastBackup > TimeSpan.FromDays(Map.refConfigurationPageVM.SelReminder.Id) Then
|
||||
If MessageBox.Show(Map.refConfigurationPageVM.SelReminder.Name & " have passed from last backup. Do you want to do a backup before closing the software?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.Yes Then
|
||||
Map.refConfigurationPageVM.Backup(True)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'If Map.refOptionPanelVM.SelItem = OptionPanelVM.Tabs.SIMUL Then
|
||||
' Map.refSimulTabVM.ResetSimulation()
|
||||
'End If
|
||||
' Imposto contesto principale
|
||||
'EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
|
||||
' Gestisco eventuale file corrente modificato
|
||||
Dim bOk As Boolean = True
|
||||
'If Map.refOptionPanelVM.SelItem = OptionPanelVM.Tabs.SIMUL Then
|
||||
' Map.refSimulTabVM.ResetSimulation()
|
||||
'End If
|
||||
' Imposto contesto principale
|
||||
'EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
|
||||
' Gestisco eventuale file corrente modificato
|
||||
Dim bOk As Boolean = True
|
||||
Select Case Map.refMainMenuVM.SelPage
|
||||
Case Pages.VIEW
|
||||
bOk = ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ)
|
||||
|
||||
@@ -70,5 +70,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.5.6.2")>
|
||||
<Assembly: AssemblyFileVersion("2.5.6.2")>
|
||||
<Assembly: AssemblyVersion("2.5.8.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.8.1")>
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class NewOpenProjectFileDialogVM
|
||||
Inherits Core.NewOpenProjectFileDialogVM
|
||||
|
||||
Public Overrides ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Dim CurrDayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
|
||||
If Map.refMainWindowVM.MainWindowM.nUserLevel > 5 Then
|
||||
CurrDayTypeList.Add("Always")
|
||||
End If
|
||||
Return CurrDayTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
m_ProjectType = ProjectType
|
||||
ProdItem.m_delUpdateNameInDb = AddressOf DbControllers.m_ProdController.UpdateDescription
|
||||
|
||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
' carico lista progetti
|
||||
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
||||
SetFixedProjectList(False)
|
||||
RefreshProjectList(GoToProd)
|
||||
Else
|
||||
SetFixedProjectList(True)
|
||||
NotifyPropertyChanged(NameOf(ProjectList))
|
||||
End If
|
||||
'm_ProjectList_View = CollectionViewSource.GetDefaultView(m_ProjectList)
|
||||
'm_ProjectList_View.Filter = AddressOf ProjectFilter
|
||||
UpdatePageList()
|
||||
End Function
|
||||
|
||||
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
m_ProjectList.Clear()
|
||||
' calcolo periodo e righe
|
||||
Dim dtStart As DateTime
|
||||
Dim dtEnd As DateTime
|
||||
Dim nRowQuantity As Integer = 20
|
||||
Select Case SelRowQuantity
|
||||
Case RowQuantities.TEN
|
||||
nRowQuantity = 10
|
||||
Case RowQuantities.TWENTY
|
||||
nRowQuantity = 20
|
||||
Case RowQuantities.THIRTY
|
||||
nRowQuantity = 30
|
||||
End Select
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
dtEnd = DateTime.Today.AddDays(1)
|
||||
dtStart = dtEnd.AddMonths(-1)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
dtEnd = DateTime.Today.AddDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
dtEnd = dtEndDate + TimeSpan.FromDays(1)
|
||||
dtStart = dtStartDate
|
||||
Case DayTypes.ALWAYS
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = New DateTime(2020, 1, 1)
|
||||
End Select
|
||||
' leggo da db
|
||||
If m_ProjectType = ProjectType.PROJ Then
|
||||
'Dim DbProjList As New List(Of ProjFileM)
|
||||
'If m_SelBTLDateType = BTLDateTypes.CREATEDATE Then
|
||||
' DbProjList = DbControllers.m_ProjController.GetLastDesc(dtStart, dtEnd, 100000, True, bViewArchived)
|
||||
' 'DbProjList = DbControllers.m_ProjController.GetLastDesc(dtStart, dtEnd, nRowQuantity * 3, True, bViewArchived)
|
||||
'Else
|
||||
' DbProjList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity * 3, True, bViewArchived)
|
||||
'End If
|
||||
'For Each Project In DbProjList
|
||||
' If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
' ' verifico se ha prod
|
||||
' If Not IsNothing(Project.nProdId) And Project.nProdId > 0 Then
|
||||
' ' verifico se prod e' gia' stato creato
|
||||
' Dim SameProdItem As ProdItem = m_ProjectList.FirstOrDefault(Function(x) Not IsNothing(x.ProdFileVM) AndAlso Not IsNothing(x.ProdFileVM.nProdId) AndAlso x.ProdFileVM.nProdId = Project.nProdId)
|
||||
' If Not IsNothing(SameProdItem) Then
|
||||
' SameProdItem.ProjFileList.Add(New ProjFileVM(Project))
|
||||
' Else
|
||||
' ' recupero Prod
|
||||
' Dim NewDbProd As ProdFileM = DbControllers.m_ProdController.FindCoreByProdId(Project.nProdId)
|
||||
' If Not IsNothing(NewDbProd) Then
|
||||
' m_ProjectList.Add(New ProdItem(New ProdFileVM(NewDbProd), New ProjFileVM(Project)))
|
||||
' End If
|
||||
' End If
|
||||
' Else
|
||||
' m_ProjectList.Add(New ProdItem(New ProjFileVM(Project)))
|
||||
' End If
|
||||
'Next
|
||||
m_ProjectList = New ObservableCollection(Of Core.ProdItem)(DbControllers.m_ProdController.GetLastDescFull(dtStart, dtEnd, nRowQuantity * 3, True, bViewArchived))
|
||||
'Dim sMachine As String = ""
|
||||
'Dim sBtlFileName As String = ""
|
||||
'Dim sListName As String = ""
|
||||
'Dim bIsCreationDate As Boolean = True
|
||||
'If SelFilterType.Id = FilterTypes.ID Then
|
||||
' ' sMachine = SearchText
|
||||
'ElseIf SelFilterType.Id = FilterTypes.BTLFILENAME Then
|
||||
' sBtlFileName = SearchText
|
||||
'ElseIf SelFilterType.Id = FilterTypes.LISTNAME Then
|
||||
' sListName = SearchText
|
||||
'ElseIf SelFilterType.Id = FilterTypes.MACHINE Then
|
||||
' sMachine = SearchText
|
||||
'End If
|
||||
'm_ProjectList = New ObservableCollection(Of Core.ProdItem)(DbControllers.m_ProdController.GetLastDescFull(dtStart, dtEnd, bIsCreationDate, nRowQuantity * 3, True, sMachine, sBtlFileName, sListName, bViewArchived))
|
||||
NotifyPropertyChanged(NameOf(ProjectList))
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim DbProdList As New List(Of ProdFileM)
|
||||
DbProdList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True, bViewArchived)
|
||||
If GoToProd Then
|
||||
For Each Project In DbProdList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
|
||||
Project.nType = Map.refProjManagerVM.CurrProj.nType Then
|
||||
If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProdItem(New ProdFileVM(Project)))
|
||||
'Else
|
||||
' DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
For Each Project In DbProdList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
If File.Exists(sPath) Then
|
||||
' recupero i proj
|
||||
Dim ProjList As New List(Of ProjectFileVM)
|
||||
For Each ProjFileId In Project.nProjIdList
|
||||
Dim ProjFileM As ProjectFileM = DbControllers.m_ProjController.FindByProjIdConv(ProjFileId)
|
||||
ProjList.Add(New ProjFileVM(ProjFileM))
|
||||
Next
|
||||
m_ProjectList.Add(New ProdItem(New ProdFileVM(Project), ProjList))
|
||||
'Else
|
||||
' DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Overrides Function UpdatePageList() As Boolean
|
||||
Dim FilteredList As IEnumerable(Of Core.ProdItem) = m_ProjectList.Where(Function(x)
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso
|
||||
((m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso x.ProjFileList.Any(Function(y) DirectCast(y, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso x.ProjFileList.Any(Function(y) DirectCast(y, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso x.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then Return False
|
||||
Return True
|
||||
End Function)
|
||||
Dim nPageRowQty As Integer = 0
|
||||
Select Case m_SelRowQuantity
|
||||
Case RowQuantities.TEN
|
||||
nPageRowQty = 10
|
||||
Case RowQuantities.TWENTY
|
||||
nPageRowQty = 20
|
||||
Case RowQuantities.THIRTY
|
||||
nPageRowQty = 30
|
||||
End Select
|
||||
Dim nStart = (nPageIndex - 1) * nPageRowQty
|
||||
Dim nEnd = Math.Min((nPageIndex * nPageRowQty), FilteredList.Count())
|
||||
If nStart > FilteredList.Count() Then
|
||||
Return False
|
||||
End If
|
||||
' FilteredList = FilteredList.OrderBy(Of ProdItem)()
|
||||
m_PageList = New ObservableCollection(Of ProdItem)(FilteredList.Skip(nStart).Take(nPageRowQty).Select(Function(x) x))
|
||||
'm_PageList.Clear()
|
||||
'For Index = nStart To nEnd
|
||||
' m_PageList.Add(FilteredList(Index))
|
||||
'Next
|
||||
NotifyPropertyChanged(NameOf(PageList))
|
||||
Return True
|
||||
|
||||
'Dim bProjectOk As Boolean = True
|
||||
''If TypeOf Proj Is ProjFileVM Then
|
||||
'Dim CurrProj As ProdItem = DirectCast(PROJ, ProdItem)
|
||||
'If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
' (m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not CurrProj.ProjFileList.Any(Function(x) SearchDate.Contains(DirectCast(x, ProjFileVM).dtExportDate.Date))) OrElse
|
||||
' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
'If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
'ElseIf TypeOf Proj Is ProdFileVM Then
|
||||
' Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
' (m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
'End If
|
||||
' Return bProjectOk
|
||||
End Function
|
||||
|
||||
Public Overrides Sub Archive()
|
||||
If IsNothing(SelProject) Then Return
|
||||
If Not IsNothing(SelProject.ProdFileVM) Then
|
||||
' archivio il progetto
|
||||
DbControllers.m_ProdController.UpdateArchived(SelProject.ProdFileVM.nProdId, Not SelProject.bIsArchived)
|
||||
NotifyPropertyChanged(NameOf(Archive_Msg))
|
||||
End If
|
||||
' aggiorno lista progetti
|
||||
RefreshProjectList()
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Delete()
|
||||
If IsNothing(SelProject) Then Return
|
||||
' recupero indice per riselezionare
|
||||
Dim ProjListIndex As Integer = m_ProjectList.IndexOf(SelProject)
|
||||
' verifico se proj selezionato e' il corrente
|
||||
If Not IsNothing(Map.refProjManagerVM.CurrProj) AndAlso SelProject.ProjFileList.Any(Function(x) x.nProjId = Map.refProjManagerVM.CurrProj.nProjId) Then
|
||||
If m_ProjectType = ProjectType.PROJ AndAlso MessageBox.Show(EgtMsg(61872), EgtMsg(30009), MessageBoxButton.OKCancel, MessageBoxImage.Warning) = MessageBoxResult.Cancel Then
|
||||
Return
|
||||
Else
|
||||
m_ChangeOpenedProjectOnCancel = True
|
||||
End If
|
||||
End If
|
||||
' verifico se prod selezionato e' il corrente
|
||||
If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso SelProject.ProdFileVM.nProdId = Map.refProdManagerVM.CurrProd.nProdId Then
|
||||
If m_ProjectType = ProjectType.PROD AndAlso MessageBox.Show(EgtMsg(61872), EgtMsg(30009), MessageBoxButton.OKCancel, MessageBoxImage.Warning) = MessageBoxResult.Cancel Then
|
||||
Return
|
||||
Else
|
||||
m_ChangeOpenedProjectOnCancel = True
|
||||
End If
|
||||
End If
|
||||
' rimuovo da lista ultimi progetti aperti
|
||||
For Each Project In SelProject.ProjFileList
|
||||
Map.refProjManagerVM.m_MruFiles.Remove(Project.sProjPath)
|
||||
Next
|
||||
Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
|
||||
If Not IsNothing(SelProject.ProdFileVM) Then
|
||||
Map.refProdManagerVM.m_MruFiles.Remove(SelProject.ProdFileVM.sProdPath)
|
||||
Map.refProdManagerVM.NotifyPropertyChanged(NameOf(Map.refProdManagerVM.MruFileNames))
|
||||
End If
|
||||
' cancello progetto
|
||||
If Not IsNothing(SelProject.ProdFileVM) Then
|
||||
DbControllers.m_ProdController.DeleteProd(SelProject.ProdFileVM.nProdId, True)
|
||||
'' cancello cartella del Prod
|
||||
'Try
|
||||
' Directory.Delete(SelProject.ProdFileVM.sProdDirPath, True)
|
||||
'Catch ex As Exception
|
||||
' EgtOutLog("Error in deleting directory " & SelProject.ProdFileVM.sProdDirPath)
|
||||
'End Try
|
||||
End If
|
||||
For Each Project In SelProject.ProjFileList
|
||||
DbControllers.m_ProjController.DeleteProj(Project.nProjId, True)
|
||||
'' cancello cartella del Proj
|
||||
'Try
|
||||
' Directory.Delete(Project.sProjDirPath, True)
|
||||
'Catch ex As Exception
|
||||
' EgtOutLog("Error in deleting directory " & Project.sProjDirPath)
|
||||
'End Try
|
||||
Next
|
||||
' aggiorno lista progetti
|
||||
RefreshProjectList()
|
||||
' ripristino selezionato
|
||||
If ProjListIndex >= 0 AndAlso ProjListIndex <= m_ProjectList.Count - 1 Then
|
||||
SelProject = m_ProjectList(ProjListIndex)
|
||||
NotifyPropertyChanged(NameOf(SelProject))
|
||||
End If
|
||||
' reset dei controller per tornare in sync
|
||||
DbControllers.m_ProjController.ResetController()
|
||||
DbControllers.m_ProdController.ResetController()
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Cancel()
|
||||
If m_ChangeOpenedProjectOnCancel Then
|
||||
Dim bOpened As Boolean = False
|
||||
If m_ProjectType = ProjectType.PROJ Then
|
||||
For Each ProjectName In Map.refProjManagerVM.m_MruFiles.FileNames
|
||||
If Not String.IsNullOrWhiteSpace(ProjectName) Then
|
||||
Dim sProjId As String = Path.GetFileNameWithoutExtension(ProjectName)
|
||||
If Not String.IsNullOrWhiteSpace(sProjId) Then
|
||||
Dim nProjId As Integer = 0
|
||||
Integer.TryParse(sProjId, nProjId)
|
||||
Dim PjFileM = DbControllers.m_ProjController.FindByProjIdConv(nProjId)
|
||||
Dim PjFileVM = New ProjFileVM(PjFileM)
|
||||
Map.refProjManagerVM.OpenProject(PjFileVM)
|
||||
bOpened = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
If Not bOpened Then
|
||||
Map.refProjManagerVM.OpenProject(m_ProjectList(0).ProjFileList(0))
|
||||
End If
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
For Each ProjectName In Map.refProdManagerVM.m_MruFiles.FileNames
|
||||
If Not String.IsNullOrWhiteSpace(ProjectName) Then
|
||||
Dim sProdId As String = Path.GetFileNameWithoutExtension(ProjectName)
|
||||
If Not String.IsNullOrWhiteSpace(sProdId) Then
|
||||
Dim nProdId As Integer = 0
|
||||
Integer.TryParse(sProdId, nProdId)
|
||||
Dim PjFileM = DbControllers.m_ProdController.FindCoreByProdId(nProdId)
|
||||
Dim PjFileVM = New ProdFileVM(PjFileM)
|
||||
Map.refProdManagerVM.OpenProject(PjFileVM)
|
||||
bOpened = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
CloseWindow(False)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
@@ -12,14 +12,17 @@ Public Class OpenProjectFileDialogVM
|
||||
|
||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
m_ProjectType = ProjectType
|
||||
m_GoToProd = GoToProd
|
||||
' carico colonne
|
||||
LoadColumns(ProjectType)
|
||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
' carico lista progetti
|
||||
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
||||
RefreshProjectList(GoToProd)
|
||||
SetFixedProjectList(False)
|
||||
RefreshProjectList()
|
||||
Else
|
||||
SetFixedProjectList(True)
|
||||
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
||||
NotifyPropertyChanged(NameOf(ProjectList))
|
||||
End If
|
||||
@@ -27,7 +30,7 @@ Public Class OpenProjectFileDialogVM
|
||||
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
||||
End Function
|
||||
|
||||
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
Public Overrides Sub RefreshProjectList()
|
||||
m_ProjectList.Clear()
|
||||
' calcolo periodo e righe
|
||||
Dim dtStart As DateTime
|
||||
@@ -44,16 +47,16 @@ Public Class OpenProjectFileDialogVM
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(31)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(31 * 3)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(31 * 6)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
dtStart = dtStartDate + TimeSpan.FromDays(1)
|
||||
dtEnd = dtEndDate
|
||||
dtEnd = dtEndDate + TimeSpan.FromDays(1)
|
||||
dtStart = dtStartDate
|
||||
End Select
|
||||
' leggo da db
|
||||
If m_ProjectType = ProjectType.PROJ Then
|
||||
@@ -64,32 +67,17 @@ Public Class OpenProjectFileDialogVM
|
||||
Else
|
||||
DbProjectList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, False)
|
||||
End If
|
||||
For Each Project In DbProjectList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
If File.Exists(sPath) Then
|
||||
m_ProjectList.Add(New ProjFileVM(Project))
|
||||
Else
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(Project.nProjId, False)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000"))
|
||||
End If
|
||||
Next
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim DbProjectList As New List(Of ProdFileM)
|
||||
DbProjectList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
If GoToProd Then
|
||||
If m_GoToProd Then
|
||||
For Each Project In DbProjectList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
|
||||
Project.nType = Map.refProjManagerVM.CurrProj.nType Then
|
||||
If File.Exists(sPath) Then
|
||||
m_ProjectList.Add(New ProdFileVM(Project))
|
||||
m_ProjectList.Add(New ProjFileVM(Project))
|
||||
Else
|
||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId, True)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
End If
|
||||
End If
|
||||
@@ -97,16 +85,31 @@ Public Class OpenProjectFileDialogVM
|
||||
Else
|
||||
For Each Project In DbProjectList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
If File.Exists(sPath) Then
|
||||
m_ProjectList.Add(New ProdFileVM(Project))
|
||||
m_ProjectList.Add(New ProjFileVM(Project))
|
||||
Else
|
||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(Project.nProjId, False)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000"))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim DbProjectList As New List(Of ProdFileM)
|
||||
DbProjectList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
For Each Project In DbProjectList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
If File.Exists(sPath) Then
|
||||
m_ProjectList.Add(New ProdFileVM(Project))
|
||||
Else
|
||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId, True)
|
||||
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -157,7 +160,7 @@ Public Class OpenProjectFileDialogVM
|
||||
Map.refProdManagerVM.m_MruFiles.Remove(SelProject.sProdPath)
|
||||
Map.refProdManagerVM.NotifyPropertyChanged(NameOf(Map.refProdManagerVM.MruFileNames))
|
||||
' cancello progetto
|
||||
DbControllers.m_ProdController.DeleteProd(SelProject.nProdId)
|
||||
DbControllers.m_ProdController.DeleteProd(SelProject.nProdId, True)
|
||||
' riporto prod in proj
|
||||
Dim nCurrCtx As Integer = EgtGetCurrentContext()
|
||||
Dim nTempCtx As Integer = EgtInitContext()
|
||||
|
||||
@@ -274,15 +274,26 @@ Public Class ProdManagerVM
|
||||
m_TempCurrProd = TempCurrPd
|
||||
Dim sFilePath As String = ""
|
||||
' se la string è vuota
|
||||
Dim OpenProjectFileDialogVM As OpenProjectFileDialogVM = Nothing
|
||||
If IsNothing(TempCurrProd) Then
|
||||
' apro dialogo di scelta file
|
||||
OpenProjectFileDialogVM = New OpenProjectFileDialogVM
|
||||
Dim OpenFile As New OpenProjectFileDialogV(Application.Current.MainWindow, OpenProjectFileDialogVM)
|
||||
Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROD)
|
||||
If IsNothing(DialogResult) OrElse Not DialogResult Then Return
|
||||
sFilePath = OpenProjectFileDialogVM.SelProject.sProdPath
|
||||
TempCurrProd = OpenProjectFileDialogVM.SelProject
|
||||
If GetMainPrivateProfileInt(S_GENERAL, K_PROJECTMODE, 0) = 1 Then
|
||||
Dim OpenProdFileDialogVM As NewOpenProjectFileDialogVM = Nothing
|
||||
' apro dialogo di scelta Prod
|
||||
OpenProdFileDialogVM = New NewOpenProjectFileDialogVM
|
||||
Dim OpenFile As New NewOpenProjectFileDialogV(Application.Current.MainWindow, OpenProdFileDialogVM)
|
||||
Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROD)
|
||||
If IsNothing(DialogResult) OrElse Not DialogResult Then Return
|
||||
sFilePath = OpenProdFileDialogVM.SelProject.ProdFileVM.sProdPath
|
||||
m_TempCurrProd = OpenProdFileDialogVM.SelProject.ProdFileVM
|
||||
Else
|
||||
Dim OpenProjectFileDialogVM As OpenProjectFileDialogVM = Nothing
|
||||
' apro dialogo di scelta file
|
||||
OpenProjectFileDialogVM = New OpenProjectFileDialogVM
|
||||
Dim OpenFile As New OpenProjectFileDialogV(Application.Current.MainWindow, OpenProjectFileDialogVM)
|
||||
Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROD)
|
||||
If IsNothing(DialogResult) OrElse Not DialogResult Then Return
|
||||
sFilePath = OpenProjectFileDialogVM.SelProject.sProdPath
|
||||
TempCurrProd = OpenProjectFileDialogVM.SelProject
|
||||
End If
|
||||
Else
|
||||
sFilePath = If(Not IsNothing(TempCurrProd.sProdPath), TempCurrProd.sProdPath, "")
|
||||
End If
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class ProdFileVM
|
||||
Inherits Core.ProdFileVM
|
||||
@@ -16,6 +17,16 @@ Public Class ProdFileVM
|
||||
If Not IsNothing(TempProj) Then sBTLFileName &= TempProj.sListName
|
||||
Next
|
||||
SetBTLFileName(sBTLFileName)
|
||||
' verifico valore description
|
||||
If Not IsNothing(ProdFileM) AndAlso String.IsNullOrWhiteSpace(ProdFileM.sName) Then
|
||||
For Each CurrProj In nProjIdList
|
||||
Dim TempProj As ProjFileM = DbControllers.m_ProjController.FindByProjIdConv(CurrProj)
|
||||
If Not IsNothing(TempProj) AndAlso Not String.IsNullOrWhiteSpace(TempProj.sBTLFileName) Then
|
||||
DbControllers.m_ProdController.UpdateDescription(ProdFileM.nProdId, TempProj.sBTLFileName)
|
||||
ProdFileM.sName = TempProj.sBTLFileName
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
@@ -145,7 +156,7 @@ Public Class ProdFileVM
|
||||
End Try
|
||||
Map.refProdManagerVM.m_MruFiles.Remove(CurrProject.sProdPath)
|
||||
Map.refProdManagerVM.NotifyPropertyChanged(NameOf(Map.refProdManagerVM.MruFileNames))
|
||||
DbControllers.m_ProdController.DeleteProd(CurrProject.nProdId)
|
||||
DbControllers.m_ProdController.DeleteProd(CurrProject.nProdId, False)
|
||||
If CurrProject.nProdId = Map.refProjManagerVM.CurrProj.nProdId Then
|
||||
' reset prod in path proj
|
||||
Map.refProjManagerVM.UpdateCurrProj()
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 596 B |
@@ -68,8 +68,6 @@ Public Module DbControllers
|
||||
DataLayer.DbConfig.CheckMigrateDb()
|
||||
DataLayer.DbConfig.CheckUser(sUser, sPwd, m_bNetwork AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK))
|
||||
DataLayer.DbConfig.CheckViews(sUser, sPwd)
|
||||
' riattivare il dump per il backup
|
||||
'DataLayer.DbConfig.DumpDB("C:\Program Files\MariaDB 10.5\bin\mysqldump", "c:\Temp\Pippo.sql")
|
||||
If m_bNetwork AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK) Then
|
||||
' imposto cartella condivisa
|
||||
GetMainPrivateProfileString(S_GENERAL, K_SHAREDFOLDER, Map.refMainWindowVM.MainWindowM.sDataDir, sSharedFolder)
|
||||
|
||||
@@ -242,6 +242,11 @@
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Width" Value="30"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToolBar_SmallToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
<Setter Property="Height" Value="20"/>
|
||||
<Setter Property="Width" Value="20"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToolBar_TextToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
@@ -351,6 +356,11 @@
|
||||
<Setter Property="Margin" Value="2.5,0,2.5,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OpenWnd_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="Foreground" Value="DarkGray"/>
|
||||
<Setter Property="Margin" Value="0,0,20,0"/>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- TextBox -->
|
||||
|
||||
@@ -554,7 +554,10 @@ Public Class WarehouseWndVM
|
||||
SectionXMaterialList = New ObservableCollection(Of SectionXMaterial)(GetSectionXMaterialsFromWarehouse())
|
||||
ParamIndex = 1
|
||||
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
|
||||
SParamList.Add(GetSParamFromWarehouse(ParamIndex))
|
||||
Dim SParamItem As SParam = GetSParamFromWarehouse(ParamIndex)
|
||||
If Not IsNothing(SParamItem) Then
|
||||
SParamList.Add(SParamItem)
|
||||
End If
|
||||
ParamIndex += 1
|
||||
End While
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user