Compare commits
210 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 33925d68b3 | |||
| f817daded5 | |||
| ab9346af02 | |||
| 864d929ea6 | |||
| 0ed6719508 | |||
| a269ad0fda | |||
| dbbfef35a9 | |||
| 4132212605 | |||
| a26b93f8a9 | |||
| 7efd7c353a | |||
| 98cc52e84f | |||
| 65db8b285c | |||
| e69f6f37d4 | |||
| 8a49d500a4 | |||
| 3991db50c4 | |||
| 9714631b68 | |||
| fdd4bfec6e | |||
| a8900568f6 | |||
| 6aefdb8b84 | |||
| 10e2f5a341 | |||
| e338412abb | |||
| ef08937e05 | |||
| 37ca0b1ae2 | |||
| bcc7af3acd | |||
| 71f5cf1ec6 | |||
| eaab42ee14 | |||
| b3a9cbbfd8 | |||
| 417d857547 | |||
| 56ad2003ac | |||
| 51bbdb6d24 | |||
| 194fd34c34 | |||
| 3ec507a967 | |||
| fcfc9f0da2 | |||
| e1de69babd | |||
| 51fb7ad34e | |||
| ad775341ad | |||
| 5df2e5e314 | |||
| 410b2155da | |||
| ebb16b6136 | |||
| fef8aaaa2f | |||
| 9fac681033 | |||
| 19732e091b | |||
| 739205f972 | |||
| 06da8c6b48 | |||
| 672ec76955 | |||
| 12dc64eb15 | |||
| 356c6b6f85 | |||
| 8e0aa7ba0c | |||
| 6047080f37 | |||
| 5d2daaf7cd | |||
| a6b10d57b7 | |||
| 68a6a3ff1b | |||
| 2109fbd65e | |||
| 01c00226bd | |||
| f1578bfe4b | |||
| d245421d52 | |||
| aab825d4fc | |||
| 3b33c1a34d | |||
| 1f2e7ce0f6 | |||
| 692c9e707b | |||
| 6d920a2453 | |||
| 67e8b2af54 | |||
| 803670f5e8 | |||
| 35272d7460 | |||
| 6f91af6546 | |||
| 8dceab40f3 | |||
| 84f76348ad | |||
| b445a17280 | |||
| 9d957975d0 | |||
| f85cc1bd33 | |||
| 89d75a36cf | |||
| d8d16a7972 | |||
| dd67130eb5 | |||
| f66fe0cb1c | |||
| 3dbc5dfb38 | |||
| 28a1a3d828 | |||
| 155da598fa | |||
| cff9bbc5c7 | |||
| e06614fd60 | |||
| 734d155d3d | |||
| 3b9bc051dd | |||
| 8df4e74a56 | |||
| beb025984e | |||
| 10d7ef179a | |||
| ec13ba8257 | |||
| f896f59bcc | |||
| 43de071280 | |||
| 2bab549ab7 | |||
| 988e91630b | |||
| 940ddae3e0 | |||
| be241f04d2 | |||
| 3873d468e7 | |||
| 318bb6d3d9 | |||
| 62d692dc32 | |||
| 228994e1e9 | |||
| 1de156f0a3 | |||
| d97fda4a83 | |||
| 9270fed036 | |||
| 4a477df49d | |||
| dc52e06160 | |||
| 1b0162ea53 | |||
| 1cde6e7e58 | |||
| 45ad346924 | |||
| 5c7b5c677d | |||
| a9f526af15 | |||
| 467010dc13 | |||
| ba13697dda | |||
| 6a51eae198 | |||
| f18f13dac4 | |||
| 825412e81a | |||
| 464c22f743 | |||
| 91524932f4 | |||
| a464c989c3 | |||
| 559206cd70 | |||
| 819928805f | |||
| 24300e8805 | |||
| 5896862614 | |||
| 70078533d2 | |||
| 07b7ad6ee3 | |||
| fc1ce2ce53 | |||
| 958421f4f5 | |||
| ef59f66c67 | |||
| 14bf36ed68 | |||
| 06bac914ef | |||
| 1b956580c9 | |||
| 625f12a1e8 | |||
| 84dffd8966 | |||
| c32715a4b5 | |||
| a83752e565 | |||
| ec2ce96b3b | |||
| d131e0b42d | |||
| efea14db89 | |||
| c09d8a6b0f | |||
| 946ad1d29c | |||
| c5f1d1669f | |||
| 689e81219b | |||
| 05ec565f84 | |||
| 0e7866922d | |||
| fb92f9faea | |||
| f65d07ab22 | |||
| f140b6df54 | |||
| 441ddc4397 | |||
| 9f16294994 | |||
| fd4e961b39 | |||
| 7156ca93d0 | |||
| 8c42493382 | |||
| 7a6eebcdab | |||
| e1b4dc52cb | |||
| 99ea410056 | |||
| ae19eae94d | |||
| 5f321fba3a | |||
| 3401bb7557 | |||
| b7a127c1cd | |||
| 8f6eaf5a53 | |||
| 80150b508a | |||
| 34089f946f | |||
| 7bc58a74e1 | |||
| 92f347cd7e | |||
| 1817870dfe | |||
| 7def088b9d | |||
| 810a61ea0d | |||
| 70cbef0efb | |||
| ec6c44d036 | |||
| 5d42576da1 | |||
| 227ded2e88 | |||
| 1c81e7fdb4 | |||
| d37014272f | |||
| dc8fcae112 | |||
| 3e84659fca | |||
| 638461a4e3 | |||
| bf1dd1d526 | |||
| 7d121b2bd5 | |||
| 0fc7d826a8 | |||
| dfb3e1f74a | |||
| 8980da46be | |||
| 531da47cbc | |||
| b279a287ec | |||
| 79db35220b | |||
| d7ba34527f | |||
| 7622117281 | |||
| b331126f8a | |||
| 8b6c9b38cc | |||
| 3133c1d78c | |||
| 2ae08165f4 | |||
| f77ea8309c | |||
| 3a9e8651e7 | |||
| eddd7b93ca | |||
| 1d9182f96d | |||
| c3916dcf41 | |||
| 15bfc1bc15 | |||
| cee4375ea3 | |||
| 5b04080f35 | |||
| 0d7cc99a2d | |||
| d48deed9e0 | |||
| 4d8f0d6411 | |||
| 1cff7af4a6 | |||
| c3cc4518d8 | |||
| 04debf6b51 | |||
| cc71f0a34f | |||
| 88b9226bcb | |||
| 9f4e025305 | |||
| ecbd6ecd66 | |||
| df3b6ae657 | |||
| 668a37c6da | |||
| f4b18d962d | |||
| eaa43c6209 | |||
| 99dd1b6807 | |||
| 5b6f719349 | |||
| dd2f75abf1 | |||
| 2922c0e6ef |
@@ -554,7 +554,7 @@ Public Class BTLFeatureM
|
||||
' Impossibile creare una feature con questi valori - ERRORE
|
||||
MessageBox.Show(EgtMsg(61852), EgtMsg(30007))
|
||||
nFeatureId = EgtBeamModifyProcess(Me.nFeatureId, Me.nSelGRP, Me.nPRC, Me.nSelSIDE, "", Me.nPRID,
|
||||
New Frame3d(), vPar, sPar, vParQ, nCrvId, nCrv2Id)
|
||||
Me.frFRAME, vPar, sPar, vParQ, nCrvId, nCrv2Id)
|
||||
SetFeatureId(nFeatureId)
|
||||
bOk = False
|
||||
End If
|
||||
|
||||
@@ -587,7 +587,7 @@ Public Class BTLPartM
|
||||
Public ReadOnly Property nINPROD As Integer
|
||||
Get
|
||||
Dim INPROD As Integer = 0
|
||||
EgtDuploCount(m_nPartId, INPROD)
|
||||
EgtDuploInRawCount(m_nPartId, INPROD)
|
||||
Return INPROD
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -17,5 +17,12 @@
|
||||
Public Const COL_DESCRIPTION As String = "colDESCRIPTION"
|
||||
Public Const COL_SUPERVISORID As String = "colSUPERVISORID"
|
||||
Public Const COL_PRIORITY As String = "colPRIORITY"
|
||||
Public Const COL_NAME As String = "colNAME"
|
||||
Public Const COL_H As String = "colH"
|
||||
Public Const COL_MATERIAL As String = "colMATERIAL"
|
||||
Public Const COL_USAGE As String = "colUSAGE"
|
||||
Public Const COL_WASTE As String = "colWASTE"
|
||||
Public Const COL_ARCHIVED As String = "colARCHIVED"
|
||||
Public Const COL_USEQTY As String = "colUSEQTY"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
Public Const S_FEATURELIST As String = "DG_FeatureList"
|
||||
Public Const S_OPENPROJFILEDLG_PROJ As String = "DG_OpenProjectFileDialog_PROJ"
|
||||
Public Const S_OPENPROJFILEDLG_PROD As String = "DG_OpenProjectFileDialog_PROD"
|
||||
Public Const S_NEWOPENPROJFILEDLG_PROD As String = "DG_NewOpenProjectFileDialog_PROD"
|
||||
Public Const S_RAWPARTLIST_BEAM As String = "DG_RawPartList_BEAM"
|
||||
Public Const S_RAWPARTLIST_WALL As String = "DG_RawPartList_WALL"
|
||||
Public Const S_PARTINRAWPARTLIST_BEAM As String = "DG_PartInRawPartList_BEAM"
|
||||
|
||||
@@ -46,6 +46,8 @@ Public Module ConstIni
|
||||
Public Const K_ENABLEEDIT As String = "EnableEdit"
|
||||
Public Const K_FASTPRODUCE As String = "FastProduce"
|
||||
Public Const K_ADDPROJ As String = "AddProj"
|
||||
Public Const K_PROJECTMODE As String = "ProjectMode"
|
||||
Public Const K_NETWAREHOUSE As String = "NetWarehouse"
|
||||
|
||||
'Public Const S_LANGUAGES As String = "Languages"
|
||||
'Public Const K_LANGUAGE As String = "Language"
|
||||
@@ -120,6 +122,16 @@ Public Module ConstIni
|
||||
Public Const K_WALLBASEDIR As String = "BaseDir"
|
||||
Public Const K_WALLBWEEXEC As String = "BweExec"
|
||||
|
||||
Public Const S_MACHINELOGFILTER As String = "MachineLogFilters"
|
||||
Public Const K_PARTEVENTTYPE As String = "PartEventType"
|
||||
Public Const K_ENTITYTYPE As String = "EntityType"
|
||||
Public Const K_DAYTYPE As String = "DayType"
|
||||
Public Const K_STARTDATE As String = "StartDate"
|
||||
Public Const K_ENDDATE As String = "EndDate"
|
||||
|
||||
Public Const S_OPENFILEDIALOG As String = "OpenFileDialog"
|
||||
Public Const K_VIEWARCHIVED As String = "ViewArchived"
|
||||
|
||||
'Public Const S_NEST As String = "Nest"
|
||||
Public Const K_NESTEXEC As String = "NestExec"
|
||||
Public Const K_FLIPROT As String = "FlipRot"
|
||||
@@ -151,5 +163,15 @@ Public Module ConstIni
|
||||
Public Const S_WAREHOUSE As String = "Warehouse"
|
||||
Public Const K_TYPE As String = "Type"
|
||||
Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity"
|
||||
Public Const K_LASTSYNCHRONIZATION As String = "LastSynchronization"
|
||||
Public Const K_USENETWAREHOUSE As String = "UseNetWarehouse"
|
||||
|
||||
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"
|
||||
|
||||
Public Const S_SPECIAL As String = "Special"
|
||||
Public Const K_SPECIALENABLE As String = "SpecialEnable"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -112,6 +112,11 @@
|
||||
<DependentUpon>LoadingWndV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LoadingWnd\LoadingWndVM.vb" />
|
||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogV.xaml.vb">
|
||||
<DependentUpon>NewOpenProjectFileDialogV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogVM.vb" />
|
||||
<Compile Include="ProjectFileVM\ProdItem.vb" />
|
||||
<Compile Include="Utility\DimensionsIniFile.vb" />
|
||||
<Compile Include="Utility\Enum.vb" />
|
||||
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
||||
@@ -141,6 +146,7 @@
|
||||
<Compile Include="Lib\MachGroupPanelM.vb" />
|
||||
<Compile Include="MachGroupModel\MyMachGroupPanelM.vb" />
|
||||
<Compile Include="Utility\ManageWindow.vb" />
|
||||
<Compile Include="Utility\RawPart.vb" />
|
||||
<Compile Include="Utility\MyMachine.vb" />
|
||||
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml.vb">
|
||||
<DependentUpon>OpenProjectFileDialogV.xaml</DependentUpon>
|
||||
@@ -153,6 +159,7 @@
|
||||
<Compile Include="ProjectManager\ProjectFileVM.vb" />
|
||||
<Compile Include="ProjectManager\ProjFileVM.vb" />
|
||||
<Compile Include="ProjectFileVM\ProjFileM.vb" />
|
||||
<Compile Include="Utility\Material.vb" />
|
||||
<Compile Include="Utility\SectionXMaterial.vb" />
|
||||
<Compile Include="Utility\BTLIniFile.vb" />
|
||||
<Compile Include="Utility\CoreMap.vb" />
|
||||
@@ -190,6 +197,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>XamlIntelliSenseFileGenerator</Generator>
|
||||
</Page>
|
||||
<Page Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -12,6 +12,8 @@ Imports EgtWPFLib5
|
||||
|
||||
Public Class EgtDataGrid
|
||||
|
||||
Public Event ResetSort()
|
||||
|
||||
' vecchio indice da salvare per il Reorder delle colonne
|
||||
Public OldIndex As Integer = 0
|
||||
' indice header su cui è aperto il ContextMenu per gestione check/uncheck LockTable
|
||||
@@ -361,6 +363,7 @@ Public Class EgtDataGrid
|
||||
' resetto graficamente anche l'header della colonna
|
||||
CurrDataGrid.Columns(column.DisplayIndex).SortDirection = Nothing
|
||||
Next
|
||||
RaiseEvent ResetSort()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -438,6 +441,9 @@ Public Class EgtDataGridColumn
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public Sub ResetToOrigIsReadOnly()
|
||||
IsReadOnly = m_OrigIsReadOnly
|
||||
End Sub
|
||||
|
||||
Friend OldCanUserReorder As Boolean?
|
||||
Private m_CanUserReorder As Boolean
|
||||
|
||||
@@ -16,6 +16,8 @@ Public Module LoadingWndHelper
|
||||
CHANGEPARAM = 10
|
||||
CREATINGPDF = 11
|
||||
CHANGEMATERIAL = 12
|
||||
BACKUP = 13
|
||||
RESTORE = 14
|
||||
End Enum
|
||||
|
||||
Dim m_MainWindow As Windows.Window
|
||||
|
||||
@@ -562,8 +562,9 @@ Public MustInherit Class PartVM
|
||||
|
||||
Public Sub CalcFallUpdate(FALL As Integer)
|
||||
EgtSetInfo(nPartId, ITG_PROD_FALL, FALL, True)
|
||||
m_PartM.nCALC_FALL = 0
|
||||
m_PartM.nCALC_FALL = FALL
|
||||
NotifyPropertyChanged(NameOf(nCALC_FALL))
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
End Sub
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
|
||||
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.5.5.4")>
|
||||
<Assembly: AssemblyFileVersion("2.5.5.4")>
|
||||
<Assembly: AssemblyVersion("2.5.12.2")>
|
||||
<Assembly: AssemblyFileVersion("2.5.12.2")>
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
<EgtWPFLib5:EgtCustomWindow x:Class="NewOpenProjectFileDialogV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
|
||||
Title="{Binding Title}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
|
||||
IsClosable="False"
|
||||
MinHeight="500" MinWidth="500"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
|
||||
<EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
<EgtWPFLib5:FileNameConverter x:Key="FileNameConverter"/>
|
||||
</EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="5*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Header="{Binding Filters_Msg}"
|
||||
Margin="5"
|
||||
Visibility="{Binding Filters_Visibility}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding BTLDateTypeList}"
|
||||
SelectedIndex="{Binding SelBTLDateType}"
|
||||
Width="105"
|
||||
Margin="5"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<ComboBox ItemsSource="{Binding DayTypeList}"
|
||||
SelectedIndex="{Binding SelDayType}"
|
||||
Width="105"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
|
||||
<TextBlock Text="{Binding From_Msg}"
|
||||
Style="{StaticResource Filter_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtStartDate}"
|
||||
Style="{StaticResource Filter_DatePicker}"/>
|
||||
<TextBlock Text="{Binding To_Msg}"
|
||||
Style="{StaticResource Filter_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtEndDate}"
|
||||
Style="{StaticResource Filter_DatePicker}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<CheckBox Grid.Column="2"
|
||||
IsChecked="{Binding bViewArchived}"
|
||||
Content="{Binding ViewArchived_Msg}"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</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="{Binding Rows_Msg}"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding RowQuantityList}"
|
||||
SelectedIndex="{Binding SelRowQuantity}"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<EgtBEAMWALL:EgtDataGrid x:Name="MainDataGrid"
|
||||
Grid.Row="1"
|
||||
ItemsSource="{Binding ProjectList}"
|
||||
SelectedItem="{Binding SelProject}"
|
||||
CanUserAddRows="False"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserResizeRows="False"
|
||||
SelectionMode="Single"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
Margin="5"
|
||||
RowDetailsVisibilityMode="Visible"
|
||||
CellEditEnding="MainDataGrid_CellEditEnding"
|
||||
BindingColumns="{Binding ProdColumns}">
|
||||
<DataGrid.Resources>
|
||||
<!-- ProdId -->
|
||||
<DataGridTextColumn x:Key="colPRODID" Binding="{Binding sProdId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Id_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--Name-->
|
||||
<DataGridTextColumn x:Key="colNAME" Binding="{Binding sName}">
|
||||
<DataGridTextColumn.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
<ToggleButton Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
IsChecked="{Binding Path=DataContext.bIsEditNameActive,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource ToolBar_SmallToggleButton}">
|
||||
<Image Source="\Resources\CalcPanel\Edit.png"
|
||||
Style="{StaticResource LockImage}"/>
|
||||
</ToggleButton>
|
||||
</Grid>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Creation date -->
|
||||
<DataGridTextColumn x:Key="colCRTDATE" Binding="{Binding dtCreateDate}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.CreateDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Machine -->
|
||||
<DataGridTextColumn x:Key="colMACHINE" Binding="{Binding sMachine}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.Machine_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Archived -->
|
||||
<DataGridTemplateColumn x:Key="colARCHIVED">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="\Resources\OpenProjectFileDialog\Archived.png"
|
||||
Visibility="{Binding Archived_Visibility}"
|
||||
Height="15"
|
||||
Width="15"
|
||||
Stretch="UniformToFill"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.Archived_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTemplateColumn.Header>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="FontWeight" Value="DemiBold"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.RowDetailsTemplate>
|
||||
<DataTemplate>
|
||||
<ItemsControl ItemsSource="{Binding ProjFileList}"
|
||||
BorderThickness="0"
|
||||
Margin="0,-1,0,0"
|
||||
Padding="0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid TextBlock.FontSize="12"
|
||||
TextBlock.FontWeight="Normal">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=DataContext.ProdColumns[0].ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Gray"
|
||||
Margin="40,0,40,0"/>
|
||||
<Grid Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Margin="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding sBTLFileName}"/>
|
||||
<TextBlock Grid.Row="1"
|
||||
Text="{Binding Path=DataContext.ListName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Text="{Binding sListName}"/>
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding Path=DataContext.ExportDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="3"
|
||||
Text="{Binding dtExportDate}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</DataTemplate>
|
||||
</DataGrid.RowDetailsTemplate>
|
||||
</EgtBEAMWALL:EgtDataGrid>
|
||||
|
||||
<UniformGrid Columns="4" Grid.Row="2" Margin="0,0,0,5">
|
||||
<Button IsDefault="True" Name="OpenBtn"
|
||||
Content="{Binding Open_Msg}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Content="{Binding Archive_Msg}"
|
||||
Command="{Binding Archive_Command}"
|
||||
IsEnabled="{Binding bArchived_IsEnabled}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Content="{Binding Delete_Msg}"
|
||||
Command="{Binding Delete_Command}"
|
||||
IsEnabled="{Binding bDelete_IsEnabled}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Command="{Binding Cancel_Command}"
|
||||
Content="{Binding Cancel_Msg}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
</UniformGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</EgtWPFLib5:EgtCustomWindow>
|
||||
@@ -0,0 +1,86 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL
|
||||
Imports System.Windows.Media
|
||||
|
||||
Public Class NewOpenProjectFileDialogV
|
||||
|
||||
Private WithEvents m_OpenProjFileDialogVM As NewOpenProjectFileDialogVM
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(Owner As Window, OpenProjFileDialogVM As NewOpenProjectFileDialogVM)
|
||||
' Funzione che interpreta l'xaml
|
||||
InitializeComponent()
|
||||
Me.Owner = Owner
|
||||
Me.DataContext = OpenProjFileDialogVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_OpenProjFileDialogVM = OpenProjFileDialogVM
|
||||
AddHandler Me.Loaded, AddressOf OpenProjectFileDialog_Loaded
|
||||
AddHandler Me.Closing, AddressOf OpenProjectFileDialog_Closing
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType, ProjectList As List(Of ProjectFileVM)) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType, ProjectList)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType, GoToProd As Boolean) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType, Nothing, GoToProd)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
Private Sub OpenProjectFileDialog_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' Carico e imposto posizione finestra
|
||||
WinPosFromIniToWindow(S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE, Me)
|
||||
End Sub
|
||||
|
||||
Private Sub OpenProjectFileDialog_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
||||
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
||||
e.Cancel = True
|
||||
Return
|
||||
End If
|
||||
' Salvo posizione finestra (se non minimizzata)
|
||||
WinPosFromWindowToIni(Me, S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub ProjectList_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
|
||||
m_OpenProjFileDialogVM.ProjDoubleClick()
|
||||
End Sub
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
|
||||
DialogResult = m_OpenProjFileDialogVM.VerifySelected()
|
||||
End Sub
|
||||
|
||||
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_OpenProjFileDialogVM.m_CloseWindow
|
||||
Me.DialogResult = bDialogResult
|
||||
End Sub
|
||||
|
||||
Private Sub MainDataGrid_CellEditEnding(sender As Object, e As DataGridCellEditEndingEventArgs)
|
||||
'm_OpenProjFileDialogVM.SetIsEditNameActive(False)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,781 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Public Enum BTLDateTypes As Integer
|
||||
CREATEDATE = 0
|
||||
EXPORTDATE = 1
|
||||
End Enum
|
||||
|
||||
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
|
||||
ALWAYS = 4
|
||||
End Enum
|
||||
|
||||
Public Enum RowQuantities As Integer
|
||||
FIFTY = 0
|
||||
HUNDRED = 1
|
||||
HUNDREDANDFIFTY = 2
|
||||
End Enum
|
||||
|
||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
Protected m_ProdColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProdColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return m_ProdColumns
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
m_ProdColumns = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_colProdFile_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colProdFile_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colProdFile_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_colArchived_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colArchived_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colArchived_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_ProjColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProjColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return m_ProjColumns
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
m_ProjColumns = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_ProjectType As ProjectType
|
||||
|
||||
Protected m_sFilter As String
|
||||
Public Property Filter As String
|
||||
Get
|
||||
Return m_sFilter
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sFilter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sFileNameFilter As Predicate(Of String)
|
||||
Public Property FileNameFilter As Predicate(Of String)
|
||||
Get
|
||||
Return m_sFileNameFilter
|
||||
End Get
|
||||
Set(value As Predicate(Of String))
|
||||
m_sFileNameFilter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sExtensions As New List(Of String)
|
||||
Public ReadOnly Property Extensions As List(Of String)
|
||||
Get
|
||||
Return m_sExtensions
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public m_ProjectList_View As CollectionView = Nothing
|
||||
Protected m_ProjectList As New ObservableCollection(Of ProdItem)
|
||||
Public ReadOnly Property ProjectList As ObservableCollection(Of ProdItem)
|
||||
Get
|
||||
Return m_ProjectList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nSelProjIndex As Integer
|
||||
Public ReadOnly Property nSelProjIndex As Integer
|
||||
Get
|
||||
Return m_nSelProjIndex
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelProject As ProdItem
|
||||
Public Property SelProject As ProdItem
|
||||
Get
|
||||
Return m_SelProject
|
||||
End Get
|
||||
Set(value As ProdItem)
|
||||
m_SelProject = value
|
||||
' verifico se abilitare il bottone Delete
|
||||
If IsNothing(m_SelProject) Then
|
||||
SetDeleteIsEnabled(False)
|
||||
SetArchivedIsEnabled(False)
|
||||
ElseIf IsNothing(m_SelProject.ProdFileVM) Then
|
||||
SetDeleteIsEnabled(True)
|
||||
SetArchivedIsEnabled(False)
|
||||
Else
|
||||
SetDeleteIsEnabled(Not SelProject.ProdFileVM.bIsProduced)
|
||||
SetArchivedIsEnabled(True)
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Archive_Msg))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_FileName As String
|
||||
Public Property FileName As String
|
||||
Get
|
||||
Return m_FileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_FileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bFixedProjectList As Boolean
|
||||
Public ReadOnly Property bFixedProjectList As Boolean
|
||||
Get
|
||||
Return m_bFixedProjectList
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetFixedProjectList(bValue As Boolean)
|
||||
m_bFixedProjectList = bValue
|
||||
NotifyPropertyChanged(NameOf(Filters_Visibility))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Filters_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_bFixedProjectList, Visibility.Collapsed, Visibility.Visible)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_BTLDateTypeList As New List(Of String)
|
||||
Public ReadOnly Property BTLDateTypeList As List(Of String)
|
||||
Get
|
||||
Return m_BTLDateTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelBTLDateType As BTLDateTypes = Nothing
|
||||
Public Property SelBTLDateType As Integer
|
||||
Get
|
||||
Return m_SelBTLDateType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
|
||||
Public Overridable ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Return m_DayTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelDayType As DayTypes = DayTypes.LASTMONTH
|
||||
Public Property SelDayType As Integer
|
||||
Get
|
||||
Return m_SelDayType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
Dim PrevSelDayType As DayTypes = m_SelDayType
|
||||
m_SelDayType = value
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_DAYTYPE, Convert.ToInt32(m_SelDayType))
|
||||
m_Date_Visibility = If(m_SelDayType = DayTypes.PERIOD, Visibility.Visible, Visibility.Collapsed)
|
||||
If m_SelDayType = DayTypes.PERIOD Then
|
||||
Select Case PrevSelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.ALWAYS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = New DateTime(2020, 1, 1)
|
||||
End Select
|
||||
NotifyPropertyChanged(NameOf(dtStartDate))
|
||||
NotifyPropertyChanged(NameOf(dtEndDate))
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Date_Visibility))
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtStartDate As DateTime = DateTime.Today
|
||||
Public Property dtStartDate As DateTime
|
||||
Get
|
||||
Return m_dtStartDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtStartDate = value
|
||||
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, lStartDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtEndDate As DateTime = DateTime.Today
|
||||
Public Property dtEndDate As DateTime
|
||||
Get
|
||||
Return m_dtEndDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtEndDate = value
|
||||
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, lEndDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
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
|
||||
Set(value As IdNameStruct)
|
||||
' resetto il contenuto della barra di ricerca testuale
|
||||
m_SearchText = ""
|
||||
NotifyPropertyChanged(NameOf(SearchText))
|
||||
' resetto le selezioni sul calendario
|
||||
If Not IsNothing(SearchDate) Then SearchDate.Clear()
|
||||
' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
m_ProjectList_View.Refresh()
|
||||
' ora setto il valore scelto come Tipo Filtro
|
||||
m_SelFilterType = value
|
||||
Select Case m_SelFilterType.Id
|
||||
Case FilterTypes.ID, FilterTypes.BTLFILENAME, FilterTypes.LISTNAME, FilterTypes.MACHINE
|
||||
SearchText_Visibility = Visibility.Visible
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
Case BTLDateTypes.EXPORTDATE, BTLDateTypes.CREATEDATE
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Visible
|
||||
Case Else
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
End Select
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SearchText As String = ""
|
||||
Public Property SearchText As String
|
||||
Get
|
||||
Return m_SearchText
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_SearchText = value
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Friend m_SearchDate As SelectedDatesCollection = Nothing
|
||||
Public ReadOnly Property SearchDate As SelectedDatesCollection
|
||||
Get
|
||||
Return m_SearchDate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SearchText_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property SearchText_Visibility As Visibility
|
||||
Get
|
||||
Return m_SearchText_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_SearchText_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(SearchText_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SearchDate_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property SearchDate_Visibility As Visibility
|
||||
Get
|
||||
Return m_SearchDate_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_SearchDate_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(SearchDate_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property bIsEditNameActive As Boolean
|
||||
Get
|
||||
Return Not m_colProdFile_Name.IsReadOnly
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If Not IsNothing(m_colProdFile_Name) Then
|
||||
m_colProdFile_Name.IsReadOnly = Not value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public Sub SetIsEditNameActive(value As Boolean)
|
||||
If Not IsNothing(m_colProdFile_Name) Then
|
||||
m_colProdFile_Name.IsReadOnly = Not value
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(bIsEditNameActive))
|
||||
End Sub
|
||||
|
||||
Private m_bViewArchived As Boolean
|
||||
Public Property bViewArchived As Boolean
|
||||
Get
|
||||
Return m_bViewArchived
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bViewArchived = value
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_VIEWARCHIVED, If(bViewArchived, 1, 0))
|
||||
If Not IsNothing( m_colArchived_Name) Then
|
||||
m_colArchived_Name.Visible = value
|
||||
RefreshProjectList()
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bArchived_IsEnabled As Boolean
|
||||
Public ReadOnly Property bArchived_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_bArchived_IsEnabled
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetArchivedIsEnabled(bValue As Boolean)
|
||||
m_bArchived_IsEnabled = bValue
|
||||
NotifyPropertyChanged(NameOf(bArchived_IsEnabled))
|
||||
End Sub
|
||||
|
||||
Private m_bDelete_IsEnabled As Boolean
|
||||
Public ReadOnly Property bDelete_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_bDelete_IsEnabled
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetDeleteIsEnabled(bValue As Boolean)
|
||||
m_bDelete_IsEnabled = bValue
|
||||
NotifyPropertyChanged(NameOf(bDelete_IsEnabled))
|
||||
End Sub
|
||||
|
||||
Protected m_ChangeOpenedProjectOnCancel As Boolean = False
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Return EgtMsg(61986)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Filters_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61985)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property FilterType_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61836)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Search_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61837)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Id_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61815)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property BTLFileName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61819)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ListName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61820)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ExportDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61821)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CreateDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61822)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Machine_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61886)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Name_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61808)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Open_Msg As String
|
||||
Get
|
||||
Return EgtMsg(30006)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archived_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61983)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archive_Msg As String
|
||||
Get
|
||||
If Not IsNothing(m_SelProject) AndAlso m_SelProject.bIsArchived Then
|
||||
Return EgtMsg(61984)
|
||||
Else
|
||||
Return EgtMsg(61981)
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Delete_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61823)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Cancel_Msg As String
|
||||
Get
|
||||
Return EgtMsg(30002)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property From_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62523)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property To_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62524)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ViewArchived_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61982)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Rows_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61995)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdProjectDoubleClick As ICommand
|
||||
Private m_cmdDelete As ICommand
|
||||
Private m_cmdArchive As ICommand
|
||||
Private m_cmdCancel As ICommand
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
Sub New()
|
||||
' assegno delegato a elementi lista
|
||||
ProdItem.m_delIsModifiedSetUp = AddressOf SetIsEditNameActive
|
||||
' carico colonne
|
||||
LoadColumns()
|
||||
m_colProdFile_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_NAME)
|
||||
m_colArchived_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_ARCHIVED)
|
||||
' leggo valori per filtri
|
||||
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, 0, sStartDate)
|
||||
Long.TryParse(sStartDate, lStartDate)
|
||||
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
|
||||
Dim sEndDate As String = "0"
|
||||
Dim lEndDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, 0, sEndDate)
|
||||
Long.TryParse(sEndDate, lEndDate)
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
m_bViewArchived = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_VIEWARCHIVED, 0) <> 0
|
||||
End Sub
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
End Sub
|
||||
|
||||
Protected Sub LoadColumns()
|
||||
'If ProjectType = ProjectType.PROJ Then
|
||||
' carico le colonne della datagrid
|
||||
' GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjColumns)
|
||||
' ' carico campi su cui eseguire il filtro di ricerca
|
||||
' m_BTLDateTypeList = New List(Of String)({CreateDate_Msg, ExportDate_Msg})
|
||||
' m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
' NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
' NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
' m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
' New IdNameStruct(FilterTypes.ID, Id_Msg),
|
||||
' New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
' New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
|
||||
' New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
' m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
' NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
'ElseIf ProjectType = ProjectType.PROD Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_NEWOPENPROJFILEDLG_PROD, ProdColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
|
||||
m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
|
||||
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
'End If
|
||||
' setto la visibilità delle colonne delle EgtDataGrid
|
||||
For Each col In ProjColumns
|
||||
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||
Next
|
||||
For Each col In ProdColumns
|
||||
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Function VerifySelected() As Boolean
|
||||
If IsNothing(SelProject) Then Return False
|
||||
Dim AllFilesInDir As IEnumerable(Of String) = Nothing
|
||||
If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then
|
||||
If Not IsNothing(SelProject.ProdFileVM) Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProdFileVM.sProdDirPath) OrElse Not Directory.Exists(SelProject.ProdFileVM.sProdDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProdFileVM.sProdDirPath)
|
||||
ElseIf SelProject.ProjFileList.Count > 0 Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProjFileList(0).sProjDirPath) OrElse Not Directory.Exists(SelProject.ProjFileList(0).sProjDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProjFileList(0).sProjDirPath)
|
||||
Else Return False
|
||||
End If
|
||||
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProdFileVM.sProdDirPath) OrElse Not Directory.Exists(SelProject.ProdFileVM.sProdDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProdFileVM.sProdDirPath)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Return AllFilesInDir.Any(Function(x) Path.GetExtension(x).ToLower() = ".nge")
|
||||
End Function
|
||||
|
||||
Protected Function ProjectFilter(Proj As Object) As Boolean
|
||||
Dim bProjectOk As Boolean = True
|
||||
'If TypeOf Proj Is ProjFileVM Then
|
||||
Dim CurrProj As ProdItem = DirectCast(Proj, ProdItem)
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
(m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not CurrProj.ProjFileList.Any(Function(x) SearchDate.Contains(DirectCast(x, ProjFileVM).dtExportDate.Date))) OrElse
|
||||
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
'ElseIf TypeOf Proj Is ProdFileVM Then
|
||||
' Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
' (m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
'End If
|
||||
Return bProjectOk
|
||||
End Function
|
||||
|
||||
Protected Sub CloseWindow(bDialogResult As Boolean)
|
||||
RaiseEvent m_CloseWindow(bDialogResult)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "ProjectDoubleClick"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property ProjectDoubleClick_Command As ICommand
|
||||
Get
|
||||
If m_cmdProjectDoubleClick Is Nothing Then
|
||||
m_cmdProjectDoubleClick = New Command(AddressOf ProjDoubleClick)
|
||||
End If
|
||||
Return m_cmdProjectDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Friend Sub ProjDoubleClick()
|
||||
' verifico se non e' attivo edit del nome
|
||||
If bIsEditNameActive Then Return
|
||||
' verifico validita' selezionato
|
||||
If VerifySelected() Then
|
||||
RaiseEvent m_CloseWindow(True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' ProjectDoubleClick
|
||||
|
||||
#Region "Archive"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Archive_Command As ICommand
|
||||
Get
|
||||
If m_cmdArchive Is Nothing Then
|
||||
m_cmdArchive = New Command(AddressOf Archive)
|
||||
End If
|
||||
Return m_cmdArchive
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Archive()
|
||||
End Sub
|
||||
|
||||
#End Region ' Archive
|
||||
|
||||
#Region "Delete"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Delete_Command As ICommand
|
||||
Get
|
||||
If m_cmdDelete Is Nothing Then
|
||||
m_cmdDelete = New Command(AddressOf Delete)
|
||||
End If
|
||||
Return m_cmdDelete
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Delete()
|
||||
End Sub
|
||||
|
||||
#End Region ' Delete
|
||||
|
||||
#Region "Cancel"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Cancel_Command As ICommand
|
||||
Get
|
||||
If m_cmdCancel Is Nothing Then
|
||||
m_cmdCancel = New Command(AddressOf Cancel)
|
||||
End If
|
||||
Return m_cmdCancel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Cancel()
|
||||
End Sub
|
||||
|
||||
#End Region ' Cancel
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
End Class
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
|
||||
Title="{Binding Title}"
|
||||
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"
|
||||
Height="500" Width="500" Topmost="True"
|
||||
MinHeight="500" MinWidth="500"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
|
||||
<EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
@@ -21,42 +21,106 @@
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<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>
|
||||
<GroupBox Header="Filters"
|
||||
Margin="5"
|
||||
Visibility="{Binding Filters_Visibility}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</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"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding SearchColumnList}"
|
||||
<ComboBox ItemsSource="{Binding SearchColumnList}"
|
||||
SelectedItem="{Binding SelSearchColumn}"
|
||||
Width="Auto"
|
||||
Margin="5"
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<TextBlock Text="{Binding Search_Msg}"
|
||||
<TextBlock Text="{Binding Search_Msg}"
|
||||
Margin="0,5,0,0"
|
||||
Grid.Row="1" Grid.Column="0"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding SearchText}"
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding SearchText}"
|
||||
Margin="5"
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding SearchText_Visibility}"/>
|
||||
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged"
|
||||
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged"
|
||||
SelectionMode="MultipleRange"
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding SearchDate_Visibility}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>-->
|
||||
|
||||
<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
|
||||
<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
|
||||
ItemsSource="{Binding ProjectList}"
|
||||
SelectedItem="{Binding SelProject}"
|
||||
CanUserAddRows="False"
|
||||
@@ -85,6 +149,14 @@
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- Project Name -->
|
||||
<DataGridTextColumn x:Key="colPROJNAME" Binding="{Binding sDescription}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- BTL FileName -->
|
||||
<DataGridTextColumn x:Key="colBTLNAME" Binding="{Binding sBTLFileName}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
|
||||
@@ -5,6 +5,8 @@ Imports System.Windows.Controls
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL
|
||||
|
||||
Public Class OpenProjectFileDialogV
|
||||
|
||||
@@ -19,6 +21,8 @@ Public Class OpenProjectFileDialogV
|
||||
Me.DataContext = OpenProjFileDialogVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_OpenProjFileDialogVM = OpenProjFileDialogVM
|
||||
AddHandler Me.Loaded, AddressOf OpenProjectFileDialog_Loaded
|
||||
AddHandler Me.Closing, AddressOf OpenProjectFileDialog_Closing
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
@@ -42,6 +46,20 @@ Public Class OpenProjectFileDialogV
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
Private Sub OpenProjectFileDialog_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' Carico e imposto posizione finestra
|
||||
WinPosFromIniToWindow(S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE, Me)
|
||||
End Sub
|
||||
|
||||
Private Sub OpenProjectFileDialog_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
||||
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
||||
e.Cancel = True
|
||||
Return
|
||||
End If
|
||||
' Salvo posizione finestra (se non minimizzata)
|
||||
WinPosFromWindowToIni(Me, S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
@@ -60,10 +78,4 @@ Public Class OpenProjectFileDialogV
|
||||
Me.DialogResult = bDialogResult
|
||||
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
|
||||
@@ -14,8 +14,36 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
|
||||
#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)
|
||||
|
||||
Protected m_GoToProd As Boolean = False
|
||||
|
||||
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProjectColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
@@ -83,18 +111,148 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista campi per ricerca testuale e con datepicker
|
||||
Protected m_SearchColumnList As New ObservableCollection(Of IdNameStruct)
|
||||
Public ReadOnly Property SearchColumnList As ObservableCollection(Of IdNameStruct)
|
||||
Private m_bFixedProjectList As Boolean
|
||||
Public ReadOnly Property bFixedProjectList As Boolean
|
||||
Get
|
||||
Return m_SearchColumnList
|
||||
Return m_bFixedProjectList
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetFixedProjectList(bValue As Boolean)
|
||||
m_bFixedProjectList = bValue
|
||||
NotifyPropertyChanged(NameOf(Filters_Visibility))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Filters_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_bFixedProjectList, Visibility.Collapsed, Visibility.Visible)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelSearchColumn As IdNameStruct = Nothing
|
||||
Public Property SelSearchColumn As IdNameStruct
|
||||
Protected m_BTLDateTypeList As New List(Of String)
|
||||
Public ReadOnly Property BTLDateTypeList As List(Of String)
|
||||
Get
|
||||
Return m_SelSearchColumn
|
||||
Return m_BTLDateTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelBTLDateType As BTLDateTypes = Nothing
|
||||
Public Property SelBTLDateType As Integer
|
||||
Get
|
||||
Return m_SelBTLDateType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
|
||||
Public ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Return m_DayTypeList
|
||||
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(30.5)
|
||||
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_OPENFILEDIALOG, 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_OPENFILEDIALOG, 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
|
||||
Set(value As IdNameStruct)
|
||||
' resetto il contenuto della barra di ricerca testuale
|
||||
@@ -103,15 +261,15 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
' resetto le selezioni sul calendario
|
||||
If Not IsNothing(SearchDate) Then SearchDate.Clear()
|
||||
' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
|
||||
m_SelSearchColumn = m_SearchColumnList(0)
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
m_ProjectList_View.Refresh()
|
||||
' ora setto il valore scelto come Tipo Filtro
|
||||
m_SelSearchColumn = value
|
||||
Select Case m_SelSearchColumn.Id
|
||||
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME, OpenProjFileColumn.MACHINE
|
||||
m_SelFilterType = value
|
||||
Select Case m_SelFilterType.Id
|
||||
Case FilterTypes.ID, FilterTypes.BTLFILENAME, FilterTypes.LISTNAME, FilterTypes.MACHINE
|
||||
SearchText_Visibility = Visibility.Visible
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
Case OpenProjFileColumn.EXPORTDATE, OpenProjFileColumn.CREATEDATE
|
||||
Case BTLDateTypes.EXPORTDATE, BTLDateTypes.CREATEDATE
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Visible
|
||||
Case Else
|
||||
@@ -161,18 +319,13 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
End Set
|
||||
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"
|
||||
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Return "Open Project"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property FilterType_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61836)
|
||||
@@ -236,6 +389,18 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
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
|
||||
|
||||
' Definizione comandi
|
||||
@@ -244,31 +409,70 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
Sub New()
|
||||
' leggo valori per filtri
|
||||
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, 0, sStartDate)
|
||||
Long.TryParse(sStartDate, lStartDate)
|
||||
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
|
||||
Dim sEndDate As String = "0"
|
||||
Dim lEndDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, 0, sEndDate)
|
||||
Long.TryParse(sEndDate, lEndDate)
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
Public Overridable Sub RefreshProjectList()
|
||||
End Sub
|
||||
|
||||
Protected Sub LoadColumns(ProjectType As ProjectType)
|
||||
If ProjectType = ProjectType.PROJ Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjectColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
|
||||
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.LISTNAME, ListName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.EXPORTDATE, ExportDate_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)})
|
||||
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg, ExportDate_Msg})
|
||||
m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
New IdNameStruct(FilterTypes.ID, Id_Msg),
|
||||
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
|
||||
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
ElseIf ProjectType = ProjectType.PROD Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
|
||||
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.MACHINE, Machine_Msg)})
|
||||
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
|
||||
m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
New IdNameStruct(FilterTypes.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
|
||||
' setto la visibilità delle colonne delle EgtDataGrid
|
||||
For Each col In ProjectColumns
|
||||
@@ -301,22 +505,22 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
Dim bProjectOk As Boolean = True
|
||||
If m_ProjectType = ProjectType.PROJ Then
|
||||
Dim CurrProj As ProjFileVM = DirectCast(Proj, ProjFileVM)
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.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_SelSearchColumn.Id = OpenProjFileColumn.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
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
(m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse
|
||||
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.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_SelSearchColumn.Id = OpenProjFileColumn.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
End If
|
||||
Return bProjectOk
|
||||
End Function
|
||||
|
||||
@@ -14,11 +14,41 @@ Public Class ProdFileM
|
||||
m_nProjIdList = value
|
||||
End Sub
|
||||
|
||||
Protected m_ProjMList As List(Of ProjFileM)
|
||||
Public ReadOnly Property ProjMList As List(Of ProjFileM)
|
||||
Get
|
||||
Return m_ProjMList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
Public Property sName As String
|
||||
Get
|
||||
Return m_sName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsProduced As Boolean
|
||||
Public Property bIsProduced As Boolean
|
||||
Get
|
||||
Return m_bIsProduced
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsProduced = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nProjCloudId As Integer
|
||||
Public Property nProjCloudId As Integer
|
||||
Get
|
||||
Return m_nProjCloudId
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nProjCloudId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
@@ -31,7 +61,7 @@ Public Class ProdFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime) As ProdFileM
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, Optional nProjCloudId As Integer = 0) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
@@ -41,6 +71,28 @@ Public Class ProdFileM
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||
NewProjectFileM.m_dtLock = dtLock
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsProduced = bIsProduced
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
NewProjectFileM.m_nProjCloudId = nProjCloudId
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_sName = sName
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||
NewProjectFileM.m_dtLock = dtLock
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsProduced = bIsProduced
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
NewProjectFileM.m_ProjMList = ProjMList
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
|
||||
Imports EgtWPFLib5
|
||||
Imports System.Windows
|
||||
|
||||
Public Class ProdItem
|
||||
Inherits VMBase
|
||||
|
||||
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
|
||||
|
||||
Protected m_ProdFileVM As ProdFileVM
|
||||
Public ReadOnly Property ProdFileVM As ProdFileVM
|
||||
Get
|
||||
Return m_ProdFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_ProjFileList As New List(Of ProjectFileVM)
|
||||
Public ReadOnly Property ProjFileList As List(Of ProjectFileVM)
|
||||
Get
|
||||
Return m_ProjFileList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sProdId As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sProdId, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property sName As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
|
||||
End Get
|
||||
Set(value As String)
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
m_ProdFileVM.sName = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dtCreateDate As Date
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sCreateDate As String
|
||||
Get
|
||||
Return dtCreateDate.ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sMachine As String
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.sMachine
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).sMachine
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsArchived As Boolean
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.bIsArchived
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).bIsArchived
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archived_Visibility As Visibility
|
||||
Get
|
||||
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList.Add(ProjFileVM)
|
||||
End Sub
|
||||
|
||||
Sub New(ProjFileVM As ProjFileVM)
|
||||
m_ProjFileList = New List(Of ProjectFileVM)({ProjFileVM})
|
||||
End Sub
|
||||
|
||||
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList = ProjFileVMList
|
||||
End Sub
|
||||
|
||||
|
||||
Public Shared Function CreateProdItem(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdItem
|
||||
|
||||
|
||||
Dim NewProdFileM = ProdFileM.CreateProdFileM(nProdId, nProjIdList, dtCreateProjDate, sName, nType, sMachine, sLockedBy, dtLock, bIsActive, bIsProduced, bIsArchived)
|
||||
Dim NewProdFileVM = New ProdFileVM(NewProdFileM)
|
||||
Dim NewProjFileVM As IEnumerable(Of ProjectFileVM)
|
||||
NewProjFileVM = ProjMList.Select(Of ProjFileVM)(Function(j) New ProjFileVM(j)).ToList
|
||||
Dim NewProdItem = New ProdItem(NewProdFileVM, NewProjFileVM.ToList)
|
||||
|
||||
Return NewProdItem
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdItem(ProjFileM As ProjFileM) As ProdItem
|
||||
|
||||
Dim NewProdItem = New ProdItem(New ProjFileVM(ProjFileM))
|
||||
|
||||
Return NewProdItem
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -19,12 +19,32 @@ Public Class ProjFileM
|
||||
End Property
|
||||
|
||||
Protected m_sBTLFileName As String = String.Empty
|
||||
Public Property sBTLFileName As String
|
||||
Public Property sBTLFileName As String
|
||||
Get
|
||||
Return m_sBTLFileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sBTLFileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sDescription As String = String.Empty
|
||||
Public Property sDescription As String
|
||||
Get
|
||||
Return m_sBTLFileName
|
||||
Return m_sDescription
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sBTLFileName = value
|
||||
m_sDescription = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nProjCloudId As Integer
|
||||
Public Property nProjCloudId As Integer
|
||||
Get
|
||||
Return m_nProjCloudId
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nProjCloudId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -37,8 +57,7 @@ Public Class ProjFileM
|
||||
Return New ProjFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String,
|
||||
sBTLFileName As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String) As ProjFileM
|
||||
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String, sBTLFileName As String, sDescription As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String, bIsActive As Boolean, bIsArchived As Boolean, Optional nProjCloudId As Integer = 0) As ProjFileM
|
||||
Dim NewProjectFileM As New ProjFileM
|
||||
NewProjectFileM.m_nProjId = nProjId
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
@@ -46,10 +65,14 @@ Public Class ProjFileM
|
||||
NewProjectFileM.m_dtExportDate = dtExportDate
|
||||
NewProjectFileM.m_sListName = sListName
|
||||
NewProjectFileM.m_sBTLFileName = sBTLFileName
|
||||
NewProjectFileM.m_sDescription = sDescription
|
||||
NewProjectFileM.m_bIsNew = IsNew
|
||||
NewProjectFileM.m_bIsLocked = IsLocked
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
NewProjectFileM.m_nProjCloudId = nProjCloudId
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
|
||||
@@ -94,6 +94,26 @@ Public Class ProjectFileM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsActive As Boolean
|
||||
Public Property bIsActive As Boolean
|
||||
Get
|
||||
Return m_bIsActive
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsActive = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsArchived As Boolean
|
||||
Public Property bIsArchived As Boolean
|
||||
Get
|
||||
Return m_bIsArchived
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsArchived = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
@@ -47,10 +47,13 @@ Public Class ProdFileVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sName As String
|
||||
Public Property sName As String
|
||||
Get
|
||||
Return ProdFileM.sName
|
||||
End Get
|
||||
Set(value As String)
|
||||
ProdFileM.sName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_sBTLFileName As String
|
||||
@@ -63,6 +66,12 @@ Public Class ProdFileVM
|
||||
m_sBTLFileName = value
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property bIsProduced As Boolean
|
||||
Get
|
||||
Return ProdFileM.bIsProduced
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New(ProdFileM As ProdFileM)
|
||||
|
||||
@@ -68,6 +68,12 @@ Public Class ProjFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sDescription As String
|
||||
Get
|
||||
Return ProjFileM.sDescription
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sListName As String
|
||||
Get
|
||||
Return ProjFileM.sListName
|
||||
|
||||
@@ -117,6 +117,18 @@ Public Class ProjectFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsActive As Boolean
|
||||
Get
|
||||
Return m_ProjectFileM.bIsActive
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsArchived As Boolean
|
||||
Get
|
||||
Return m_ProjectFileM.bIsArchived
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Id_Msg As String
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
|
||||
Public ReadOnly Property sPROD As String
|
||||
Get
|
||||
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
Imports System.Windows
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MaterialM
|
||||
|
||||
Protected m_nId As Integer
|
||||
Public ReadOnly Property nId As Integer
|
||||
Get
|
||||
Return m_nId
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetId(nId As Integer)
|
||||
m_nId = nId
|
||||
End Sub
|
||||
|
||||
Protected m_sMaterial As String
|
||||
Public ReadOnly Property sMaterial As String
|
||||
Get
|
||||
Return m_sMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sWarehouseMaterial As String
|
||||
Public ReadOnly Property sWarehouseMaterial As String
|
||||
Get
|
||||
Return m_sWarehouseMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dW As Double = 0
|
||||
Public ReadOnly Property dW As Double
|
||||
Get
|
||||
Return m_dW
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dH As Double = 0
|
||||
Public ReadOnly Property dH As Double
|
||||
Get
|
||||
Return m_dH
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dL As Double = 0
|
||||
Public ReadOnly Property dL As Double
|
||||
Get
|
||||
Return m_dL
|
||||
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Shared Operator =(ByVal S1 As MaterialM, ByVal S2 As MaterialM) As Boolean
|
||||
If IsNothing(S1) OrElse IsNothing(S2) Then Return False
|
||||
Return (Math.Abs(S1.m_dH - S2.m_dH) < 100 * EPS_SMALL AndAlso
|
||||
Math.Abs(S1.m_dW - S2.m_dW) < 100 * EPS_SMALL AndAlso
|
||||
Math.Abs(S1.m_dL - S2.m_dL) < 100 * EPS_SMALL AndAlso
|
||||
S1.m_sWarehouseMaterial = S2.m_sWarehouseMaterial)
|
||||
End Operator
|
||||
|
||||
Shared Operator <>(ByVal S1 As MaterialM, ByVal S2 As MaterialM) As Boolean
|
||||
Return Not S1 = S2
|
||||
End Operator
|
||||
|
||||
Public Overrides Function Equals(ByVal obj As Object) As Boolean
|
||||
If TypeOf obj Is MaterialM Then
|
||||
Return Me = DirectCast(obj, MaterialM) '(m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x)))
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_sMaterial = sMaterial
|
||||
m_sWarehouseMaterial = sWarehouseMaterial
|
||||
End Sub
|
||||
|
||||
Sub New(nId As Integer, dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
|
||||
m_nId = nId
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_sMaterial = sMaterial
|
||||
m_sWarehouseMaterial = sWarehouseMaterial
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class RawPartM
|
||||
Inherits VMBase
|
||||
|
||||
Protected m_nId As Integer
|
||||
Public ReadOnly Property nId As Integer
|
||||
Get
|
||||
Return m_nId
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetId(nId As Integer)
|
||||
m_nId = nId
|
||||
End Sub
|
||||
|
||||
Private m_bActive As Boolean
|
||||
Public Property bActive As Boolean
|
||||
Get
|
||||
Return m_bActive
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bActive = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Material As MaterialM
|
||||
Public Property Material As MaterialM
|
||||
Get
|
||||
Return m_Material
|
||||
End Get
|
||||
Set(value As MaterialM)
|
||||
m_Material = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dW As Double
|
||||
Public Property dW As Double
|
||||
Get
|
||||
Return m_dW
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dW = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dL As Double
|
||||
Public Property dL As Double
|
||||
Get
|
||||
Return m_dL
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nQuantity As Integer
|
||||
Public Property nQuantity As Integer
|
||||
Get
|
||||
Return m_nQuantity
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nQuantity = value
|
||||
End Set
|
||||
End Property
|
||||
Private m_bUseQuantity As Boolean
|
||||
Public Property bUseQuantity As Boolean
|
||||
Get
|
||||
Return m_bUseQuantity
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bUseQuantity = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(SxM As MaterialM, W As Double, L As Double, Qty As Integer, Active As Boolean)
|
||||
m_Material = SxM
|
||||
m_dW = W
|
||||
m_dL = L
|
||||
m_nQuantity = Qty
|
||||
m_bActive = Active
|
||||
End Sub
|
||||
|
||||
Sub New(nId As Integer, SxM As MaterialM, W As Double, L As Double, Qty As Integer, bUseQty As Boolean, Active As Boolean)
|
||||
m_nId = nId
|
||||
m_Material = SxM
|
||||
m_dW = W
|
||||
m_dL = L
|
||||
m_nQuantity = Qty
|
||||
m_bUseQuantity = bUseQty
|
||||
m_bActive = Active
|
||||
End Sub
|
||||
|
||||
Public Sub Update(RawPart As RawPartM)
|
||||
m_Material = RawPart.m_Material
|
||||
m_dW = RawPart.dW
|
||||
m_dL = RawPart.dL
|
||||
m_nQuantity = RawPart.m_nQuantity
|
||||
m_bUseQuantity = RawPart.m_bUseQuantity
|
||||
m_bActive = RawPart.m_bActive
|
||||
End Sub
|
||||
|
||||
Public Function Copy() As RawPartM
|
||||
Return New RawPartM(m_nId, m_Material, m_dW, m_dL, m_nQuantity, bUseQuantity, bActive)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@@ -15,10 +15,15 @@ Public Class SectionXMaterial
|
||||
m_nType = nType
|
||||
End Sub
|
||||
|
||||
Protected m_Material As List(Of String)
|
||||
Public ReadOnly Property sMaterial As List(Of String)
|
||||
Public ReadOnly Property sMaterial As String
|
||||
Get
|
||||
Return m_Material
|
||||
Return m_MaterialM.sMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sWarehouseMaterial As String
|
||||
Get
|
||||
Return m_MaterialM.sWarehouseMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -42,50 +47,59 @@ Public Class SectionXMaterial
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dW As Double = 0
|
||||
Protected m_MaterialM As MaterialM
|
||||
Public ReadOnly Property MaterialM As MaterialM
|
||||
Get
|
||||
Return m_MaterialM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dW As Double
|
||||
Get
|
||||
Return m_dW
|
||||
Return m_MaterialM.dW
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dH As Double = 0
|
||||
Public ReadOnly Property dH As Double
|
||||
Get
|
||||
Return m_dH
|
||||
Return m_MaterialM.dH
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dL As Double = 0
|
||||
Public ReadOnly Property dL As Double
|
||||
Get
|
||||
Return m_dL
|
||||
Return m_MaterialM.dL
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sSectionXMaterial As String
|
||||
Get
|
||||
Dim sAlias As String = String.Empty
|
||||
For Each sMatItem In sMaterial
|
||||
sAlias &= sMatItem & ";"
|
||||
Next
|
||||
sAlias = sAlias.TrimEnd(";")
|
||||
If Me = Empty Then
|
||||
Return ""
|
||||
ElseIf m_nType = MachineType.BEAM Then
|
||||
Return LenToString(m_dW, 3) & " x " & LenToString(m_dH, 3) & " " & sAlias
|
||||
Return LenToString(m_MaterialM.dW, 3) & " x " & LenToString(m_MaterialM.dH, 3) & " " & If(GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 1, sWarehouseMaterial, sMaterial)
|
||||
ElseIf m_nType = MachineType.WALL Then
|
||||
Return LenToString(m_dH, 3) & " " & sAlias
|
||||
Return LenToString(m_MaterialM.dH, 3) & " " & If(GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 1, sWarehouseMaterial, sMaterial)
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sWarehouseSectionXMaterial As String
|
||||
Get
|
||||
If Me = Empty Then
|
||||
Return ""
|
||||
ElseIf m_nType = MachineType.BEAM Then
|
||||
Return LenToString(m_MaterialM.dW, 3) & " x " & LenToString(m_MaterialM.dH, 3) & " " & sWarehouseMaterial
|
||||
ElseIf m_nType = MachineType.WALL Then
|
||||
Return LenToString(m_MaterialM.dH, 3) & " " & sWarehouseMaterial
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Shared Operator =(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
|
||||
Return (Math.Abs( S1.m_dH - S2.m_dH) < 100 * EPS_SMALL AndAlso
|
||||
Math.Abs( S1.m_dW - S2.m_dW) < 100 * EPS_SMALL AndAlso
|
||||
Math.Abs( S1.m_dL - S2.m_dL) < 100 * EPS_SMALL AndAlso
|
||||
S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)))
|
||||
Return S1.m_MaterialM = S2.m_MaterialM
|
||||
End Operator
|
||||
|
||||
Shared Operator <>(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
|
||||
@@ -99,25 +113,21 @@ Public Class SectionXMaterial
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String)
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
|
||||
If m_nType = BWType.BEAM Then
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_MaterialM = New MaterialM(dW, dH, 0, sMaterial, sWarehouseMaterial)
|
||||
ElseIf m_nType = BWType.WALL Then
|
||||
m_dH = dH
|
||||
m_MaterialM = New MaterialM(0, dH, 0, sMaterial, sWarehouseMaterial)
|
||||
Else
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_MaterialM = New MaterialM(dW, dH, dL, sMaterial, sWarehouseMaterial)
|
||||
End If
|
||||
m_Material = New List(Of String)
|
||||
Dim sMaterialArray() As String = Split(sMaterial, ";")
|
||||
For Each sMatItem In sMaterialArray
|
||||
m_Material.Add(sMatItem)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Shared Empty As New SectionXMaterial(-1, -1, -1, "")
|
||||
Sub New(MaterialM As MaterialM)
|
||||
m_MaterialM = MaterialM
|
||||
End Sub
|
||||
|
||||
Public Shared Empty As New SectionXMaterial(-1, -1, -1, "", "")
|
||||
|
||||
#Region "Import BTL <-> Warehouse"
|
||||
|
||||
@@ -195,22 +205,14 @@ Public Class SectionXMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, nQuantity As Integer)
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, nQuantity As Integer, sWarehouseMaterial As String)
|
||||
If m_nType = BWType.BEAM Then
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_MaterialM = New MaterialM(dW, dH, 0, sMaterial, sWarehouseMaterial)
|
||||
ElseIf m_nType = BWType.WALL Then
|
||||
m_dH = dH
|
||||
m_MaterialM = New MaterialM(0, dH, 0, sMaterial, sWarehouseMaterial)
|
||||
Else
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_MaterialM = New MaterialM(dW, dH, dL, sMaterial, sWarehouseMaterial)
|
||||
End If
|
||||
m_Material = New List(Of String)
|
||||
Dim sMaterialArray() As String = Split(sMaterial, ";")
|
||||
For Each sMatItem In sMaterialArray
|
||||
m_Material.Add(sMatItem)
|
||||
Next
|
||||
m_nQuantity = nQuantity
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
</configSections>
|
||||
<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>
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
|
||||
</provider>
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=Egalware_24068!;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
|
||||
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=steamware_password;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
@@ -31,7 +31,7 @@
|
||||
</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" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.3.6.0" newVersion="1.3.6.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
|
||||
@@ -41,6 +41,18 @@
|
||||
<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.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.3" newVersion="6.0.0.3" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="K4os.Compression.LZ4" publicKeyToken="2186fa9121ef231d" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="K4os.Hash.xxHash" publicKeyToken="32cd54395057cec3" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.8.0" newVersion="1.0.8.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup>
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione Alias su DB (es: materiali da BTL e su DB)
|
||||
/// </summary>
|
||||
public class AliasController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AliasController()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Conversion of DB model class to base class
|
||||
/// </summary>
|
||||
/// <param name="coreMat"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.AliasM ConvToCore(AliasModel dbRec)
|
||||
{
|
||||
Core.AliasM answ = new Core.AliasM(dbRec.ValueOriginal, dbRec.ValueAlias);
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a DTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static AliasDTO ConvToDto(AliasModel currRec)
|
||||
{
|
||||
AliasDTO answ = new AliasDTO()
|
||||
{
|
||||
ValOrig = currRec.ValueOriginal,
|
||||
ValAlias = currRec.ValueAlias
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione da DTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <param name="family"></param>
|
||||
/// <returns></returns>
|
||||
public static AliasModel ConvToModel(AliasDTO currRec, string family)
|
||||
{
|
||||
AliasModel answ = new AliasModel()
|
||||
{
|
||||
Family = family,
|
||||
ValueOriginal = currRec.ValOrig,
|
||||
ValueAlias = currRec.ValAlias
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete by key
|
||||
/// </summary>
|
||||
/// <param name="Family"></param>
|
||||
/// <param name="ValueOriginal"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByKey(string Family, string ValueOriginal)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == Family && x.ValueOriginal == ValueOriginal);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.AliasList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Alias.DeleteByKey: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key
|
||||
/// </summary>
|
||||
/// <param name="MatId"></param>
|
||||
/// <returns></returns>
|
||||
public AliasModel FindByDbId(string ValueOriginal)
|
||||
{
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
string Family = "MatCode";
|
||||
return localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == Family && x.ValueOriginal.ToLower() == ValueOriginal.ToLower())
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get record by Key
|
||||
/// </summary>
|
||||
/// <param name="MatId"></param>
|
||||
/// <returns></returns>
|
||||
public AliasModel FindByDbId(string ValueOriginal, string Family)
|
||||
{
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == Family && x.ValueOriginal.ToLower() == ValueOriginal.ToLower())
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Alias x famiglia
|
||||
/// </summary>
|
||||
/// <param name="Family">se "" restituisce tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<AliasModel> GetFilt(string Family)
|
||||
{
|
||||
// retrieve
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == Family)
|
||||
.OrderBy(x => x.ValueOriginal)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert Alias record
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Upsert(AliasModel updItem)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == updItem.Family && x.ValueOriginal == updItem.ValueOriginal)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.AliasList.Add(updItem);
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Alias.Upsert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert Alias record list
|
||||
/// </summary>
|
||||
/// <param name="updList"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpsertList(List<AliasModel> updList)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var updItem in updList)
|
||||
{
|
||||
|
||||
var item2update = localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == updItem.Family && x.ValueOriginal.ToLower() == updItem.ValueOriginal.ToLower())
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
if (item2update.ValueAlias.ToLower() != updItem.ValueAlias.ToLower())
|
||||
{
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.AliasList.Add(updItem);
|
||||
}
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Alias.UpsertList: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,233 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione MagmanSync su DB (registrazione operazioni di sync con MagMan online)
|
||||
/// </summary>
|
||||
public class MagmanSyncController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MagmanSyncController()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Purge dei record inviati oltre periodo di giorni indicato
|
||||
/// </summary>
|
||||
/// <param name="NumDayMax">Num gg max da mantenere in registro</param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteOlder(int NumDayMax)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
var items2del = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.DtExe != null && adesso.Subtract(x.DtReq).TotalDays > NumDayMax);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.SyncList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Alias.DeleteOlder | NumDayMax: {NumDayMax}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista record filtrati
|
||||
/// </summary>
|
||||
/// <param name="SyncType">Tipo di record richiesti, se "" = tutti</param>
|
||||
/// <param name="DtMax">Data-Ora limite per recupero ordinato DESC</param>
|
||||
/// <param name="NumMax">num max di record da restituire</param>
|
||||
/// <returns></returns>
|
||||
public List<MagmanSyncModel> GetFilt(string SyncType, DateTime DtMax, int NumMax)
|
||||
{
|
||||
List<MagmanSyncModel> dbResult = new List<MagmanSyncModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => (string.IsNullOrEmpty(SyncType) || x.SyncType == SyncType) && x.DtReq <= DtMax)
|
||||
.OrderByDescending(x => x.DtReq)
|
||||
.Take(NumMax)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert record MagmanSync
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns>ID record inserito</returns>
|
||||
public int Insert(MagmanSyncModel newRec)
|
||||
{
|
||||
int newId = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
// inserisco record
|
||||
localDbCtx.SyncList.Add(newRec);
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newId = newRec.SyncId;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.Insert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update con indicazione DtExt di completamento
|
||||
/// </summary>
|
||||
/// <param name="SyncId">ID record</param>
|
||||
/// <param name="DtExe">Data-Ora exe</param>
|
||||
/// <returns></returns>
|
||||
public bool SetCompleted(int SyncId, DateTime DtExe)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.SyncId == SyncId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
// update
|
||||
item2update.DtExe = DtExe;
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.SetCompleted: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert record MagmanSync
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Upsert(MagmanSyncModel updItem)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.SyncId == updItem.SyncId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.SyncList.Add(updItem);
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.Upsert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert Alias record list
|
||||
/// </summary>
|
||||
/// <param name="updList"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpsertList(List<MagmanSyncModel> updList)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var updItem in updList)
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.SyncId == updItem.SyncId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.SyncList.Add(updItem);
|
||||
}
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.UpsertList: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,454 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static EgtBEAMWALL.DataLayer.Controllers.MaterialsController.SearchResult;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione Materiali su DB (= magazzino locale)
|
||||
/// </summary>
|
||||
public class MaterialsController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MaterialsController()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of DB model class to base class
|
||||
/// </summary>
|
||||
/// <param name="coreMat"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.MaterialM ConvToCore(MaterialModel dbRec)
|
||||
{
|
||||
Core.MaterialM answ = new Core.MaterialM(dbRec.MatId, (double)dbRec.WMm, (double)dbRec.HMm, (double)dbRec.LMm, dbRec.MatCode);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a DTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static MaterialDTO ConvToDto(MaterialModel currRec)
|
||||
{
|
||||
MaterialDTO answ = new MaterialDTO()
|
||||
{
|
||||
MatCloudId = currRec.MatCloudId,
|
||||
MatLocalId = currRec.MatId,
|
||||
MatCode = currRec.MatCode,
|
||||
MatDesc = currRec.MatDesc,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione da DTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static MaterialModel ConvToModel(MaterialDTO currRec)
|
||||
{
|
||||
MaterialModel answ = new MaterialModel()
|
||||
{
|
||||
MatCloudId = currRec.MatCloudId,
|
||||
MatId = currRec.MatLocalId,
|
||||
MatCode = currRec.MatCode,
|
||||
MatDesc = currRec.MatDesc,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of base class to DB model class
|
||||
/// </summary>
|
||||
/// <param name="coreRec"></param>
|
||||
/// <returns></returns>
|
||||
public static MaterialModel ConvToModel(Core.MaterialM coreRec)
|
||||
{
|
||||
MaterialModel answ = new MaterialModel();
|
||||
if (coreRec != null)
|
||||
{
|
||||
answ = new MaterialModel()
|
||||
{
|
||||
MatId = coreRec.nId,
|
||||
MatCode = coreRec.sMaterial,
|
||||
HMm = (decimal)coreRec.dH,
|
||||
LMm = (decimal)coreRec.dL,
|
||||
WMm = (decimal)coreRec.dW,
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete by key
|
||||
/// </summary>
|
||||
/// <param name="MatId"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByKey(int MatId)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => x.MatId == MatId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.MaterialsList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.DeleteByKey: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key
|
||||
/// </summary>
|
||||
/// <param name="MatId"></param>
|
||||
/// <returns></returns>
|
||||
public Core.MaterialM FindByDbId(int MatId)
|
||||
{
|
||||
Core.MaterialM result = new Core.MaterialM(0, 0, 0, "NONE");
|
||||
var rawData = FindByDbIdModel(MatId);
|
||||
if (rawData != null)
|
||||
{
|
||||
result = ConvToCore(rawData);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key in formato Model
|
||||
/// </summary>
|
||||
/// <param name="MatId"></param>
|
||||
/// <returns></returns>
|
||||
public MaterialModel FindByDbIdModel(int MatId)
|
||||
{
|
||||
MaterialModel result = new MaterialModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
result = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => x.MatId == MatId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Material (filtro x MatId) in formato Core
|
||||
/// </summary>
|
||||
/// <param name="MatCode">se "" restituisce tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.MaterialM> GetFilt(string MatCode)
|
||||
{
|
||||
// recupero e converto
|
||||
List<Core.MaterialM> result = new List<Core.MaterialM>();
|
||||
var rawData = GetFiltModel(MatCode);
|
||||
if (rawData != null)
|
||||
{
|
||||
result = rawData.Select(x => ConvToCore(x)).ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Material (filtro x MatId) in formato Model
|
||||
/// </summary>
|
||||
/// <param name="MatCode">se "" restituisce tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<MaterialModel> GetFiltModel(string MatCode)
|
||||
{
|
||||
List<MaterialModel> result = new List<MaterialModel>();
|
||||
// retrieve
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
result = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => string.IsNullOrEmpty(MatCode) || x.MatCode == MatCode)
|
||||
.OrderBy(x => x.MatDesc)
|
||||
.ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert Material record from CoreM if missing or return existing (for Id)
|
||||
/// </summary>
|
||||
/// <param name="coreItem"></param>
|
||||
/// <returns>MatId (existing or new)</returns>
|
||||
public int Insert(Core.MaterialM coreItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
// converto
|
||||
MaterialModel updItem = ConvToModel(coreItem);
|
||||
newIdx = Insert(updItem);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert Material record
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns>MatId (existing or new)</returns>
|
||||
public int Insert(MaterialModel updItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|
||||
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|
||||
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
newIdx = item2update.MatId;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.MaterialsList.Add(updItem);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newIdx = updItem.MatId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.Insert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il primo materiale (se esiste) per MatCode (diretto o tramite Alias)
|
||||
/// </summary>
|
||||
/// <param name="MatCode">Non accetta ""</param>
|
||||
/// <returns></returns>
|
||||
public SearchResult SearchFilt(string MatCode)
|
||||
{
|
||||
// init valori esito ricerca + risultato
|
||||
TypeFound esito = string.IsNullOrEmpty(MatCode) ? TypeFound.MISSING_CODE : TypeFound.NOT_FOUND;
|
||||
List<Core.MaterialM> result = new List<Core.MaterialM>();
|
||||
// solo se ho una VERA ricerca x MatCode
|
||||
if (!string.IsNullOrEmpty(MatCode))
|
||||
{
|
||||
// cerco nei materiali
|
||||
var rawData = GetFiltModel(MatCode);
|
||||
if (rawData != null && rawData.Count > 0)
|
||||
{
|
||||
// ...e converto
|
||||
result = rawData.Select(x => ConvToCore(x)).ToList();
|
||||
esito = TypeFound.MATERIAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cerco negli alias...
|
||||
using (AliasController aliasDbContr = new AliasController())
|
||||
{
|
||||
var aliasRec = aliasDbContr.FindByDbId(MatCode);
|
||||
if (aliasRec != null)
|
||||
{
|
||||
rawData = GetFiltModel(aliasRec.ValueAlias);
|
||||
if (rawData != null && rawData.Count > 0)
|
||||
{
|
||||
// ...e converto
|
||||
result = rawData.Select(x => ConvToCore(x)).ToList();
|
||||
esito = TypeFound.ALIAS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// compongo risposta!
|
||||
SearchResult answ = new SearchResult()
|
||||
{
|
||||
Tipo = esito,
|
||||
Result = result
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Material record from CoreM
|
||||
/// </summary>
|
||||
/// <param name="coreItem"></param>
|
||||
/// <returns>Returns 0 if not found</returns>
|
||||
public int Update(Core.MaterialM coreItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
// converto
|
||||
MaterialModel updItem = ConvToModel(coreItem);
|
||||
newIdx = Update(updItem);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Material record
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns>Returns 0 if not found</returns>
|
||||
public int Update(MaterialModel updItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|
||||
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|
||||
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
item2update.MatCloudId = updItem.MatCloudId;
|
||||
item2update.MatDesc = updItem.MatDesc;
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newIdx = item2update.MatId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.Update: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upsert Material record
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns>MatId (existing or new)</returns>
|
||||
public int Upsert(MaterialModel updItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|
||||
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|
||||
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
item2update.MatCloudId = updItem.MatCloudId;
|
||||
item2update.MatDesc = updItem.MatDesc;
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newIdx = item2update.MatId;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.MaterialsList.Add(updItem);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newIdx = updItem.MatId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.Insert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
/// <summary>
|
||||
/// Risultato ricerca materiali
|
||||
/// </summary>
|
||||
public class SearchResult
|
||||
{
|
||||
#region Public Enums
|
||||
|
||||
/// <summary>
|
||||
/// Enum del risultato della ricerca materiali
|
||||
/// </summary>
|
||||
public enum TypeFound
|
||||
{
|
||||
MISSING_CODE = 0,
|
||||
NOT_FOUND,
|
||||
ALIAS,
|
||||
MATERIAL
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Materiali trovati
|
||||
/// </summary>
|
||||
public List<Core.MaterialM> Result { get; set; } = new List<Core.MaterialM>();
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia oggetto trovato
|
||||
/// </summary>
|
||||
public TypeFound Tipo { get; set; } = TypeFound.MISSING_CODE;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using NLog.LayoutRenderers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
@@ -58,10 +59,84 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
public bool DeleteProd(int ProdId)
|
||||
/// <summary>
|
||||
/// Helper conversione a ProjectDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec">record in formato ProdModel</param>
|
||||
/// <returns></returns>
|
||||
public static ProjectDTO ConvToDto(ProdModel currRec)
|
||||
{
|
||||
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
|
||||
ProjectDTO answ = new ProjectDTO()
|
||||
{
|
||||
ProjCloudId = currRec.ProjCloudId,
|
||||
ProjLocalId = currRec.ProdDbId,
|
||||
ProjExtId = currRec.ProdId,
|
||||
// è calcolato sul cloud, da token --> machine ID
|
||||
MachineCloudId = 0,
|
||||
// è calcolato sul cloud, da token --> KeyNum
|
||||
KeyNum = 0,
|
||||
// disponibile solo su PROJ
|
||||
BTLFileName = "",
|
||||
PType = (EgwProxy.MagMan.BWType)currRec.PType,
|
||||
Machine = currRec.Machine,
|
||||
ProjDescription = currRec.Description,
|
||||
DtCreated = currRec.DtCreated,
|
||||
DtLastAction = DateTime.MinValue,
|
||||
DtSchedule = DateTime.MinValue,
|
||||
DtStartProd = DateTime.MinValue,
|
||||
// disponibile solo su PROJ
|
||||
ListName = "",
|
||||
ProcTimeEst = 0,
|
||||
ProcTimeReal = 0,
|
||||
IsActive = currRec.IsActive,
|
||||
IsArchived = currRec.IsArchived
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Helper conversione modelli verso Core.ProdItem
|
||||
/// </summary>
|
||||
/// <param name="currProd"></param>
|
||||
/// <returns></returns>
|
||||
public Core.ProdItem ConvToCore(ProdModel currProd)
|
||||
{
|
||||
Core.ProdItem answ = Core.ProdItem.CreateProdItem(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProjId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive, j.ProjCloudId)).ToList());
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione modelli verso Core.ProdItem
|
||||
/// </summary>
|
||||
/// <param name="currProd"></param>
|
||||
/// <returns></returns>
|
||||
public Core.ProdItem ConvToCore(ProjModel currProj)
|
||||
{
|
||||
Core.ProdItem answ = Core.ProdItem.CreateProdItem(Core.ProjFileM.CreateProjFileM(currProj.ProjId, 0, currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.ProjDescription, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine, currProj.IsActive, currProj.IsActive, currProj.ProjCloudId));
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione modelli
|
||||
/// </summary>
|
||||
/// <param name="currProd"></param>
|
||||
/// <returns></returns>
|
||||
public Core.ProdFileM ConvToCoreFile(ProdModel currProd)
|
||||
{
|
||||
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjCloudId);
|
||||
//Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProdId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Prod(+proj...) logically / on DB by ProdId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="IsLogical"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteProd(int ProdId, bool IsLogical)
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var currProd = localDbCtx
|
||||
@@ -69,50 +144,78 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
|
||||
// sel dei proj da aggiornare...
|
||||
var proj2update = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// sel dei MachGroup da prod
|
||||
var machGroup2del = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// selezione dei part da machgroup
|
||||
var part2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
try
|
||||
// procedo SOLO SE NON è stato prodotto (se è stato prodotto --> NON permetto la
|
||||
// cancellazione ed esco con false...)
|
||||
if (!currProd.IsProduced)
|
||||
{
|
||||
// update proj...
|
||||
foreach (var item in proj2update)
|
||||
// sel dei proj da aggiornare...
|
||||
var proj2update = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// se richiesta cancellazione logica o cmq se fosse stato taggato come prodotto
|
||||
if (IsLogical)
|
||||
{
|
||||
item.ProdDbId = null;
|
||||
try
|
||||
{
|
||||
// segno eliminazione logica al/ai PROJ...
|
||||
foreach (var item in proj2update)
|
||||
{
|
||||
item.IsActive = false;
|
||||
}
|
||||
// segno eliminazione logica al prod
|
||||
currProd.IsActive = false;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.DeleteProd (logical only): {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// sel dei MachGroup da prod
|
||||
var machGroup2del = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
|
||||
// selezione dei part da machgroup
|
||||
var part2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
|
||||
.ToList();
|
||||
try
|
||||
{
|
||||
// update proj...
|
||||
foreach (var item in proj2update)
|
||||
{
|
||||
item.ProdDbId = null;
|
||||
}
|
||||
// remove from database
|
||||
localDbCtx.PartList.RemoveRange(part2del);
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
localDbCtx.MachGroupList.RemoveRange(machGroup2del);
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
localDbCtx.ProdList.Remove(currProd);
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.DeleteProd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
// remove from database
|
||||
localDbCtx.PartList.RemoveRange(part2del);
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
localDbCtx.MachGroupList.RemoveRange(machGroup2del);
|
||||
//// salvo
|
||||
//localDbCtx.SaveChanges();
|
||||
localDbCtx.ProdList.Remove(currProd);
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.DeleteProd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -170,20 +273,263 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate);
|
||||
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjCloudId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco progetti
|
||||
/// Elenco prod
|
||||
/// </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>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdFileM> GetLastDesc(int numRecord)
|
||||
public List<Core.ProdFileM> GetLastDesc(int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
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
|
||||
.Where(x => (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// conversione
|
||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate)).ToList();
|
||||
result = dbResult.Select(x => Core.ProdFileM.CreateProdFileM(x.ProdId, ProjIdByProd(x.ProdId), x.DtCreated, x.Description, x.PType, x.Machine, x.LockedBy, x.LockDate, x.IsActive, x.IsProduced, x.IsArchived, x.ProjCloudId)).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>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdFileM> GetLastDesc(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
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 && (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.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, x.IsActive, x.IsProduced, x.IsArchived, x.ProjCloudId)).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
// elenco prod completi
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// recupero PROD + proj relativi
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => (!x.IsArchived || ShowArchived))
|
||||
//.Include(j => j.)
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null)
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => ConvToCore(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => ConvToCore(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
// elenco prod completi
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => ConvToCore(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => ConvToCore(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco prod
|
||||
/// </summary>
|
||||
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||
/// <param name="DtIsCreation">Ture: usa data creazione / False: usa data export</param>
|
||||
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||
/// <param name="Machine">Nome Macchina (default vuoto = non usato)</param>
|
||||
/// <param name="BtlFileName">Nome file BTL (default vuoto = non usato)</param>
|
||||
/// <param name="ListName">Nome List (default vuoto = non usato)</param>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProdItem> GetLastDescFull(DateTime DtStart, DateTime DtEnd, bool DtIsCreation, int NumRecord, bool OnlyActive, string Machine = "", string BtlFileName = "", string ListName = "", bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||
// elenco proj "orfani"
|
||||
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (NumRecord == 0)
|
||||
{
|
||||
NumRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
dbResultProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => (!x.IsArchived || ShowArchived))
|
||||
// condizione join sui PROJ
|
||||
.Join(localDbCtx.ProjList.Where(x =>
|
||||
(x.IsActive || !OnlyActive)
|
||||
&& (string.IsNullOrEmpty(Machine) || x.Machine.ToLower().Contains(Machine.ToLower()))
|
||||
&& (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName.ToLower().Contains(BtlFileName.ToLower()))
|
||||
&& (string.IsNullOrEmpty(ListName) || x.ListName.ToLower().Contains(ListName.ToLower()))
|
||||
&& ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd)))
|
||||
),
|
||||
p => p.ProdDbId,
|
||||
e => e.ProdDbId,
|
||||
(p, e) => p)
|
||||
.Distinct()
|
||||
.Include(j => j.ProjListNav)
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
|
||||
// recupero i proj "orfani"
|
||||
dbResultProj = localDbCtx
|
||||
.ProjList
|
||||
.Where(x =>
|
||||
(x.IsActive || !OnlyActive)
|
||||
&& x.Prod == null
|
||||
&& (string.IsNullOrEmpty(Machine) || x.Machine.ToLower().Contains(Machine.ToLower()))
|
||||
&& (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName.ToLower().Contains(BtlFileName.ToLower()))
|
||||
&& (string.IsNullOrEmpty(ListName) || x.ListName.ToLower().Contains(ListName.ToLower()))
|
||||
&& ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd))))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(NumRecord)
|
||||
.ToList();
|
||||
}
|
||||
// conversione
|
||||
result = dbResultProd.Select(x => ConvToCore(x)).ToList();
|
||||
var resProj = dbResultProj.Select(x => ConvToCore(x)).ToList();
|
||||
// sommo i risultati
|
||||
result.AddRange(resProj);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -385,6 +731,163 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x campo IsArchived
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="IsArchived"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateArchived(int ProdId, bool IsArchived)
|
||||
{
|
||||
bool fatto = false;
|
||||
// cerco specifico Prod
|
||||
ProdModel currData = new ProdModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
// sel dei proj da aggiornare...
|
||||
var proj2update = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currData.ProdDbId)
|
||||
.ToList();
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currData.IsArchived = IsArchived;
|
||||
|
||||
// update dei proj relativi
|
||||
foreach (var item in proj2update)
|
||||
{
|
||||
item.IsArchived = IsArchived;
|
||||
}
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateArchived:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateArchived: req item was not found | ProdId {ProdId} | IsArchived {IsArchived}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x ProjectCloudId
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="Description"></param>
|
||||
/// <returns></returns>
|
||||
public Core.ProdFileM UpdateCloudId(int ProdId, int ProjCloudId)
|
||||
{
|
||||
// cerco specifico Proj
|
||||
ProdModel currData;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno valore BTL
|
||||
currData.ProjCloudId = ProjCloudId;
|
||||
|
||||
// salvo record PROD
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
// cerco se ci siano prod colelgati ed aggiorno pure loro...
|
||||
var projList = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currData.ProdDbId)
|
||||
.ToList();
|
||||
if (projList != null)
|
||||
{
|
||||
foreach (var item in projList)
|
||||
{
|
||||
item.ProjCloudId = ProjCloudId;
|
||||
}
|
||||
// salvo modifihce ai PROJ
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateCloudId:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateCloudId: req item was not found | ProdId {ProdId} | ProjCloudId {ProjCloudId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return ConvToCoreFile(currData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x Description
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="Description"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateDescription(int ProdId, string Description)
|
||||
{
|
||||
bool fatto = false;
|
||||
// cerco specifico Prod
|
||||
ProdModel currData = new ProdModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currData.Description = Description;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateDescription:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateDescription: req item was not found | ProdId {ProdId} | Description {Description}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x elenco MachGroup:
|
||||
/// - NON vengono eliminati record (se ce ne son altri sul DB non saranno toccati)
|
||||
@@ -408,7 +911,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.OrderBy(n => n.PartCount);
|
||||
|
||||
// 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;
|
||||
if (testOk)
|
||||
{
|
||||
@@ -610,7 +1113,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return coreConv(currData);
|
||||
return ConvToCoreFile(currData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -632,7 +1135,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
// aggiorno valore BTL
|
||||
// aggiorno valore tipo
|
||||
currData.PType = PType;
|
||||
|
||||
// Commit changes
|
||||
@@ -652,7 +1155,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return coreConv(currData);
|
||||
return ConvToCoreFile(currData);
|
||||
}
|
||||
|
||||
/// <summary> Return User Code/Key that Locks by ProdId (proj & prod) </summary> <param
|
||||
@@ -705,40 +1208,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione modelli
|
||||
/// </summary>
|
||||
/// <param name="currProd"></param>
|
||||
/// <returns></returns>
|
||||
protected Core.ProdFileM coreConv(ProdModel currProd)
|
||||
{
|
||||
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get LAST paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
protected List<ProdModel> GetLastDbModelDesc(int numRecord)
|
||||
{
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// se numRecord = 0 --> passo tutti
|
||||
if (numRecord == 0)
|
||||
{
|
||||
numRecord = localDbCtx.ProdList.Count();
|
||||
}
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.ProdList
|
||||
.OrderByDescending(x => x.ProdId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
protected List<int> ProjIdByProd(int ProdId)
|
||||
{
|
||||
var ProjCtr = new ProjController();
|
||||
@@ -756,5 +1225,54 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x campo IsProduced lasciato private se servisse in futuro x ora NON
|
||||
/// esposto e fatto implicitamente in StatusMapController.StartProd
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="IsProduced"></param>
|
||||
/// <returns></returns>
|
||||
private bool UpdateProduced(int ProdId, bool IsProduced)
|
||||
{
|
||||
bool fatto = false;
|
||||
// cerco specifico Prod
|
||||
ProdModel currData = new ProdModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currData.IsProduced = IsProduced;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateProduced:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateProduced: req item was not found | ProdId {ProdId} | IsProduced {IsProduced}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -19,6 +20,72 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a ProjectDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec">record in formato ProjModel</param>
|
||||
/// <returns></returns>
|
||||
public static ProjectDTO ConvToDto(ProjModel currRec)
|
||||
{
|
||||
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
|
||||
ProjectDTO answ = new ProjectDTO()
|
||||
{
|
||||
ProjCloudId = currRec.ProjCloudId,
|
||||
ProjLocalId = currRec.ProjDbId,
|
||||
ProjExtId = currRec.ProjId,
|
||||
// è calcolato sul cloud, da token --> machine ID
|
||||
MachineCloudId = 0,
|
||||
// è calcolato sul cloud, da token --> KeyNum
|
||||
KeyNum = 0,
|
||||
BTLFileName = currRec.BTLFileName,
|
||||
PType = (EgwProxy.MagMan.BWType)currRec.PType,
|
||||
Machine = currRec.Machine,
|
||||
ProjDescription = currRec.ProjDescription,
|
||||
DtCreated = currRec.DtCreated,
|
||||
DtLastAction = DateTime.MinValue,
|
||||
DtSchedule = DateTime.MinValue,
|
||||
DtStartProd = DateTime.MinValue,
|
||||
ListName = currRec.ListName,
|
||||
ProcTimeEst = 0,
|
||||
ProcTimeReal = 0,
|
||||
IsActive = currRec.IsActive,
|
||||
IsArchived = currRec.IsArchived
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a ProjModel
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <param name="isActive"></param>
|
||||
/// <returns></returns>
|
||||
public static ProjModel ConvToModel(ProjectDTO currRec, bool isActive)
|
||||
{
|
||||
ProjModel answ = new ProjModel()
|
||||
{
|
||||
ProjCloudId = currRec.ProjCloudId,
|
||||
ProjDbId = currRec.ProjLocalId,
|
||||
ProjId = currRec.ProjExtId,
|
||||
//MachineID = currRec.MachineCloudId,
|
||||
//KeyNum = currRec.KeyNum,
|
||||
BTLFileName = currRec.BTLFileName,
|
||||
PType = (BWType)currRec.PType,
|
||||
Machine = currRec.Machine,
|
||||
ProjDescription = currRec.ProjDescription,
|
||||
DtCreated = currRec.DtCreated,
|
||||
//DtLastAction = currRec.DtLastAction,
|
||||
//DtSchedule = currRec.DtSchedule,
|
||||
//DtStartProd = currRec.DtStartProd,
|
||||
ListName = currRec.ListName,
|
||||
//ProcTimeEst = currRec.ProcTimeEst,
|
||||
//ProcTimeReal = currRec.ProcTimeReal,
|
||||
IsActive = currRec.IsActive,
|
||||
IsArchived = currRec.IsArchived
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search for already imported BTL from FileName (only)
|
||||
/// =0 : NOT found >0 : ProjId (already present) for overwrite
|
||||
@@ -33,6 +100,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
var dbResult = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.BTLFileName == BTLFileName)
|
||||
//valutare se usare solo attivi...
|
||||
//.Where(x => x.BTLFileName == BTLFileName && x.IsActive == true)
|
||||
.FirstOrDefault();
|
||||
|
||||
//se avesse trovato-- > riporto id...
|
||||
@@ -45,11 +114,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Proj on DB by ProjId
|
||||
/// Helper conversione modelli
|
||||
/// </summary>
|
||||
/// <param name="currRec">record in formato ProjModel</param>
|
||||
/// <returns></returns>
|
||||
public Core.ProjFileM ConvToCore(ProjModel currRec)
|
||||
{
|
||||
Core.ProjFileM answ = null;
|
||||
if (currRec != null)
|
||||
{
|
||||
answ = Core.ProjFileM.CreateProjFileM(currRec.ProjId, ProdIdByProdDbId(currRec.ProdDbId), currRec.DtCreated, currRec.DtExported, currRec.ListName, currRec.BTLFileName, currRec.ProjDescription, currRec.IsNew, currRec.Locked, currRec.PType, currRec.Machine, currRec.IsActive, currRec.IsArchived, currRec.ProjCloudId);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Proj logically / on DB by ProjId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="IsLogical"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteProj(int ProjId)
|
||||
public bool DeleteProj(int ProjId, bool IsLogical)
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
@@ -59,25 +144,45 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.SingleOrDefault();
|
||||
// sel delle BTLParts da proj
|
||||
var parts2del = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == currProj.ProjDbId);
|
||||
|
||||
try
|
||||
if (IsLogical)
|
||||
{
|
||||
// remove from database
|
||||
localDbCtx.BTLPartList.RemoveRange(parts2del);
|
||||
localDbCtx.ProjList.Remove(currProj);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
try
|
||||
{
|
||||
currProj.IsActive = false;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
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}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
// sel delle BTLParts da proj
|
||||
var parts2del = localDbCtx
|
||||
.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;
|
||||
@@ -91,8 +196,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// Get records filtered by BtlPartName matching regexp BtlFileName[_number]
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public List<ProjModel> FindByBtlFileName(string BtlFileName)
|
||||
public List<ProjModel> FindByBtlFileName(string BtlFileName, bool OnlyActive)
|
||||
{
|
||||
List<ProjModel> searchResult = new List<ProjModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
@@ -100,7 +206,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// in primi cerco il record "parent" generale, se non ci fosse inutile proseguire...
|
||||
ProjModel parentRec = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.BTLFileName == BtlFileName)
|
||||
.Where(x => x.BTLFileName == BtlFileName && (!OnlyActive || x.IsActive))
|
||||
.FirstOrDefault();
|
||||
if (parentRec != null && parentRec.ProjId > 0)
|
||||
{
|
||||
@@ -109,7 +215,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// cerco eventuali dati "child" puliti
|
||||
var childRec = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_"))
|
||||
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_") && (!OnlyActive || x.IsActive))
|
||||
.ToList();
|
||||
// faccio filtro con ricerca regexp x scartare "falsi positivi" come BtlFileName_nonNumero...
|
||||
if (childRec.Count > 0)
|
||||
@@ -174,13 +280,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public Core.ProjFileM FindByProjIdConv(int ProjId)
|
||||
{
|
||||
return coreConv(FindByProjId(ProjId));
|
||||
return ConvToCore(FindByProjId(ProjId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get filtered data by ProdId (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="ProdDbId"></param>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProjFileM> GetByProdAsc(int ProdId)
|
||||
{
|
||||
@@ -212,7 +318,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.OrderBy(x => x.ProdDbId)
|
||||
.ToList();
|
||||
// conversione
|
||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||
answ = dbRes.Select(x => ConvToCore(x)).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -252,7 +358,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.OrderByDescending(x => x.ProdDbId)
|
||||
.ToList();
|
||||
// conversione
|
||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||
answ = dbRes.Select(x => ConvToCore(x)).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -280,9 +386,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <summary>
|
||||
/// Elenco progetti
|
||||
/// </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>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProjFileM> GetLastDesc(int numRecord)
|
||||
public List<Core.ProjFileM> GetLastByExpDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
|
||||
|
||||
@@ -296,11 +406,76 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// retrieve
|
||||
var dbRes = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => (!x.IsArchived || ShowArchived) && (x.DtExported >= dtStart && x.DtExported <= dtEnd) && (!OnlyActive || x.IsActive))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
// conversione
|
||||
answ = dbRes.Select(x => coreConv(x)).ToList();
|
||||
answ = dbRes.Select(x => ConvToCore(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>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProjFileM> GetLastDesc(int numRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
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.IsArchived || ShowArchived) && (!OnlyActive || x.IsActive))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
// conversione
|
||||
answ = dbRes.Select(x => ConvToCore(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>
|
||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.ProjFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
|
||||
{
|
||||
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.IsArchived || ShowArchived) && (x.DtCreated >= dtStart && x.DtCreated <= dtEnd) && (!OnlyActive || x.IsActive))
|
||||
.OrderByDescending(x => x.ProjId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
// conversione
|
||||
answ = dbRes.Select(x => ConvToCore(x)).ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -341,6 +516,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
ProjId = nextId,
|
||||
BTLFileName = "",
|
||||
ProjDescription = "",
|
||||
IsNew = true,
|
||||
Locked = true,
|
||||
LockedBy = UserKey,
|
||||
@@ -405,7 +581,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// salvataggio
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
return coreConv(currProj);
|
||||
return ConvToCore(currProj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -435,7 +611,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
currProj.IsNew = false;
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
return coreConv(currProj);
|
||||
return ConvToCore(currProj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -489,7 +665,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// Update record su DB x elenco BTLParts
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="newBTLFileName"></param>
|
||||
/// <param name="BtlPartList"></param>
|
||||
/// <returns></returns>
|
||||
public ProjModel UpdateBtlParts(int ProjId, List<Core.BTLPartM> BtlPartList)
|
||||
{
|
||||
@@ -577,15 +753,62 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
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 Proj.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 ConvToCore(currData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x nomeBTL, ListName, ExportDate
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="BTLFileName"></param>
|
||||
/// <param name="Description"></param>
|
||||
/// <param name="ListName"></param>
|
||||
/// <param name="DtExported"></param>
|
||||
/// <param name="PType"></param>
|
||||
/// <param name="Machine"></param>
|
||||
/// <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
|
||||
ProjModel currData;
|
||||
@@ -600,8 +823,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
try
|
||||
{
|
||||
// 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato -->
|
||||
// nuovo nome, nel formato nomeOriginale_idx, dove idx è il contatore libero successivo
|
||||
var duplicateList = FindByBtlFileName(BTLFileName);
|
||||
// nuovo nome, nel formato nomeOriginale_idx, dove idx è il contatore libero
|
||||
// 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
|
||||
if (duplicateList != null && duplicateList.Count > 0)
|
||||
{
|
||||
@@ -635,6 +860,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
// aggiorno valore BTL
|
||||
currData.BTLFileName = BTLFileName;
|
||||
// aggiorno il resto
|
||||
currData.ProjDescription = Description;
|
||||
currData.DtExported = DtExported;
|
||||
currData.ListName = ListName;
|
||||
currData.PType = PType;
|
||||
@@ -652,13 +879,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
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);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
|
||||
return coreConv(currData);
|
||||
return ConvToCore(currData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -700,7 +927,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return coreConv(currData);
|
||||
return ConvToCore(currData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -743,28 +970,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return coreConv(currData);
|
||||
return ConvToCore(currData);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione modelli
|
||||
/// </summary>
|
||||
/// <param name="currProj"></param>
|
||||
/// <returns></returns>
|
||||
protected Core.ProjFileM coreConv(ProjModel currProj)
|
||||
{
|
||||
Core.ProjFileM answ = null;
|
||||
if (currProj != null)
|
||||
{
|
||||
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get LAST paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione RawItem (barre) su DB (= magazzino locale)
|
||||
/// </summary>
|
||||
public class RawItemsController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public RawItemsController()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversion da DB model class a base class (VB)
|
||||
/// </summary>
|
||||
/// <param name="dbRec"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.RawPartM ConvToCore(RawItemModel dbRec)
|
||||
{
|
||||
// converto in primis il materiale relativo
|
||||
Core.MaterialM matRec = MaterialsController.ConvToCore(dbRec.MaterialNav);
|
||||
Core.RawPartM answ = new Core.RawPartM(dbRec.RawItemId, matRec, (double)dbRec.WMm, (double)dbRec.LMm, dbRec.QtyAvail, dbRec.UseQty, dbRec.IsActive);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a ItemDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static ItemDTO ConvToItemDto(RawItemModel currRec)
|
||||
{
|
||||
ItemDTO answ = new ItemDTO()
|
||||
{
|
||||
MatCloudId = currRec.MaterialNav != null ? currRec.MaterialNav.MatCloudId : 0,
|
||||
MatLocalId = currRec.MatId,
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemLocalId = currRec.RawItemId,
|
||||
IsRemn = currRec.IsRemn,
|
||||
QtyAvail = currRec.QtyAvail,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm,
|
||||
Note = currRec.Note
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione da ItemDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <param name="isActive"></param>
|
||||
/// <returns></returns>
|
||||
public static RawItemModel ConvToModel(ItemDTO currRec, bool isActive)
|
||||
{
|
||||
RawItemModel answ = new RawItemModel()
|
||||
{
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemId = currRec.RawItemLocalId,
|
||||
QtyAvail = currRec.QtyAvail,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm,
|
||||
MatId = currRec.MatLocalId,
|
||||
IsRemn = currRec.IsRemn,
|
||||
IsActive = isActive,
|
||||
UseQty = true,
|
||||
Note = currRec.Note
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione da ResourceExpDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <param name="matLocalId"></param>
|
||||
/// <returns></returns>
|
||||
public static RawItemModel ConvToModel(ResourceExpDTO currRec, int matLocalId)
|
||||
{
|
||||
RawItemModel answ = new RawItemModel()
|
||||
{
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemId = currRec.RawItemLocalId,
|
||||
QtyAvail = currRec.Qty,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm,
|
||||
MatId = matLocalId,
|
||||
IsRemn = currRec.IsRemn,
|
||||
IsActive = currRec.IsActive,
|
||||
UseQty = true,
|
||||
Note = currRec.Note
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of base class to DB model class
|
||||
/// </summary>
|
||||
/// <param name="coreRec"></param>
|
||||
/// <returns></returns>
|
||||
public static RawItemModel ConvToModel(Core.RawPartM coreRec)
|
||||
{
|
||||
RawItemModel answ = new RawItemModel();
|
||||
if (coreRec != null)
|
||||
{
|
||||
answ = new RawItemModel()
|
||||
{
|
||||
RawItemId = coreRec.nId,
|
||||
MatId = coreRec.Material.nId,
|
||||
HMm = (decimal)coreRec.Material.dH,
|
||||
LMm = (decimal)coreRec.dL,
|
||||
WMm = coreRec.dW > 0 ? (decimal)coreRec.dW : (decimal)coreRec.Material.dW,
|
||||
IsActive = coreRec.bActive,
|
||||
UseQty = coreRec.bUseQuantity,
|
||||
QtyAvail = coreRec.nQuantity
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a ResourceDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static ResourceDTO ConvToResDto(RawItemModel currRec)
|
||||
{
|
||||
ResourceDTO answ = new ResourceDTO()
|
||||
{
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemLocalId = currRec.RawItemId,
|
||||
Qty = currRec.QtyAvail
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Helper conversione a ResourceDTO con garanzia valori Qty negativi
|
||||
///// </summary>
|
||||
///// <param name="currRec"></param>
|
||||
///// <returns></returns>
|
||||
//public static ResourceDTO ConvToResDtoNeg(RawItemModel currRec)
|
||||
//{
|
||||
// ResourceDTO answ = new ResourceDTO()
|
||||
// {
|
||||
// RawItemCloudId = currRec.RawItemCloudId,
|
||||
// RawItemLocalId = currRec.RawItemId,
|
||||
// Qty = -Math.Abs(currRec.QtyAvail)
|
||||
// };
|
||||
// return answ;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Delete by key
|
||||
/// </summary>
|
||||
/// <param name="RawItemId"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByKey(int RawItemId)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.RawItemList
|
||||
.Where(x => x.RawItemId == RawItemId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.RawItemList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on RawItems.DeleteByKey: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key / Core
|
||||
/// </summary>
|
||||
/// <param name="RawItemId"></param>
|
||||
/// <returns></returns>
|
||||
public Core.RawPartM FindByDbId(int RawItemId)
|
||||
{
|
||||
var rawdata = FindByDbIdModel(RawItemId);
|
||||
var result = ConvToCore(rawdata);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key / Db Model
|
||||
/// </summary>
|
||||
/// <param name="RawItemId"></param>
|
||||
/// <returns></returns>
|
||||
public RawItemModel FindByDbIdModel(int RawItemId)
|
||||
{
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.RawItemList
|
||||
.Where(x => x.RawItemId == RawItemId)
|
||||
.Include(m => m.MaterialNav)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Material (filtro x MatId) / Core
|
||||
/// </summary>
|
||||
/// <param name="MatId">0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.RawPartM> GetFilt(int MatId)
|
||||
{
|
||||
var rawList = GetFiltModel(MatId);
|
||||
var result = rawList.Select(x => ConvToCore(x)).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Material (filtro x MatId)
|
||||
/// </summary>
|
||||
/// <param name="MatId">0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<RawItemModel> GetFiltModel(int MatId)
|
||||
{
|
||||
// retrieve
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.RawItemList
|
||||
.Include(j => j.MaterialNav)
|
||||
.Where(x => MatId == 0 || x.MatId == MatId)
|
||||
.OrderBy(x => x.LMm)
|
||||
.ThenBy(x => x.WMm)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert RawItem record
|
||||
/// </summary>
|
||||
/// <param name="updItem">Recorda da registrare</param>
|
||||
/// <param name="changeUseQty">Indica se, in caso di modifica, vada aggiornato UseQty</param>
|
||||
/// <param name="changeQtyAvail">Indica se, in caso di modifica, vada aggiornato QtyAvail</param>
|
||||
/// <returns></returns>
|
||||
public int Upsert(RawItemModel updItem, bool changeUseQty, bool changeQtyAvail)
|
||||
{
|
||||
int newIdx = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.RawItemList
|
||||
.Where(x => (updItem.RawItemId > 0 && x.RawItemId == updItem.RawItemId)
|
||||
|| (x.MatId == updItem.MatId && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);\
|
||||
item2update.RawItemCloudId = updItem.RawItemCloudId;
|
||||
item2update.HMm = updItem.HMm;
|
||||
item2update.LMm = updItem.LMm;
|
||||
item2update.WMm = updItem.WMm;
|
||||
item2update.IsActive = updItem.IsActive;
|
||||
item2update.IsRemn = updItem.IsRemn;
|
||||
if (changeUseQty)
|
||||
{
|
||||
item2update.UseQty = updItem.UseQty;
|
||||
}
|
||||
if (changeQtyAvail)
|
||||
{
|
||||
item2update.QtyAvail = updItem.QtyAvail;
|
||||
item2update.LastSync = DateTime.Now;
|
||||
}
|
||||
localDbCtx.Entry(item2update).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.RawItemList.Add(updItem);
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
if (item2update != null)
|
||||
{
|
||||
newIdx = item2update.RawItemId;
|
||||
}
|
||||
else
|
||||
{
|
||||
newIdx = updItem.RawItemId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on RawItems.Upsert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert RawItem record from CoreM
|
||||
/// </summary>
|
||||
/// <param name="coreItem"></param>
|
||||
/// <returns></returns>
|
||||
public int Upsert(Core.RawPartM coreItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
// converto
|
||||
RawItemModel updItem = ConvToModel(coreItem);
|
||||
newIdx = Upsert(updItem, true, true);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// Initialize database context
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// aggiungo
|
||||
// per prima cosa indico come prodotto il PROD...
|
||||
var currProdData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currProdData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currProdData.IsProduced = true;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateProduced:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateProduced: req item was not found | ProdId {ProdId} | IsProduced: true";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
// resetto done
|
||||
done = false;
|
||||
// aggiungo in StatusMap
|
||||
localDbCtx.StatusMapList.Add(prodSMRecord);
|
||||
|
||||
// recupero MachGroup da PROD
|
||||
@@ -185,8 +215,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,26 @@ namespace EgtBEAMWALL.DataLayer
|
||||
/// </summary>
|
||||
public DbSet<StatusMapModel> StatusMapList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Wharehouse materials management
|
||||
/// </summary>
|
||||
public DbSet<MaterialModel> MaterialsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Wharehouse items management
|
||||
/// </summary>
|
||||
public DbSet<RawItemModel> RawItemList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias management
|
||||
/// </summary>
|
||||
public DbSet<AliasModel> AliasList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias management
|
||||
/// </summary>
|
||||
public DbSet<MagmanSyncModel> SyncList { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("AliasList")]
|
||||
public class AliasModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Famiglia di sinonimi
|
||||
/// </summary>
|
||||
[Column("Family", Order = 1), Key]
|
||||
public string Family { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice originale (da trasformare)
|
||||
/// </summary>
|
||||
[Column("ValueOriginal", Order = 2), Key]
|
||||
public string ValueOriginal { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice Alias in cui viene convertito
|
||||
/// </summary>
|
||||
public string ValueAlias { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("MagmanSync")]
|
||||
public partial class MagmanSyncModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int SyncId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia Sync
|
||||
/// </summary>
|
||||
public string SyncType { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Id riferimento remoto cloud x invio (es ProjCloudId)
|
||||
/// </summary>
|
||||
public int CloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra inserimento richiesta
|
||||
/// </summary>
|
||||
public DateTime DtReq { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra esecuzione richiesta
|
||||
/// </summary>
|
||||
public DateTime? DtExe { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Payload trasmesso/da trasmettere (serializzato)
|
||||
/// </summary>
|
||||
public string Payload { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Record inviato se DtExe != null && >= dtReq
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool Sent
|
||||
{
|
||||
get => DtExe != null && DtExe > DtReq;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("MaterialsList")]
|
||||
public partial class MaterialModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
public MaterialModel()
|
||||
{
|
||||
RawItemList = new HashSet<RawItemModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int MatId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale (Identificativo DB esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int MatCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Codice Materiale
|
||||
/// </summary>
|
||||
public string MatCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione Materiale
|
||||
/// </summary>
|
||||
public string MatDesc { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in mm
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Width/Larghezza in mm
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Height (Thikness/Spessore) in mm
|
||||
/// </summary>
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID dell'ultimo articolo (variante) usato per il materiale
|
||||
/// </summary>
|
||||
public int RawItemIdLast { get; set; } = 0;
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal LIn
|
||||
{
|
||||
get => Math.Round(LMm / (decimal)25.4, 3);
|
||||
}
|
||||
/// <summary>
|
||||
/// Width/Larghezza in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal WIn
|
||||
{
|
||||
get => Math.Round(WMm / (decimal)25.4, 3);
|
||||
}
|
||||
/// <summary>
|
||||
/// Height/Altezza (Thikness/Spessore) in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal HIn
|
||||
{
|
||||
get => Math.Round(HMm / (decimal)25.4, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale x QR/Datamatrix
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public string MatDtmx
|
||||
{
|
||||
get => $"MT{MatExtId:00000000}";
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Verifica che sia Beam, quando L == 0
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsBeam
|
||||
{
|
||||
get => (LMm == 0 && (HMm > 0 && WMm > 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica che sia Wall, quando W/L == 0
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsWall
|
||||
{
|
||||
get => (LMm == 0 && WMm == 0);
|
||||
}
|
||||
|
||||
public virtual ICollection<RawItemModel> RawItemList { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella deiu raggruppamenti PROJ in forma di PROD
|
||||
/// </summary>
|
||||
@@ -16,12 +17,24 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public ProdModel()
|
||||
{
|
||||
ProjListNav = new HashSet<ProjModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca DB
|
||||
/// </summary>
|
||||
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProdDbId { get; set; }
|
||||
|
||||
[Column("Description")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data Creazione
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("DtCreated")]
|
||||
public DateTime DtCreated { get; set; }
|
||||
|
||||
@@ -37,6 +50,29 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca per EgtBM
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
[Index]
|
||||
public int ProdId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice Proj per sync info (Identificativo DB esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int ProjCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
@@ -50,27 +86,30 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
[Index]
|
||||
[Column("IsActive")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca DB
|
||||
/// Stato Prodotto = inviato ALMENO UNA VOLTA al supervisore --> NON eliminabile se non in modo logico
|
||||
/// </summary>
|
||||
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProdDbId { get; set; }
|
||||
[Index]
|
||||
[Column("IsProduced")]
|
||||
public bool IsProduced { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// chiave univoca per EgtBM
|
||||
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public int ProdId { get; set; }
|
||||
[Index]
|
||||
[Column("IsArchived")]
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// Collezione oggetti Proj associati (almeno 1 by design)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
public virtual ICollection<ProjModel> ProjListNav { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella dei PROJ caricati dal BTL
|
||||
/// </summary>
|
||||
@@ -16,6 +16,9 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
[Column("BTLFileName")]
|
||||
public string BTLFileName { get; set; } = "";
|
||||
|
||||
@@ -23,17 +26,20 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
/// Data Creazione
|
||||
/// </summary>
|
||||
[Column("DtCreated")]
|
||||
[Index]
|
||||
public DateTime DtCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data Esportazione
|
||||
/// </summary>
|
||||
[Column("DtExported")]
|
||||
[Index]
|
||||
public DateTime DtExported { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Stato NEW = creato ma NON salvato
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsNew")]
|
||||
public bool IsNew { get; set; } = true;
|
||||
|
||||
@@ -49,17 +55,25 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockedBy")]
|
||||
public string LockedBy { get; set; } = "";
|
||||
[Column("ProdDbId")]
|
||||
public int? ProdDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un dispositivo in rete
|
||||
/// ID da modello ext
|
||||
/// </summary>
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
[Column("Id")]
|
||||
[Index]
|
||||
public int ProjId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice Proj per sync info (Identificativo DB esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int ProjCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
@@ -67,22 +81,40 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public virtual ProdModel Prod { get; set; }
|
||||
|
||||
[Column("ProdDbId")]
|
||||
public int? ProdDbId { get; set; }
|
||||
|
||||
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
[Column("Id")]
|
||||
public int ProjId { get; set; }
|
||||
/// <summary>
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockedBy")]
|
||||
public string LockedBy { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un
|
||||
/// dispositivo in rete
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsActive")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Descrizione progetto (copiata da BTLFileName inizialmente)
|
||||
/// </summary>
|
||||
[Column("ProjDescription")]
|
||||
public string ProjDescription { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsArchived")]
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public virtual ProdModel Prod { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
|
||||
[Table("RawItemList")]
|
||||
public partial class RawItemModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int RawItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice RawMat univoco e in sync (Identificativo DB esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int RawItemCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ForeignKey Materiale
|
||||
/// </summary>
|
||||
public int MatId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Qty available on wharehouse
|
||||
/// </summary>
|
||||
public int QtyAvail { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Active/ = can be used
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Remnant
|
||||
/// </summary>
|
||||
public bool IsRemn { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Lenght
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Width
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Height (Thikness/Spessore) in mm
|
||||
/// </summary>
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Note (optional)
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Indica se debba usare qty effettiva o indefinita (x nesting/schedulazione a capacita illimitata)
|
||||
/// </summary>
|
||||
public bool UseQty { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultimo aggiornamento dal cloud dei dati (in particolare giacenza)
|
||||
/// </summary>
|
||||
public DateTime LastSync { get; set; } = DateTime.Now;
|
||||
|
||||
#if false
|
||||
[NotMapped]
|
||||
public decimal LIn
|
||||
{
|
||||
get => Math.Round(LMm / (decimal)25.4, 3);
|
||||
}
|
||||
[NotMapped]
|
||||
public decimal WIn
|
||||
{
|
||||
get => Math.Round(WMm / (decimal)25.4, 3);
|
||||
}
|
||||
[NotMapped]
|
||||
public decimal HIn
|
||||
{
|
||||
get => Math.Round(HMm / (decimal)25.4, 3);
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public decimal Area
|
||||
{
|
||||
get => LMm * WMm;
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string ItemDtmx
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = $"MT99999999-{LMm * 1000:00000000}";
|
||||
if (MaterialNav != null)
|
||||
{
|
||||
answ = $"MT{MaterialNav.MatExtId:00000000}-{LMm * 1000:00000000}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Navigation property to Material
|
||||
/// </summary>
|
||||
[ForeignKey("MatId")]
|
||||
public virtual MaterialModel MaterialNav { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using Ionic.Zip;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
@@ -18,6 +21,7 @@ namespace EgtBEAMWALL.DataLayer
|
||||
public static string DATABASE_SERV = "127.0.0.1";
|
||||
|
||||
public static string DATABASE_USER = "EgtUser";
|
||||
public static string ZIP_PWD = "viacremasca-viacremasca-viacremasca-viacremasca";
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
@@ -29,9 +33,9 @@ namespace EgtBEAMWALL.DataLayer
|
||||
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string
|
||||
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato (server=localhost;port=3306;database=EgtBwDb_000102;uid=root;pwd=Egalware_24068!;)
|
||||
/// </summary>
|
||||
public static string CONNECTION_STRING { get; set; } = "";
|
||||
public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -72,35 +76,130 @@ namespace EgtBEAMWALL.DataLayer
|
||||
// esecuzione script di install locale
|
||||
return Controllers.DbController.man.refreshViews(DATABASE_NAME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua DUMP del DB dato utente admin + percorso salvataggio
|
||||
/// Effettua DUMP del DB dato utente admin + percorso salvataggio (zip cifrato)
|
||||
/// </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>
|
||||
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;
|
||||
// aggiungo sql finale
|
||||
if (!outFilePath.EndsWith(".sql"))
|
||||
// fix path eseguibile
|
||||
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
|
||||
string dirPath = Path.GetDirectoryName(outFilePath);
|
||||
string dirPath = Path.GetDirectoryName(zipFilePath);
|
||||
if (!Directory.Exists(dirPath))
|
||||
{
|
||||
Directory.CreateDirectory(dirPath);
|
||||
}
|
||||
// se ci fosse già file elimino...
|
||||
if (File.Exists(outFilePath))
|
||||
// se ci fosse già file elimino (sql/zip)
|
||||
if (File.Exists(tempSqlPath))
|
||||
{
|
||||
File.Delete(outFilePath);
|
||||
File.Delete(tempSqlPath);
|
||||
}
|
||||
// chiamo script esterno...
|
||||
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {DATABASE_NAME} > {outFilePath}";
|
||||
if (File.Exists(zipFilePath))
|
||||
{
|
||||
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);
|
||||
// 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;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// Esecuzione di un comando esterno
|
||||
/// </summary>
|
||||
@@ -134,13 +233,12 @@ namespace EgtBEAMWALL.DataLayer
|
||||
process.Close();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di init standard per DB in rete con Master_Key
|
||||
/// </summary>
|
||||
/// <param name="server">Indirizzo del server (tipicamente indirizzo di rete)</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>
|
||||
public static void InitDb(string server, string nKey, string sKey, string masterKey = "")
|
||||
{
|
||||
@@ -150,6 +248,7 @@ namespace EgtBEAMWALL.DataLayer
|
||||
DATABASE_NAME = $"EgtBwDb_{masterKey}";
|
||||
DATABASE_USER = $"user_{nKey}";
|
||||
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";
|
||||
// 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";
|
||||
|
||||
@@ -40,9 +40,15 @@
|
||||
<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>
|
||||
</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">
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2402.2912\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -52,15 +58,18 @@
|
||||
<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>
|
||||
</Reference>
|
||||
<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>
|
||||
<Reference Include="K4os.Compression.LZ4, Version=1.3.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.1.3.6\lib\net462\K4os.Compression.LZ4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.6\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -76,6 +85,9 @@
|
||||
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=110.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
@@ -88,13 +100,14 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
<Reference Include="System.IO.Pipelines, Version=6.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.6.0.3\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
@@ -105,10 +118,20 @@
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.7.0.2\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -123,6 +146,15 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminContext.cs" />
|
||||
<Compile Include="Controllers\MagmanSyncController.cs" />
|
||||
<Compile Include="Controllers\MagmanController.cs" />
|
||||
<Compile Include="Controllers\AliasController.cs" />
|
||||
<Compile Include="Controllers\RawItemsController.cs" />
|
||||
<Compile Include="Controllers\MaterialsController.cs" />
|
||||
<Compile Include="DatabaseModels\AliasModel.cs" />
|
||||
<Compile Include="DatabaseModels\MagmanSyncModel.cs" />
|
||||
<Compile Include="DatabaseModels\MaterialModel.cs" />
|
||||
<Compile Include="DatabaseModels\RawItemModel.cs" />
|
||||
<Compile Include="DatabaseModels\UserPrivModel.cs" />
|
||||
<Compile Include="DbConfig.cs" />
|
||||
<Compile Include="Controllers\LogMachineController.cs" />
|
||||
@@ -172,6 +204,46 @@
|
||||
<Compile Include="Migrations\202207051703296_UpgradeLockModel.designer.cs">
|
||||
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202306081452095_UpdateProjModel.cs" />
|
||||
<Compile Include="Migrations\202306081452095_UpdateProjModel.designer.cs">
|
||||
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202308241516227_AddProdStatusVarAndIndex.cs" />
|
||||
<Compile Include="Migrations\202308241516227_AddProdStatusVarAndIndex.designer.cs">
|
||||
<DependentUpon>202308241516227_AddProdStatusVarAndIndex.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202308250853396_AddProjArchivedField.cs" />
|
||||
<Compile Include="Migrations\202308250853396_AddProjArchivedField.designer.cs">
|
||||
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.cs" />
|
||||
<Compile Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.designer.cs">
|
||||
<DependentUpon>202401181534084_AddAliasMaterialRawItemsModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401291722150_FixMatItemCloudId.cs" />
|
||||
<Compile Include="Migrations\202401291722150_FixMatItemCloudId.designer.cs">
|
||||
<DependentUpon>202401291722150_FixMatItemCloudId.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401310830146_FixItemRemn.cs" />
|
||||
<Compile Include="Migrations\202401310830146_FixItemRemn.designer.cs">
|
||||
<DependentUpon>202401310830146_FixItemRemn.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202402141003461_RawItemAddUseQty.cs" />
|
||||
<Compile Include="Migrations\202402141003461_RawItemAddUseQty.designer.cs">
|
||||
<DependentUpon>202402141003461_RawItemAddUseQty.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202402290716188_AddProjCloudId.cs" />
|
||||
<Compile Include="Migrations\202402290716188_AddProjCloudId.Designer.cs">
|
||||
<DependentUpon>202402290716188_AddProjCloudId.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202403120645357_RawItemAddLastSync.cs" />
|
||||
<Compile Include="Migrations\202403120645357_RawItemAddLastSync.Designer.cs">
|
||||
<DependentUpon>202403120645357_RawItemAddLastSync.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202403120803297_AddMagmanSyncTab.cs" />
|
||||
<Compile Include="Migrations\202403120803297_AddMagmanSyncTab.Designer.cs">
|
||||
<DependentUpon>202403120803297_AddMagmanSyncTab.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
@@ -211,6 +283,36 @@
|
||||
<EmbeddedResource Include="Migrations\202207051703296_UpgradeLockModel.resx">
|
||||
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202306081452095_UpdateProjModel.resx">
|
||||
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202308241516227_AddProdStatusVarAndIndex.resx">
|
||||
<DependentUpon>202308241516227_AddProdStatusVarAndIndex.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202308250853396_AddProjArchivedField.resx">
|
||||
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.resx">
|
||||
<DependentUpon>202401181534084_AddAliasMaterialRawItemsModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401291722150_FixMatItemCloudId.resx">
|
||||
<DependentUpon>202401291722150_FixMatItemCloudId.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401310830146_FixItemRemn.resx">
|
||||
<DependentUpon>202401310830146_FixItemRemn.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202402141003461_RawItemAddUseQty.resx">
|
||||
<DependentUpon>202402141003461_RawItemAddUseQty.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202402290716188_AddProjCloudId.resx">
|
||||
<DependentUpon>202402290716188_AddProjCloudId.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202403120645357_RawItemAddLastSync.resx">
|
||||
<DependentUpon>202403120645357_RawItemAddLastSync.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202403120803297_AddMagmanSyncTab.resx">
|
||||
<DependentUpon>202403120803297_AddMagmanSyncTab.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class 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
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddProdStatusVarAndIndex : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProdStatusVarAndIndex));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202308241516227_AddProdStatusVarAndIndex"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddProdStatusVarAndIndex : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProdList", "IsActive", c => c.Boolean(nullable: false));
|
||||
AddColumn("dbo.ProdList", "IsProduced", c => c.Boolean(nullable: false));
|
||||
AddColumn("dbo.ProdList", "IsArchived", c => c.Boolean(nullable: false));
|
||||
CreateIndex("dbo.ProjList", "DtCreated");
|
||||
CreateIndex("dbo.ProjList", "DtExported");
|
||||
CreateIndex("dbo.ProjList", "IsActive");
|
||||
CreateIndex("dbo.ProjList", "IsNew");
|
||||
CreateIndex("dbo.ProjList", "Id");
|
||||
CreateIndex("dbo.ProdList", "DtCreated");
|
||||
CreateIndex("dbo.ProdList", "Id");
|
||||
CreateIndex("dbo.ProdList", "IsActive");
|
||||
CreateIndex("dbo.ProdList", "IsProduced");
|
||||
CreateIndex("dbo.ProdList", "IsArchived");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.ProdList", new[] { "IsArchived" });
|
||||
DropIndex("dbo.ProdList", new[] { "IsProduced" });
|
||||
DropIndex("dbo.ProdList", new[] { "IsActive" });
|
||||
DropIndex("dbo.ProdList", new[] { "Id" });
|
||||
DropIndex("dbo.ProdList", new[] { "DtCreated" });
|
||||
DropIndex("dbo.ProjList", new[] { "Id" });
|
||||
DropIndex("dbo.ProjList", new[] { "IsNew" });
|
||||
DropIndex("dbo.ProjList", new[] { "IsActive" });
|
||||
DropIndex("dbo.ProjList", new[] { "DtExported" });
|
||||
DropIndex("dbo.ProjList", new[] { "DtCreated" });
|
||||
DropColumn("dbo.ProdList", "IsArchived");
|
||||
DropColumn("dbo.ProdList", "IsProduced");
|
||||
DropColumn("dbo.ProdList", "IsActive");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddProjArchivedField : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProjArchivedField));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202308250853396_AddProjArchivedField"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddProjArchivedField : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "IsArchived", c => c.Boolean(nullable: false));
|
||||
CreateIndex("dbo.ProjList", "IsArchived");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.ProjList", new[] { "IsArchived" });
|
||||
DropColumn("dbo.ProjList", "IsArchived");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Generated
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddAliasMaterialRawItemsModel : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddAliasMaterialRawItemsModel));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401181534084_AddAliasMaterialRawItemsModel"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddAliasMaterialRawItemsModel : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.AliasList",
|
||||
c => new
|
||||
{
|
||||
Family = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
|
||||
ValueOriginal = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
|
||||
ValueAlias = c.String(unicode: false),
|
||||
})
|
||||
.PrimaryKey(t => new { t.Family, t.ValueOriginal });
|
||||
|
||||
CreateTable(
|
||||
"dbo.MaterialsList",
|
||||
c => new
|
||||
{
|
||||
MatId = c.Int(nullable: false, identity: true),
|
||||
MatExtId = c.Int(nullable: false),
|
||||
MatCode = c.String(unicode: false),
|
||||
MatDesc = c.String(unicode: false),
|
||||
LMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
WMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
HMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
RawItemIdLast = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.MatId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.RawItemList",
|
||||
c => new
|
||||
{
|
||||
RawItemId = c.Int(nullable: false, identity: true),
|
||||
MatId = c.Int(nullable: false),
|
||||
QtyAvail = c.Int(nullable: false),
|
||||
IsActive = c.Boolean(nullable: false),
|
||||
LMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
WMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
HMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
Note = c.String(unicode: false),
|
||||
})
|
||||
.PrimaryKey(t => t.RawItemId)
|
||||
.ForeignKey("dbo.MaterialsList", t => t.MatId, cascadeDelete: true)
|
||||
.Index(t => t.MatId);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.RawItemList", "MatId", "dbo.MaterialsList");
|
||||
DropIndex("dbo.RawItemList", new[] { "MatId" });
|
||||
DropTable("dbo.RawItemList");
|
||||
DropTable("dbo.MaterialsList");
|
||||
DropTable("dbo.AliasList");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class FixMatItemCloudId : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(FixMatItemCloudId));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401291722150_FixMatItemCloudId"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class FixMatItemCloudId : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.MaterialsList", "MatCloudId", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.RawItemList", "RawItemCloudId", c => c.Int(nullable: false));
|
||||
DropColumn("dbo.MaterialsList", "MatExtId");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.MaterialsList", "MatExtId", c => c.Int(nullable: false));
|
||||
DropColumn("dbo.RawItemList", "RawItemCloudId");
|
||||
DropColumn("dbo.MaterialsList", "MatCloudId");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -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 FixItemRemn : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(FixItemRemn));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401310830146_FixItemRemn"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class FixItemRemn : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.RawItemList", "IsRemn", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.RawItemList", "IsRemn");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class RawItemAddUseQty : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(RawItemAddUseQty));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202402141003461_RawItemAddUseQty"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class RawItemAddUseQty : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.RawItemList", "UseQty", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.RawItemList", "UseQty");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -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 AddProjCloudId : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProjCloudId));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202402290716188_AddProjCloudId"; }
|
||||
}
|
||||
|
||||
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 AddProjCloudId : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "ProjCloudId", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.ProdList", "ProjCloudId", c => c.Int(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.ProdList", "ProjCloudId");
|
||||
DropColumn("dbo.ProjList", "ProjCloudId");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class RawItemAddLastSync : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(RawItemAddLastSync));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202403120645357_RawItemAddLastSync"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class RawItemAddLastSync : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.RawItemList", "LastSync", c => c.DateTime(nullable: false, precision: 0));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.RawItemList", "LastSync");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddMagmanSyncTab : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddMagmanSyncTab));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202403120803297_AddMagmanSyncTab"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddMagmanSyncTab : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.MagmanSync",
|
||||
c => new
|
||||
{
|
||||
SyncId = c.Int(nullable: false, identity: true),
|
||||
SyncType = c.String(unicode: false),
|
||||
CloudId = c.Int(nullable: false),
|
||||
DtReq = c.DateTime(nullable: false, precision: 0),
|
||||
DtExe = c.DateTime(precision: 0),
|
||||
Payload = c.String(unicode: false),
|
||||
})
|
||||
.PrimaryKey(t => t.SyncId);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropTable("dbo.MagmanSync");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.5.5.4")]
|
||||
[assembly: AssemblyFileVersion("2.5.5.4")]
|
||||
[assembly: AssemblyVersion("2.5.12.2")]
|
||||
[assembly: AssemblyFileVersion("2.5.12.2")]
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
|
||||
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2402.2912" targetFramework="net472" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||
<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.Streams" version="1.3.5" targetFramework="net472" />
|
||||
<package id="K4os.Compression.LZ4" version="1.3.6" targetFramework="net472" />
|
||||
<package id="K4os.Compression.LZ4.Streams" version="1.3.6" targetFramework="net472" />
|
||||
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
|
||||
<package id="MySql.Data" version="8.0.21" targetFramework="net472" />
|
||||
<package id="MySql.Data.EntityFramework" version="8.0.21" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
|
||||
<package id="NLog" version="5.0.1" targetFramework="net472" />
|
||||
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
|
||||
<package id="RestSharp" version="110.2.0" targetFramework="net472" />
|
||||
<package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
||||
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net472" />
|
||||
<package id="System.IO.Pipelines" version="6.0.3" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
|
||||
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net472" />
|
||||
<package id="System.Text.Json" version="7.0.2" targetFramework="net472" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -1,31 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<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 -->
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/>
|
||||
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
|
||||
<providers>
|
||||
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<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>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0"/>
|
||||
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
|
||||
<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>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<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"/>
|
||||
<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" />
|
||||
</DbProviderFactories>
|
||||
</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>
|
||||
<RootNamespace>EgtBEAMWALL.StressTest</RootNamespace>
|
||||
<AssemblyName>EgtBEAMWALL.StressTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ namespace EgtBEAMWALL.StressTest.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// 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.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ namespace EgtBEAMWALL.StressTest.Properties {
|
||||
|
||||
|
||||
[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 {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace EgtBEAMWALL.StressTest
|
||||
{
|
||||
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
|
||||
|
||||
public List<Core.BTLPartM> BtlPartList = new List<Core.BTLPartM>();
|
||||
@@ -30,30 +16,6 @@ namespace EgtBEAMWALL.StressTest
|
||||
|
||||
#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
|
||||
|
||||
/// <summary>
|
||||
@@ -79,7 +41,7 @@ namespace EgtBEAMWALL.StressTest
|
||||
List<DataLayer.DatabaseModels.BTLPartModel> currPartList = new List<DataLayer.DatabaseModels.BTLPartModel>();
|
||||
List<Core.MyMachGroupM> currMachGroupList = new List<Core.MyMachGroupM>();
|
||||
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..
|
||||
for (int j = 0; j < currRandom.BtlPart2Proj; j++)
|
||||
{
|
||||
@@ -107,8 +69,8 @@ namespace EgtBEAMWALL.StressTest
|
||||
{
|
||||
for (int l = 0; l < currRandom.Part2MachGroup; l++)
|
||||
{
|
||||
// FixME!!! non può creare x loop in CreateBeamDL che vuole nParentMachGroup
|
||||
// genero le Part x MachGroup ed assegno
|
||||
// FixME!!! non può creare x loop in CreateBeamDL che vuole
|
||||
// nParentMachGroup genero le Part x MachGroup ed assegno
|
||||
Core.PartM currPart = Core.PartM.CreatePart(Core.ConstBeam.BWType.BEAM, currMachGroupList.FirstOrDefault(), currPartList[BPIdx].PartId, 1);
|
||||
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 });
|
||||
@@ -138,9 +100,45 @@ namespace EgtBEAMWALL.StressTest
|
||||
|
||||
public void initDb()
|
||||
{
|
||||
var firstData = ProjCtr.GetLastDesc(1);
|
||||
var firstData = ProjCtr.GetLastDesc(1, true);
|
||||
}
|
||||
|
||||
#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
@@ -35,6 +35,10 @@ namespace EgtBEAMWALL.StressTest
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.buttonDataSeed = new System.Windows.Forms.Button();
|
||||
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.SuspendLayout();
|
||||
//
|
||||
@@ -92,17 +96,57 @@ namespace EgtBEAMWALL.StressTest
|
||||
// labelResult
|
||||
//
|
||||
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.Size = new System.Drawing.Size(35, 13);
|
||||
this.labelResult.TabIndex = 4;
|
||||
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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
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.groupBox1);
|
||||
this.Name = "StressTest";
|
||||
@@ -122,6 +166,10 @@ namespace EgtBEAMWALL.StressTest
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Button buttonDataSeed;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EgtBEAMWALL.StressTest
|
||||
{
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
@@ -21,17 +29,6 @@ namespace EgtBEAMWALL.StressTest
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public StressTest()
|
||||
{
|
||||
InitializeComponent();
|
||||
// warm up DB
|
||||
CurrSim.initDb();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int numProj
|
||||
@@ -52,6 +49,54 @@ namespace EgtBEAMWALL.StressTest
|
||||
|
||||
#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)
|
||||
{
|
||||
// genero dati col SIM
|
||||
|
||||
@@ -149,6 +149,9 @@
|
||||
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
|
||||
</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">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
|
||||
@@ -177,9 +180,6 @@
|
||||
<HintPath>..\ExtLibs\Interop.FXServer.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</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">
|
||||
<HintPath>..\ExtLibs\ISOCNC.Remoting.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
|
||||
xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
|
||||
<!--<ToggleButton IsChecked="{Binding DataContext.bL_IsReadOnly, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>-->
|
||||
<EgtBEAMWALLCORE:EgtDataGrid ItemsSource="{Binding Tag.MachGroupVMList,
|
||||
<EgtBEAMWALLCORE:EgtDataGrid x:Name="MachGroupDataGrid"
|
||||
ItemsSource="{Binding Tag.MachGroupVMList_View,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"
|
||||
SelectedItem="{Binding Tag.SelectedMachGroup,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserDeleteRows="False"
|
||||
CanUserResizeRows="False"
|
||||
@@ -17,6 +19,7 @@
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
Margin="0,0,0,5"
|
||||
BindingColumns="{Binding RawPartColumns}"
|
||||
Sorting="MachGroupVMList_Sorting"
|
||||
Style="{StaticResource DataGrid_CustomHighLight}">
|
||||
<DataGrid.Resources>
|
||||
<!--ID - Id gruppo-->
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
Public Class RawPartListV
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports Mysqlx
|
||||
Imports Org.BouncyCastle.Crypto
|
||||
Imports System.ComponentModel
|
||||
|
||||
Public Class RawPartListV
|
||||
|
||||
Sub New()
|
||||
|
||||
' This call is required by the designer.
|
||||
InitializeComponent()
|
||||
|
||||
' Add any initialization after the InitializeComponent() call.
|
||||
MyComparer.SetDataGrid(MachGroupDataGrid)
|
||||
AddHandler MachGroupDataGrid.ResetSort, AddressOf MachGroupDataGrid_ResetSort
|
||||
End Sub
|
||||
|
||||
' funzione che permette di selezionare un RawPart anche quando gia' selezionato
|
||||
Private Sub RawPartRow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
|
||||
@@ -12,4 +27,432 @@
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MachGroupVMList_Sorting(sender As Object, e As DataGridSortingEventArgs)
|
||||
' aggiorno direziona colonna
|
||||
Dim column As DataGridColumn = e.Column
|
||||
column.SortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
|
||||
' ricalcolo colonne sort
|
||||
Dim datagrid As DataGrid = sender
|
||||
MyComparer.RefreshColumns()
|
||||
' lancio sort custom
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
e.Handled = True
|
||||
End Sub
|
||||
|
||||
'Private Sub MachGroupVMList_Sorting(sender As Object, e As DataGridSortingEventArgs)
|
||||
' Dim column As DataGridColumn = e.Column
|
||||
' Dim datagrid As DataGrid = sender
|
||||
' Dim comparer As IComparer = Nothing
|
||||
' e.Handled = True
|
||||
' Dim direction As ListSortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
|
||||
' column.SortDirection = direction
|
||||
' Dim m_ColumnList As New List(Of DataGridColumn)
|
||||
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
' For Each col In datagrid.Columns
|
||||
' If Not IsNothing(col.SortDirection) Then
|
||||
' m_ColumnList.Add(col)
|
||||
' m_EgtColumnList.Add(Map.refRawPartListVM.RawPartColumns(col.DisplayIndex))
|
||||
' End If
|
||||
' Next
|
||||
' Dim lcv As ListCollectionView = CType(CollectionViewSource.GetDefaultView(datagrid.ItemsSource), ListCollectionView)
|
||||
' comparer = New MyComparer(Map.refRawPartListVM.RawPartColumns(column.DisplayIndex), m_ColumnList, m_EgtColumnList, direction)
|
||||
' lcv.CustomSort = comparer
|
||||
'End Sub
|
||||
|
||||
Private Sub MachGroupDataGrid_ResetSort()
|
||||
MyComparer.RefreshColumns()
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Friend Class MyComparer
|
||||
Implements IComparer
|
||||
|
||||
Private Shared DataGrid As DataGrid
|
||||
Friend Shared Sub SetDataGrid(value As DataGrid)
|
||||
DataGrid = value
|
||||
End Sub
|
||||
|
||||
Private Shared m_ColumnList As New List(Of DataGridColumn)
|
||||
Private Shared m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
|
||||
Friend Shared Sub RefreshColumns()
|
||||
m_ColumnList.Clear()
|
||||
m_EgtColumnList.Clear()
|
||||
For Each col In DataGrid.Columns
|
||||
If Not IsNothing(col.SortDirection) Then
|
||||
m_ColumnList.Add(col)
|
||||
m_EgtColumnList.Add(Map.refRawPartListVM.RawPartColumns(col.DisplayIndex))
|
||||
End If
|
||||
Next
|
||||
Map.refRawPartListVM.SetRawPartListSorted(m_ColumnList.Count > 0)
|
||||
End Sub
|
||||
|
||||
|
||||
Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
Dim bFirstInQueue As Boolean = First.bToBeProduced
|
||||
Dim bSecondInQueue As Boolean = Second.bToBeProduced
|
||||
' verifico se gia' prodotti
|
||||
If bFirstProduced AndAlso bSecondProduced Then
|
||||
If First.nProductionIndex > Second.nProductionIndex Then
|
||||
Return 1
|
||||
ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
Return -1
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
ElseIf bFirstProduced Then
|
||||
Return -1
|
||||
ElseIf bSecondProduced Then
|
||||
Return 1
|
||||
ElseIf bFirstInQueue AndAlso bSecondInQueue Then
|
||||
If First.nProductionIndex > Second.nProductionIndex Then
|
||||
Return 1
|
||||
ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
Return -1
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
ElseIf bFirstInQueue Then
|
||||
Return -1
|
||||
ElseIf bSecondInQueue Then
|
||||
Return 1
|
||||
Else
|
||||
' verifico ordine per colonne
|
||||
Dim ColumnIndex = 0
|
||||
While ColumnIndex <= m_EgtColumnList.Count - 1
|
||||
Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
|
||||
Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
|
||||
If nCheck <> 0 Then
|
||||
Return nCheck
|
||||
End If
|
||||
ColumnIndex += 1
|
||||
End While
|
||||
' se non trovo colonne, metto in ordine indice di produzione
|
||||
If First.nProductionIndex > Second.nProductionIndex Then
|
||||
Return 1
|
||||
ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
Return -1
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
|
||||
Select Case Column.Name
|
||||
Case COL_NAME
|
||||
If First.nName > Second.nName Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.nName < Second.nName Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_STARTCUT
|
||||
If First.Id > Second.Id Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.Id < Second.Id Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_W
|
||||
If First.dW > Second.dW Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dW < Second.dW Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_H
|
||||
If First.dH > Second.dH Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dH < Second.dH Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_L
|
||||
If First.dL > Second.dL Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dL < Second.dL Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_POSZ
|
||||
'If First.posz > Second.dL Then
|
||||
' Return 1 * nDirection
|
||||
'ElseIf First.dL < Second.dL Then
|
||||
' Return -1 * nDirection
|
||||
'Else
|
||||
' Return 0
|
||||
'End If
|
||||
Case COL_MATERIAL
|
||||
If First.sMATERIAL > Second.sMATERIAL Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_USAGE
|
||||
If First.dUsage > Second.dUsage Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dUsage < Second.dUsage Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Case COL_WASTE
|
||||
If First.dWaste > Second.dWaste Then
|
||||
Return 1 * nDirection
|
||||
ElseIf First.dWaste < Second.dWaste Then
|
||||
Return -1 * nDirection
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
End Select
|
||||
Return 0
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
'Friend Class MyComparer
|
||||
' Implements IComparer
|
||||
|
||||
' Dim m_Direction As ListSortDirection
|
||||
' Dim m_Column As EgtDataGridColumn
|
||||
' Dim m_ColumnList As List(Of DataGridColumn)
|
||||
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
|
||||
' Sub New(Column As EgtDataGridColumn, ColumnList As List(Of DataGridColumn), EgtColumnList As List(Of EgtDataGridColumn), Direction As ListSortDirection)
|
||||
' m_Column = Column
|
||||
' m_ColumnList = ColumnList
|
||||
' m_EgtColumnList = EgtColumnList
|
||||
' m_Direction = Direction
|
||||
' End Sub
|
||||
|
||||
' Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
' Dim nDirection As Integer = If(m_Direction, 1, -1)
|
||||
' If bFirstProduced AndAlso bSecondProduced Then
|
||||
' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' Return 1
|
||||
' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' Return -1
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' ElseIf bFirstProduced Then
|
||||
' Return -1
|
||||
' ElseIf bSecondProduced Then
|
||||
' Return 1
|
||||
' Else
|
||||
' Dim ColumnIndex = 0
|
||||
' While ColumnIndex <= m_EgtColumnList.Count - 1
|
||||
' Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
|
||||
' Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
|
||||
' If nCheck <> 0 Then
|
||||
' Return nCheck
|
||||
' End If
|
||||
' ColumnIndex += 1
|
||||
' End While
|
||||
' Return 0
|
||||
' End If
|
||||
' End Function
|
||||
|
||||
' Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
|
||||
' Select Case Column.Name
|
||||
' Case COL_NAME
|
||||
' If First.nName > Second.nName Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.nName < Second.nName Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_STARTCUT
|
||||
' If First.Id > Second.Id Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.Id < Second.Id Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_W
|
||||
' If First.dW > Second.dW Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dW < Second.dW Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_H
|
||||
' If First.dH > Second.dH Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dH < Second.dH Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_L
|
||||
' If First.dL > Second.dL Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dL < Second.dL Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_POSZ
|
||||
' 'If First.posz > Second.dL Then
|
||||
' ' Return 1 * nDirection
|
||||
' 'ElseIf First.dL < Second.dL Then
|
||||
' ' Return -1 * nDirection
|
||||
' 'Else
|
||||
' ' Return 0
|
||||
' 'End If
|
||||
' Case COL_MATERIAL
|
||||
' If First.sMATERIAL > Second.sMATERIAL Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_USAGE
|
||||
' If First.dUsage > Second.dUsage Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dUsage < Second.dUsage Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_WASTE
|
||||
' If First.dWaste > Second.dWaste Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dWaste < Second.dWaste Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' End Select
|
||||
' End Function
|
||||
|
||||
' 'Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
' ' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
' ' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
' ' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
' ' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
' ' Dim nDirection As Integer = If(m_Direction, 1, -1)
|
||||
' ' If bFirstProduced AndAlso bSecondProduced Then
|
||||
' ' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' ' Return 1
|
||||
' ' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' ' Return -1
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' ElseIf bFirstProduced Then
|
||||
' ' Return -1
|
||||
' ' ElseIf bSecondProduced Then
|
||||
' ' Return 1
|
||||
' ' Else
|
||||
' ' Select Case m_Column.Name
|
||||
' ' Case COL_NAME
|
||||
' ' If First.nName > Second.nName Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.nName < Second.nName Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_STARTCUT
|
||||
' ' If First.Id > Second.Id Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.Id < Second.Id Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_W
|
||||
' ' If First.dW > Second.dW Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dW < Second.dW Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_H
|
||||
' ' If First.dH > Second.dH Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dH < Second.dH Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_L
|
||||
' ' If First.dL > Second.dL Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dL < Second.dL Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_POSZ
|
||||
' ' 'If First.posz > Second.dL Then
|
||||
' ' ' Return 1 * nDirection
|
||||
' ' 'ElseIf First.dL < Second.dL Then
|
||||
' ' ' Return -1 * nDirection
|
||||
' ' 'Else
|
||||
' ' ' Return 0
|
||||
' ' 'End If
|
||||
' ' Case COL_MATERIAL
|
||||
' ' If First.sMATERIAL > Second.sMATERIAL Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_USAGE
|
||||
' ' If First.dUsage > Second.dUsage Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dUsage < Second.dUsage Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' Case COL_WASTE
|
||||
' ' If First.dWaste > Second.dWaste Then
|
||||
' ' Return 1 * nDirection
|
||||
' ' ElseIf First.dWaste < Second.dWaste Then
|
||||
' ' Return -1 * nDirection
|
||||
' ' Else
|
||||
' ' Return 0
|
||||
' ' End If
|
||||
' ' End Select
|
||||
' ' 'Dim dFirstValue As Double
|
||||
' ' 'If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' ' ' Return 1 * nDirection
|
||||
' ' 'ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' ' ' Return -1 * nDirection
|
||||
' ' 'Else
|
||||
' ' ' Return 0
|
||||
' ' 'End If
|
||||
' ' End If
|
||||
|
||||
' ' Throw New NotImplementedException()
|
||||
' 'End Function
|
||||
|
||||
'End Class
|
||||
|
||||
@@ -6,6 +6,17 @@ Public Class RawPartListVM
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Private m_bRawPartListSorted As Boolean
|
||||
Public ReadOnly Property bRawPartListSorted As Boolean
|
||||
Get
|
||||
Return m_bRawPartListSorted
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetRawPartListSorted(value As Boolean)
|
||||
m_bRawPartListSorted = value
|
||||
Map.refLeftPanelVM.NotifyPropertyChanged(NameOf(Map.refLeftPanelVM.MoveRawPart_IsEnabled))
|
||||
End Sub
|
||||
|
||||
Private m_colRawPart_StartCut As EgtDataGridColumn
|
||||
Public ReadOnly Property colRawPart_StartCut As EgtDataGridColumn
|
||||
Get
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.ComponentModel
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports System.Windows.Threading
|
||||
@@ -198,6 +199,8 @@ Public Class LeftPanelVM
|
||||
Return False
|
||||
ElseIf IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then
|
||||
Return False
|
||||
ElseIf Map.refRawPartListVM.bRawPartListSorted Then
|
||||
Return False
|
||||
ElseIf Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup) Then
|
||||
Dim SelMachgroup As MyMachGroupVM = DirectCast(Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup, MyMachGroupVM)
|
||||
Return SelMachgroup.nProduction_State <= ItemState.Confirmed AndAlso Not SelMachgroup.bToBeProduced
|
||||
@@ -434,6 +437,10 @@ Public Class LeftPanelVM
|
||||
New OPState("Reset", OPStates.End),
|
||||
New OPState("Unspecified", OPStates.Unspecified)
|
||||
}
|
||||
Case Else
|
||||
m_OPStateList = New List(Of OPState) From {
|
||||
New OPState("Unspecified", OPStates.Unspecified)
|
||||
}
|
||||
End Select
|
||||
' seleziono in partenza unspecified
|
||||
Dim UnspecifiedState As OPState = m_OPStateList.FirstOrDefault(Function(x) x.Id = OPStates.Unspecified)
|
||||
@@ -512,7 +519,8 @@ Public Class LeftPanelVM
|
||||
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList) OrElse Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0 Then Return
|
||||
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.nProduction_State <= ItemState.Confirmed) Then Return
|
||||
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.dtStartTime = DateTime.MinValue) Then Return
|
||||
Dim ToDoList As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
|
||||
Dim View As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList_View.Cast(Of MachGroupVM).ToList()
|
||||
Dim ToDoList As List(Of MachGroupVM) = View.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
|
||||
If Not IsNothing(ToDoList) AndAlso ToDoList.Count > 0 Then
|
||||
MyMachGroupVM.Produce(ToDoList)
|
||||
End If
|
||||
@@ -561,6 +569,8 @@ Public Class LeftPanelVM
|
||||
If CurrentMachine.Flow = FlowTypes.ONEBYONE Then
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
End If
|
||||
' aggiorno log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
#End Region ' DoneRawPart
|
||||
@@ -800,6 +810,8 @@ Public Class LeftPanelVM
|
||||
Next
|
||||
SetDonePart(SelMachGroup, SelMachGroup.SelPart)
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.SelectedMachGroup = SelMachGroup
|
||||
' aggiorno log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
Public Sub SetDonePart(MachGroup As MyMachGroupVM, Part As PartVM)
|
||||
@@ -815,8 +827,9 @@ Public Class LeftPanelVM
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreatePartStateLog(Time - TimeSpan.FromSeconds(1), Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, Part.nPartId, 1, DbControllers.SupervisorId))
|
||||
' se e' il primo ad essere lavorato
|
||||
If Not MachGroup.PartVMList.Any(Function(x) x IsNot Part AndAlso x.dtStartTime > DateTime.MinValue) Then
|
||||
Dim bCurrToBeProduced As Boolean = MachGroup.bToBeProduced Or MachGroup.bReadyForMachining Or MachGroup.bSentToMachine
|
||||
' se non e' gia' in coda per essere prodotto
|
||||
If Not (MachGroup.bToBeProduced Or MachGroup.bReadyForMachining Or MachGroup.bSentToMachine) Then
|
||||
If Not bCurrToBeProduced Then
|
||||
' riposiziono il gruppo come primo dei non lavorati assegnandogli indice corretto
|
||||
' cerco primo indice di pezzo non in produzione
|
||||
Dim NewIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) DirectCast(x, MyMachGroupVM).dtStartTime = DateTime.MinValue AndAlso DirectCast(x, MyMachGroupVM).bToBeProduced = False))
|
||||
@@ -840,6 +853,10 @@ Public Class LeftPanelVM
|
||||
MachGroup.dtStartTime = Time
|
||||
MachGroup.nProduction_State = ItemState.WIP
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
|
||||
' aggiorno sort custom dei MachGroup
|
||||
If Not bCurrToBeProduced Then
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End If
|
||||
' scrivo evento inizio MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(Time - TimeSpan.FromSeconds(1), Map.refSupervisorManagerVM.CurrProd.nProdId, MachGroup.Id, 1, DbControllers.SupervisorId))
|
||||
' blocco produzione di tutti gli altri perche' iniziato questo
|
||||
@@ -907,7 +924,13 @@ Public Class LeftPanelVM
|
||||
If nSelMGIndex = 0 Then Return
|
||||
Dim PreviousMG As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList(nSelMGIndex - 1)
|
||||
If PreviousMG.nProduction_State >= ItemState.WIP Or PreviousMG.bReadyForMachining Then Return
|
||||
' scambio indici
|
||||
Dim nSelMGProdIndex As Integer = SelMachGroup.nProductionIndex
|
||||
SelMachGroup.SetProductionIndex(PreviousMG.nProductionIndex)
|
||||
PreviousMG.SetProductionIndex(nSelMGProdIndex)
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(nSelMGIndex, nSelMGIndex - 1)
|
||||
' lancio sort custom
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End Sub
|
||||
|
||||
#End Region ' MoveUpRawPart
|
||||
@@ -936,7 +959,14 @@ Public Class LeftPanelVM
|
||||
If SelMachGroup.nProduction_State >= ItemState.WIP Or SelMachGroup.bReadyForMachining Then Return
|
||||
Dim nSelMGIndex = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(SelMachGroup)
|
||||
If nSelMGIndex = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count - 1 Then Return
|
||||
' scambio indici
|
||||
Dim NextMG As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList(nSelMGIndex + 1)
|
||||
Dim nSelMGProdIndex As Integer = SelMachGroup.nProductionIndex
|
||||
SelMachGroup.SetProductionIndex(NextMG.nProductionIndex)
|
||||
NextMG.SetProductionIndex(nSelMGProdIndex)
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(nSelMGIndex, nSelMGIndex + 1)
|
||||
' lancio sort custom
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End Sub
|
||||
|
||||
#End Region ' MoveDownRawPart
|
||||
|
||||
@@ -467,6 +467,9 @@ Public Class MachCommandMessagePanelVM
|
||||
MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.RESET))
|
||||
' annullo stato di pronto ad essere lavorato di tutti i programmi
|
||||
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then Map.refProjectVM.SupervisorMachGroupPanelVM.ResetAllMachGroups()
|
||||
' rifaccio sort lista grezzi
|
||||
' lancio sort custom
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Step_Command As ICommand
|
||||
|
||||
@@ -317,6 +317,7 @@ Public Class MyMachGroupVM
|
||||
' segno pezzo da produrre
|
||||
MachGroup.m_bToBeProduced = True
|
||||
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Production_Background))
|
||||
Map.refSupervisorMachGroupPanelVM.MachGroupVMList_View.Refresh()
|
||||
|
||||
' sposto MachGroup in lista come ultimo dei pronti da produrre
|
||||
Dim OldIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(MachGroup)
|
||||
|
||||
@@ -21,6 +21,13 @@ Public Class SupervisorMachGroupPanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_MachGroupVMList_View As ListCollectionView = Nothing
|
||||
Public ReadOnly Property MachGroupVMList_View As ListCollectionView
|
||||
Get
|
||||
Return m_MachGroupVMList_View
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' lock per aggiunta elemento a lista MachGroup
|
||||
Private m_Lock_AddMachGroup As New Object
|
||||
|
||||
@@ -39,6 +46,23 @@ Public Class SupervisorMachGroupPanelVM
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
Private m_MachGroupVMListComparer As MyComparer
|
||||
Friend ReadOnly Property MachGroupVMListComparer As MyComparer
|
||||
Get
|
||||
Return m_MachGroupVMListComparer
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend Sub SetMachGroupVMListView()
|
||||
m_MachGroupVMList_View = CollectionViewSource.GetDefaultView(m_MachGroupVMList)
|
||||
m_MachGroupVMListComparer = New MyComparer
|
||||
m_MachGroupVMList_View.CustomSort = m_MachGroupVMListComparer
|
||||
NotifyPropertyChanged(NameOf(MachGroupVMList_View))
|
||||
End Sub
|
||||
|
||||
Friend Sub RefreshMachGroupVMSort()
|
||||
m_MachGroupVMList_View.CustomSort = m_MachGroupVMListComparer
|
||||
End Sub
|
||||
|
||||
Sub New(MachGroupPanelM As MachGroupPanelM)
|
||||
MyBase.New(MachGroupPanelM)
|
||||
@@ -166,3 +190,151 @@ Public Class SupervisorMachGroupPanelVM
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
|
||||
'Friend Class MachGroupVMListComparer
|
||||
' Implements IComparer
|
||||
|
||||
' Dim m_Direction As ListSortDirection
|
||||
' Dim m_Column As EgtDataGridColumn
|
||||
' Dim m_ColumnList As List(Of DataGridColumn)
|
||||
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
|
||||
' Sub New()
|
||||
' m_Column = column
|
||||
' m_ColumnList = ColumnList
|
||||
' m_EgtColumnList = EgtColumnList
|
||||
' m_Direction = direction
|
||||
|
||||
|
||||
' Dim column As DataGridColumn = e.Column
|
||||
' Dim datagrid As DataGrid = sender
|
||||
' Dim comparer As IComparer = Nothing
|
||||
' e.Handled = True
|
||||
' Dim direction As ListSortDirection = If((column.SortDirection <> ListSortDirection.Ascending), ListSortDirection.Ascending, ListSortDirection.Descending)
|
||||
' column.SortDirection = direction
|
||||
' Dim m_ColumnList As New List(Of DataGridColumn)
|
||||
' Dim m_EgtColumnList As New List(Of EgtDataGridColumn)
|
||||
' For Each col In datagrid.Columns
|
||||
' If Not IsNothing(col.SortDirection) Then
|
||||
' m_ColumnList.Add(col)
|
||||
' m_EgtColumnList.Add(Map.refRawPartListVM.RawPartColumns(col.DisplayIndex))
|
||||
' End If
|
||||
' Next
|
||||
' Dim lcv As ListCollectionView = CType(CollectionViewSource.GetDefaultView(datagrid.ItemsSource), ListCollectionView)
|
||||
' comparer = New MyComparer(Map.refRawPartListVM.RawPartColumns(column.DisplayIndex), m_ColumnList, m_EgtColumnList, direction)
|
||||
' lcv.CustomSort = comparer
|
||||
|
||||
|
||||
|
||||
' End Sub
|
||||
|
||||
' Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
|
||||
' Dim First As MyMachGroupVM = DirectCast(x, MyMachGroupVM)
|
||||
' Dim Second As MyMachGroupVM = DirectCast(y, MyMachGroupVM)
|
||||
' Dim bFirstProduced As Boolean = First.nProduction_State = Core.ItemState.WIP OrElse First.nProduction_State = Core.ItemState.Produced
|
||||
' Dim bSecondProduced As Boolean = Second.nProduction_State = Core.ItemState.WIP OrElse Second.nProduction_State = Core.ItemState.Produced
|
||||
' Dim nDirection As Integer = If(m_Direction, 1, -1)
|
||||
' If bFirstProduced AndAlso bSecondProduced Then
|
||||
' If First.nProductionIndex > Second.nProductionIndex Then
|
||||
' Return 1
|
||||
' ElseIf First.nProductionIndex < Second.nProductionIndex Then
|
||||
' Return -1
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' ElseIf bFirstProduced Then
|
||||
' Return -1
|
||||
' ElseIf bSecondProduced Then
|
||||
' Return 1
|
||||
' Else
|
||||
' Dim ColumnIndex = 0
|
||||
' While ColumnIndex <= m_EgtColumnList.Count - 1
|
||||
' Dim nDir As ListSortDirection = If(m_ColumnList(ColumnIndex).SortDirection, 1, -1)
|
||||
' Dim nCheck As Integer = Check(First, Second, nDir, m_EgtColumnList(ColumnIndex))
|
||||
' If nCheck <> 0 Then
|
||||
' Return nCheck
|
||||
' End If
|
||||
' ColumnIndex += 1
|
||||
' End While
|
||||
' Return 0
|
||||
' End If
|
||||
' End Function
|
||||
|
||||
' Private Function Check(First As MyMachGroupVM, Second As MyMachGroupVM, nDirection As Integer, Column As EgtDataGridColumn) As Integer
|
||||
' Select Case Column.Name
|
||||
' Case COL_NAME
|
||||
' If First.nName > Second.nName Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.nName < Second.nName Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_STARTCUT
|
||||
' If First.Id > Second.Id Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.Id < Second.Id Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_W
|
||||
' If First.dW > Second.dW Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dW < Second.dW Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_H
|
||||
' If First.dH > Second.dH Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dH < Second.dH Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_L
|
||||
' If First.dL > Second.dL Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dL < Second.dL Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_POSZ
|
||||
' 'If First.posz > Second.dL Then
|
||||
' ' Return 1 * nDirection
|
||||
' 'ElseIf First.dL < Second.dL Then
|
||||
' ' Return -1 * nDirection
|
||||
' 'Else
|
||||
' ' Return 0
|
||||
' 'End If
|
||||
' Case COL_MATERIAL
|
||||
' If First.sMATERIAL > Second.sMATERIAL Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.sMATERIAL < Second.sMATERIAL Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_USAGE
|
||||
' If First.dUsage > Second.dUsage Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dUsage < Second.dUsage Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' Case COL_WASTE
|
||||
' If First.dWaste > Second.dWaste Then
|
||||
' Return 1 * nDirection
|
||||
' ElseIf First.dWaste < Second.dWaste Then
|
||||
' Return -1 * nDirection
|
||||
' Else
|
||||
' Return 0
|
||||
' End If
|
||||
' End Select
|
||||
' End Function
|
||||
|
||||
'End Class
|
||||
|
||||
@@ -588,6 +588,8 @@ Public Class MachManaging
|
||||
' scrivo evento inizio MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(dtStart, nP_Prod, nP_Machgroup, nP_State, DbControllers.SupervisorId))
|
||||
End If
|
||||
' flag di aggiornamento log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
ElseIf nP_State = PartState.END_ Then
|
||||
@@ -697,6 +699,8 @@ Public Class MachManaging
|
||||
Map.refLeftPanelVM.PrintLabel(MachGroup, Part)
|
||||
End If
|
||||
End If
|
||||
' flag di aggiornamento log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
End If
|
||||
|
||||
@@ -25,16 +25,37 @@
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Height="30">
|
||||
<TextBlock Text="{Binding Entity_Msg}"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding EntityTypeList}"
|
||||
SelectedIndex="{Binding SelEntityType}"
|
||||
Width="70"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<TextBlock Text="{Binding Event_Msg}"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding PartEventTypeList}"
|
||||
SelectedIndex="{Binding SelPartEventType}"
|
||||
Width="70"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<TextBlock Text="{Binding Date_Msg}"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding DayTypeList}"
|
||||
SelectedIndex="{Binding SelDayType}"
|
||||
Width="70"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
|
||||
<TextBlock Text="{Binding From_Msg}"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtStartDate}"
|
||||
Style="{StaticResource Log_DatePicker}"/>
|
||||
<TextBlock Text="{Binding To_Msg}"
|
||||
Style="{StaticResource Log_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtEndDate}"
|
||||
Style="{StaticResource Log_DatePicker}"/>
|
||||
</StackPanel>
|
||||
<!--<TextBox Text="{Binding MaxRowNumber}"/>-->
|
||||
<Button Grid.Column="1"
|
||||
Command="{Binding Refresh_Command}"
|
||||
|
||||
@@ -9,6 +9,16 @@ Imports EgtBEAMWALL.Core.MachLog
|
||||
Public Class MachineLogPageVM
|
||||
Inherits VMBase
|
||||
|
||||
Private m_Lock_LogList As New Object
|
||||
|
||||
Private m_MachineLog_Timer As New DispatcherTimer
|
||||
|
||||
Private Enum DayTypes As Integer
|
||||
TODAY = 0
|
||||
YESTERDAY = 1
|
||||
PERIOD = 2
|
||||
End Enum
|
||||
|
||||
Private m_colMachineLog_Type As EgtDataGridColumn
|
||||
Public ReadOnly Property colMachineLog_Type As EgtDataGridColumn
|
||||
Get
|
||||
@@ -62,7 +72,7 @@ Public Class MachineLogPageVM
|
||||
End Set
|
||||
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)
|
||||
Get
|
||||
Return m_PartEventTypeList
|
||||
@@ -76,11 +86,12 @@ Public Class MachineLogPageVM
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelPartEventType = value
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_PARTEVENTTYPE, m_SelPartEventType.ToString())
|
||||
m_MachineLogList_View.Refresh()
|
||||
End Set
|
||||
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)
|
||||
Get
|
||||
Return m_EntityTypeList
|
||||
@@ -94,10 +105,75 @@ Public Class MachineLogPageVM
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelEntityType = value
|
||||
WriteMainPrivateProfileString(S_MACHINELOGFILTER, K_ENTITYTYPE, m_SelEntityType.ToString())
|
||||
m_MachineLogList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({EgtMsg(62529), EgtMsg(62530), EgtMsg(62531)})
|
||||
Public ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Return m_DayTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelDayType As DayTypes = DayTypes.TODAY
|
||||
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_MACHINELOGFILTER, K_DAYTYPE, Convert.ToInt32(m_SelDayType))
|
||||
m_Date_Visibility = If(m_SelDayType = DayTypes.PERIOD, Visibility.Visible, Visibility.Collapsed)
|
||||
If m_SelDayType = DayTypes.PERIOD Then
|
||||
m_dtStartDate = If(PrevSelDayType = DayTypes.TODAY, DateTime.Today, DateTime.Today - TimeSpan.FromDays(1))
|
||||
m_dtEndDate = If(PrevSelDayType = DayTypes.TODAY, DateTime.Today, DateTime.Today - TimeSpan.FromDays(1))
|
||||
NotifyPropertyChanged(NameOf(dtStartDate))
|
||||
NotifyPropertyChanged(NameOf(dtEndDate))
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Date_Visibility))
|
||||
' aggiorno lista da Db
|
||||
UpdateMachineLogList(True)
|
||||
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
|
||||
UpdateMachineLogList(True)
|
||||
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
|
||||
UpdateMachineLogList(True)
|
||||
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
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdRefresh As ICommand
|
||||
|
||||
@@ -151,6 +227,35 @@ Public Class MachineLogPageVM
|
||||
End Get
|
||||
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
|
||||
|
||||
@@ -167,6 +272,33 @@ Public Class MachineLogPageVM
|
||||
m_colMachineLog_Type = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_TYPE)
|
||||
m_colMachineLog_Description = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_DESCRIPTION)
|
||||
m_colMachineLog_SupervisorId = m_MachineLogColumns.FirstOrDefault(Function(x) x.Name = COL_SUPERVISORID)
|
||||
' imposto valori filtri da ini
|
||||
m_SelPartEventType = GetMainPrivateProfileInt(S_MACHINELOGFILTER, K_PARTEVENTTYPE, 2)
|
||||
m_SelEntityType = GetMainPrivateProfileInt(S_MACHINELOGFILTER, K_ENTITYTYPE, 1)
|
||||
m_SelDayType = GetMainPrivateProfileInt(S_MACHINELOGFILTER, K_DAYTYPE, 0)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.TODAY
|
||||
m_dtStartDate = DateTime.Today
|
||||
m_dtEndDate = DateTime.Today
|
||||
Case DayTypes.YESTERDAY
|
||||
m_dtStartDate = DateTime.Today - TimeSpan.FromDays(1)
|
||||
m_dtEndDate = DateTime.Today - TimeSpan.FromDays(1)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
GetMainPrivateProfileString(S_MACHINELOGFILTER, K_STARTDATE, 0, sStartDate)
|
||||
Long.TryParse(sStartDate, lStartDate)
|
||||
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
|
||||
Dim sEndDate As String = "0"
|
||||
Dim lEndDate As Long = 0
|
||||
GetMainPrivateProfileString(S_MACHINELOGFILTER, K_ENDDATE, 0, sEndDate)
|
||||
Long.TryParse(sEndDate, lEndDate)
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
m_MachineLog_Timer.Interval = TimeSpan.FromMilliseconds(100)
|
||||
AddHandler m_MachineLog_Timer.Tick, AddressOf MachineLog_Timer_Tick
|
||||
m_MachineLog_Timer.Start()
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
@@ -209,13 +341,69 @@ Public Class MachineLogPageVM
|
||||
m_colMachineLog_Description.ColumnVisibility = Visibility.Collapsed
|
||||
m_colMachineLog_SupervisorId.ColumnVisibility = Visibility.Collapsed
|
||||
End If
|
||||
UpdateMachineLogList()
|
||||
UpdateMachineLogList(True)
|
||||
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
|
||||
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
|
||||
End Sub
|
||||
|
||||
Friend Sub UpdateMachineLogList()
|
||||
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())
|
||||
' indice di aggiornamento della lista rispetto a Db
|
||||
Private m_nUpdateIndex As Integer
|
||||
' indice di ricaricamento completo della lista dal Db
|
||||
Private m_nRefreshIndex As Integer
|
||||
' indice dell'ultimo update/refresh
|
||||
Private m_nLastLogUpdate As Integer
|
||||
|
||||
Friend Sub UpdateMachineLogList(bRefresh As Boolean)
|
||||
Dim nMaxIndex As Integer = Math.Max(m_nUpdateIndex, m_nRefreshIndex)
|
||||
If bRefresh Then
|
||||
m_nRefreshIndex = nMaxIndex + 1
|
||||
Else
|
||||
m_nUpdateIndex = nMaxIndex + 1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MachineLog_Timer_Tick(sender As Object, e As EventArgs)
|
||||
SyncLock m_Lock_LogList
|
||||
Dim nRefresh As Integer = m_nRefreshIndex
|
||||
Dim nUpdate As Integer = m_nUpdateIndex
|
||||
If nRefresh > m_nLastLogUpdate Then
|
||||
m_nLastLogUpdate = nRefresh
|
||||
UpdateFromDb(True)
|
||||
ElseIf nUpdate > m_nLastLogUpdate Then
|
||||
m_nLastLogUpdate = nUpdate
|
||||
UpdateFromDb(False)
|
||||
End If
|
||||
End SyncLock
|
||||
End Sub
|
||||
|
||||
Friend Sub UpdateFromDb(bRefresh As Boolean)
|
||||
'm_MachineLogList = New ObservableCollection(Of LogEvent)(DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Now - TimeSpan.FromDays(300), DateTime.Now).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList())
|
||||
Dim DbList As List(Of LogEvent)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.PERIOD
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(m_dtStartDate, m_dtEndDate + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
Case DayTypes.YESTERDAY
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today - TimeSpan.FromDays(1), DateTime.Today).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
Case Else ' DayTypes.TODAY
|
||||
DbList = DbControllers.m_LogMachineController.GetCoreDesc(DateTime.Today, DateTime.Today + TimeSpan.FromDays(1)).Select(Of LogEvent)(Function(x) New LogEvent(x)).ToList()
|
||||
End Select
|
||||
If bRefresh OrElse m_MachineLogList.Count < 1 Then
|
||||
m_MachineLogList = New ObservableCollection(Of LogEvent)(DbList)
|
||||
Else
|
||||
' cerco in lista Db ultimo elemento della mia lista
|
||||
Dim LastItem As LogEvent = m_MachineLogList(0)
|
||||
Dim CommonItem As LogEvent = DbList.FirstOrDefault(Function(x) x.EventDateTime = LastItem.EventDateTime AndAlso x.EventType = LastItem.EventType AndAlso x.SupervisorId = LastItem.SupervisorId AndAlso x.Value = LastItem.Value)
|
||||
Dim nCommonItemIndex As Integer
|
||||
If Not IsNothing(CommonItem) Then
|
||||
nCommonItemIndex = DbList.IndexOf(CommonItem)
|
||||
End If
|
||||
' aggiorno i successivi
|
||||
If nCommonItemIndex >= 0 Then
|
||||
For Index = nCommonItemIndex - 1 To 0 Step -1
|
||||
m_MachineLogList.Insert(0, DbList(Index))
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(MachineLogList))
|
||||
m_MachineLogList_View = CollectionViewSource.GetDefaultView(m_MachineLogList)
|
||||
m_MachineLogList_View.Filter = AddressOf MachineLogFilter
|
||||
@@ -243,7 +431,7 @@ Public Class MachineLogPageVM
|
||||
''' Execute the Open. This method is invoked by the OpenCommand.
|
||||
''' </summary>
|
||||
Friend Sub Refresh()
|
||||
UpdateMachineLogList()
|
||||
UpdateMachineLogList(False)
|
||||
End Sub
|
||||
|
||||
#End Region ' Refresh
|
||||
|
||||
@@ -248,8 +248,8 @@ Public Class MainWindowM
|
||||
EgtSetLockId( sLockId)
|
||||
End If
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2505, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2505, 1, m_nKeyOptions)
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2512, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2512, 1, m_nKeyOptions)
|
||||
' Inizializzazione generale di EgtInterface
|
||||
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
m_sLogFile = m_sTempDir & "\" & SUPGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
|
||||
@@ -70,5 +70,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.5.5.4")>
|
||||
<Assembly: AssemblyFileVersion("2.5.5.4")>
|
||||
<Assembly: AssemblyVersion("2.5.12.2")>
|
||||
<Assembly: AssemblyFileVersion("2.5.12.2")>
|
||||
|
||||
@@ -11,20 +11,14 @@ Public Class OpenProjectFileDialogVM
|
||||
|
||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
m_ProjectType = ProjectType
|
||||
m_GoToProd = GoToProd
|
||||
' carico colonne
|
||||
LoadColumns(ProjectType)
|
||||
NotifyPropertyChanged(NameOf(SearchColumnList))
|
||||
m_SelSearchColumn = m_SearchColumnList(0)
|
||||
LoadColumns(m_ProjectType)
|
||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
' carico lista progetti
|
||||
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
||||
' leggo da db
|
||||
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
|
||||
RefreshProjectList()
|
||||
Else
|
||||
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
||||
NotifyPropertyChanged(NameOf(ProjectList))
|
||||
@@ -33,6 +27,45 @@ Public Class OpenProjectFileDialogVM
|
||||
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
||||
End Function
|
||||
|
||||
Public Overrides Sub RefreshProjectList()
|
||||
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(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
dtStart = dtEnd - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
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 Class
|
||||
|
||||
@@ -77,24 +77,25 @@ Public Class SupervisorManagerVM
|
||||
'Private m_cmdSave As ICommand
|
||||
Private m_cmdGoToProd As ICommand
|
||||
|
||||
#Region "ToolTip"
|
||||
#Region "ToolTip"
|
||||
|
||||
'Proprietà ToolTip
|
||||
Public ReadOnly Property OpenToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property GoToProd_ToolTip As String
|
||||
Get
|
||||
Return EgtMsg(61835)
|
||||
End Get
|
||||
End Property
|
||||
'Proprietà ToolTip
|
||||
Public ReadOnly Property OpenToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property GoToProd_ToolTip As String
|
||||
Get
|
||||
Return EgtMsg(61835)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' ToolTip
|
||||
|
||||
|
||||
|
||||
#End Region ' ToolTip
|
||||
#End Region ' Fields & Properties
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
@@ -297,6 +298,11 @@ Public Class SupervisorManagerVM
|
||||
End If
|
||||
Map.refProjectVM.SupervisorMachGroupPanelVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList))
|
||||
m_bLoadingProd = False
|
||||
|
||||
MyComparer.RefreshColumns()
|
||||
Map.refSupervisorMachGroupPanelVM.SetMachGroupVMListView()
|
||||
Map.refSupervisorMachGroupPanelVM.RefreshMachGroupVMSort()
|
||||
|
||||
NotifyPropertyChanged(NameOf(MruFileNames))
|
||||
LoadingWndHelper.CloseLoadingWnd(ActiveIds.OPENPROD)
|
||||
End Sub
|
||||
|
||||
@@ -342,6 +342,16 @@
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="10,0,10,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Log_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="5,0,5,0"/>
|
||||
</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>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
@@ -720,4 +730,22 @@
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
|
||||
<!-- DatePicker -->
|
||||
|
||||
<Style x:Key="Log_DatePicker" TargetType="{x:Type DatePicker}">
|
||||
<Setter Property="Height" Value="22" />
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- DatePicker -->
|
||||
|
||||
<Style x:Key="Filter_DatePicker" TargetType="{x:Type DatePicker}">
|
||||
<Setter Property="Height" Value="22" />
|
||||
<Setter Property="Width" Value="100" />
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user