Optimizer 2.7.11.17

-sistemato errore selezione macchina
This commit is contained in:
Demetrio Cassarino
2025-12-12 09:10:44 +01:00
parent 4c97b3a6f6
commit ff849a7708
15 changed files with 218 additions and 310 deletions
@@ -214,7 +214,6 @@ Public Class MyMachGroupPanelM
Dim DuploArray() As Integer
Dim RotArray(DuploList.Count) As Integer
Dim FlipArray(DuploList.Count) As Integer
Dim QArray(DuploList.Count) As Dictionary(Of String, Dictionary(Of String, String))
DuploArray = DuploList.ToArray()
' recupero ROT (gradi) e FLIP (0/1) per non perderli
For Duploindex = 0 To DuploArray.Length - 1
@@ -224,8 +223,6 @@ Public Class MyMachGroupPanelM
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
If FlipArray(Duploindex) <> 0 Then FlipArray(Duploindex) = 180
If nBWType = BWType.WALL Then
' salvo parametri Q
QArray(Duploindex) = New Dictionary(Of String, Dictionary(Of String, String))
' ciclo sugli outline
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
@@ -248,42 +245,10 @@ Public Class MyMachGroupPanelM
nPRId = nGlobPRId
nGlobPRId += 1
End If
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nOutlineId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
Next
' aggiornamento dei Duplo
@@ -293,50 +258,6 @@ Public Class MyMachGroupPanelM
' ripristino info rot e flip
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
If nBWType = BWType.WALL Then
' ciclo sugli outline
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QArray(Duploindex).ContainsKey(sKey) Then
For Each QPar In QArray(Duploindex)(sKey)
EgtSetInfo(nOutlineId, QPar.Key, QPar.Value)
Next
End If
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QArray(Duploindex).ContainsKey(sKey) Then
For Each QPar In QArray(Duploindex)(sKey)
EgtSetInfo(nFeatureId, QPar.Key, QPar.Value)
Next
End If
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
Next
End Sub
@@ -90,7 +90,7 @@ Public Class BTLPartVM
Else
Dim MachGroupModel = Nothing
If Not IsNothing(Map.refProdManagerVM) Then
MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(ProjectManagerVM.CurrProj.nProdId, nMachgroupId)
MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(ProjectManagerVM.CurrProd.nProdId, nMachgroupId)
End If
If Not IsNothing(MachGroupModel) AndAlso MachGroupModel.State > ItemState.ND Then
bDuploInProduction = True
@@ -242,7 +242,7 @@ Public Class BTLPartVM
Public Property sW As String
Get
Dim nOrigGroupId As Integer = nPartId
If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso EgtBeamGetBuildingIsOn() AndAlso Map.refShowBeamPanelVM.bShowAll Then
If EgtBeamGetBuildingIsOn() AndAlso Map.refShowBeamPanelVM.bShowAll Then
nOrigGroupId = GetOrigFrameGroup(nPartId)
End If
Dim frBeam As New Frame3d
@@ -2775,18 +2775,6 @@ Public Class BTLPartVM
Next
End If
End Sub
Private Sub OnBTLQParamVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
For Each BTLParamVM As BTLParamVM In e.NewItems
AddHandler BTLParamVM.PropertyChanged, AddressOf OnBTLQParamVMPropertyChanged
Next
End If
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
For Each BTLParamVM As BTLParamVM In e.OldItems
RemoveHandler BTLParamVM.PropertyChanged, AddressOf OnBTLQParamVMPropertyChanged
Next
End If
End Sub
Private Sub OnBTLFeatureVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
@@ -2807,12 +2795,6 @@ Public Class BTLPartVM
CalcGlobalUpdate(True)
End Select
End Sub
Private Sub OnBTLQParamVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
Case NameOf(sender.dValue), NameOf(sender.sValue)
CalcGlobalUpdate(True)
End Select
End Sub
#End Region ' EVENTS
@@ -513,9 +513,8 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel Grid.Row="1"
Grid.ColumnSpan="2"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
<StackPanel Grid.Row="1"
Grid.Column="1"
Style="{StaticResource BTLPartList_StackPanel}">
<TextBlock Text="STATUS:"
Style="{StaticResource Status_TextBlock}"/>
@@ -32,17 +32,6 @@ Public Class LeftPanelVM
End Get
End Property
Private m_OnlyProdPartManagerVisibility As Visibility = Visibility.Collapsed
Public ReadOnly Property OnlyProdPartManagerVisibility As Visibility
Get
Return m_OnlyProdPartManagerVisibility
End Get
End Property
Friend Sub SetOnlyProdPartManager_Visibility(value As Visibility)
m_OnlyProdPartManagerVisibility = value
NotifyPropertyChanged(NameOf(OnlyProdPartManagerVisibility))
End Sub
Private m_IsFilterBtnOpen As Boolean = False
Public Property IsFilterBtnOpen As Boolean
Get
@@ -768,7 +768,6 @@ Public Class MyMachGroupVM
EgtGetInfo(nBtlInfoId, BTL_GEN_PROJTYPE, nBWType)
Dim DuploRot As Integer = 0
Dim DuploFlip As Integer = 0
Dim QParams As New Dictionary(Of String, Dictionary(Of String, String))
' se da aggiornare, leggo info del duplo che verrebbero perse
If bDuploToUpdate Then
' recupero ROT (gradi) e FLIP (gradi) per non perderli
@@ -792,42 +791,10 @@ Public Class MyMachGroupVM
bTotIsModified = True
nGlobPRId += 1
End If
Dim sKey As String = nPRId & "." & nPRC
QParams.Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nOutlineId, QKey, QValue) Then
QParams(sKey).Add(QKey, QValue)
End If
Next
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(Part.nPartId, PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
Dim nPRId As Integer = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
QParams.Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QParams(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
End If
' disabilito impostazione modificato
@@ -841,50 +808,6 @@ Public Class MyMachGroupVM
' ripristino i valori di ROT e FLIP
EgtSetInfo(Part.nPartId, MGR_PRT_ROT, DuploRot)
EgtSetInfo(Part.nPartId, MGR_PRT_FLIP, DuploFlip)
If nBWType = BWType.WALL Then
' ciclo sugli outline
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(Part.nPartId, OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
Dim nPRId As Integer = 0
EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QParams.ContainsKey(sKey) Then
For Each QPar In QParams(sKey)
EgtSetInfo(nOutlineId, QPar.Key, QPar.Value)
Next
End If
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(Part.nPartId, PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
Dim nPRId As Integer = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QParams.ContainsKey(sKey) Then
For Each QPar In QParams(sKey)
EgtSetInfo(nFeatureId, QPar.Key, QPar.Value)
Next
End If
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
End If
Part.nProduction_State = ItemState.ND
Part.NotifyPropertyChanged(NameOf(Part.Background))
@@ -1,5 +1,4 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.DataLayer.DatabaseModels
@@ -527,7 +526,6 @@ Public Class PartVM
EgtGetInfo(nBtlInfoId, BTL_GEN_PROJTYPE, nBWType)
Dim DuploRot As Integer = 0
Dim DuploFlip As Integer = 0
Dim QParams As New Dictionary(Of String, Dictionary(Of String, String))
' se da aggiornare, leggo info del duplo che verrebbero perse
If bDuploToUpdate Then
' recupero ROT (gradi) e FLIP (gradi) per non perderli
@@ -550,42 +548,10 @@ Public Class PartVM
nPRId = nGlobPRId
nGlobPRId += 1
End If
Dim sKey As String = nPRId & "." & nPRC
QParams.Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nOutlineId, QKey, QValue) Then
QParams(sKey).Add(QKey, QValue)
End If
Next
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
Dim nPRId As Integer = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
QParams.Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QParams(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
End If
' disabilito impostazione modificato
@@ -599,50 +565,6 @@ Public Class PartVM
' ripristino i valori di ROT e FLIP
EgtSetInfo(nPartId, MGR_PRT_ROT, DuploRot)
EgtSetInfo(nPartId, MGR_PRT_FLIP, DuploFlip)
If nBWType = BWType.WALL Then
' ciclo sugli outline
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
Dim nPRId As Integer = 0
EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QParams.ContainsKey(sKey) Then
For Each QPar In QParams(sKey)
EgtSetInfo(nOutlineId, QPar.Key, QPar.Value)
Next
End If
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
Dim nPRId As Integer = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
' ripristino parametri Q
If QParams.ContainsKey(sKey) Then
For Each QPar In QParams(sKey)
EgtSetInfo(nFeatureId, QPar.Key, QPar.Value)
Next
End If
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
End If
nProduction_State = ItemState.ND
NotifyPropertyChanged(NameOf(Background))
@@ -872,27 +794,6 @@ Public Class PartVM
End Select
End Sub
Private Sub OnBTLQParamVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
For Each BTLParamVM As BTLParamVM In e.NewItems
AddHandler BTLParamVM.PropertyChanged, AddressOf OnBTLQParamVMPropertyChanged
Next
End If
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
For Each BTLParamVM As BTLParamVM In e.OldItems
RemoveHandler BTLParamVM.PropertyChanged, AddressOf OnBTLQParamVMPropertyChanged
Next
End If
End Sub
Private Sub OnBTLQParamVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
Case NameOf(sender.dValue), NameOf(sender.sValue)
' setto pezzo da ricalcolare
ResetCalcTotalPart()
End Select
End Sub
#End Region ' EVENTS
End Class
@@ -99,7 +99,7 @@ Public Class MainWindowVM
AddHandler m_Supervisor_Timer.Tick, AddressOf SupervisorTimer_Tick
m_Supervisor_Timer.Start()
' imposto e avvio contatore SplashScreen
m_SplashScreen_Timer.Interval = New TimeSpan(0, 0, 0, 0, 100)
m_SplashScreen_Timer.Interval = New TimeSpan(0, 0, 0, 0, 50)
AddHandler m_SplashScreen_Timer.Tick, AddressOf SplashScreenTimer_Tick
If Not IsNothing(MapV.refSplashScreenV) Then
m_SplashScreen_Timer.Start()
@@ -140,6 +140,11 @@ Public Class MainWindowVM
DbControllers.Init()
' chiamata a caso su Db per inizializzarlo
DbControllers.m_ProjController.FindByProjDbId(0)
'Dim dbInitTask = Task.Run(Sub()
' DbControllers.Init()
' DbControllers.m_ProjController.FindByProjDbId(0)
' End Sub)
'Await dbInitTask
' Verifico che l'inizializzazione di tutte le parti del programma sia andata a buon fine
If Map.EndInit() Then
m_bInitStatus = True
@@ -179,9 +184,12 @@ Public Class MainWindowVM
If Not IsNothing(ProdFileM) Then
Dim ProdFileVM = New ProdFileVM(ProdFileM)
Map.refProdManagerVM.OpenProject(ProdFileVM)
'Await Map.refProdManagerVM.OpenProjectAsync(ProdFileVM)
End If
End If
End If
' segno su contatore splashscreen render finito
m_WaitAfterRender = 1
' inizializzo thread di aggiornamento e comunicazione con DB
' creo thread gestione macchina
@@ -191,6 +199,7 @@ Public Class MainWindowVM
m_SupervisorCommThread.SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_SupervisorCommThread.Start()
'Await Task.Run(Sub() SupervisorCommThread.SupervisorCommThreadFunction())
' verifico se richiedere di fare backup
If Map.refConfigurationPageVM.SelReminder.Id <> 0 Then
@@ -243,10 +252,36 @@ Public Class MainWindowVM
End If
End If
End If
' segno su contatore splashscreen render finito
m_WaitAfterRender = 1
'' controllo backup in background
'Await Task.Run(Sub()
' If Map.refConfigurationPageVM.SelReminder.Id <> 0 Then
' Dim sBackupFolder As String = Path.Combine(Map.refMainWindowVM.MainWindowM.sDataDir, "Backup")
' Dim LastBackupDate As Date = GetLastBackupDateFast(sBackupFolder)
' If LastBackupDate <> Date.MinValue Then
' Dim TimeFromLastBackup As TimeSpan = DateTime.Now - LastBackupDate
' If TimeFromLastBackup > TimeSpan.FromDays(Map.refConfigurationPageVM.SelReminder.Id) Then
' Application.Current.Dispatcher.Invoke(Sub()
' If MessageBox.Show(Application.Current.MainWindow, String.Format(EgtMsg(61987), Map.refConfigurationPageVM.SelReminder.Name), EgtMsg(15002), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.Yes Then
' Map.refConfigurationPageVM.Backup(True)
' End If
' End Sub)
' End If
' End If
' End If
' End Sub)
End Sub
Private Function GetLastBackupDateFast(sBackupFolder As String) As Date
If Not Directory.Exists(sBackupFolder) Then Return Date.MinValue
Dim dirs = Directory.GetDirectories(sBackupFolder, "*", SearchOption.AllDirectories)
Dim dates = From d In dirs
Let yearStr = Path.GetFileName(Path.GetDirectoryName(Path.GetDirectoryName(d)))
Let monthStr = Path.GetFileName(Path.GetDirectoryName(d))
Let dayStr = Path.GetFileName(d)
Select New Date(Integer.Parse(yearStr), Integer.Parse(monthStr), Integer.Parse(dayStr))
Return If(dates.Any(), dates.Max(), Date.MinValue)
End Function
Private Sub SplashScreenTimer_Tick()
If m_WaitAfterRender > 1 Then
m_Window_Opacity = 1
@@ -67,5 +67,5 @@ Imports System.Windows
' Revision
'
<Assembly: AssemblyVersion("2.7.11.16")>
<Assembly: AssemblyFileVersion("2.7.11.16")>
<Assembly: AssemblyVersion("2.7.11.17")>
<Assembly: AssemblyFileVersion("2.7.11.17")>
@@ -75,9 +75,7 @@
Style="{StaticResource Project_Border}">
<TextBlock Grid.ColumnSpan="2"
Text="{Binding BTLStructureVM.SelBTLPart.sNAM}"
VerticalAlignment="Center"
Foreground="{StaticResource BeamWall_White}"
Style="{StaticResource Macro_TextBlock}"/>
Style="{StaticResource RightPanel_TextBlock}"/>
</Border>
<Button Grid.Column="2"
@@ -24,7 +24,7 @@
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sW,
RelativeSource={RelativeSource AncestorType={x:Type OPTIMIZER:PartManagerV}},
UpdateSourceTrigger=Explicit}"
Style="{StaticResource Dimension_TextBox}"/>
Style="{StaticResource EgtPartManager_TextBox}"/>
</StackPanel>
<StackPanel Grid.Column="1"
Style="{StaticResource PartManagers_StackPanel}">
@@ -33,7 +33,7 @@
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sH,
RelativeSource={RelativeSource AncestorType={x:Type OPTIMIZER:PartManagerV}},
UpdateSourceTrigger=Explicit}"
Style="{StaticResource Dimension_TextBox}"/>
Style="{StaticResource EgtPartManager_TextBox}"/>
</StackPanel>
<StackPanel Grid.Column="2"
Style="{StaticResource PartManagerL_StackPanel}">
@@ -42,7 +42,7 @@
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sL,
RelativeSource={RelativeSource AncestorType={x:Type OPTIMIZER:PartManagerV}},
UpdateSourceTrigger=Explicit}"
Style="{StaticResource Dimension_TextBox}"/>
Style="{StaticResource EgtPartManager_TextBox}"/>
</StackPanel>
<StackPanel Grid.Row="1"
Style="{StaticResource PartManagers_StackPanel}">
@@ -62,6 +62,7 @@
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sADDED,
RelativeSource={RelativeSource AncestorType={x:Type OPTIMIZER:PartManagerV}},
UpdateSourceTrigger=Explicit}"
ExplicitUpdateSource="EnterKeyPress"
Style="{StaticResource Qty_TextBox}"/>
</StackPanel>
</Grid>
@@ -1,3 +1,2 @@
Public Class PartManagerV
End Class
@@ -1201,6 +1201,153 @@ Public Class ProdManagerVM
Return True
End Function
Friend Async Function OpenProjectAsync(TempCurrPd As ProdFileVM) As Task(Of Boolean)
m_TempCurrProd = TempCurrPd
Dim sFilePath As String = ""
' Se la stringa è vuota → apro dialogo
If IsNothing(TempCurrProd) Then
If GetMainPrivateProfileInt(S_GENERAL, K_PROJECTMODE, 0) = 1 Then
Dim OpenProdFileDialogVM As NewOpenProjectFileDialogVM = Nothing
OpenProdFileDialogVM = New NewOpenProjectFileDialogVM
Dim OpenFile As New NewOpenProjectFileDialogV(Application.Current.MainWindow, OpenProdFileDialogVM)
Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROD)
If IsNothing(DialogResult) OrElse Not DialogResult Then Return True
sFilePath = OpenProdFileDialogVM.SelProject.ProdFileVM.sProdPath
m_TempCurrProd = OpenProdFileDialogVM.SelProject.ProdFileVM
Else
Dim OpenProjectFileDialogVM As OpenProjectFileDialogVM = Nothing
OpenProjectFileDialogVM = New OpenProjectFileDialogVM
Dim OpenFile As New OpenProjectFileDialogV(Application.Current.MainWindow, OpenProjectFileDialogVM)
Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROD)
If IsNothing(DialogResult) OrElse Not DialogResult Then Return True
sFilePath = OpenProjectFileDialogVM.SelProject.sProdPath
m_TempCurrProd = OpenProjectFileDialogVM.SelProject
End If
Else
sFilePath = If(Not IsNothing(m_TempCurrProd.sProdPath), m_TempCurrProd.sProdPath, "")
End If
' Apertura finestra di loading
LoadingWndHelper.OpenLoadingWnd(ActiveIds.OPENPROD, 3, EgtMsg(63004), EgtMsg(63001), 50)
' Controllo esistenza file
If Not File.Exists(sFilePath) Then
MessageBox.Show(EgtMsg(61871))
EgtOutLog("Errore! File da aprire non trovato!")
Return False
End If
' Verifico macchina associata
Dim OpenProjectMachine As MyMachine = Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = m_TempCurrProd.sMachine)
If IsNothing(OpenProjectMachine) Then
m_MruFiles.Remove(sFilePath)
MessageBox.Show(EgtMsg(61885), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error)
EgtOutLog("Errore! Macchina del progetto da aprire non trovata!")
Return False
End If
' Apertura file → Dispatcher.Invoke per garantire STA
Dim fileOpened As Boolean = Await Application.Current.Dispatcher.InvokeAsync(Function()
Return EgtOpenFile(sFilePath)
End Function)
If Not fileOpened Then
m_MruFiles.Remove(sFilePath)
If Not IsNothing(ProjectManagerVM.CurrProd) AndAlso sFilePath <> ProjectManagerVM.CurrProd.sProdPath Then
Await OpenProjectAsync(ProjectManagerVM.CurrProd)
Else
NewProject()
End If
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10003) & " '" & sFilePath & "'", EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error)
EgtOutLog("Errore! Caricamento del progetto fallito!")
Return False
End If
' Imposto macchina corrente
InitCurrentMachine(OpenProjectMachine)
SectionXMaterial.SetType(TempCurrPd.nType)
' Caricamento BTL e gruppi di lavorazione in parallelo
Dim btlTask = Task.Run(Function() New BTLStructureVM(BTLStructureM.CreateBTLStructure(0)))
Dim machGroupTask = Task.Run(Function() New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList())))
Await Task.WhenAll(btlTask, machGroupTask)
Map.refProjectVM.BTLStructureVM = btlTask.Result
CopyBuilding()
Map.refProjectVM.MachGroupPanelVM = machGroupTask.Result
If IsNothing(Map.refProjectVM.BTLStructureVM) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM) Then
m_MruFiles.Remove(sFilePath)
If Not IsNothing(ProjectManagerVM.CurrProd) AndAlso sFilePath <> ProjectManagerVM.CurrProd.sProdPath Then
Await OpenProjectAsync(ProjectManagerVM.CurrProd)
Else
NewProject()
End If
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10003) & " '" & sFilePath & "'", EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error)
EgtOutLog("Errore! Caricamento fallito!")
Return False
End If
' Imposto progetto corrente
Dim OldProd As ProdFileVM = ProjectManagerVM.CurrProd
ProjectManagerVM.CurrProd = TempCurrPd
DbControllers.m_ProdController.LockByProdId(ProjectManagerVM.CurrProd.nProdId, True, Map.refMainWindowVM.MainWindowM.GetKeyNumber())
' Recupero indice sessione
Dim CommIndex As Integer = -1
Dim ActiveSessionList As List(Of StatusMapModel) = Await Task.Run(Function() DbControllers.m_StatusMapController.GetProd(m_SupervisorId))
For Each ActiveSession In ActiveSessionList
If Not IsNothing(ProjectManagerVM.CurrProd) AndAlso ActiveSession.ItemId = ProjectManagerVM.CurrProd.nProdId Then
CommIndex = ActiveSession.Index
End If
Next
' Calcolo volumi in parallelo
Await Task.Run(Sub()
Parallel.ForEach(Map.refProjectVM.BTLStructureVM.BTLPartVMList,
Sub(BTLPart)
If BTLPart.BTLPartM.dVolume <= 0 Then
BTLPart.CalcBTLPartVolume()
End If
End Sub)
End Sub)
' Aggiornamenti UI
Application.Current.Dispatcher.Invoke(Sub()
Map.refMachinePanelVM.SelectedMachine = OpenProjectMachine
Map.refMachinePanelVM.SetSelMachineName(OpenProjectMachine.Name)
Map.refMachinePanelVM.SetStrategyManagerIsChecked(True)
Core.ViewPanelVM.UpdateBWType(ProjectManagerVM.CurrProd.nType)
Map.refRawPartListVM.UpdateColumns(ProjectManagerVM.CurrProd.nType)
Map.refFeatureInPartInRawPartListVM.UpdateColumns(ProjectManagerVM.CurrProd.nType)
Map.refProjectVM.SetOptimizePanel_Visibility(True)
Map.refMainWindowVM.UpdateTitle()
Map.refMyStatusBarVM.RefreshMachName()
' seleziono primo pezzo
If Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count > 0 Then
Map.refProjectVM.BTLStructureVM.SetSelBTLPart(Map.refProjectVM.BTLStructureVM.BTLPartVMList(0))
End If
End Sub)
' Aggiorno MRU
If Not Map.refProdManagerVM.TempCurrProd.bIsNew Then
m_MruFiles.Add(sFilePath)
End If
NotifyPropertyChanged(NameOf(MruFileNames))
' Aggiorno lista bottoni BTL
Map.refSceneBuildingVM.ButtonBuildingList.Clear()
For Each ItemProd As Integer In ProjectManagerVM.CurrProd.nProjIdList
Dim TempProj As ProjFileM = DbControllers.m_ProjController.FindByProjIdConv(ItemProd)
Map.refSceneBuildingVM.ButtonBuildingList.Add(New ButtonBuildingItem(ItemProd, m_nListProjAsseBase(ItemProd), TempProj.sBTLFileName))
Next
' Chiudo loading
LoadingWndHelper.CloseLoadingWnd(ActiveIds.OPENPROD)
Return True
End Function
Public Function Save(Optional bShowLoading As Boolean = False) As Boolean
If IsNothing(CurrProd) Then Return False
If bShowLoading Then LoadingWndHelper.OpenLoadingWnd(ActiveIds.SAVEPROD, 2, EgtMsg(63007), EgtMsg(63012), 70) ' Project saving ' Saving geometry
@@ -1233,7 +1380,7 @@ Public Class ProdManagerVM
DbControllers.m_ProjController.UpdateMachine(ProjId, Map.refCALCPanelVM.SelectedMachine.Name)
' se uno dei Proj interessati equivale al Proj correntemente aperto setto la Macchina dello stesso
' (poichè il progetto corrente non viene riaperto e riletto dal DB)
If ProjId = CurrProj.nProjId Then CurrProj.SetMachine(Map.refCALCPanelVM.SelectedMachine.Name)
If ProjId = CurrProd.nProdId Then CurrProd.SetMachine(Map.refCALCPanelVM.SelectedMachine.Name)
Next
Map.refCALCPanelVM.ResetMachineModified()
' aggiorno nome macchina in statusbar
+5 -8
View File
@@ -16,17 +16,16 @@
<RowDefinition Height="{Binding GridDims[2].GridLen, Mode=TwoWay}"/>
</Grid.RowDefinitions>
<OPTIMIZER:TopPanelV Grid.ColumnSpan="3" DataContext="{StaticResource ProjectVM}"/>
<OPTIMIZER:TopPanelV Grid.ColumnSpan="3"/>
<OPTIMIZER:LeftPanelTopV Grid.Row="1" DataContext="{StaticResource ProjectVM}"/>
<OPTIMIZER:LeftPanelTopV Grid.Row="1"/>
<GridSplitter Grid.Column="1"
Grid.RowSpan="4"
Style="{StaticResource Width_GridSplitter}"/>
<OPTIMIZER:RightPanelTopV Grid.Row="1"
Grid.Column="2"
DataContext="{StaticResource ProjectVM}"/>
Grid.Column="2"/>
<OPTIMIZER:SceneBuildingV Grid.Row="1"
Grid.Column="2"
@@ -40,11 +39,9 @@
Style="{StaticResource HeightBottom_GridSplitter}"/>
<OPTIMIZER:RightPanelBottomV Grid.Row="3"
Grid.Column="2"
DataContext="{StaticResource ProjectVM}"/>
Grid.Column="2"/>
<OPTIMIZER:LeftPanelBottomV Grid.Row="3"
DataContext="{StaticResource ProjectVM}"/>
<OPTIMIZER:LeftPanelBottomV Grid.Row="3"/>
</Grid>
@@ -653,6 +653,7 @@ Public Class ProjectVM
Next
End If
Map.refProdManagerVM.Save()
Map.refProdManagerVM.CopyBuilding()
End Sub
#End Region ' Ok_Command
@@ -89,6 +89,13 @@
<Setter Property="Margin" Value="2,3,0,2"/>
</Style>
<Style x:Key="RightPanel_TextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource ForegroundWhite_TextBlock}">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<!--#endregion ForegroundWhite-->
<!--#region PartManager-->
@@ -389,11 +396,19 @@
<!--#region EgtOptimizer-->
<!--#region Dimension_TextBox-->
<Style x:Key="Dimension_TextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource EgtOptmizer_TextBox}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="55"/>
</Style>
<Style x:Key="EgtPartManager_TextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource Dimension_TextBox}">
<Setter Property="ExplicitUpdateSource" Value="EnterKeyPress"/>
</Style>
<!--#endregion Dimension_TextBox-->
<Style x:Key="Qty_TextBox" TargetType="{x:Type EgtWPFLib5:EgtTextBox}" BasedOn="{StaticResource EgtOptmizer_TextBox}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="40"/>