Compare commits

..

36 Commits

Author SHA1 Message Date
Emmanuele Sassi 3e84659fca -aggiunta gestione backup all'uscita programma
- aggiunta gestione stato durante backup e restore
2023-08-21 11:38:43 +02:00
Emmanuele Sassi 638461a4e3 - gestione backup e ripristino
- aggiornamento pacchetto ionic.zip con dotnetzip
2023-07-31 09:59:05 +02:00
Emmanuele Sassi bf1dd1d526 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/Backup&Restore 2023-07-27 12:47:08 +02:00
Emmanuele Sassi 7d121b2bd5 - aggiunta grafica 2023-07-27 12:46:28 +02:00
Emmanuele Sassi 0fc7d826a8 Modifiche per campo Description 2023-07-27 12:45:16 +02:00
Samuele Locatelli dfb3e1f74a COmpletato metodi con
- password zip
- gestione temp folder
- ripristino altri DB
2023-07-27 12:23:53 +02:00
Samuele Locatelli 8980da46be Aggiunti esempi e conf x testare opzioni export/import 2023-07-27 09:16:21 +02:00
Samuele Locatelli 531da47cbc MySQL backup/Restore:
- nota sui parametri da impiegare
- update eseguibili x call default
- stopwatch esempio tempi esecuzione
2023-07-27 08:50:59 +02:00
Samuele Locatelli b279a287ec test backup & restore 2023-07-27 07:53:00 +02:00
Emmanuele Sassi 8b6c9b38cc Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/ModificheDaDB 2023-06-16 15:06:30 +02:00
Emmanuele Sassi 3133c1d78c - Aggiunto parametro Description a ProjFileVM
- Modificati filtri apertura file
2023-06-16 15:06:18 +02:00
Samuele Locatelli 2ae08165f4 PROD:
- Aggiunta metodo recupero dati filtrati periodo e attivi
2023-06-16 13:23:50 +02:00
Samuele Locatelli f77ea8309c Modifica migration x valore default IsActive 2023-06-16 13:23:34 +02:00
Samuele Locatelli 3a9e8651e7 DataLayer / ProjController:
- Aggiunto metodo x recupero dati per export date
2023-06-16 09:30:50 +02:00
Emmanuele Sassi eddd7b93ca Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/ModificheDaDB 2023-06-15 13:00:10 +02:00
Samuele Locatelli 1d9182f96d Merge remote-tracking branch 'origin/feature/ModificheDaDB' into DataLayer 2023-06-15 12:58:53 +02:00
Samuele Locatelli c3916dcf41 Aggiunta metodo filtro periodo progetti 2023-06-15 12:58:47 +02:00
Emmanuele Sassi 15bfc1bc15 Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/ModificheDaDB 2023-06-15 10:27:00 +02:00
Emmanuele Sassi cee4375ea3 - correzione isreadonly su PosZ 2023-06-15 10:20:19 +02:00
Emmanuele Sassi 5b04080f35 EgtBEAMWALL 2.5f2 :
- aggiornamento versioni
2023-06-13 12:21:08 +02:00
Emmanuele Sassi 0d7cc99a2d Merge branch 'fix/UpdatePriorityInProd' 2023-06-13 12:15:16 +02:00
Emmanuele Sassi d48deed9e0 - gestione presenza Priority da flag su WallData 2023-06-12 12:50:26 +02:00
DarioS 4d8f0d6411 EgtBeamWall :
- aggiornata libreria esterna EgtUILib.dll.
2023-06-12 10:37:54 +02:00
Emmanuele Sassi 1cff7af4a6 EgtBEAMWALL 2.5f1 :
- aggiornamento versioni
2023-06-12 10:25:20 +02:00
Emmanuele Sassi c3cc4518d8 Merge branch 'fix/MacComm' 2023-06-12 10:08:33 +02:00
Emmanuele Sassi 04debf6b51 Merge branch 'feature/MachLogFilter' 2023-06-12 10:08:24 +02:00
Emmanuele Sassi cc71f0a34f - aggiunti messaggi nelle varie lingue 2023-06-12 10:06:49 +02:00
Emmanuele Sassi 3787b4e1f5 - commentati log 2023-06-12 09:16:44 +02:00
Emmanuele Sassi c968befafb - aggiunta log 2023-06-09 12:21:58 +02:00
Emmanuele Sassi df3b6ae657 - gestito update del priority su pezzi in ottimizzazione
- resettato stato calc su modifica priority
2023-06-08 19:32:22 +02:00
Samuele Locatelli 668a37c6da update lettura ultimi Proj 2023-06-08 18:06:43 +02:00
Samuele Locatelli f4b18d962d Update readme 2023-06-08 17:18:35 +02:00
Samuele Locatelli eaa43c6209 Fix gestione cancellazione logica x ricerche 2023-06-08 17:17:15 +02:00
Samuele Locatelli 99dd1b6807 Update conversioni + metodi x NUOVI campi:
- Projdescription (modificabile)
- IsActive (per cancellazione logica)
2023-06-08 17:10:39 +02:00
Samuele Locatelli 5b6f719349 Update modello dati + migrazioni 2023-06-08 17:10:17 +02:00
Emmanuele Sassi 93b3ddec79 - gestito sinclock su lista ThreadCommand in Supervisor 2023-06-08 13:01:00 +02:00
68 changed files with 3756 additions and 2203 deletions
+7
View File
@@ -127,6 +127,8 @@ Public Module ConstIni
Public Const K_STARTDATE As String = "StartDate" Public Const K_STARTDATE As String = "StartDate"
Public Const K_ENDDATE As String = "EndDate" Public Const K_ENDDATE As String = "EndDate"
Public Const S_OPENFILEDIALOG As String = "OpenFileDialog"
'Public Const S_NEST As String = "Nest" 'Public Const S_NEST As String = "Nest"
Public Const K_NESTEXEC As String = "NestExec" Public Const K_NESTEXEC As String = "NestExec"
Public Const K_FLIPROT As String = "FlipRot" Public Const K_FLIPROT As String = "FlipRot"
@@ -159,4 +161,9 @@ Public Module ConstIni
Public Const K_TYPE As String = "Type" Public Const K_TYPE As String = "Type"
Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity" Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity"
Public Const S_BACKUPANDRESTORE As String = "Backup&Restore"
Public Const K_EXTERNALBACKUPACTIVE As String = "ExternalBackupActive"
Public Const K_EXTERNALFILEPATH As String = "ExternalFilePath"
Public Const K_REMINDERFREQUENCY As String = "ReminderFrequency"
End Module End Module
@@ -438,6 +438,9 @@ Public Class EgtDataGridColumn
End If End If
End Set End Set
End Property End Property
Public Sub ResetToOrigIsReadOnly()
IsReadOnly = m_OrigIsReadOnly
End Sub
Friend OldCanUserReorder As Boolean? Friend OldCanUserReorder As Boolean?
Private m_CanUserReorder As Boolean Private m_CanUserReorder As Boolean
@@ -16,6 +16,8 @@ Public Module LoadingWndHelper
CHANGEPARAM = 10 CHANGEPARAM = 10
CREATINGPDF = 11 CREATINGPDF = 11
CHANGEMATERIAL = 12 CHANGEMATERIAL = 12
BACKUP = 13
RESTORE = 14
End Enum End Enum
Dim m_MainWindow As Windows.Window Dim m_MainWindow As Windows.Window
+2 -2
View File
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below: ' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.5.5.4")> <Assembly: AssemblyVersion("2.5.6.2")>
<Assembly: AssemblyFileVersion("2.5.5.4")> <Assembly: AssemblyFileVersion("2.5.6.2")>
@@ -5,9 +5,9 @@
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core" xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
Title="{Binding Title}" Title="{Binding Title}"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}" Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False" WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
Height="500" Width="500" Topmost="True" MinHeight="500" MinWidth="500" Topmost="True"
DataContext="{Binding RelativeSource={RelativeSource Self}}"> DataContext="{Binding RelativeSource={RelativeSource Self}}">
<EgtWPFLib5:EgtCustomWindow.Resources> <EgtWPFLib5:EgtCustomWindow.Resources>
@@ -21,42 +21,105 @@
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel> <GroupBox Header="Filters"
<Grid Grid.Row="0" Margin="5"> Margin="5">
<Grid.RowDefinitions> <Grid>
<RowDefinition Height="1*" /> <Grid.RowDefinitions>
<RowDefinition Height="1*" /> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> <RowDefinition Height="Auto"/>
<Grid.ColumnDefinitions> </Grid.RowDefinitions>
<ColumnDefinition Width="1*" /> <Grid>
<ColumnDefinition Width="1*" /> <Grid.ColumnDefinitions>
</Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</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>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<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="Rows"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding RowQuantityList}"
SelectedIndex="{Binding SelRowQuantity}"
Style="{StaticResource FeatureComboBox}"/>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<TextBlock Text="{Binding FilterType_Msg}"
<!--<StackPanel>
<Grid Grid.Row="0" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding FilterType_Msg}"
Grid.Row="0" Grid.Column="0" Grid.Row="0" Grid.Column="0"
Style="{StaticResource OptionTextBlock}"/> Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding SearchColumnList}" <ComboBox ItemsSource="{Binding SearchColumnList}"
SelectedItem="{Binding SelSearchColumn}" SelectedItem="{Binding SelSearchColumn}"
Width="Auto" Width="Auto"
Margin="5" Margin="5"
Grid.Row="0" Grid.Column="1" Grid.Row="0" Grid.Column="1"
Style="{StaticResource FeatureComboBox}"/> Style="{StaticResource FeatureComboBox}"/>
<TextBlock Text="{Binding Search_Msg}" <TextBlock Text="{Binding Search_Msg}"
Margin="0,5,0,0" Margin="0,5,0,0"
Grid.Row="1" Grid.Column="0" Grid.Row="1" Grid.Column="0"
Style="{StaticResource OptionTextBlock}"/> Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SearchText}" <EgtWPFLib5:EgtTextBox Text="{Binding SearchText}"
Margin="5" Margin="5"
Grid.Row="1" Grid.Column="1" Grid.Row="1" Grid.Column="1"
Visibility="{Binding SearchText_Visibility}"/> Visibility="{Binding SearchText_Visibility}"/>
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged" <Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged"
SelectionMode="MultipleRange" SelectionMode="MultipleRange"
Grid.Row="1" Grid.Column="1" Grid.Row="1" Grid.Column="1"
Visibility="{Binding SearchDate_Visibility}"/> Visibility="{Binding SearchDate_Visibility}"/>
</Grid> </Grid>
</StackPanel> </StackPanel>-->
<EgtBEAMWALL:EgtDataGrid Grid.Row="1" <EgtBEAMWALL:EgtDataGrid Grid.Row="1"
ItemsSource="{Binding ProjectList}" ItemsSource="{Binding ProjectList}"
SelectedItem="{Binding SelProject}" SelectedItem="{Binding SelProject}"
CanUserAddRows="False" CanUserAddRows="False"
@@ -85,6 +148,14 @@
</DataTemplate> </DataTemplate>
</DataGridTextColumn.HeaderTemplate> </DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn> </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:OpenProjectFileDialogV}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
<!-- BTL FileName --> <!-- BTL FileName -->
<DataGridTextColumn x:Key="colBTLNAME" Binding="{Binding sBTLFileName}"> <DataGridTextColumn x:Key="colBTLNAME" Binding="{Binding sBTLFileName}">
<DataGridTextColumn.HeaderTemplate> <DataGridTextColumn.HeaderTemplate>
@@ -5,6 +5,8 @@ Imports System.Windows.Controls
Imports System.Windows.Input Imports System.Windows.Input
Imports EgtBEAMWALL.Core.ConstBeam Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL
Public Class OpenProjectFileDialogV Public Class OpenProjectFileDialogV
@@ -19,6 +21,8 @@ Public Class OpenProjectFileDialogV
Me.DataContext = OpenProjFileDialogVM Me.DataContext = OpenProjFileDialogVM
' Assegno al riferimento locale al VM il VM preso dal DataContext ' Assegno al riferimento locale al VM il VM preso dal DataContext
m_OpenProjFileDialogVM = OpenProjFileDialogVM m_OpenProjFileDialogVM = OpenProjFileDialogVM
AddHandler Me.Loaded, AddressOf OpenProjectFileDialog_Loaded
AddHandler Me.Closing, AddressOf OpenProjectFileDialog_Closing
End Sub End Sub
#End Region ' CONSTRUCTOR #End Region ' CONSTRUCTOR
@@ -42,6 +46,20 @@ Public Class OpenProjectFileDialogV
Return Me.ShowDialog() Return Me.ShowDialog()
End Function 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 #End Region ' METHODS
#Region "EVENTS" #Region "EVENTS"
@@ -60,10 +78,4 @@ Public Class OpenProjectFileDialogV
Me.DialogResult = bDialogResult Me.DialogResult = bDialogResult
End Sub End Sub
Private Sub Calendar_SelectedDatesChanged(sender As Object, e As SelectionChangedEventArgs)
Dim cal As System.Windows.Controls.Calendar = sender
m_OpenProjFileDialogVM.m_SearchDate = cal.SelectedDates
m_OpenProjFileDialogVM.m_ProjectList_View.Refresh()
End Sub
End Class End Class
@@ -14,6 +14,32 @@ Public MustInherit Class OpenProjectFileDialogVM
#Region "FIELDS & PROPERTIES" #Region "FIELDS & PROPERTIES"
Public Enum BTLDateTypes As Integer
CREATEDATE = 0
EXPORTDATE = 1
End Enum
Private 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
End Enum
Public Enum RowQuantities As Integer
FIFTY = 0
HUNDRED = 1
HUNDREDANDFIFTY = 2
End Enum
Friend Event m_CloseWindow(bDialogResult As Boolean) Friend Event m_CloseWindow(bDialogResult As Boolean)
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn) Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
@@ -83,18 +109,131 @@ Public MustInherit Class OpenProjectFileDialogVM
End Set End Set
End Property End Property
' lista campi per ricerca testuale e con datepicker Protected m_BTLDateTypeList As New List(Of String)
Protected m_SearchColumnList As New ObservableCollection(Of IdNameStruct) Public ReadOnly Property BTLDateTypeList As List(Of String)
Public ReadOnly Property SearchColumnList As ObservableCollection(Of IdNameStruct)
Get Get
Return m_SearchColumnList Return m_BTLDateTypeList
End Get End Get
End Property End Property
Protected m_SelSearchColumn As IdNameStruct = Nothing Protected m_SelBTLDateType As BTLDateTypes = Nothing
Public Property SelSearchColumn As IdNameStruct Public Property SelBTLDateType As Integer
Get Get
Return m_SelSearchColumn Return m_SelBTLDateType
End Get
Set(value As Integer)
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
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)
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_dtStartDate = DateTime.Today + TimeSpan.FromDays(1)
m_dtEndDate = m_dtStartDate - TimeSpan.FromDays(31)
Case DayTypes.LAST3MONTHS
Case DayTypes.LAST6MONTHS
End Select
NotifyPropertyChanged(NameOf(dtStartDate))
NotifyPropertyChanged(NameOf(dtEndDate))
End If
NotifyPropertyChanged(NameOf(Date_Visibility))
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
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_MACHINELOGFILTER, K_STARTDATE, lStartDate.ToString())
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
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_MACHINELOGFILTER, K_ENDDATE, lEndDate.ToString())
' aggiorno lista da Db
RefreshProjectList()
m_ProjectList_View.Refresh()
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
Private 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()
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 End Get
Set(value As IdNameStruct) Set(value As IdNameStruct)
' resetto il contenuto della barra di ricerca testuale ' resetto il contenuto della barra di ricerca testuale
@@ -103,15 +242,15 @@ Public MustInherit Class OpenProjectFileDialogVM
' resetto le selezioni sul calendario ' resetto le selezioni sul calendario
If Not IsNothing(SearchDate) Then SearchDate.Clear() 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) ' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
m_SelSearchColumn = m_SearchColumnList(0) m_SelFilterType = m_FilterTypeList(0)
m_ProjectList_View.Refresh() m_ProjectList_View.Refresh()
' ora setto il valore scelto come Tipo Filtro ' ora setto il valore scelto come Tipo Filtro
m_SelSearchColumn = value m_SelFilterType = value
Select Case m_SelSearchColumn.Id Select Case m_SelFilterType.Id
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME, OpenProjFileColumn.MACHINE Case FilterTypes.ID, FilterTypes.BTLFILENAME, FilterTypes.LISTNAME, FilterTypes.MACHINE
SearchText_Visibility = Visibility.Visible SearchText_Visibility = Visibility.Visible
SearchDate_Visibility = Visibility.Collapsed SearchDate_Visibility = Visibility.Collapsed
Case OpenProjFileColumn.EXPORTDATE, OpenProjFileColumn.CREATEDATE Case BTLDateTypes.EXPORTDATE, BTLDateTypes.CREATEDATE
SearchText_Visibility = Visibility.Collapsed SearchText_Visibility = Visibility.Collapsed
SearchDate_Visibility = Visibility.Visible SearchDate_Visibility = Visibility.Visible
Case Else Case Else
@@ -161,18 +300,13 @@ Public MustInherit Class OpenProjectFileDialogVM
End Set End Set
End Property End Property
Public Enum OpenProjFileColumn As Integer
NULL = 0
ID = 1
BTLFILENAME = 2
LISTNAME = 3
EXPORTDATE = 4
CREATEDATE = 5
MACHINE = 6
End Enum
#Region "Messages" #Region "Messages"
Public ReadOnly Property Title As String
Get
Return "Open Project"
End Get
End Property
Public ReadOnly Property FilterType_Msg As String Public ReadOnly Property FilterType_Msg As String
Get Get
Return EgtMsg(61836) Return EgtMsg(61836)
@@ -236,6 +370,18 @@ Public MustInherit Class OpenProjectFileDialogVM
End Get End Get
End Property 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
#End Region #End Region
' Definizione comandi ' Definizione comandi
@@ -244,31 +390,45 @@ Public MustInherit Class OpenProjectFileDialogVM
#End Region ' FIELDS & PROPERTIES #End Region ' FIELDS & PROPERTIES
Sub New()
End Sub
#Region "METHODS" #Region "METHODS"
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean? 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
Protected Sub LoadColumns(ProjectType As ProjectType) Protected Sub LoadColumns(ProjectType As ProjectType)
If ProjectType = ProjectType.PROJ Then If ProjectType = ProjectType.PROJ Then
' carico le colonne della datagrid ' carico le colonne della datagrid
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjectColumns) GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjectColumns)
' carico campi su cui eseguire il filtro di ricerca ' carico campi su cui eseguire il filtro di ricerca
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""), m_BTLDateTypeList = New List(Of String)({CreateDate_Msg, ExportDate_Msg})
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg), m_SelBTLDateType = BTLDateTypes.CREATEDATE
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg), NotifyPropertyChanged(NameOf(BTLDateTypeList))
New IdNameStruct(OpenProjFileColumn.LISTNAME, ListName_Msg), NotifyPropertyChanged(NameOf(SelBTLDateType))
New IdNameStruct(OpenProjFileColumn.EXPORTDATE, ExportDate_Msg), m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg), New IdNameStruct(FilterTypes.ID, Id_Msg),
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_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 ElseIf ProjectType = ProjectType.PROD Then
' carico le colonne della datagrid ' carico le colonne della datagrid
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns) GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns)
' carico campi su cui eseguire il filtro di ricerca ' carico campi su cui eseguire il filtro di ricerca
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""), m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg), m_SelBTLDateType = BTLDateTypes.CREATEDATE
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg), NotifyPropertyChanged(NameOf(BTLDateTypeList))
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg), NotifyPropertyChanged(NameOf(SelBTLDateType))
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)}) 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.MACHINE, Machine_Msg)})
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
NotifyPropertyChanged(NameOf(SelFilterType))
End If End If
' setto la visibilità delle colonne delle EgtDataGrid ' setto la visibilità delle colonne delle EgtDataGrid
For Each col In ProjectColumns For Each col In ProjectColumns
@@ -301,22 +461,22 @@ Public MustInherit Class OpenProjectFileDialogVM
Dim bProjectOk As Boolean = True Dim bProjectOk As Boolean = True
If m_ProjectType = ProjectType.PROJ Then If m_ProjectType = ProjectType.PROJ Then
Dim CurrProj As ProjFileVM = DirectCast(Proj, ProjFileVM) Dim CurrProj As ProjFileVM = DirectCast(Proj, ProjFileVM)
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso ( If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
(m_SelSearchColumn.Id = OpenProjFileColumn.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse (m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso ( If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse (m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse (m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
ElseIf m_ProjectType = ProjectType.PROD Then ElseIf m_ProjectType = ProjectType.PROD Then
Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM) Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso ( If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso ( If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse (m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
(m_SelSearchColumn.Id = OpenProjFileColumn.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
End If End If
Return bProjectOk Return bProjectOk
End Function End Function
+34 -24
View File
@@ -19,39 +19,49 @@ Public Class ProjFileM
End Property End Property
Protected m_sBTLFileName As String = String.Empty Protected m_sBTLFileName As String = String.Empty
Public Property sBTLFileName As String Public Property sBTLFileName As String
Get Get
Return m_sBTLFileName Return m_sBTLFileName
End Get End Get
Set(value As String) Set(value As String)
m_sBTLFileName = value m_sBTLFileName = value
End Set End Set
End Property End Property
Protected m_sDescription As String = String.Empty
Public Property sDescription As String
Get
Return m_sDescription
End Get
Set(value As String)
m_sDescription = value
End Set
End Property
#Region "CONSTRUCTORS" #Region "CONSTRUCTORS"
Protected Sub New() Protected Sub New()
End Sub End Sub
Public Shared Function CreateNewProjFileM() As ProjFileM Public Shared Function CreateNewProjFileM() As ProjFileM
Return New ProjFileM Return New ProjFileM
End Function End Function
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String, 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
sBTLFileName As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String) As ProjFileM Dim NewProjectFileM As New ProjFileM
Dim NewProjectFileM As New ProjFileM NewProjectFileM.m_nProjId = nProjId
NewProjectFileM.m_nProjId = nProjId NewProjectFileM.m_nProdId = nProdId
NewProjectFileM.m_nProdId = nProdId NewProjectFileM.m_dtCreateDate = dtCreateProjDate
NewProjectFileM.m_dtCreateDate = dtCreateProjDate NewProjectFileM.m_dtExportDate = dtExportDate
NewProjectFileM.m_dtExportDate = dtExportDate NewProjectFileM.m_sListName = sListName
NewProjectFileM.m_sListName = sListName NewProjectFileM.m_sBTLFileName = sBTLFileName
NewProjectFileM.m_sBTLFileName = sBTLFileName NewProjectFileM.m_sDescription = sDescription
NewProjectFileM.m_bIsNew = IsNew NewProjectFileM.m_bIsNew = IsNew
NewProjectFileM.m_bIsLocked = IsLocked NewProjectFileM.m_bIsLocked = IsLocked
NewProjectFileM.m_nType = nType NewProjectFileM.m_nType = nType
NewProjectFileM.m_sMachine = sMachine NewProjectFileM.m_sMachine = sMachine
Return NewProjectFileM Return NewProjectFileM
End Function End Function
#End Region ' CONSTRUCTORS #End Region ' CONSTRUCTORS
@@ -68,6 +68,12 @@ Public Class ProjFileVM
End Get End Get
End Property End Property
Public ReadOnly Property sDescription As String
Get
Return ProjFileM.sDescription
End Get
End Property
Public ReadOnly Property sListName As String Public ReadOnly Property sListName As String
Get Get
Return ProjFileM.sListName Return ProjFileM.sListName
+1 -1
View File
@@ -6,7 +6,7 @@
</configSections> </configSections>
<entityFramework> <entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />--> <!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers> <providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider> </provider>
@@ -1,6 +1,5 @@
using EgtBEAMWALL.DataLayer.DatabaseModels; using EgtBEAMWALL.DataLayer.DatabaseModels;
using NLog; using NLog;
using NLog.LayoutRenderers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -174,14 +173,75 @@ namespace EgtBEAMWALL.DataLayer.Controllers
} }
/// <summary> /// <summary>
/// Elenco progetti /// Elenco prod
/// </summary> /// </summary>
/// <param name="numRecord"></param> /// <param name="numRecord">Num max record da recuperare</param>
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
/// <returns></returns> /// <returns></returns>
public List<Core.ProdFileM> GetLastDesc(int numRecord) public List<Core.ProdFileM> GetLastDesc(int numRecord, bool OnlyActive)
{ {
List<Core.ProdFileM> result = new List<Core.ProdFileM>(); List<Core.ProdFileM> result = new List<Core.ProdFileM>();
var dbResult = GetLastDbModelDesc(numRecord); //List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
List<ProdModel> dbResult = new List<ProdModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProdList.Count();
}
// retrieve
dbResult = localDbCtx
.ProdList
// condizione join sui PROJ
.Join(localDbCtx.ProjList.Where(x=> x.IsActive || !OnlyActive),
p => p.ProdDbId,
e=> e.ProdDbId,
(p,e) => p)
.OrderByDescending(x => x.ProdId)
.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();
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>
/// <returns></returns>
public List<Core.ProdFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive)
{
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
List<ProdModel> dbResult = new List<ProdModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProdList.Count();
}
// retrieve
dbResult = localDbCtx
.ProdList
.Where(x => x.DtCreated >= dtStart && x.DtCreated <= dtEnd)
// condizione join sui PROJ
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
p => p.ProdDbId,
e => e.ProdDbId,
(p, e) => p)
.OrderByDescending(x => x.ProdId)
.Take(numRecord)
.ToList();
}
// conversione // 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)).ToList();
return result; return result;
@@ -408,7 +468,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.OrderBy(n => n.PartCount); .OrderBy(n => n.PartCount);
// controllo: nell'elenco delle barre MachGroupList NON devono esserci duplicati per // controllo: nell'elenco delle barre MachGroupList NON devono esserci duplicati per
// l'ID (esterno) che deve essere univoco... // l'ID (esterno) che deve essere univoco...
testOk = listaCheck.Where(x => x.PartCount > 1).Count() == 0; testOk = listaCheck.Where(x => x.PartCount > 1).Count() == 0;
if (testOk) if (testOk)
{ {
@@ -716,6 +776,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return answ; return answ;
} }
#if false
/// <summary> /// <summary>
/// Get LAST paginated data from DB (DESC ordered) /// Get LAST paginated data from DB (DESC ordered)
/// </summary> /// </summary>
@@ -737,7 +798,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.Take(numRecord) .Take(numRecord)
.ToList(); .ToList();
} }
} }
#endif
protected List<int> ProjIdByProd(int ProdId) protected List<int> ProjIdByProd(int ProdId)
{ {
@@ -45,11 +45,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
} }
/// <summary> /// <summary>
/// Delete Proj on DB by ProjId /// Delete Proj logically / on DB by ProjId
/// </summary> /// </summary>
/// <param name="ProjId"></param> /// <param name="ProjId"></param>
/// <param name="IsLogical"></param>
/// <returns></returns> /// <returns></returns>
public bool DeleteProj(int ProjId) public bool DeleteProj(int ProjId, bool IsLogical)
{ {
bool done = false; bool done = false;
@@ -59,25 +60,45 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProjList .ProjList
.Where(x => x.ProjId == ProjId) .Where(x => x.ProjId == ProjId)
.SingleOrDefault(); .SingleOrDefault();
// sel delle BTLParts da proj
var parts2del = localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId);
try if (IsLogical)
{ {
// remove from database try
localDbCtx.BTLPartList.RemoveRange(parts2del); {
localDbCtx.ProjList.Remove(currProj); currProj.IsActive = false;
// Commit changes // Commit changes
localDbCtx.SaveChanges(); localDbCtx.SaveChanges();
done = true; done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Proj.DeleteProj (logical only): {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
} }
catch (Exception exc) else
{ {
string errMessage = $"EXCEPTION on Proj.DeleteProj: {Environment.NewLine}{exc}"; // sel delle BTLParts da proj
Console.WriteLine(errMessage); var parts2del = localDbCtx
Log.Error(errMessage); .BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId);
try
{
// remove from database
localDbCtx.BTLPartList.RemoveRange(parts2del);
localDbCtx.ProjList.Remove(currProj);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Proj.DeleteProj (on DB): {Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
} }
} }
return done; return done;
@@ -91,8 +112,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// Get records filtered by BtlPartName matching regexp BtlFileName[_number] /// Get records filtered by BtlPartName matching regexp BtlFileName[_number]
/// </summary> /// </summary>
/// <param name="BtlFileName">Base name to search for (=starts by BtlFileName%)</param> /// <param name="BtlFileName">Base name to search for (=starts by BtlFileName%)</param>
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
/// <returns></returns> /// <returns></returns>
public List<ProjModel> FindByBtlFileName(string BtlFileName) public List<ProjModel> FindByBtlFileName(string BtlFileName, bool OnlyActive)
{ {
List<ProjModel> searchResult = new List<ProjModel>(); List<ProjModel> searchResult = new List<ProjModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING)) using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
@@ -100,7 +122,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// in primi cerco il record "parent" generale, se non ci fosse inutile proseguire... // in primi cerco il record "parent" generale, se non ci fosse inutile proseguire...
ProjModel parentRec = localDbCtx ProjModel parentRec = localDbCtx
.ProjList .ProjList
.Where(x => x.BTLFileName == BtlFileName) .Where(x => x.BTLFileName == BtlFileName && (!OnlyActive || x.IsActive))
.FirstOrDefault(); .FirstOrDefault();
if (parentRec != null && parentRec.ProjId > 0) if (parentRec != null && parentRec.ProjId > 0)
{ {
@@ -109,7 +131,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// cerco eventuali dati "child" puliti // cerco eventuali dati "child" puliti
var childRec = localDbCtx var childRec = localDbCtx
.ProjList .ProjList
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_")) .Where(x => x.BTLFileName.StartsWith(BtlFileName + "_") && (!OnlyActive || x.IsActive))
.ToList(); .ToList();
// faccio filtro con ricerca regexp x scartare "falsi positivi" come BtlFileName_nonNumero... // faccio filtro con ricerca regexp x scartare "falsi positivi" come BtlFileName_nonNumero...
if (childRec.Count > 0) if (childRec.Count > 0)
@@ -180,7 +202,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <summary> /// <summary>
/// Get filtered data by ProdId (ASC ordered) /// Get filtered data by ProdId (ASC ordered)
/// </summary> /// </summary>
/// <param name="ProdDbId"></param> /// <param name="ProdId"></param>
/// <returns></returns> /// <returns></returns>
public List<Core.ProjFileM> GetByProdAsc(int ProdId) public List<Core.ProjFileM> GetByProdAsc(int ProdId)
{ {
@@ -280,9 +302,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <summary> /// <summary>
/// Elenco progetti /// Elenco progetti
/// </summary> /// </summary>
/// <param name="numRecord"></param> /// <param name="dtStart">Inizio periodo estrazione (per export date)</param>
/// <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>
/// <returns></returns> /// <returns></returns>
public List<Core.ProjFileM> GetLastDesc(int numRecord) public List<Core.ProjFileM> GetLastByExpDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive)
{ {
List<Core.ProjFileM> answ = new List<Core.ProjFileM>(); List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
@@ -296,6 +321,69 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// retrieve // retrieve
var dbRes = localDbCtx var dbRes = localDbCtx
.ProjList .ProjList
.Where(x => (x.DtExported >= dtStart && x.DtExported <= dtEnd) && (!OnlyActive || x.IsActive))
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
/// <summary>
/// Elenco progetti
/// </summary>
/// <param name="numRecord">Num max record da recuperare</param>
/// <param name="OnlyActive">Solo i record attivi (senza cancellazione logica)</param>
/// <returns></returns>
public List<Core.ProjFileM> GetLastDesc(int numRecord, bool OnlyActive)
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProjList.Count();
}
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => (!OnlyActive || x.IsActive))
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
return answ;
}
/// <summary>
/// Elenco progetti
/// </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 i record attivi (senza cancellazione logica)</param>
/// <returns></returns>
public List<Core.ProjFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive)
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProjList.Count();
}
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => (x.DtCreated >= dtStart && x.DtCreated <= dtEnd) && (!OnlyActive || x.IsActive))
.OrderByDescending(x => x.ProjId) .OrderByDescending(x => x.ProjId)
.Take(numRecord) .Take(numRecord)
.ToList(); .ToList();
@@ -341,6 +429,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{ {
ProjId = nextId, ProjId = nextId,
BTLFileName = "", BTLFileName = "",
ProjDescription = "",
IsNew = true, IsNew = true,
Locked = true, Locked = true,
LockedBy = UserKey, LockedBy = UserKey,
@@ -577,15 +666,62 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return currData; return currData;
} }
/// <summary>
/// Update record su DB x Description
/// </summary>
/// <param name="ProjId"></param>
/// <param name="Description"></param>
/// <returns></returns>
public Core.ProjFileM UpdateDescription(int ProjId, string Description)
{
// cerco specifico Proj
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
if (currData != null)
{
try
{
// aggiorno valore BTL
currData.ProjDescription = Description;
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Part.UpdateDescription:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Proj.UpdateDescription: req item was not found | ProjId {ProjId} | Description {Description}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return coreConv(currData);
}
/// <summary> /// <summary>
/// Update record su DB x nomeBTL, ListName, ExportDate /// Update record su DB x nomeBTL, ListName, ExportDate
/// </summary> /// </summary>
/// <param name="ProjId"></param> /// <param name="ProjId"></param>
/// <param name="BTLFileName"></param> /// <param name="BTLFileName"></param>
/// <param name="Description"></param>
/// <param name="ListName"></param> /// <param name="ListName"></param>
/// <param name="DtExported"></param> /// <param name="DtExported"></param>
/// <param name="PType"></param>
/// <param name="Machine"></param>
/// <returns></returns> /// <returns></returns>
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported, BWType PType, string Machine) public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string Description, string ListName, DateTime DtExported, BWType PType, string Machine)
{ {
// cerco specifico Proj // cerco specifico Proj
ProjModel currData; ProjModel currData;
@@ -600,8 +736,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
try try
{ {
// 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato --> // 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato -->
// nuovo nome, nel formato nomeOriginale_idx, dove idx è il contatore libero successivo // nuovo nome, nel formato nomeOriginale_idx, dove idx è il contatore libero
var duplicateList = FindByBtlFileName(BTLFileName); // successivo 2023.06.08: lasciato come prima, anche NON attivi
// (cancellazione logica)
var duplicateList = FindByBtlFileName(BTLFileName, false);
// devo verificare SOLO SE la lista non è vuota // devo verificare SOLO SE la lista non è vuota
if (duplicateList != null && duplicateList.Count > 0) if (duplicateList != null && duplicateList.Count > 0)
{ {
@@ -635,6 +773,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// aggiorno valore BTL // aggiorno valore BTL
currData.BTLFileName = BTLFileName; currData.BTLFileName = BTLFileName;
// aggiorno il resto
currData.ProjDescription = Description;
currData.DtExported = DtExported; currData.DtExported = DtExported;
currData.ListName = ListName; currData.ListName = ListName;
currData.PType = PType; currData.PType = PType;
@@ -652,7 +792,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
} }
else else
{ {
string errMessage = $"ERROR on Proj.UpdateInfo: req item was not found | ProjId {ProjId} | BTLFileName {BTLFileName} | ListName {ListName} | DtExported {DtExported} | PType {PType} | Machine {Machine}"; string errMessage = $"ERROR on Proj.UpdateInfo: req item was not found | ProjId {ProjId} | Description {BTLFileName} | ListName {ListName} | DtExported {DtExported} | PType {PType} | Machine {Machine}";
Console.WriteLine(errMessage); Console.WriteLine(errMessage);
Log.Error(errMessage); Log.Error(errMessage);
} }
@@ -760,7 +900,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
Core.ProjFileM answ = null; Core.ProjFileM answ = null;
if (currProj != null) if (currProj != null)
{ {
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, 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);
} }
return answ; return answ;
} }
@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using static EgtBEAMWALL.Core.ConstBeam; using static EgtBEAMWALL.Core.ConstBeam;
@@ -31,6 +28,12 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Column("DtExported")] [Column("DtExported")]
public DateTime DtExported { get; set; } public DateTime DtExported { get; set; }
/// <summary>
/// Record attivo (se false == cancellazione logica)
/// </summary>
[Column("IsActive")]
public bool IsActive { get; set; } = true;
/// <summary> /// <summary>
/// Stato NEW = creato ma NON salvato /// Stato NEW = creato ma NON salvato
/// </summary> /// </summary>
@@ -43,6 +46,13 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Column("ListName")] [Column("ListName")]
public string ListName { get; set; } = ""; 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> /// <summary>
/// Stato locked (quando aperto da un dispositivo in rete) /// Stato locked (quando aperto da un dispositivo in rete)
/// </summary> /// </summary>
@@ -55,12 +65,6 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Column("LockedBy")] [Column("LockedBy")]
public string LockedBy { get; set; } = ""; public string LockedBy { 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> /// <summary>
/// Macchina /// Macchina
/// </summary> /// </summary>
@@ -76,6 +80,12 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ProjDbId { get; set; } public int ProjDbId { get; set; }
/// <summary>
/// Descrizione progetto (copiata da BTLFileName inizialmente)
/// </summary>
[Column("ProjDescription")]
public string ProjDescription { get; set; } = "";
[Column("Id")] [Column("Id")]
public int ProjId { get; set; } public int ProjId { get; set; }
+115 -16
View File
@@ -1,7 +1,10 @@
using System.Diagnostics; using Ionic.Zip;
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Xml.Linq;
namespace EgtBEAMWALL.DataLayer namespace EgtBEAMWALL.DataLayer
{ {
@@ -18,6 +21,7 @@ namespace EgtBEAMWALL.DataLayer
public static string DATABASE_SERV = "127.0.0.1"; public static string DATABASE_SERV = "127.0.0.1";
public static string DATABASE_USER = "EgtUser"; public static string DATABASE_USER = "EgtUser";
public static string ZIP_PWD = "viacremasca-viacremasca-viacremasca-viacremasca";
#endregion Public Fields #endregion Public Fields
@@ -29,7 +33,7 @@ namespace EgtBEAMWALL.DataLayer
public static string ADMIN_CONNECTION_STRING { get; set; } = ""; public static string ADMIN_CONNECTION_STRING { get; set; } = "";
/// <summary> /// <summary>
/// DB Connection string /// DB Connection string, per effettuare migration riportare valore connessione admin cablato
/// </summary> /// </summary>
public static string CONNECTION_STRING { get; set; } = ""; public static string CONNECTION_STRING { get; set; } = "";
@@ -72,35 +76,130 @@ namespace EgtBEAMWALL.DataLayer
// esecuzione script di install locale // esecuzione script di install locale
return Controllers.DbController.man.refreshViews(DATABASE_NAME); return Controllers.DbController.man.refreshViews(DATABASE_NAME);
} }
/// <summary> /// <summary>
/// Effettua DUMP del DB dato utente admin + percorso salvataggio /// Effettua DUMP del DB dato utente admin + percorso salvataggio (zip cifrato)
/// </summary> /// </summary>
/// <param name="outFilePath">Percorso di salvataggio del dump (*.sql)</param> /// <param name="zipFilePath">Percorso di salvataggio del dump (*.zip)</param>
/// <param name="dbName">Nome del DB da processare (se vuoto quello di default calcolato)</param>
/// <param name="mysqlDumpPath">Nome o Percorso Eseguibile mysqldump (opzionale)</param>
/// <param name="exportOpt">Opzioni in fase di export (default: --skip-extended-insert)</param>
/// <returns></returns> /// <returns></returns>
public static bool DumpDB(string mysqlDumpPath, string outFilePath) public static bool DataBaseDumpToFile(string zipFilePath, string dbName = "", string mysqlDumpPath = "mysqldump", string exportOpt = "--skip-extended-insert")
{ {
bool fatto = false; bool fatto = false;
// aggiungo sql finale // fix path eseguibile
if (!outFilePath.EndsWith(".sql")) if (string.IsNullOrEmpty(mysqlDumpPath))
{ {
outFilePath = $"{outFilePath}.sql"; mysqlDumpPath = "mysqldump";
} }
if (string.IsNullOrEmpty(dbName))
{
dbName = DATABASE_NAME;
}
// verifica zip finale
if (!zipFilePath.EndsWith(".zip"))
{
zipFilePath = $"{zipFilePath}.zip";
}
// creo nome file per export sql (temporaneo)
string tempSqlPath = zipFilePath.Replace(".zip", ".sql");
// esecuzione script x dump del DB // esecuzione script x dump del DB
string dirPath = Path.GetDirectoryName(outFilePath); string dirPath = Path.GetDirectoryName(zipFilePath);
if (!Directory.Exists(dirPath)) if (!Directory.Exists(dirPath))
{ {
Directory.CreateDirectory(dirPath); Directory.CreateDirectory(dirPath);
} }
// se ci fosse già file elimino... // se ci fosse già file elimino (sql/zip)
if (File.Exists(outFilePath)) if (File.Exists(tempSqlPath))
{ {
File.Delete(outFilePath); File.Delete(tempSqlPath);
} }
// chiamo script esterno... if (File.Exists(zipFilePath))
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {DATABASE_NAME} > {outFilePath}"; {
File.Delete(zipFilePath);
}
// creazione SQL, tramite script esterno... importante parametro "--skip-extended-insert" altrimenti problemi con restore (anche se + verboso e lento in backup...)
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {dbName} {exportOpt} > {tempSqlPath}";
ExecuteCommand(callScript); ExecuteCommand(callScript);
// compressione con pwd!
using (ZipFile zip = new ZipFile())
{
// aggiungo pwd
zip.Password = ZIP_PWD;
// inserisco file
zip.AddFile(tempSqlPath, "");
zip.Save(zipFilePath);
fatto = true;
}
// elimino file sql temporaneo...
if (File.Exists(tempSqlPath))
{
File.Delete(tempSqlPath);
}
return fatto; return fatto;
} }
/// <summary>
/// Effettua restore come overwrite del DB di DEFAULT... irreversibile
/// </summary>
/// <param name="zipFilePath">Percorso di lettura del dump cifrato (*.zip)</param>
/// <param name="dbName">Nome del DB da processare (se vuoto quello di default calcolato)</param>
/// <param name="tempFolder">Percorso cartella temp x esecuzione</param>
/// <param name="mysqlPath">Nome o Percorso Eseguibile mysql (opzionale)</param>
/// <param name="importOpt">Opzioni in fase di import (default: --force)</param>
/// <returns></returns>
public static bool DataBaseRestoreFromFile(string zipFilePath, string dbName = "", string tempFolder="", string mysqlPath = "mysql", string importOpt = "--force")
{
bool fatto = false;
// fix path eseguibile
if (string.IsNullOrEmpty(mysqlPath))
{
mysqlPath = "mysql";
}
if (string.IsNullOrEmpty(dbName))
{
dbName = DATABASE_NAME;
}
if (string.IsNullOrEmpty(tempFolder))
{
tempFolder = "C:\\Temp";
}
// verifica zip finale
if (!zipFilePath.EndsWith(".zip"))
{
zipFilePath = $"{zipFilePath}.zip";
}
// elimino eventuale temp folder precedente...
if (Directory.Exists(tempFolder))
{
Directory.Delete(tempFolder, true);
}
Directory.CreateDirectory(tempFolder);
// scompatto file zip --> sql
using (ZipFile zip = ZipFile.Read(zipFilePath))
{
zip.Password = ZIP_PWD;
zip.ExtractAll(tempFolder, ExtractExistingFileAction.OverwriteSilently);
}
// verifico che ci sia 1 file sql...
var sqlFiles = Directory.GetFiles(tempFolder, "*.sql");
if (sqlFiles != null && sqlFiles.Length == 1)
{
// verifico nome file per export sql (temporaneo)
string tempSqlPath = sqlFiles.FirstOrDefault();
// chiamo script esterno...
string callScript = $"\"{mysqlPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {importOpt} {dbName} < {tempSqlPath}";
ExecuteCommand(callScript);
// elimino il file sql importato...
File.Delete(tempSqlPath);
// elimino temp folder...
Directory.Delete(tempFolder, true);
fatto = true;
}
return fatto;
}
/// <summary> /// <summary>
/// Esecuzione di un comando esterno /// Esecuzione di un comando esterno
/// </summary> /// </summary>
@@ -134,13 +233,12 @@ namespace EgtBEAMWALL.DataLayer
process.Close(); process.Close();
} }
/// <summary> /// <summary>
/// Metodo di init standard per DB in rete con Master_Key /// Metodo di init standard per DB in rete con Master_Key
/// </summary> /// </summary>
/// <param name="server">Indirizzo del server (tipicamente indirizzo di rete)</param> /// <param name="server">Indirizzo del server (tipicamente indirizzo di rete)</param>
/// <param name="nKey">Numero chiave</param> /// <param name="nKey">Numero chiave</param>
/// <param name="sKey">Codice/pwd associato a chaive</param> /// <param name="sKey">Codice/pwd associato a chiave</param>
/// <param name="masterKey">Numero di chiave master con cui è creato il DB</param> /// <param name="masterKey">Numero di chiave master con cui è creato il DB</param>
public static void InitDb(string server, string nKey, string sKey, string masterKey = "") public static void InitDb(string server, string nKey, string sKey, string masterKey = "")
{ {
@@ -150,6 +248,7 @@ namespace EgtBEAMWALL.DataLayer
DATABASE_NAME = $"EgtBwDb_{masterKey}"; DATABASE_NAME = $"EgtBwDb_{masterKey}";
DATABASE_USER = $"user_{nKey}"; DATABASE_USER = $"user_{nKey}";
DATABASE_PWD = $"pwd_{sKey}"; DATABASE_PWD = $"pwd_{sKey}";
ZIP_PWD = $"{DATABASE_USER}:{DATABASE_PWD}:{DATABASE_USER}:{DATABASE_PWD}";
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};SslMode=None"; CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};SslMode=None";
// stringa admin con utente root egalware... // stringa admin con utente root egalware...
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;SslMode=none;CHARSET=utf8"; ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;SslMode=none;CHARSET=utf8";
@@ -40,6 +40,9 @@
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath> <HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference> </Reference>
<Reference Include="DotNetZip, Version=1.16.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5"> <Reference Include="EgtWPFLib5">
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath> <HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
</Reference> </Reference>
@@ -172,6 +175,10 @@
<Compile Include="Migrations\202207051703296_UpgradeLockModel.designer.cs"> <Compile Include="Migrations\202207051703296_UpgradeLockModel.designer.cs">
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon> <DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Migrations\202306081452095_UpdateProjModel.cs" />
<Compile Include="Migrations\202306081452095_UpdateProjModel.designer.cs">
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" /> <Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" /> <Compile Include="Utils.cs" />
@@ -211,6 +218,9 @@
<EmbeddedResource Include="Migrations\202207051703296_UpgradeLockModel.resx"> <EmbeddedResource Include="Migrations\202207051703296_UpgradeLockModel.resx">
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon> <DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Migrations\202306081452095_UpdateProjModel.resx">
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
@@ -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 UpdateProjModel : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateProjModel));
string IMigrationMetadata.Id
{
get { return "202306081452095_UpdateProjModel"; }
}
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 UpdateProjModel : DbMigration
{
public override void Up()
{
AddColumn("dbo.ProjList", "IsActive", c => c.Boolean(nullable: false, defaultValueSql: "1"));
AddColumn("dbo.ProjList", "ProjDescription", c => c.String(unicode: false));
}
public override void Down()
{
DropColumn("dbo.ProjList", "ProjDescription");
DropColumn("dbo.ProjList", "IsActive");
}
}
}
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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.5.4")] [assembly: AssemblyVersion("2.5.6.2")]
[assembly: AssemblyFileVersion("2.5.5.4")] [assembly: AssemblyFileVersion("2.5.6.2")]
+1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" /> <package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" /> <package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" /> <package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" /> <package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
+29 -9
View File
@@ -1,31 +1,51 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections> </configSections>
<entityFramework> <entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/> <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers> <providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
</providers> </providers>
</entityFramework> </entityFramework>
<connectionStrings> <connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none" providerName="MySql.Data.MySqlClient"/> <add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none" providerName="MySql.Data.MySqlClient" />
</connectionStrings> </connectionStrings>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral"/> <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0"/> <bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.21.9.0" newVersion="3.21.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.5.0" newVersion="1.3.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<system.data> <system.data>
<DbProviderFactories> <DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"/> <remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories> </DbProviderFactories>
</system.data> </system.data>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>EgtBEAMWALL.StressTest</RootNamespace> <RootNamespace>EgtBEAMWALL.StressTest</RootNamespace>
<AssemblyName>EgtBEAMWALL.StressTest</AssemblyName> <AssemblyName>EgtBEAMWALL.StressTest</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
+1 -1
View File
@@ -19,7 +19,7 @@ namespace EgtBEAMWALL.StressTest.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
+1 -1
View File
@@ -12,7 +12,7 @@ namespace EgtBEAMWALL.StressTest.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.6.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+40 -42
View File
@@ -1,25 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text;
namespace EgtBEAMWALL.StressTest namespace EgtBEAMWALL.StressTest
{ {
public class Simulator public class Simulator
{ {
#region Protected Fields
protected DataLayer.Controllers.BTLPartController BtlPartCtr = new DataLayer.Controllers.BTLPartController();
protected DataLayer.Controllers.MachGroupController MachGroupCtr = new DataLayer.Controllers.MachGroupController();
protected SimParams MaxParams = new SimParams();
protected DataLayer.Controllers.PartController PartCtr = new DataLayer.Controllers.PartController();
protected DataLayer.Controllers.ProdController ProdCtr = new DataLayer.Controllers.ProdController();
protected DataLayer.Controllers.ProjController ProjCtr = new DataLayer.Controllers.ProjController();
#endregion Protected Fields
#region Public Fields #region Public Fields
public List<Core.BTLPartM> BtlPartList = new List<Core.BTLPartM>(); public List<Core.BTLPartM> BtlPartList = new List<Core.BTLPartM>();
@@ -30,30 +16,6 @@ namespace EgtBEAMWALL.StressTest
#endregion Public Fields #endregion Public Fields
#region Protected Properties
/// <summary>
/// restituisce un set di parametri simulazione generando a caso dal set di base
/// </summary>
protected SimParams RandomParamSet
{
get
{
Random rndGen = new Random();
SimParams answ = new SimParams()
{
BtlPart2Proj = rndGen.Next(MaxParams.BtlPart2Proj) + 1,
BtlRepeat = rndGen.Next(MaxParams.BtlRepeat) + 1,
Part2MachGroup = rndGen.Next(MaxParams.Part2MachGroup) + 1,
Proj2Prod = rndGen.Next(MaxParams.Proj2Prod) + 1
};
return answ;
}
}
#endregion Protected Properties
#region Public Methods #region Public Methods
/// <summary> /// <summary>
@@ -79,7 +41,7 @@ namespace EgtBEAMWALL.StressTest
List<DataLayer.DatabaseModels.BTLPartModel> currPartList = new List<DataLayer.DatabaseModels.BTLPartModel>(); List<DataLayer.DatabaseModels.BTLPartModel> currPartList = new List<DataLayer.DatabaseModels.BTLPartModel>();
List<Core.MyMachGroupM> currMachGroupList = new List<Core.MyMachGroupM>(); List<Core.MyMachGroupM> currMachGroupList = new List<Core.MyMachGroupM>();
List<Core.PartM> currMGPartList = new List<Core.PartM>(); List<Core.PartM> currMGPartList = new List<Core.PartM>();
ProjCtr.UpdateInfo(currProjId, $"{DateTime.Now:yyyyMMdd_HHmmssfff}", $"LN_{DateTime.Now:yyyyMMdd_HHmm}", DateTime.Now.AddSeconds(15), Core.ConstBeam.BWType.BEAM, "SIM01"); ProjCtr.UpdateInfo(currProjId, "TestBTL", $"{DateTime.Now:yyyyMMdd_HHmmssfff}", $"LN_{DateTime.Now:yyyyMMdd_HHmm}", DateTime.Now.AddSeconds(15), Core.ConstBeam.BWType.BEAM, "SIM01");
// genero le BTLParts ed assegno.. // genero le BTLParts ed assegno..
for (int j = 0; j < currRandom.BtlPart2Proj; j++) for (int j = 0; j < currRandom.BtlPart2Proj; j++)
{ {
@@ -107,8 +69,8 @@ namespace EgtBEAMWALL.StressTest
{ {
for (int l = 0; l < currRandom.Part2MachGroup; l++) for (int l = 0; l < currRandom.Part2MachGroup; l++)
{ {
// FixME!!! non può creare x loop in CreateBeamDL che vuole nParentMachGroup // FixME!!! non può creare x loop in CreateBeamDL che vuole
// genero le Part x MachGroup ed assegno // nParentMachGroup genero le Part x MachGroup ed assegno
Core.PartM currPart = Core.PartM.CreatePart(Core.ConstBeam.BWType.BEAM, currMachGroupList.FirstOrDefault(), currPartList[BPIdx].PartId, 1); Core.PartM currPart = Core.PartM.CreatePart(Core.ConstBeam.BWType.BEAM, currMachGroupList.FirstOrDefault(), currPartList[BPIdx].PartId, 1);
currMGPartList.Add(currPart); currMGPartList.Add(currPart);
//currMGPartList.Add(new DataLayer.DatabaseModels.PartModel() { BTLPartDbId = currBTLPart.BTLPartDbId, PDN = l * k * currRandom.Part2MachGroup, PartId = l, H = 10 * l, L = 50 * l, W = 5 * l }); //currMGPartList.Add(new DataLayer.DatabaseModels.PartModel() { BTLPartDbId = currBTLPart.BTLPartDbId, PDN = l * k * currRandom.Part2MachGroup, PartId = l, H = 10 * l, L = 50 * l, W = 5 * l });
@@ -138,9 +100,45 @@ namespace EgtBEAMWALL.StressTest
public void initDb() public void initDb()
{ {
var firstData = ProjCtr.GetLastDesc(1); var firstData = ProjCtr.GetLastDesc(1, true);
} }
#endregion Public Methods #endregion Public Methods
#region Protected Fields
protected DataLayer.Controllers.BTLPartController BtlPartCtr = new DataLayer.Controllers.BTLPartController();
protected DataLayer.Controllers.MachGroupController MachGroupCtr = new DataLayer.Controllers.MachGroupController();
protected SimParams MaxParams = new SimParams();
protected DataLayer.Controllers.PartController PartCtr = new DataLayer.Controllers.PartController();
protected DataLayer.Controllers.ProdController ProdCtr = new DataLayer.Controllers.ProdController();
protected DataLayer.Controllers.ProjController ProjCtr = new DataLayer.Controllers.ProjController();
#endregion Protected Fields
#region Protected Properties
/// <summary>
/// restituisce un set di parametri simulazione generando a caso dal set di base
/// </summary>
protected SimParams RandomParamSet
{
get
{
Random rndGen = new Random();
SimParams answ = new SimParams()
{
BtlPart2Proj = rndGen.Next(MaxParams.BtlPart2Proj) + 1,
BtlRepeat = rndGen.Next(MaxParams.BtlRepeat) + 1,
Part2MachGroup = rndGen.Next(MaxParams.Part2MachGroup) + 1,
Proj2Prod = rndGen.Next(MaxParams.Proj2Prod) + 1
};
return answ;
}
}
#endregion Protected Properties
} }
} }
+49 -1
View File
@@ -35,6 +35,10 @@ namespace EgtBEAMWALL.StressTest
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.buttonDataSeed = new System.Windows.Forms.Button(); this.buttonDataSeed = new System.Windows.Forms.Button();
this.labelResult = new System.Windows.Forms.Label(); this.labelResult = new System.Windows.Forms.Label();
this.btnDbDump = new System.Windows.Forms.Button();
this.btnDbRestore = new System.Windows.Forms.Button();
this.txtDumpFile = new System.Windows.Forms.TextBox();
this.txtDbName = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -92,17 +96,57 @@ namespace EgtBEAMWALL.StressTest
// labelResult // labelResult
// //
this.labelResult.AutoSize = true; this.labelResult.AutoSize = true;
this.labelResult.Location = new System.Drawing.Point(479, 91); this.labelResult.Location = new System.Drawing.Point(250, 75);
this.labelResult.Name = "labelResult"; this.labelResult.Name = "labelResult";
this.labelResult.Size = new System.Drawing.Size(35, 13); this.labelResult.Size = new System.Drawing.Size(35, 13);
this.labelResult.TabIndex = 4; this.labelResult.TabIndex = 4;
this.labelResult.Text = "label2"; this.labelResult.Text = "label2";
// //
// btnDbDump
//
this.btnDbDump.Location = new System.Drawing.Point(18, 136);
this.btnDbDump.Name = "btnDbDump";
this.btnDbDump.Size = new System.Drawing.Size(75, 45);
this.btnDbDump.TabIndex = 5;
this.btnDbDump.Text = "DB Dump";
this.btnDbDump.UseVisualStyleBackColor = true;
this.btnDbDump.Click += new System.EventHandler(this.btnDbDump_Click);
//
// btnDbRestore
//
this.btnDbRestore.Location = new System.Drawing.Point(338, 136);
this.btnDbRestore.Name = "btnDbRestore";
this.btnDbRestore.Size = new System.Drawing.Size(75, 45);
this.btnDbRestore.TabIndex = 6;
this.btnDbRestore.Text = "DB Restore";
this.btnDbRestore.UseVisualStyleBackColor = true;
this.btnDbRestore.Click += new System.EventHandler(this.btnDbRestore_Click);
//
// txtDumpFile
//
this.txtDumpFile.Location = new System.Drawing.Point(118, 161);
this.txtDumpFile.Name = "txtDumpFile";
this.txtDumpFile.Size = new System.Drawing.Size(186, 20);
this.txtDumpFile.TabIndex = 3;
this.txtDumpFile.Text = "C:\\Temp\\MyDbDump.zip";
//
// txtDbName
//
this.txtDbName.Location = new System.Drawing.Point(118, 136);
this.txtDbName.Name = "txtDbName";
this.txtDbName.Size = new System.Drawing.Size(186, 20);
this.txtDbName.TabIndex = 7;
this.txtDbName.Text = "egtbwdb_000142";
//
// StressTest // StressTest
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.txtDbName);
this.Controls.Add(this.txtDumpFile);
this.Controls.Add(this.btnDbRestore);
this.Controls.Add(this.btnDbDump);
this.Controls.Add(this.labelResult); this.Controls.Add(this.labelResult);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "StressTest"; this.Name = "StressTest";
@@ -122,6 +166,10 @@ namespace EgtBEAMWALL.StressTest
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button buttonDataSeed; private System.Windows.Forms.Button buttonDataSeed;
private System.Windows.Forms.Label labelResult; private System.Windows.Forms.Label labelResult;
private System.Windows.Forms.Button btnDbDump;
private System.Windows.Forms.Button btnDbRestore;
private System.Windows.Forms.TextBox txtDumpFile;
private System.Windows.Forms.TextBox txtDbName;
} }
} }
+62 -17
View File
@@ -1,17 +1,25 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace EgtBEAMWALL.StressTest namespace EgtBEAMWALL.StressTest
{ {
public partial class StressTest : Form public partial class StressTest : Form
{ {
#region Public Constructors
public StressTest()
{
InitializeComponent();
// init cablato sul mio DB
DataLayer.DbConfig.InitDb("127.0.0.1", "000470", "36311", "000470");
//// warm up DB
//CurrSim.initDb();
}
#endregion Public Constructors
#region Protected Fields #region Protected Fields
/// <summary> /// <summary>
@@ -21,17 +29,6 @@ namespace EgtBEAMWALL.StressTest
#endregion Protected Fields #endregion Protected Fields
#region Public Constructors
public StressTest()
{
InitializeComponent();
// warm up DB
CurrSim.initDb();
}
#endregion Public Constructors
#region Protected Properties #region Protected Properties
protected int numProj protected int numProj
@@ -52,6 +49,54 @@ namespace EgtBEAMWALL.StressTest
#region Private Methods #region Private Methods
private void btnDbDump_Click(object sender, EventArgs e)
{
var result = MessageBox.Show("Sicuro di voler generare il dump del DB corrente?", "DB Dump", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (result == DialogResult.Yes)
{
labelResult.Text = "...";
Stopwatch sw = new Stopwatch();
sw.Start();
//string binPath = "C:\\Program Files\\MariaDB 10.5\\bin";
//string myDumpPath = Path.Combine(binPath, "mysqldump.exe");
string outPath = txtDumpFile.Text.Trim();
string dbName = txtDbName.Text.Trim();
if (!string.IsNullOrEmpty(outPath))
{
// effettua dump
//DataLayer.DbConfig.DataBaseDumpToFile(outPath, "mysqldump");
//DataLayer.DbConfig.DataBaseDumpToFile(outPath, "mysqldump", "--skip-extended-insert");
DataLayer.DbConfig.DataBaseDumpToFile(outPath, dbName);
sw.Stop();
var elapsed = sw.Elapsed;
labelResult.Text = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss} | Dump Done in {elapsed.TotalSeconds:N3} sec!";
}
}
}
private void btnDbRestore_Click(object sender, EventArgs e)
{
var result = MessageBox.Show("Sicuro di voler ripristinare il file dump sul DB corrente?", "DB Restore", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (result == DialogResult.Yes)
{
labelResult.Text = "...";
string inPath = txtDumpFile.Text.Trim();
string dbName = txtDbName.Text.Trim();
string tempFolder = Path.Combine(Path.GetDirectoryName(inPath), "DbRestore");
Stopwatch sw = new Stopwatch();
sw.Start();
// effettua restore
DataLayer.DbConfig.DataBaseRestoreFromFile(inPath, dbName, tempFolder); sw.Stop();
//string binPath = "C:\\Program Files\\MariaDB 10.5\\bin";
//string mysqlPath = Path.Combine(binPath, "mysql.exe");
//DataLayer.DbConfig.DataBaseRestoreFromFile(inPath, "mysql");
var elapsed = sw.Elapsed;
labelResult.Text = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss} | Restore Done in {elapsed.TotalSeconds:N3} sec!";
}
}
private void buttonDataSeed_Click(object sender, EventArgs e) private void buttonDataSeed_Click(object sender, EventArgs e)
{ {
// genero dati col SIM // genero dati col SIM
@@ -149,6 +149,9 @@
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath> <HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
</Reference> </Reference>
<Reference Include="DotNetZip, Version=1.16.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath> <HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
@@ -177,9 +180,6 @@
<HintPath>..\ExtLibs\Interop.FXServer.dll</HintPath> <HintPath>..\ExtLibs\Interop.FXServer.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
</Reference> </Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="ISOCNC.Remoting"> <Reference Include="ISOCNC.Remoting">
<HintPath>..\ExtLibs\ISOCNC.Remoting.dll</HintPath> <HintPath>..\ExtLibs\ISOCNC.Remoting.dll</HintPath>
</Reference> </Reference>
@@ -40,7 +40,7 @@ Public Class LeftPanelVM
Return m_SelChannel Return m_SelChannel
End Get End Get
Set(ByVal value As IdNameStruct) Set(ByVal value As IdNameStruct)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SETCHANNEL, value.Id)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.SETCHANNEL, value.Id))
m_SelChannel = value m_SelChannel = value
End Set End Set
End Property End Property
@@ -86,7 +86,7 @@ Public Class LeftPanelVM
Return m_SelOPMode Return m_SelOPMode
End Get End Get
Set(ByVal value As OPState) Set(ByVal value As OPState)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SETOPMODE, value.Id)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.SETOPMODE, value.Id))
' se MDI ' se MDI
If value.Id = OPModes.Mdi Then If value.Id = OPModes.Mdi Then
' mostro pagina comandi MDI ' mostro pagina comandi MDI
@@ -561,8 +561,6 @@ Public Class LeftPanelVM
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
MyMachGroupVM.UpdateProduceIsEnabledForAll() MyMachGroupVM.UpdateProduceIsEnabledForAll()
End If End If
' aggiorno log macchina
Map.refMachineLogPageVM.UpdateMachineLogList(False)
End Sub End Sub
#End Region ' DoneRawPart #End Region ' DoneRawPart
@@ -802,8 +800,6 @@ Public Class LeftPanelVM
Next Next
SetDonePart(SelMachGroup, SelMachGroup.SelPart) SetDonePart(SelMachGroup, SelMachGroup.SelPart)
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
' aggiorno log macchina
Map.refMachineLogPageVM.UpdateMachineLogList(False)
End Sub End Sub
Public Sub SetDonePart(MachGroup As MyMachGroupVM, Part As PartVM) Public Sub SetDonePart(MachGroup As MyMachGroupVM, Part As PartVM)
+1 -1
View File
@@ -163,7 +163,7 @@ Public Class MDIPageVM
''' </summary> ''' </summary>
Friend Sub SendMDI() Friend Sub SendMDI()
If Not String.IsNullOrWhiteSpace(m_sMDICommand_Text) Then If Not String.IsNullOrWhiteSpace(m_sMDICommand_Text) Then
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.MDI, m_sMDICommand_Text)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.MDI, m_sMDICommand_Text))
End If End If
End Sub End Sub
@@ -427,11 +427,11 @@ Public Class MachCommandMessagePanelVM
End Property End Property
Public Sub Disconnect() Public Sub Disconnect()
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.DISCONNECT)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.DISCONNECT))
End Sub End Sub
Public Sub SetOPState(OpState As Integer) Public Sub SetOPState(OpState As Integer)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SETOPMODE)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.SETOPMODE))
End Sub End Sub
Public ReadOnly Property Start_Command As ICommand Public ReadOnly Property Start_Command As ICommand
@@ -442,7 +442,7 @@ Public Class MachCommandMessagePanelVM
End Property End Property
Public Sub Start(ByVal param As Object) Public Sub Start(ByVal param As Object)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.START)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.START))
End Sub End Sub
Public ReadOnly Property Stop_Command As ICommand Public ReadOnly Property Stop_Command As ICommand
@@ -453,7 +453,7 @@ Public Class MachCommandMessagePanelVM
End Property End Property
Public Sub [Stop](ByVal param As Object) Public Sub [Stop](ByVal param As Object)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOP_)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOP_))
End Sub End Sub
Public ReadOnly Property Reset_Command As ICommand Public ReadOnly Property Reset_Command As ICommand
@@ -464,7 +464,7 @@ Public Class MachCommandMessagePanelVM
End Property End Property
Public Sub Reset(ByVal param As Object) Public Sub Reset(ByVal param As Object)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.RESET)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.RESET))
' annullo stato di pronto ad essere lavorato di tutti i programmi ' annullo stato di pronto ad essere lavorato di tutti i programmi
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then Map.refProjectVM.SupervisorMachGroupPanelVM.ResetAllMachGroups() If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then Map.refProjectVM.SupervisorMachGroupPanelVM.ResetAllMachGroups()
End Sub End Sub
@@ -477,7 +477,7 @@ Public Class MachCommandMessagePanelVM
End Property End Property
Public Sub [Step](ByVal param As Object) Public Sub [Step](ByVal param As Object)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STEP_)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STEP_))
End Sub End Sub
Public ReadOnly Property SetPoint_Command As ICommand Public ReadOnly Property SetPoint_Command As ICommand
@@ -488,7 +488,7 @@ Public Class MachCommandMessagePanelVM
End Property End Property
Public Sub SetPoint(ByVal param As Object) Public Sub SetPoint(ByVal param As Object)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.SETPOINT)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.SETPOINT))
End Sub End Sub
@@ -500,7 +500,7 @@ Public Class MachCommandMessagePanelVM
End Property End Property
Public Sub DeleteAlarms(ByVal param As Object) Public Sub DeleteAlarms(ByVal param As Object)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.DELETEALARMS)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.DELETEALARMS))
End Sub End Sub
Public Function GetVarPathByName(Name As String) As String Public Function GetVarPathByName(Name As String) As String
@@ -10,6 +10,9 @@ Imports EgtBEAMWALL.Supervisor.CommVar
Public Class MachManaging Public Class MachManaging
' lock per aggiunta elemento a lista MachGroup
Private Shared Lock_CommandList As New Object
Private m_bConnected As Boolean = False Private m_bConnected As Boolean = False
Public ReadOnly Property bConnected As Boolean Public ReadOnly Property bConnected As Boolean
Get Get
@@ -53,6 +56,22 @@ Public Class MachManaging
Return m_CommandList Return m_CommandList
End Get End Get
End Property End Property
Friend Shared Sub AddToCommandList(value As ThreadCommand)
SyncLock Lock_CommandList
' EgtOutLog("Inizio ciclo rimozioni")
For CommandIndex = m_CommandList.Count - 1 To 0 Step -1
Dim Command As ThreadCommand = m_CommandList(CommandIndex)
If Command.ProcessingStatus = ThreadCommand.ProcessingStatuses.DONE Then
' EgtOutLog("Inizio rimozione comando")
m_CommandList.Remove(Command)
' EgtOutLog("Fine rimozione comando")
End If
Next
' EgtOutLog("Fine ciclo rimozioni")
CommandList.Add(value)
' EgtOutLog("Count dopo aggiunta: " & CommandList.Count)
End SyncLock
End Sub
Private m_bStartPending As Boolean = False Private m_bStartPending As Boolean = False
Public ReadOnly Property StartPending As Boolean Public ReadOnly Property StartPending As Boolean
@@ -569,8 +588,6 @@ Public Class MachManaging
' scrivo evento inizio MachGroup su DB ' scrivo evento inizio MachGroup su DB
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(dtStart, nP_Prod, nP_Machgroup, nP_State, DbControllers.SupervisorId)) DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(dtStart, nP_Prod, nP_Machgroup, nP_State, DbControllers.SupervisorId))
End If End If
' flag di aggiornamento log macchina
Map.refMachineLogPageVM.UpdateMachineLogList(False)
' attesa per essere sicuro che abbia scritto e riletto variabili ' attesa per essere sicuro che abbia scritto e riletto variabili
Threading.Thread.Sleep(300) Threading.Thread.Sleep(300)
ElseIf nP_State = PartState.END_ Then ElseIf nP_State = PartState.END_ Then
@@ -640,7 +657,7 @@ Public Class MachManaging
' se non impostata data start ' se non impostata data start
If MachGroup.dtStartTime = DateTime.MinValue Then If MachGroup.dtStartTime = DateTime.MinValue Then
EgtOutLog("Start date not set on Prod " & nP_Prod & " Machgroup " & nP_Machgroup) ' EgtOutLog("Start date not set on Prod " & nP_Prod & " Machgroup " & nP_Machgroup)
Dim dtStart As DateTime = MachGroup.dtEndTime - TimeSpan.FromSeconds(60) Dim dtStart As DateTime = MachGroup.dtEndTime - TimeSpan.FromSeconds(60)
' provo a recuperare tempo stimato ' provo a recuperare tempo stimato
If MachGroup.nCALC_TIME > 0 Then If MachGroup.nCALC_TIME > 0 Then
@@ -680,8 +697,6 @@ Public Class MachManaging
Map.refLeftPanelVM.PrintLabel(MachGroup, Part) Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
End If End If
End If End If
' flag di aggiornamento log macchina
Map.refMachineLogPageVM.UpdateMachineLogList(False)
' attesa per essere sicuro che abbia scritto e riletto variabili ' attesa per essere sicuro che abbia scritto e riletto variabili
Threading.Thread.Sleep(300) Threading.Thread.Sleep(300)
End If End If
@@ -726,7 +741,7 @@ Public Class MachManaging
End Function End Function
Private Function SendNextProgram() As Boolean Private Function SendNextProgram() As Boolean
EgtOutLog("Inizio SendNextProgram") ' EgtOutLog("Inizio SendNextProgram")
Dim bSent As Boolean = False Dim bSent As Boolean = False
If (CurrentMachine.NCType = NCTypes.TPA AndAlso Not m_bStartPending AndAlso Tpa.opState = MachineOperatingState.Pending) OrElse If (CurrentMachine.NCType = NCTypes.TPA AndAlso Not m_bStartPending AndAlso Tpa.opState = MachineOperatingState.Pending) OrElse
(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM AndAlso Not Num_Flexium.bIsTransferActive) OrElse (CurrentMachine.NCType = NCTypes.NUM_FLEXIUM AndAlso Not Num_Flexium.bIsTransferActive) OrElse
@@ -734,20 +749,20 @@ Public Class MachManaging
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT AndAlso Not Num_Axium_PCToolkit.bIsTransferActive) Then ' Or Tpa.opState = MachineOperatingState.Start) Then (CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT AndAlso Not Num_Axium_PCToolkit.bIsTransferActive) Then ' Or Tpa.opState = MachineOperatingState.Start) Then
' verifico se c'e' un programma da lanciare ' verifico se c'e' un programma da lanciare
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
EgtOutLog("Start " & DateTime.Now()) ' EgtOutLog("Start " & DateTime.Now())
Dim bMachGroupNotReady As Boolean = False Dim bMachGroupNotReady As Boolean = False
SyncLock m_Lock_SendProgram SyncLock m_Lock_SendProgram
For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
EgtOutLog("Ciclo su name: " & MyMachGroup.Name & " id: " & MyMachGroup.Id) ' EgtOutLog("Ciclo su name: " & MyMachGroup.Name & " id: " & MyMachGroup.Id)
If Not MyMachGroup.bSentToMachine AndAlso (MyMachGroup.dtStartTime = DateTime.MinValue OrElse If Not MyMachGroup.bSentToMachine AndAlso (MyMachGroup.dtStartTime = DateTime.MinValue OrElse
(Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL AndAlso MyMachGroup.bResetWhileCutting)) Then (Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL AndAlso MyMachGroup.bResetWhileCutting)) Then
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " è da fare") ' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " è da fare")
' verifico se ricalcolo finito ' verifico se ricalcolo finito
If MyMachGroup.bReadyForMachining AndAlso If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER OrElse CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT, Not MyMachGroup.bSendingToMachine, True) Then If MyMachGroup.bReadyForMachining AndAlso If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER OrElse CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT, Not MyMachGroup.bSendingToMachine, True) Then
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " pronto per essere lavorato") ' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " pronto per essere lavorato")
' lo lancio ' lo lancio
bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name) bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name)
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString()) ' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString())
Select Case CurrentMachine.NCType Select Case CurrentMachine.NCType
Case NCTypes.TPA Case NCTypes.TPA
MyMachGroup.SetSentToMachine(bSent) MyMachGroup.SetSentToMachine(bSent)
@@ -759,7 +774,7 @@ Public Class MachManaging
Else Else
' programma non ancora pronto, esco per attendere ' programma non ancora pronto, esco per attendere
bMachGroupNotReady = True bMachGroupNotReady = True
EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " non ancora pronto per essere mandato") ' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " non ancora pronto per essere mandato")
Exit For Exit For
'Return False 'Return False
End If End If
@@ -767,7 +782,7 @@ Public Class MachManaging
Next Next
End SyncLock End SyncLock
If bMachGroupNotReady Then Return False If bMachGroupNotReady Then Return False
EgtOutLog("End " & DateTime.Now()) ' EgtOutLog("End " & DateTime.Now())
End If End If
End If End If
Return bSent Return bSent
@@ -775,10 +790,17 @@ Public Class MachManaging
Private Sub CommandList_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs) Private Sub CommandList_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
If Not IsNothing(e.NewItems) Then If Not IsNothing(e.NewItems) Then
For Each Command In e.NewItems ' EgtOutLog("Inizio ciclo esecuzione comandi")
ExecuteCommand(DirectCast(Command, ThreadCommand)) Dim nCommandCount As Integer = e.NewItems.Count
m_CommandList.Remove(Command) For CommandIndex = 0 To nCommandCount - 1
Dim Command As ThreadCommand = e.NewItems(CommandIndex)
If Command.ProcessingStatus = ThreadCommand.ProcessingStatuses.WAITING Then
Command.SetProcessingStatus(ThreadCommand.ProcessingStatuses.PROCESSING)
ExecuteCommand(DirectCast(Command, ThreadCommand))
Command.SetProcessingStatus(ThreadCommand.ProcessingStatuses.DONE)
End If
Next Next
' EgtOutLog("Fine ciclo esecuzione di " & nCommandCount & " comandi")
End If End If
End Sub End Sub
@@ -1048,7 +1070,7 @@ Public Class MachManaging
Num_Axium_APServer.StartTransfer() Num_Axium_APServer.StartTransfer()
Return True Return True
Case NCTypes.NUM_AXIUM_PCTOOLKIT Case NCTypes.NUM_AXIUM_PCTOOLKIT
EgtOutLog("Pre Download") ' EgtOutLog("Pre Download")
Dim nFileType As Integer = 0 Dim nFileType As Integer = 0
If Integer.TryParse(ProgramId, nFileType) AndAlso nFileType > 0 Then If Integer.TryParse(ProgramId, nFileType) AndAlso nFileType > 0 Then
Num_Axium_PCToolkit.FileDownload(nFileType * 10, ProgramPath) Num_Axium_PCToolkit.FileDownload(nFileType * 10, ProgramPath)
@@ -54,6 +54,12 @@ End Class
Public Class ThreadCommand Public Class ThreadCommand
Public Enum ProcessingStatuses
WAITING = 1
PROCESSING = 2
DONE = 3
End Enum
Private m_CommandType As CommandTypes Private m_CommandType As CommandTypes
Public ReadOnly Property CommandType As CommandTypes Public ReadOnly Property CommandType As CommandTypes
Get Get
@@ -95,6 +101,16 @@ Public Class ThreadCommand
End Get End Get
End Property End Property
Private m_ProcessingStatus As ProcessingStatuses = ProcessingStatuses.WAITING
Public ReadOnly Property ProcessingStatus As ProcessingStatuses
Get
Return m_ProcessingStatus
End Get
End Property
Friend Sub SetProcessingStatus(value As ProcessingStatuses)
m_ProcessingStatus = value
End Sub
Protected Sub New() Protected Sub New()
End Sub End Sub
@@ -25,21 +25,21 @@
</Grid> </Grid>
<StackPanel Orientation="Horizontal" Height="30"> <StackPanel Orientation="Horizontal" Height="30">
<TextBlock Text="Entità" <TextBlock Text="{Binding Entity_Msg}"
Style="{StaticResource Log_TextBlock}"/> Style="{StaticResource Log_TextBlock}"/>
<ComboBox ItemsSource="{Binding EntityTypeList}" <ComboBox ItemsSource="{Binding EntityTypeList}"
SelectedIndex="{Binding SelEntityType}" SelectedIndex="{Binding SelEntityType}"
Width="70" Width="70"
Margin="0,0,2.5,0" Margin="0,0,2.5,0"
Style="{StaticResource PartParam_ComboBox}"/> Style="{StaticResource PartParam_ComboBox}"/>
<TextBlock Text="Evento" <TextBlock Text="{Binding Event_Msg}"
Style="{StaticResource Log_TextBlock}"/> Style="{StaticResource Log_TextBlock}"/>
<ComboBox ItemsSource="{Binding PartEventTypeList}" <ComboBox ItemsSource="{Binding PartEventTypeList}"
SelectedIndex="{Binding SelPartEventType}" SelectedIndex="{Binding SelPartEventType}"
Width="70" Width="70"
Margin="0,0,2.5,0" Margin="0,0,2.5,0"
Style="{StaticResource PartParam_ComboBox}"/> Style="{StaticResource PartParam_ComboBox}"/>
<TextBlock Text="Data" <TextBlock Text="{Binding Date_Msg}"
Style="{StaticResource Log_TextBlock}"/> Style="{StaticResource Log_TextBlock}"/>
<ComboBox ItemsSource="{Binding DayTypeList}" <ComboBox ItemsSource="{Binding DayTypeList}"
SelectedIndex="{Binding SelDayType}" SelectedIndex="{Binding SelDayType}"
@@ -47,11 +47,11 @@
Margin="0,0,2.5,0" Margin="0,0,2.5,0"
Style="{StaticResource PartParam_ComboBox}"/> Style="{StaticResource PartParam_ComboBox}"/>
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}"> <StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
<TextBlock Text="Dal" <TextBlock Text="{Binding From_Msg}"
Style="{StaticResource Log_TextBlock}"/> Style="{StaticResource Log_TextBlock}"/>
<DatePicker SelectedDate="{Binding dtStartDate}" <DatePicker SelectedDate="{Binding dtStartDate}"
Style="{StaticResource Log_DatePicker}"/> Style="{StaticResource Log_DatePicker}"/>
<TextBlock Text="Al" <TextBlock Text="{Binding To_Msg}"
Style="{StaticResource Log_TextBlock}"/> Style="{StaticResource Log_TextBlock}"/>
<DatePicker SelectedDate="{Binding dtEndDate}" <DatePicker SelectedDate="{Binding dtEndDate}"
Style="{StaticResource Log_DatePicker}"/> Style="{StaticResource Log_DatePicker}"/>
@@ -9,10 +9,6 @@ Imports EgtBEAMWALL.Core.MachLog
Public Class MachineLogPageVM Public Class MachineLogPageVM
Inherits VMBase Inherits VMBase
Private m_Lock_LogList As New Object
Private m_MachineLog_Timer As New DispatcherTimer
Private Enum DayTypes As Integer Private Enum DayTypes As Integer
TODAY = 0 TODAY = 0
YESTERDAY = 1 YESTERDAY = 1
@@ -72,7 +68,7 @@ Public Class MachineLogPageVM
End Set End Set
End Property End Property
Private m_PartEventTypeList As New List(Of String)({"", "Inizio", "Fine"}) Private m_PartEventTypeList As New List(Of String)({"", EgtMsg(62527), EgtMsg(62528)})
Public ReadOnly Property PartEventTypeList As List(Of String) Public ReadOnly Property PartEventTypeList As List(Of String)
Get Get
Return m_PartEventTypeList Return m_PartEventTypeList
@@ -91,7 +87,7 @@ Public Class MachineLogPageVM
End Set End Set
End Property End Property
Private m_EntityTypeList As New List(Of String)({"", "Pezzo", "Barra"}) Private m_EntityTypeList As New List(Of String)({"", EgtMsg(62525), EgtMsg(62526)})
Public ReadOnly Property EntityTypeList As List(Of String) Public ReadOnly Property EntityTypeList As List(Of String)
Get Get
Return m_EntityTypeList Return m_EntityTypeList
@@ -110,7 +106,7 @@ Public Class MachineLogPageVM
End Set End Set
End Property End Property
Private m_DayTypeList As New List(Of String)({"Oggi", "Ieri", "Periodo"}) Private m_DayTypeList As New List(Of String)({EgtMsg(62529), EgtMsg(62530), EgtMsg(62531)})
Public ReadOnly Property DayTypeList As List(Of String) Public ReadOnly Property DayTypeList As List(Of String)
Get Get
Return m_DayTypeList Return m_DayTypeList
@@ -135,7 +131,7 @@ Public Class MachineLogPageVM
End If End If
NotifyPropertyChanged(NameOf(Date_Visibility)) NotifyPropertyChanged(NameOf(Date_Visibility))
' aggiorno lista da Db ' aggiorno lista da Db
UpdateMachineLogList(True) UpdateMachineLogList()
End Set End Set
End Property End Property
@@ -149,7 +145,7 @@ Public Class MachineLogPageVM
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc() Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_STARTDATE, lStartDate.ToString()) WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_STARTDATE, lStartDate.ToString())
' aggiorno lista da Db ' aggiorno lista da Db
UpdateMachineLogList(True) UpdateMachineLogList()
End Set End Set
End Property End Property
@@ -163,7 +159,7 @@ Public Class MachineLogPageVM
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc() Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_ENDDATE, lEndDate.ToString()) WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_ENDDATE, lEndDate.ToString())
' aggiorno lista da Db ' aggiorno lista da Db
UpdateMachineLogList(True) UpdateMachineLogList()
End Set End Set
End Property End Property
@@ -227,6 +223,35 @@ Public Class MachineLogPageVM
End Get End Get
End Property End Property
Public ReadOnly Property Entity_Msg As String
Get
Return EgtMsg(62520)
End Get
End Property
Public ReadOnly Property Event_Msg As String
Get
Return EgtMsg(62521)
End Get
End Property
Public ReadOnly Property Date_Msg As String
Get
Return EgtMsg(62522)
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
#End Region ' Messages #End Region ' Messages
@@ -267,9 +292,6 @@ Public Class MachineLogPageVM
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today) m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
m_Date_Visibility = Visibility.Visible m_Date_Visibility = Visibility.Visible
End Select 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 Sub
#End Region ' CONSTRUCTORS #End Region ' CONSTRUCTORS
@@ -312,69 +334,21 @@ Public Class MachineLogPageVM
m_colMachineLog_Description.ColumnVisibility = Visibility.Collapsed m_colMachineLog_Description.ColumnVisibility = Visibility.Collapsed
m_colMachineLog_SupervisorId.ColumnVisibility = Visibility.Collapsed m_colMachineLog_SupervisorId.ColumnVisibility = Visibility.Collapsed
End If End If
UpdateMachineLogList(True) UpdateMachineLogList()
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList) m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
m_MachineLogList_View.Filter = AddressOf MachineLogFilter m_MachineLogList_View.Filter = AddressOf MachineLogFilter
End Sub End Sub
' indice di aggiornamento della lista rispetto a Db Friend Sub UpdateMachineLogList()
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()) '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 Select Case m_SelDayType
Case DayTypes.PERIOD Case DayTypes.TODAY
DbList = DbControllers.m_LogMachineController.GetCoreDesc(m_dtStartDate, m_dtEndDate + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList() 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 Case DayTypes.YESTERDAY
DbList = DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today - TimeSpan.FromDays(1), DateTime.Today).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList() 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 Else ' DayTypes.TODAY Case DayTypes.PERIOD
DbList = DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today, DateTime.Today + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList() 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())
End Select 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)) NotifyPropertyChanged(NameOf(MachineLogList))
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList) m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
m_MachineLogList_View.Filter = AddressOf MachineLogFilter m_MachineLogList_View.Filter = AddressOf MachineLogFilter
@@ -402,7 +376,7 @@ Public Class MachineLogPageVM
''' Execute the Open. This method is invoked by the OpenCommand. ''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary> ''' </summary>
Friend Sub Refresh() Friend Sub Refresh()
UpdateMachineLogList(False) UpdateMachineLogList()
End Sub End Sub
#End Region ' Refresh #End Region ' Refresh
@@ -277,31 +277,31 @@ Public Class MainMenuVM
Private Function InitINPUTS() As Boolean Private Function InitINPUTS() As Boolean
' fermo e riavvio lettura variabili per includere quelle della pagina input ' fermo e riavvio lettura variabili per includere quelle della pagina input
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage)) Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Return True Return True
End Function End Function
Private Function ExitINPUTS() As Boolean Private Function ExitINPUTS() As Boolean
' fermo e riavvio lettura variabili per includere quelle della pagina input ' fermo e riavvio lettura variabili per includere quelle della pagina input
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
Return True Return True
End Function End Function
Private Function InitOUTPUTS() As Boolean Private Function InitOUTPUTS() As Boolean
' fermo e riavvio lettura variabili per includere quelle della pagina input ' fermo e riavvio lettura variabili per includere quelle della pagina input
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage)) Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Return True Return True
End Function End Function
Private Function ExitOUTPUTS() As Boolean Private Function ExitOUTPUTS() As Boolean
' fermo e riavvio lettura variabili per includere quelle della pagina input ' fermo e riavvio lettura variabili per includere quelle della pagina input
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
Return True Return True
End Function End Function
@@ -248,8 +248,8 @@ Public Class MainWindowM
EgtSetLockId( sLockId) EgtSetLockId( sLockId)
End If End If
' Recupero livello e opzioni della chiave ' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2505, 1, m_nKeyLevel) And Dim bKey As Boolean = EgtGetKeyLevel(5327, 2506, 1, m_nKeyLevel) And
EgtGetKeyOptions(5327, 2505, 1, m_nKeyOptions) EgtGetKeyOptions(5327, 2506, 1, m_nKeyOptions)
' Inizializzazione generale di EgtInterface ' Inizializzazione generale di EgtInterface
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0) m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
m_sLogFile = m_sTempDir & "\" & SUPGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString()) m_sLogFile = m_sTempDir & "\" & SUPGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
@@ -234,7 +234,7 @@ Public Class MainWindowVM
Return Return
End If End If
' disconnetto comunicazione con macchina ' disconnetto comunicazione con macchina
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.DISCONNECT)) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.DISCONNECT))
' termino thread di comunicazione con Db ed altri programmi ' termino thread di comunicazione con Db ed altri programmi
ViewerOptimizerCommThread.StopThread() ViewerOptimizerCommThread.StopThread()
' Verifico modifica parametri in Configurazione e chiedo il salvataggio ' Verifico modifica parametri in Configurazione e chiedo il salvataggio
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below: ' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.5.5.4")> <Assembly: AssemblyVersion("2.5.6.2")>
<Assembly: AssemblyFileVersion("2.5.5.4")> <Assembly: AssemblyFileVersion("2.5.6.2")>
@@ -12,19 +12,12 @@ Public Class OpenProjectFileDialogVM
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean? 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_ProjectType = ProjectType
' carico colonne ' carico colonne
LoadColumns(ProjectType) LoadColumns(m_ProjectType)
NotifyPropertyChanged(NameOf(SearchColumnList)) NotifyPropertyChanged(NameOf(FilterTypeList))
m_SelSearchColumn = m_SearchColumnList(0) m_SelFilterType = m_FilterTypeList(0)
' carico lista progetti ' carico lista progetti
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
' leggo da db RefreshProjectList(GoToProd)
If ProjectType = ProjectType.PROD Then
Dim DbProjectList As New List(Of ProdFileM)
DbProjectList = DbControllers.m_ProdController.GetLastDesc(50)
For Each Project In DbProjectList
m_ProjectList.Add(New ProdFileVM(Project))
Next
End If
Else Else
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList) m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
NotifyPropertyChanged(NameOf(ProjectList)) NotifyPropertyChanged(NameOf(ProjectList))
@@ -33,6 +26,45 @@ Public Class OpenProjectFileDialogVM
m_ProjectList_View.Filter = AddressOf ProjectFilter m_ProjectList_View.Filter = AddressOf ProjectFilter
End Function 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.FIFTY
nRowQuantity = 50
Case RowQuantities.HUNDRED
nRowQuantity = 100
Case RowQuantities.HUNDREDANDFIFTY
nRowQuantity = 150
End Select
Select Case m_SelDayType
Case DayTypes.LASTMONTH
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
dtStart = dtEnd - TimeSpan.FromDays(31)
Case DayTypes.LAST3MONTHS
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
dtStart = dtEnd - TimeSpan.FromDays(31 * 3)
Case DayTypes.LAST6MONTHS
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
dtStart = dtEnd - TimeSpan.FromDays(31 * 6)
Case DayTypes.PERIOD
dtStart = dtStartDate + TimeSpan.FromDays(1)
dtEnd = dtEndDate
End Select
' leggo da db
If 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
m_ProjectList.Add(New ProdFileVM(Project))
Next
End If
End Sub
#End Region ' METHODS #End Region ' METHODS
End Class End Class
@@ -348,6 +348,11 @@
<Setter Property="Margin" Value="5,0,5,0"/> <Setter Property="Margin" Value="5,0,5,0"/>
</Style> </Style>
<Style x:Key="Filter_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="2.5,0,2.5,0"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- TextBox --> <!-- TextBox -->
@@ -733,5 +738,14 @@
</Style> </Style>
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- DatePicker -->
<Style x:Key="Filter_DatePicker" TargetType="{x:Type DatePicker}">
<Setter Property="Height" Value="22" />
<Setter Property="Width" Value="100" />
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
</ResourceDictionary> </ResourceDictionary>
+4 -3
View File
@@ -1,4 +1,5 @@
Imports EgtWPFLib5 Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core Imports EgtBEAMWALL.Core
Public Class LogEvent Public Class LogEvent
@@ -77,9 +78,9 @@ Public Class LogEvent
Get Get
Select Case m_Status Select Case m_Status
Case 1 Case 1
Return "Inizio" Return EgtMsg(62527)
Case 2 Case 2
Return "Fine" Return EgtMsg(62528)
Case Else Case Else
Return "" Return ""
End Select End Select
@@ -64,7 +64,7 @@ Public Class Variable
Return CommVar.sValue Return CommVar.sValue
End Get End Get
Set(value As String) Set(value As String)
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.WRITE, {CommVar.nType}, Nothing, {CommVar.sAddress, value})) MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.WRITE, {CommVar.nType}, Nothing, {CommVar.sAddress, value}))
NotifyPropertyChanged(NameOf(sValue)) NotifyPropertyChanged(NameOf(sValue))
End Set End Set
End Property End Property
+1 -1
View File
@@ -6,7 +6,7 @@
</configSections> </configSections>
<entityFramework> <entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />--> <!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers> <providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider> </provider>
+1 -1
View File
@@ -2,10 +2,10 @@
<packages> <packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" /> <package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
<package id="Csv" version="1.0.31" targetFramework="net472" /> <package id="Csv" version="1.0.31" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" /> <package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="FluentFTP" version="19.2.2" targetFramework="net472" /> <package id="FluentFTP" version="19.2.2" targetFramework="net472" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" /> <package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
<package id="Ionic.Zip" version="1.9.1.8" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" /> <package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" /> <package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" /> <package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
+9 -1
View File
@@ -6,7 +6,7 @@
</configSections> </configSections>
<entityFramework> <entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />--> <!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers> <providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider> </provider>
@@ -41,6 +41,14 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" /> <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<system.data> <system.data>
@@ -120,9 +120,17 @@ Public Class BTLFeatureVM
End Get End Get
Set(value As String) Set(value As String)
Dim nTemp As Integer = 0 Dim nTemp As Integer = 0
If Integer.TryParse(value, nTemp) Then If Integer.TryParse(value, nTemp) Then
m_BTLFeatureM.nPriority = nTemp If EgtSetInfo(nFeatureId, BTL_FTR_PRIORITY, nTemp) Then
EgtSetInfo( nFeatureId, BTL_FTR_PRIORITY, m_BTLFeatureM.nPriority) m_BTLFeatureM.nPriority = nTemp
' setto feature da ricalcolare
ResetCalcFeature()
' se in View
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
' imposto modificato per copie
EgtDuploSetModified(m_BTLPartM.nPartId)
End If
End If
End If End If
NotifyPropertyChanged(NameOf(sPriority)) NotifyPropertyChanged(NameOf(sPriority))
End Set End Set
@@ -2164,7 +2164,7 @@ Public Class BTLPartVM
' imposto path disegno da mostrare in BottomPanel ' imposto path disegno da mostrare in BottomPanel
Dim SelPBTLParam As BTLParamVM = Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.SelPBTLParam Dim SelPBTLParam As BTLParamVM = Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.SelPBTLParam
If Not IsNothing(SelPBTLParam) Then Map.refBottomPanelVM.SetCurrDraw(SelPBTLParam.sDrawPath) If Not IsNothing(SelPBTLParam) Then Map.refBottomPanelVM.SetCurrDraw(SelPBTLParam.sDrawPath)
Case NameOf(sender.bDO) Case NameOf(sender.bDO), NameOf(sender.sPriority)
NotifyPropertyChanged(NameOf(bDOALL)) NotifyPropertyChanged(NameOf(bDOALL))
' setto pezzo da ricalcolare ' setto pezzo da ricalcolare
'ResetCalcTotalPart() 'ResetCalcTotalPart()
@@ -71,6 +71,64 @@
<CheckBox IsChecked="{Binding bPrintLabel_IsChecked}" <CheckBox IsChecked="{Binding bPrintLabel_IsChecked}"
Margin="0,5,0,0"/> Margin="0,5,0,0"/>
</UniformGrid> </UniformGrid>
<GroupBox Header="Backup And Restore">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0"
Margin="0,2,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<CheckBox x:Name="ExternalBackup_CheckBox"
IsChecked="{Binding bExternalBackupActive}"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="1"
Text="External file path:"
VerticalAlignment="Center"/>
</Grid>
<Grid Grid.Row="1"
Margin="0,2,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding ExternalBackupFolderPath}"
IsEnabled="{Binding IsChecked, ElementName=ExternalBackup_CheckBox}"
Margin="0,0,2.5,0"/>
<Button Grid.Column="1"
Content="..."
Width="18"
Command="{Binding ChooseExternalBackupFolderPath_Command}"
IsEnabled="{Binding IsChecked, ElementName=ExternalBackup_CheckBox}"
Margin="2.5,0,0,0"/>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Reminder Frequency"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding ReminderList}"
SelectedItem="{Binding SelReminder}"/>
</Grid>
<StackPanel Grid.Row="3"
Orientation="Horizontal">
<Button Content="Backup"
Command="{Binding Backup_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Restore"
Command="{Binding Restore_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</StackPanel>
</Grid>
</GroupBox>
</StackPanel> </StackPanel>
</Grid> </Grid>
</TabItem.Content> </TabItem.Content>
@@ -3,6 +3,12 @@ Imports System.IO
Imports EgtUILib Imports EgtUILib
Imports EgtWPFLib5 Imports EgtWPFLib5
Imports EgtBEAMWALL.Core Imports EgtBEAMWALL.Core
Imports MS.Internal
Imports Org.BouncyCastle.X509
Imports Ionic.Zip
Imports Org.BouncyCastle.Bcpg
Imports Microsoft.VisualBasic.ApplicationServices
Imports Renci.SshNet.Security
Public Class ConfigurationPageVM Public Class ConfigurationPageVM
Inherits VMBase Inherits VMBase
@@ -36,8 +42,6 @@ Public Class ConfigurationPageVM
' flag modifica parametri Macchina ' flag modifica parametri Macchina
Friend bModifyMachParam As Boolean Friend bModifyMachParam As Boolean
' Definizione comandi
Private m_cmdSave As ICommand
Public ReadOnly Property MachinePanelVM As MachinePanelVM Public ReadOnly Property MachinePanelVM As MachinePanelVM
Get Get
@@ -160,6 +164,66 @@ Public Class ConfigurationPageVM
End Set End Set
End Property End Property
Private m_bBackupRunning As Boolean = False
Public ReadOnly Property bBackupRunning As Boolean
Get
Return m_bBackupRunning
End Get
End Property
Private m_bRestoreRunning As Boolean = False
Public ReadOnly Property bRestoreRunning As Boolean
Get
Return m_bRestoreRunning
End Get
End Property
Private m_bExternalBackupActive As Boolean
Public Property bExternalBackupActive As Boolean
Get
Return m_bExternalBackupActive
End Get
Set(value As Boolean)
m_bExternalBackupActive = value
WriteMainPrivateProfileString(S_BACKUPANDRESTORE, K_EXTERNALBACKUPACTIVE, If(m_bExternalBackupActive, 1, 0))
End Set
End Property
Private m_ExternalBackupFolderPath As String
Public Property ExternalBackupFolderPath As String
Get
Return m_ExternalBackupFolderPath
End Get
Set(value As String)
m_ExternalBackupFolderPath = value
WriteMainPrivateProfileString(S_BACKUPANDRESTORE, K_EXTERNALFILEPATH, m_ExternalBackupFolderPath)
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")})
Public ReadOnly Property ReminderList As List(Of IdNameStruct)
Get
Return m_ReminderList
End Get
End Property
Private m_SelReminder As IdNameStruct
Public Property SelReminder As IdNameStruct
Get
Return m_SelReminder
End Get
Set(value As IdNameStruct)
m_SelReminder = value
WriteMainPrivateProfileString(S_BACKUPANDRESTORE, K_REMINDERFREQUENCY, m_SelReminder.Id)
End Set
End Property
' Definizione comandi
Private m_cmdSave As ICommand
Private m_cmdChooseExternalBackupFolderPath As ICommand
Private m_cmdBackup As ICommand
Private m_cmdRestore As ICommand
#Region "Messages" #Region "Messages"
Public ReadOnly Property L_Msg As String Public ReadOnly Property L_Msg As String
@@ -327,7 +391,7 @@ Public Class ConfigurationPageVM
' leggo SectionTime e PartTime ' leggo SectionTime e PartTime
GetMainPrivateProfileString(S_NEST, K_SECTIONTIME, "", SectionTime) GetMainPrivateProfileString(S_NEST, K_SECTIONTIME, "", SectionTime)
GetMainPrivateProfileString(S_NEST, K_PARTTIME, "", PartTime) GetMainPrivateProfileString(S_NEST, K_PARTTIME, "", PartTime)
m_bPrintLabel_IsChecked = ( GetMainPrivateProfileInt(S_PRINTER, K_ENABLE, 0) <> 0) m_bPrintLabel_IsChecked = (GetMainPrivateProfileInt(S_PRINTER, K_ENABLE, 0) <> 0)
' assegno le liste dei parametri della macchina corrente alla ConfigMachTableList alla pagina di Configurazione ' assegno le liste dei parametri della macchina corrente alla ConfigMachTableList alla pagina di Configurazione
ConfigMachTableList = CurrentMachine.MachTableList ConfigMachTableList = CurrentMachine.MachTableList
' carico i parametri Q dei Process letti dall'ini ' carico i parametri Q dei Process letti dall'ini
@@ -346,10 +410,19 @@ Public Class ConfigurationPageVM
m_QBTLParamVMList_View = CollectionViewSource.GetDefaultView(m_QBTLParamVMList) m_QBTLParamVMList_View = CollectionViewSource.GetDefaultView(m_QBTLParamVMList)
m_QBTLParamVMList_View.GroupDescriptions.Add(New PropertyGroupDescription(NameOf(QBTLParamVM.GroupType))) m_QBTLParamVMList_View.GroupDescriptions.Add(New PropertyGroupDescription(NameOf(QBTLParamVM.GroupType)))
m_QBTLParamVMList_View.GroupDescriptions.Add(New PropertyGroupDescription(NameOf(QBTLParamVM.ghDesc))) m_QBTLParamVMList_View.GroupDescriptions.Add(New PropertyGroupDescription(NameOf(QBTLParamVM.ghDesc)))
' leggo dati per backup
GetMainPrivateProfileString(S_BACKUPANDRESTORE, K_EXTERNALFILEPATH, "", m_ExternalBackupFolderPath)
Dim nDefaultReminderFrequency As Integer = GetMainPrivateProfileInt(S_BACKUPANDRESTORE, K_REMINDERFREQUENCY, 1)
SelReminder = m_ReminderList.FirstOrDefault(Function(x) x.Id = nDefaultReminderFrequency)
Dim nExternalBackupActive As Integer = GetMainPrivateProfileInt(S_BACKUPANDRESTORE, K_EXTERNALBACKUPACTIVE, 0)
m_bExternalBackupActive = nExternalBackupActive > 0
NotifyPropertyChanged(NameOf(bExternalBackupActive))
End Sub End Sub
#End Region ' Constructor #End Region ' Constructor
#Region "COMMANDS"
#Region "SaveCommand" #Region "SaveCommand"
''' <summary> ''' <summary>
@@ -373,6 +446,333 @@ Public Class ConfigurationPageVM
#End Region ' SaveCommand #End Region ' SaveCommand
#Region "ChooseExternalBackupFolderPath"
''' <summary>
''' Returns a command that do Save.
''' </summary>
Public ReadOnly Property ChooseExternalBackupFolderPath_Command As ICommand
Get
If m_cmdChooseExternalBackupFolderPath Is Nothing Then
m_cmdChooseExternalBackupFolderPath = New Command(AddressOf ChooseExternalBackupFolderPath)
End If
Return m_cmdChooseExternalBackupFolderPath
End Get
End Property
''' <summary>
''' Execute the Save. This method is invoked by the SaveCommand.
''' </summary>
Public Sub ChooseExternalBackupFolderPath()
'Dim FileDialog As New System.Windows.Forms.FolderBrowserDialog With {.SelectedPath = m_ExternalBackupFolderPath,
' .Description = "Backup & Restore File Path"}
Dim FileDialog As New Microsoft.Win32.SaveFileDialog() With {.InitialDirectory = m_ExternalBackupFolderPath,
.CheckFileExists = False,
.CheckPathExists = False,
.DefaultExt = ".folder",
.OverwritePrompt = False,
.FileName = "Select this ",
.Title = "Backup & Restore File Path"}
If FileDialog.ShowDialog() Then
m_ExternalBackupFolderPath = Path.GetDirectoryName(FileDialog.FileName)
WriteMainPrivateProfileString(S_BACKUPANDRESTORE, K_EXTERNALFILEPATH, m_ExternalBackupFolderPath)
NotifyPropertyChanged(NameOf(ExternalBackupFolderPath))
End If
End Sub
#End Region ' ChooseExternalBackupFolderPath
#Region "Backup"
''' <summary>
''' Returns a command that do Save.
''' </summary>
Public ReadOnly Property Backup_Command As ICommand
Get
If m_cmdBackup Is Nothing Then
m_cmdBackup = New Command(AddressOf BackupCmd)
End If
Return m_cmdBackup
End Get
End Property
''' <summary>
''' Execute the Save. This method is invoked by the SaveCommand.
''' </summary>
Public Sub BackupCmd()
Backup(True)
End Sub
Public Sub Backup(bLoadingWindow As Boolean)
m_bBackupRunning = True
' verifico se esiste cartella backup, altrimenti la creo
Dim sBackupFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\Backup"
If Directory.Exists(sBackupFolder) Then
' verifico se devo cancellare backup vecchi
Dim nBackupCount As Integer = 0
Dim YearDirList() As String = Directory.GetDirectories(sBackupFolder)
For YearIndex = YearDirList.Length - 1 To 0 Step -1
Dim nYear As Integer = 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
Dim nMonth As Integer = 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
Dim nDay As Integer = 0
Integer.TryParse(Path.GetFileName(DayDirList(DayIndex)), nDay)
If nBackupCount > 3 Then
Directory.Delete(sBackupFolder & "\" & nYear & "\" & nMonth & "\" & nDay, True)
End If
Next
DayDirList = Directory.GetDirectories(sMonthDir)
If IsNothing(DayDirList) OrElse DayDirList.Length = 0 Then
Directory.Delete(sMonthDir)
End If
Next
MonthDirList = Directory.GetDirectories(sYearDir)
If IsNothing(MonthDirList) OrElse MonthDirList.Length = 0 Then
Directory.Delete(sYearDir)
End If
Next
Else
Directory.CreateDirectory(sBackupFolder)
End If
sBackupFolder &= "\" & DateTime.Now().Year
If Not Directory.Exists(sBackupFolder) Then
Directory.CreateDirectory(sBackupFolder)
End If
sBackupFolder &= "\" & DateTime.Now().Month
If Not Directory.Exists(sBackupFolder) Then
Directory.CreateDirectory(sBackupFolder)
End If
sBackupFolder &= "\" & DateTime.Now().Day
If Not Directory.Exists(sBackupFolder) Then
Directory.CreateDirectory(sBackupFolder)
End If
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
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)
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
' backup dei progetti correnti
Try
Using zip As New Ionic.Zip.ZipFile(sBackupFolder, Console.Out)
zip.AlternateEncodingUsage = ZipOption.Always
zip.AlternateEncoding = Text.Encoding.UTF8
zip.CompressionMethod = CompressionMethod.None
' aggiungo Db
zip.AddItem(sBackupZipPath, "")
' aggiungo cartella progetti
Dim sProjectFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir & "\"
Dim sKey As String = ""
EgtGetKeyInfo(sKey)
sKey = sKey.Replace(" ", "")
Dim sUserFolder As String = ""
If Not IsNothing(sKey) AndAlso sKey.Length > 11 Then
sUserFolder = sKey.Substring(3, 6)
sProjectFolder &= sUserFolder
End If
zip.AddItem(sProjectFolder, sUserFolder)
' salvo lo zip
zip.Save()
End Using
Catch ex As Exception
MessageBox.Show("Backup failed! Impossible to create the backup package!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
bOk = False
End Try
End If
' se esiste zip del Db, lo elimino
If File.Exists(sBackupZipPath) Then
File.Delete(sBackupZipPath)
End If
' se richiesto faccio copia su external source
If m_bExternalBackupActive Then
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)
End If
End If
'chiudo finestra di caricamento
If bLoadingWindow Then LoadingWndHelper.CloseLoadingWnd(ActiveIds.BACKUP)
m_bBackupRunning = False
End Sub
Private Async Sub CopyForExternalBackup(sBackupFile As String, sExternalBackupFolder As String)
Using SourceStream As FileStream = File.Open(sBackupFile, FileMode.Open)
Dim sExternalBackupFile As String = sExternalBackupFolder & "\" & Path.GetFileName(sBackupFile)
Using DestinationStream As FileStream = File.Create(sExternalBackupFile)
Await SourceStream.CopyToAsync(DestinationStream)
End Using
End Using
End Sub
#End Region ' Backup
#Region "Restore"
''' <summary>
''' Returns a command that do Save.
''' </summary>
Public ReadOnly Property Restore_Command As ICommand
Get
If m_cmdRestore Is Nothing Then
m_cmdRestore = New Command(AddressOf Restore)
End If
Return m_cmdRestore
End Get
End Property
''' <summary>
''' Execute the Save. This method is invoked by the SaveCommand.
''' </summary>
Public Sub Restore()
' recupero processo del supervisore
Dim sSupervisorName As String = "EgtBEAMWALL.SupervisorR32"
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)
Return
End If
m_bRestoreRunning = True
' verifico se esiste backup
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 sRestorePath As String = ""
If Directory.Exists(sBackupFolder) Then
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)))
sRestorePath = sDayDir & "\" & nMaxVersion & ".bwbck"
Exit For
End If
Next
If Not String.IsNullOrEmpty(sRestorePath) Then Exit For
Next
If Not String.IsNullOrEmpty(sRestorePath) Then Exit For
Next
End If
If String.IsNullOrEmpty(sRestorePath) Then
MessageBox.Show("Restore impossible! Last backup not found!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
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)
Case MessageBoxResult.Yes
bDoBackup = True
Case MessageBoxResult.No
bDoBackup = False
Case MessageBoxResult.Cancel
MessageBox.Show("Restore operation aborted!", "Warning", 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
If bDoBackup Then
Backup(False)
End If
' recupero cartella corrente dei progetti
Dim sProjectFolder As String = Map.refMainWindowVM.MainWindowM.sDataDir
Dim sKey As String = ""
EgtGetKeyInfo(sKey)
sKey = sKey.Replace(" ", "")
Dim sUserFolder As String = ""
If Not IsNothing(sKey) AndAlso sKey.Length > 11 Then
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
End If
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.RESTORE, 2, "Restore data extraction", 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
Directory.Delete(sRestoreDir, True)
End If
Directory.CreateDirectory(sRestoreDir)
Dim bOk As Boolean = True
' apro file zip
Try
Using zip As New Ionic.Zip.ZipFile(sRestorePath, Console.Out)
' estraggo file da zip
zip.ExtractAll(sRestoreDir)
End Using
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)
bOk = False
End Try
Dim sBackupTempPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\DbRestore"
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.RESTORE, 3, "Database restore", 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)
bOk = False
End Try
End If
If File.Exists(sRestoreDir & "\DbBackup.zip") Then
File.Delete(sRestoreDir & "\DbBackup.zip")
End If
If bOk Then
' sposto il backup al posto giusto
Directory.Move(sRestoreDir & "\" & sUserFolder, sProjectFolder & "\" & sUserFolder)
End If
If Directory.Exists(sRestoreDir) Then
Directory.Delete(sRestoreDir)
End If
LoadingWndHelper.CloseLoadingWnd(ActiveIds.RESTORE)
m_bRestoreRunning = False
End Sub
#End Region ' Restore
#End Region ' COMMANDS
#Region "Methods" #Region "Methods"
' funzione che scrive i parametri modificati sul file INI ' funzione che scrive i parametri modificati sul file INI
@@ -141,6 +141,9 @@
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath> <HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference> </Reference>
<Reference Include="DotNetZip, Version=1.16.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath> <HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
@@ -158,9 +161,6 @@
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath> <HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
</Reference> </Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL"> <Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath> <HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference> </Reference>
@@ -29,7 +29,7 @@ Public Class FeatureManagerVM
Public ReadOnly Property Priority_Visibility As Visibility Public ReadOnly Property Priority_Visibility As Visibility
Get Get
Return if(CurrentMachine.nType = Core.ConstBeam.MachineType.WALL, Visibility.Visible, Visibility.Collapsed) Return If(CurrentMachine.nType = Core.ConstBeam.MachineType.WALL AndAlso CurrentMachine.bIsEnabledPriority, Visibility.Visible, Visibility.Collapsed)
End Get End Get
End Property End Property
@@ -62,7 +62,7 @@ Public Class FeatureInPartInRawPartListVM
Friend Sub UpdateColumns(nMachType As MachineType) Friend Sub UpdateColumns(nMachType As MachineType)
If Not IsNothing(m_colFeatureInPartInRawPart_Priority) Then If Not IsNothing(m_colFeatureInPartInRawPart_Priority) Then
m_colFeatureInPartInRawPart_Priority.Visible = (nMachType=MachineType.WALL) m_colFeatureInPartInRawPart_Priority.Visible = (nMachType = MachineType.WALL AndAlso CurrentMachine.bIsEnabledPriority)
End If End If
End Sub End Sub
@@ -27,6 +27,13 @@ Public Class RawPartListVM
End Get End Get
End Property End Property
Private m_colRawPart_PosZ As EgtDataGridColumn
Public ReadOnly Property colRawPart_PosZ As EgtDataGridColumn
Get
Return m_colRawPart_PosZ
End Get
End Property
Private m_RawPartColumns As New ObservableCollection(Of EgtDataGridColumn) Private m_RawPartColumns As New ObservableCollection(Of EgtDataGridColumn)
Public Property RawPartColumns As ObservableCollection(Of EgtDataGridColumn) Public Property RawPartColumns As ObservableCollection(Of EgtDataGridColumn)
Get Get
@@ -120,6 +127,7 @@ Public Class RawPartListVM
m_colRawPart_StartCut = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_STARTCUT) m_colRawPart_StartCut = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_STARTCUT)
m_colRawPart_W = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_W) m_colRawPart_W = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_W)
m_colRawPart_L = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_L) m_colRawPart_L = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_L)
m_colRawPart_PosZ = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSZ)
' aggiorno la visibilità delle colonne ' aggiorno la visibilità delle colonne
For Each col In RawPartColumns For Each col In RawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed) col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
@@ -235,8 +235,8 @@ Public Class MainWindowM
EgtSetLockId( sLockId) EgtSetLockId( sLockId)
End If End If
' Recupero livello e opzioni della chiave ' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2505, 1, m_nKeyLevel) And Dim bKey As Boolean = EgtGetKeyLevel(5327, 2506, 1, m_nKeyLevel) And
EgtGetKeyOptions(5327, 2505, 1, m_nKeyOptions) EgtGetKeyOptions(5327, 2506, 1, m_nKeyOptions)
' Inizializzazione generale di EgtInterface ' Inizializzazione generale di EgtInterface
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0) m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
m_sLogFile = m_sTempDir & "\" & VWOPTGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString()) m_sLogFile = m_sTempDir & "\" & VWOPTGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
@@ -266,16 +266,67 @@ Public Class MainWindowVM
End If End If
' verifico se sono in modifica percorso libero ' verifico se sono in modifica percorso libero
If Map.refFreeContourManagerVM.bIsActive Then If Map.refFreeContourManagerVM.bIsActive Then
MessageBox.Show("Before closing software exit from path modification!") MessageBox.Show("Exit from path modification before closing software!")
Return Return
End If End If
'If Map.refOptionPanelVM.SelItem = OptionPanelVM.Tabs.SIMUL Then ' verifico se sto facendo backup
' Map.refSimulTabVM.ResetSimulation() If Map.refConfigurationPageVM.bBackupRunning Then
'End If MessageBox.Show("Backup running! Impossible closing the software until finish the backup process!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
' Imposto contesto principale End If
'EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx()) If Map.refConfigurationPageVM.bRestoreRunning Then
' Gestisco eventuale file corrente modificato MessageBox.Show("Restore running! Impossible closing the software until finish the restore process!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
Dim bOk As Boolean = True 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
Select Case Map.refMainMenuVM.SelPage Select Case Map.refMainMenuVM.SelPage
Case Pages.VIEW Case Pages.VIEW
bOk = ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ) bOk = ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ)
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below: ' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.5.5.4")> <Assembly: AssemblyVersion("2.5.6.2")>
<Assembly: AssemblyFileVersion("2.5.5.4")> <Assembly: AssemblyFileVersion("2.5.6.2")>
@@ -14,57 +14,11 @@ Public Class OpenProjectFileDialogVM
m_ProjectType = ProjectType m_ProjectType = ProjectType
' carico colonne ' carico colonne
LoadColumns(ProjectType) LoadColumns(ProjectType)
NotifyPropertyChanged(NameOf(SearchColumnList)) NotifyPropertyChanged(NameOf(FilterTypeList))
m_SelSearchColumn = m_SearchColumnList(0) m_SelFilterType = m_FilterTypeList(0)
' carico lista progetti ' carico lista progetti
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
' leggo da db RefreshProjectList(GoToProd)
If ProjectType = ProjectType.PROJ Then
Dim DbProjectList As New List(Of ProjFileM)
DbProjectList = DbControllers.m_ProjController.GetLastDesc(5000)
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
DbControllers.m_ProjController.DeleteProj(Project.nProjId)
EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000"))
End If
Next
ElseIf ProjectType = ProjectType.PROD Then
Dim DbProjectList As New List(Of ProdFileM)
DbProjectList = DbControllers.m_ProdController.GetLastDesc(5000)
If 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"
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))
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 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)
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
End If
Next
End If
End If
Else Else
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList) m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
NotifyPropertyChanged(NameOf(ProjectList)) NotifyPropertyChanged(NameOf(ProjectList))
@@ -73,6 +27,89 @@ Public Class OpenProjectFileDialogVM
m_ProjectList_View.Filter = AddressOf ProjectFilter m_ProjectList_View.Filter = AddressOf ProjectFilter
End Function 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.FIFTY
nRowQuantity = 50
Case RowQuantities.HUNDRED
nRowQuantity = 100
Case RowQuantities.HUNDREDANDFIFTY
nRowQuantity = 150
End Select
Select Case m_SelDayType
Case DayTypes.LASTMONTH
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
dtStart = dtEnd - TimeSpan.FromDays(31)
Case DayTypes.LAST3MONTHS
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
dtStart = dtEnd - TimeSpan.FromDays(31 * 3)
Case DayTypes.LAST6MONTHS
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
dtStart = dtEnd - TimeSpan.FromDays(31 * 6)
Case DayTypes.PERIOD
dtStart = dtStartDate + TimeSpan.FromDays(1)
dtEnd = dtEndDate
End Select
' leggo da db
If m_ProjectType = ProjectType.PROJ Then
Dim DbProjectList As New List(Of ProjFileM)
' CheckMe: lasciato come prima, anche NON attivi (cancellazione logica)
If m_SelBTLDateType = BTLDateTypes.CREATEDATE Then
DbProjectList = DbControllers.m_ProjController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
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
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 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))
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 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)
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 Sub Delete() Public Overrides Sub Delete()
If IsNothing(SelProject) Then Return If IsNothing(SelProject) Then Return
' recupero indice per riselezionare ' recupero indice per riselezionare
@@ -91,7 +128,8 @@ Public Class OpenProjectFileDialogVM
Map.refProjManagerVM.m_MruFiles.Remove(SelProject.sProjPath) Map.refProjManagerVM.m_MruFiles.Remove(SelProject.sProjPath)
Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames)) Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
' cancello progetto ' cancello progetto
DbControllers.m_ProjController.DeleteProj(SelProject.nProjId) ' CheckMe impostata come cancellazione FISICA dal DB...
DbControllers.m_ProjController.DeleteProj(SelProject.nProjId, False)
' cancello cartella del Proj ' cancello cartella del Proj
Try Try
Directory.Delete(SelProject.sProjDirPath, True) Directory.Delete(SelProject.sProjDirPath, True)
@@ -101,7 +139,7 @@ Public Class OpenProjectFileDialogVM
' aggiorno lista progetti ' aggiorno lista progetti
m_ProjectList.Clear() m_ProjectList.Clear()
Dim DbProjectList As New List(Of ProjFileM) Dim DbProjectList As New List(Of ProjFileM)
DbProjectList = DbControllers.m_ProjController.GetLastDesc(50) DbProjectList = DbControllers.m_ProjController.GetLastDesc(50, False)
For Each Project In DbProjectList For Each Project In DbProjectList
m_ProjectList.Add(New ProjFileVM(Project)) m_ProjectList.Add(New ProjFileVM(Project))
Next Next
@@ -179,7 +217,7 @@ Public Class OpenProjectFileDialogVM
' aggiorno lista progetti ' aggiorno lista progetti
m_ProjectList.Clear() m_ProjectList.Clear()
Dim DbProjectList As New List(Of ProdFileM) Dim DbProjectList As New List(Of ProdFileM)
DbProjectList = DbControllers.m_ProdController.GetLastDesc(50) DbProjectList = DbControllers.m_ProdController.GetLastDesc(50, False)
For Each Project In DbProjectList For Each Project In DbProjectList
m_ProjectList.Add(New ProdFileVM(Project)) m_ProjectList.Add(New ProdFileVM(Project))
Next Next
File diff suppressed because it is too large Load Diff
@@ -267,6 +267,9 @@ Public Class ProjectVM
If Not IsNothing(Map.refRawPartListVM.colRawPart_L) Then If Not IsNothing(Map.refRawPartListVM.colRawPart_L) Then
Map.refRawPartListVM.colRawPart_L.IsReadOnly = True Map.refRawPartListVM.colRawPart_L.IsReadOnly = True
End If End If
If Not IsNothing(Map.refRawPartListVM.colRawPart_PosZ) Then
Map.refRawPartListVM.colRawPart_PosZ.IsReadOnly = True
End If
If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Offset) Then If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Offset) Then
Map.refPartInRawPartListVM.colPartInRawPart_Offset.IsReadOnly = True Map.refPartInRawPartListVM.colPartInRawPart_Offset.IsReadOnly = True
End If End If
@@ -285,58 +288,55 @@ Public Class ProjectVM
If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do) Then If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do) Then
Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.IsReadOnly = True Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.IsReadOnly = True
End If End If
If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Priority) Then
Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Priority.IsReadOnly = True
End If
m_bLockUX = True m_bLockUX = True
' se calcolo finito ' se calcolo finito
Else Else
ManageIsEnabled(True) ManageIsEnabled(True)
' aggiungere gestione colonne editabili delle tabelle ' aggiungere gestione colonne editabili delle tabelle
If Not IsNothing(Map.refPartListVM.colPart_Do) Then If Not IsNothing(Map.refPartListVM.colPart_Do) Then
Map.refPartListVM.colPart_Do.IsReadOnly = False Map.refPartListVM.colPart_Do.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refFeatureListVM.colFeature_Do) Then If Not IsNothing(Map.refFeatureListVM.colFeature_Do) Then
Map.refFeatureListVM.colFeature_Do.IsReadOnly = False Map.refFeatureListVM.colFeature_Do.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refPParameterListVM.colPParam_Value) Then If Not IsNothing(Map.refPParameterListVM.colPParam_Value) Then
Map.refPParameterListVM.colPParam_Value.IsReadOnly = False Map.refPParameterListVM.colPParam_Value.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refQParameterListVM.colQParam_Value) Then If Not IsNothing(Map.refQParameterListVM.colQParam_Value) Then
Map.refQParameterListVM.colQParam_Value.IsReadOnly = False Map.refQParameterListVM.colQParam_Value.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refQParameterListVM.colQParam_Custom) Then If Not IsNothing(Map.refQParameterListVM.colQParam_Custom) Then
Map.refQParameterListVM.colQParam_Custom.IsReadOnly = False Map.refQParameterListVM.colQParam_Custom.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refRawPartListVM.colRawPart_StartCut) Then If Not IsNothing(Map.refRawPartListVM.colRawPart_StartCut) Then
Map.refRawPartListVM.colRawPart_StartCut.IsReadOnly = False Map.refRawPartListVM.colRawPart_StartCut.ResetToOrigIsReadOnly()
End If End If
If m_BTLStructureVM.nPROJTYPE <> BWType.BEAM AndAlso Not IsNothing(Map.refRawPartListVM.colRawPart_W) Then If m_BTLStructureVM.nPROJTYPE <> BWType.BEAM AndAlso Not IsNothing(Map.refRawPartListVM.colRawPart_W) Then
Map.refRawPartListVM.colRawPart_W.IsReadOnly = False Map.refRawPartListVM.colRawPart_W.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refRawPartListVM.colRawPart_L) Then If Not IsNothing(Map.refRawPartListVM.colRawPart_L) Then
Map.refRawPartListVM.colRawPart_L.IsReadOnly = False Map.refRawPartListVM.colRawPart_L.ResetToOrigIsReadOnly()
End If
If Not IsNothing(Map.refRawPartListVM.colRawPart_PosZ) Then
Map.refRawPartListVM.colRawPart_PosZ.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Offset) Then If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Offset) Then
Map.refPartInRawPartListVM.colPartInRawPart_Offset.IsReadOnly = False Map.refPartInRawPartListVM.colPartInRawPart_Offset.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Rot) Then If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Rot) Then
Map.refPartInRawPartListVM.colPartInRawPart_Rot.IsReadOnly = False Map.refPartInRawPartListVM.colPartInRawPart_Rot.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Flip) Then If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Flip) Then
Map.refPartInRawPartListVM.colPartInRawPart_Flip.IsReadOnly = False Map.refPartInRawPartListVM.colPartInRawPart_Flip.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_PosX) Then If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_PosX) Then
Map.refPartInRawPartListVM.colPartInRawPart_PosX.IsReadOnly = False Map.refPartInRawPartListVM.colPartInRawPart_PosX.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_PosY) Then If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_PosY) Then
Map.refPartInRawPartListVM.colPartInRawPart_PosY.IsReadOnly = False Map.refPartInRawPartListVM.colPartInRawPart_PosY.ResetToOrigIsReadOnly()
End If End If
If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do) Then If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do) Then
Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.IsReadOnly = False Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.ResetToOrigIsReadOnly()
End If
If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Priority) Then
Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Priority.IsReadOnly = False
End If End If
' fermo il timer ' fermo il timer
If Not m_bCalcRunning Then If Not m_bCalcRunning Then
@@ -15,6 +15,11 @@ Public Class ProjFileVM
Sub New(ProjectFileM As ProjFileM) Sub New(ProjectFileM As ProjFileM)
MyBase.New(ProjectFileM) MyBase.New(ProjectFileM)
' verifico valore description
If Not IsNothing(ProjectFileM) AndAlso String.IsNullOrWhiteSpace(ProjectFileM.sDescription) Then
DbControllers.m_ProjController.UpdateDescription(ProjectFileM.nProjId, ProjectFileM.sBTLFileName)
ProjectFileM.sDescription = ProjectFileM.sBTLFileName
End If
End Sub End Sub
#End Region ' CONSTRUCTORS #End Region ' CONSTRUCTORS
@@ -137,9 +142,11 @@ Public Class ProjFileVM
Directory.Delete(sProjectDirPath, True) Directory.Delete(sProjectDirPath, True)
End If End If
Map.refProjManagerVM.m_MruFiles.Remove(CurrProject.sProjPath) Map.refProjManagerVM.m_MruFiles.Remove(CurrProject.sProjPath)
Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames)) Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
DbControllers.m_ProjController.DeleteProj(CurrProject.nProjId)
Map.refProjManagerVM.CurrProj = Nothing ' CheckMe impostata come cancellazione FISICA dal DB...
DbControllers.m_ProjController.DeleteProj(CurrProject.nProjId, False)
Map.refProjManagerVM.CurrProj = Nothing
EgtResetModified() EgtResetModified()
Return True Return True
End If End If
@@ -87,6 +87,13 @@ Public Module CurrentMachine
Return m_dMinOffset Return m_dMinOffset
End Get End Get
End Property End Property
' Attivazione Priority pareti
Private m_bIsEnabledPriority As Boolean = 0
Public ReadOnly Property bIsEnabledPriority As Boolean
Get
Return m_bIsEnabledPriority
End Get
End Property
#Region "Proprietà che leggono e scrivono i valori anche da o su file ini" #Region "Proprietà che leggono e scrivono i valori anche da o su file ini"
@@ -300,6 +307,11 @@ Public Module CurrentMachine
End Select End Select
EgtLuaGetGlobNumVar("GWD.MIN_HEIGHT", m_dMinRawH) EgtLuaGetGlobNumVar("GWD.MIN_HEIGHT", m_dMinRawH)
EgtLuaGetGlobNumVar("GWD.MAX_HEIGHT", m_dMaxRawH) EgtLuaGetGlobNumVar("GWD.MAX_HEIGHT", m_dMaxRawH)
If EgtLuaGetGlobNumVar("GWD.BTL_PRIORITY", nTemp) Then
m_bIsEnabledPriority = nTemp > 0
Else
m_bIsEnabledPriority = False
End If
Else Else
m_nViewDir = VT.ISO_SW m_nViewDir = VT.ISO_SW
m_OrigCorner = MCH_CR.BR m_OrigCorner = MCH_CR.BR
@@ -308,6 +320,7 @@ Public Module CurrentMachine
m_NestingCorner = MCH_CR.BR m_NestingCorner = MCH_CR.BR
m_dMinRawH = 5 m_dMinRawH = 5
m_dMaxRawH = 500 m_dMaxRawH = 500
m_bIsEnabledPriority = False
End If End If
' Cancello tavola globale ' Cancello tavola globale
EgtLuaResetGlobVar("GWD") EgtLuaResetGlobVar("GWD")
@@ -346,6 +346,11 @@
<Setter Property="Margin" Value="10,0,10,0"/> <Setter Property="Margin" Value="10,0,10,0"/>
</Style> </Style>
<Style x:Key="Filter_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="2.5,0,2.5,0"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- TextBox --> <!-- TextBox -->
@@ -802,4 +807,13 @@
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- DatePicker -->
<Style x:Key="Filter_DatePicker" TargetType="{x:Type DatePicker}">
<Setter Property="Height" Value="22" />
<Setter Property="Width" Value="100" />
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
</ResourceDictionary> </ResourceDictionary>
+1 -1
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" /> <package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" /> <package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" /> <package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
<package id="Ionic.Zip" version="1.9.1.8" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" /> <package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" /> <package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" /> <package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
Binary file not shown.
Binary file not shown.
+5 -4
View File
@@ -78,7 +78,8 @@ END
vers | data | note vers | data | note
---------|----------|--------- ---------|----------|---------
?? | 2021.04.12 | Riconciliazione su ramo TotalRebuild 2.5.X | 2023.06.08 | Aggiunta cancellazione logica + descrizione Proj editabile
?? | 2021.04.03 | Upgrade versione con DataLayer EF 6.4.4 1.0.0 | 2021.04.12 | Riconciliazione su ramo TotalRebuild
?? | 2021.03.06 | Versione con StressTest WinForm x DataLayer EF 6.0 0.9.0 | 2021.04.03 | Upgrade versione con DataLayer EF 6.4.4
?? | 2021.03.05 | Prima versione con DataLayer EF 6.0 0.8.0 | 2021.03.06 | Versione con StressTest WinForm x DataLayer EF 6.0
0.7.0 | 2021.03.05 | Prima versione con DataLayer EF 6.0
BIN
View File
Binary file not shown.