Merge branch 'master' into feature/NewOpenWindow
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
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"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.5.7.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.7.1")>
|
||||
<Assembly: AssemblyVersion("2.5.8.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.8.1")>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
|
||||
IsClosable="False"
|
||||
MinHeight="500" MinWidth="500" Topmost="True"
|
||||
MinHeight="500" MinWidth="500"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
|
||||
<EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
@@ -22,7 +22,7 @@
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Header="Filters"
|
||||
<GroupBox Header="{Binding Filters_Msg}"
|
||||
Margin="5"
|
||||
Visibility="{Binding Filters_Visibility}">
|
||||
<Grid>
|
||||
@@ -80,7 +80,7 @@
|
||||
Visibility="{Binding SearchText_Visibility}"/>
|
||||
<StackPanel Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="Rows"
|
||||
<TextBlock Text="{Binding Rows_Msg}"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding RowQuantityList}"
|
||||
SelectedIndex="{Binding SelRowQuantity}"
|
||||
@@ -149,7 +149,7 @@
|
||||
<DataGridTemplateColumn x:Key="colARCHIVED">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="\Resources\CalcPanel\Edit.png"
|
||||
<Image Source="\Resources\OpenProjectFileDialog\Archived.png"
|
||||
Visibility="{Binding Archived_Visibility}"
|
||||
Height="15"
|
||||
Width="15"
|
||||
@@ -163,7 +163,6 @@
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<!--<Setter Property="IsEnabled" Value="{Binding bIsEnabled}"/>-->
|
||||
<Setter Property="FontWeight" Value="DemiBold"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
||||
@@ -224,78 +223,6 @@
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<!--<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
|
||||
ItemsSource="{Binding ProjFileList}"
|
||||
CanUserAddRows="False"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserResizeRows="False"
|
||||
SelectionMode="Single"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
Margin="0"
|
||||
BindingColumns="{Binding Path=DataContext.ProjColumns, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}">
|
||||
<DataGrid.Resources>
|
||||
-->
|
||||
<!-- ProjId -->
|
||||
<!--
|
||||
<DataGridTextColumn x:Key="colPROJID" Binding="{Binding sProjId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Id_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
-->
|
||||
<!-- Project Name -->
|
||||
<!--
|
||||
<DataGridTextColumn x:Key="colPROJNAME" Binding="{Binding sDescription}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
-->
|
||||
<!-- BTL FileName -->
|
||||
<!--
|
||||
<DataGridTextColumn x:Key="colBTLNAME" Binding="{Binding sBTLFileName}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
-->
|
||||
<!-- ListName -->
|
||||
<!--
|
||||
<DataGridTextColumn x:Key="colLISTNAME" Binding="{Binding sListName}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.ListName_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
-->
|
||||
<!-- Exported date -->
|
||||
<!--
|
||||
<DataGridTextColumn x:Key="colEXPDATE" Binding="{Binding dtExportDate}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.ExportDate_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</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>
|
||||
</DataGrid.Resources>
|
||||
</EgtBEAMWALL:EgtDataGrid>-->
|
||||
</DataTemplate>
|
||||
</DataGrid.RowDetailsTemplate>
|
||||
</EgtBEAMWALL:EgtDataGrid>
|
||||
@@ -306,6 +233,7 @@
|
||||
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}"
|
||||
|
||||
@@ -80,7 +80,7 @@ Public Class NewOpenProjectFileDialogV
|
||||
End Sub
|
||||
|
||||
Private Sub MainDataGrid_CellEditEnding(sender As Object, e As DataGridCellEditEndingEventArgs)
|
||||
m_OpenProjFileDialogVM.SetIsEditNameActive(False)
|
||||
'm_OpenProjFileDialogVM.SetIsEditNameActive(False)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -32,6 +32,7 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
LAST3MONTHS = 1
|
||||
LAST6MONTHS = 2
|
||||
PERIOD = 3
|
||||
ALWAYS = 4
|
||||
End Enum
|
||||
|
||||
Public Enum RowQuantities As Integer
|
||||
@@ -130,10 +131,13 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
' 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
|
||||
@@ -185,8 +189,8 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({"Last Month", "Last 3 Months", "Last 6 Months", EgtMsg(62531)})
|
||||
Public ReadOnly Property DayTypeList As List(Of String)
|
||||
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
|
||||
@@ -206,13 +210,16 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
Select Case PrevSelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(31)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(31 * 3)
|
||||
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(31 * 6)
|
||||
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))
|
||||
@@ -383,11 +390,24 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
Set(value As Boolean)
|
||||
m_bViewArchived = value
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_VIEWARCHIVED, If(bViewArchived, 1, 0))
|
||||
m_colArchived_Name.Visible = value
|
||||
RefreshProjectList()
|
||||
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
|
||||
@@ -405,9 +425,16 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Return "Open Project"
|
||||
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)
|
||||
@@ -505,6 +532,12 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Rows_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61995)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
' Definizione comandi
|
||||
@@ -516,6 +549,8 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
#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)
|
||||
@@ -525,13 +560,13 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(31)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(31 * 3)
|
||||
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(31 * 6)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
@@ -747,6 +782,8 @@ End Class
|
||||
Public Class ProdItem
|
||||
Inherits VMBase
|
||||
|
||||
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
|
||||
|
||||
Protected m_ProdFileVM As ProdFileVM
|
||||
Public ReadOnly Property ProdFileVM As ProdFileVM
|
||||
Get
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -146,7 +146,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
|
||||
@@ -167,7 +167,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
|
||||
@@ -408,6 +408,31 @@ 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"
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
|
||||
Public ReadOnly Property sPROD As String
|
||||
Get
|
||||
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -233,6 +233,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
@@ -273,6 +274,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
|
||||
@@ -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.7.1")]
|
||||
[assembly: AssemblyFileVersion("2.5.7.1")]
|
||||
[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
|
||||
|
||||
@@ -39,6 +46,23 @@ Public Class SupervisorMachGroupPanelVM
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#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)
|
||||
@@ -166,3 +190,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.7.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.7.1")>
|
||||
<Assembly: AssemblyVersion("2.5.8.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.8.1")>
|
||||
|
||||
@@ -43,13 +43,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,24 +77,25 @@ 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
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
@@ -297,6 +298,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
|
||||
@@ -1084,12 +1079,12 @@ Public Class MachParam
|
||||
Select Case nType
|
||||
Case MachParamType.DOUBLE_
|
||||
StringToDoubleAdv(value, dNewValue, True)
|
||||
m_IsModifiedValue = Math.Abs( dNewValue - m_dValue) > EPS_SMALL
|
||||
m_IsModifiedValue = Math.Abs(dNewValue - m_dValue) > EPS_SMALL
|
||||
Case MachParamType.LENGTH
|
||||
StringToLenAdv(value, dNewValue, True)
|
||||
m_IsModifiedValue = Math.Abs( dNewValue - m_dValue) > EPS_SMALL
|
||||
m_IsModifiedValue = Math.Abs(dNewValue - m_dValue) > EPS_SMALL
|
||||
Case Else
|
||||
m_IsModifiedValue = String.Compare( value, m_sValue) <> 0
|
||||
m_IsModifiedValue = String.Compare(value, m_sValue) <> 0
|
||||
End Select
|
||||
End If
|
||||
' se valore immesso è diverso e password non inserita
|
||||
|
||||
@@ -997,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
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -171,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
|
||||
@@ -283,60 +328,18 @@ 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
|
||||
|
||||
@@ -70,5 +70,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.5.7.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.7.1")>
|
||||
<Assembly: AssemblyVersion("2.5.8.1")>
|
||||
<Assembly: AssemblyFileVersion("2.5.8.1")>
|
||||
|
||||
+21
-12
@@ -8,6 +8,16 @@ 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?
|
||||
@@ -44,24 +54,27 @@ Public Class NewOpenProjectFileDialogVM
|
||||
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
|
||||
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, nRowQuantity, True, bViewArchived)
|
||||
DbProjList = DbControllers.m_ProjController.GetLastDesc(dtStart, dtEnd, nRowQuantity * 3, True, bViewArchived)
|
||||
Else
|
||||
DbProjList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, True, bViewArchived)
|
||||
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
|
||||
@@ -128,11 +141,6 @@ Public Class NewOpenProjectFileDialogVM
|
||||
' archivio il progetto
|
||||
DbControllers.m_ProdController.UpdateArchived(SelProject.ProdFileVM.nProdId, Not SelProject.bIsArchived)
|
||||
NotifyPropertyChanged(NameOf(Archive_Msg))
|
||||
Else
|
||||
If m_SelProject.ProjFileList.Count > 0 Then
|
||||
' DbControllers.m_ProjController.archived
|
||||
Else Return
|
||||
End If
|
||||
End If
|
||||
' aggiorno lista progetti
|
||||
RefreshProjectList()
|
||||
@@ -254,6 +262,7 @@ Public Class ProdItem
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
DbControllers.m_ProdController.UpdateDescription(m_ProdFileVM.nProdId, value)
|
||||
m_ProdFileVM.sName = value
|
||||
m_delIsModifiedSetUp(False)
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -46,16 +46,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
|
||||
|
||||
@@ -282,6 +282,7 @@ Public Class ProdManagerVM
|
||||
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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class ProdFileVM
|
||||
Inherits Core.ProdFileVM
|
||||
@@ -155,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, True)
|
||||
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 |
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user