Aggiunta tab vuoto a tab prod/proj e controllo pulsanti

This commit is contained in:
Demetrio Cassarino
2023-10-30 12:28:58 +01:00
parent e1954b3731
commit 91d943d0a7
10 changed files with 187 additions and 124 deletions
+3 -2
View File
@@ -48,8 +48,9 @@ Public Module ConstGen
' Selezione Tab Prod / Proj
Public Enum ProdProj As Integer
PROJ = 0
PROD = 1
NULL = 0
PROJ = 1
PROD = 2
End Enum
' File di log generale
@@ -1,4 +1,5 @@
Imports System.Reflection
Imports EgtBEAMWALL.Core.ConstGen
Public Class BTLPartListV
@@ -46,6 +47,7 @@ Public Class BTLPartListV
e.Handled = True
ElseIf e.ChangedButton = m_HighlightBtn Then
Map.refProjectVM.BTLStructureVM.SetSelectionType(BTLStructureVM.SelectionTypes.HIGHLIGHT)
Map.refProjectVM.SelProdProj = ProdProj.NULL
End If
End If
'If e.ChangedButton = Input.MouseButton.Left Then
@@ -369,7 +369,11 @@ Public Class MyMachGroupVM
Dim sCurrMachGroupName As String = ""
EgtGetMachGroupName(nCurrMachGroup, sCurrMachGroupName)
' scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_PRODID, Map.refProdManagerVM.CurrProd.nProdId)
If Not IsNothing(Map.refProdManagerVM) Then
EgtSetInfo(nCurrMachGroup, MGR_RPT_PRODID, Map.refProdManagerVM.CurrProd.nProdId)
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
EgtSetInfo(nCurrMachGroup, MGR_RPT_PRODID, Map.refOnlyProdManagerVM.CurrProd.nProdId)
End If
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, sMATERIAL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PATTID, nCurrMachGroup)
' scrivo dati costruzione grezzo in gruppo di lavorazione
@@ -316,7 +316,7 @@ Public Class OnlyProdManagerVM
If Not m_bOpenProj Then Return
m_bOpenProj = False
Select Case Map.refMainMenuVM.SelPage
Case Pages.MACHINING
Case Pages.MACHINING OrElse Pages.ONLYPRODPAGE
' recupero progetto da Id
Dim DbProject As ProdFileM
DbProject = DbControllers.m_ProdController.FindCoreByProdId(m_nProjIdToOpen)
@@ -349,6 +349,94 @@ Public Class OnlyProdManagerVM
m_nProjIdToOpen = GDB_ID.NULL
End Sub
Private Sub InitProd()
' inizializzo nuovo progetto PROD
Dim nProdId As Integer = 0
Dim sProdDir As String = ""
InitNewProjectPROD(m_CurrProj.nProjId, nProdId, sProdDir)
' setto il PType del Prod
DbControllers.m_ProdController.UpdatePType(nProdId, CurrProj.nType)
' setto la Macchina associata al Prod
DbControllers.m_ProdController.UpdateMachine(nProdId, CurrProj.sMachine)
' copio file progetto
Dim sProjPath As String = String.Empty
Dim bOk = False
Dim sProdPath As String = sProdDir & "\" & nProdId.ToString("0000") & ".nge"
If EgtGetCurrFilePath(sProjPath) AndAlso Not String.IsNullOrEmpty(sProjPath) Then
Try
File.Copy(sProjPath, sProdPath)
'Map.refSceneHostVM.MainController.OpenProject(sProdPath)
bOk = True
Catch ex As Exception
EgtOutLog("Impossibile copiare il file")
bOk = False
End Try
End If
If bOk Then
' aggiorno path proj
Map.refOnlyProdManagerVM.UpdateCurrProj()
' imposto currprod
Map.refOnlyProdManagerVM.SetCurrProd(nProdId)
' imposto TempCurrProd
Map.refOnlyProdManagerVM.TempCurrProd = Map.refOnlyProdManagerVM.CurrProd
' setto flag nuovo progetto in prod
Map.refOnlyProdManagerVM.CurrProd.bIsNew = True
Else
' elimino da DB
DbControllers.m_ProdController.DeleteProd(nProdId, True)
End If
End Sub
Private Sub ManageImportLog(nProjId As Integer, sProjDir As String)
Dim LogFile As New List(Of String)
Using FileStream As FileStream = New FileStream(Map.refMainWindowVM.MainWindowM.sLogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim StreamReader As New StreamReader(FileStream)
Dim Line As String = StreamReader.ReadLine()
While Not StreamReader.EndOfStream
Line = StreamReader.ReadLine()
LogFile.Add(Line)
End While
StreamReader.Close()
End Using
If LogFile.Count > 0 Then
' recupero ultima occorrenza di import
Dim sLastImport As String = LogFile.LastOrDefault(Function(x) x.Contains("ImportBtl"))
' verifico linee successive
Dim nLastImportIndex As Integer = -1
If Not String.IsNullOrWhiteSpace(sLastImport) Then
nLastImportIndex = LogFile.IndexOf(sLastImport)
End If
Dim sImportMessage As String = sLastImport & Environment.NewLine
Dim sImportLog As New List(Of String)({sLastImport})
If nLastImportIndex > 0 Then
Dim bGlobalError As Boolean = False
' ciclo sulle righe successive
For Index = nLastImportIndex + 1 To LogFile.Count - 1
Dim sLogLine As String = LogFile(Index).Trim()
' verifico se fanno parte dell'import
Dim bStartWithError As Boolean = sLogLine.StartsWith("Error")
Dim bStartWithInfo As Boolean = sLogLine.StartsWith("Info")
If Not bStartWithError And Not bStartWithInfo Then Exit For
If bStartWithError Then
If Not bGlobalError Then bGlobalError = True
sImportMessage &= sLogLine & Environment.NewLine
End If
sImportLog.Add(sLogLine)
Next
' salvo file ImportLog nel progetto
Try
File.WriteAllLines(sProjDir & "\" & nProjId.ToString("0000") & "-ImportLog.txt", sImportLog)
Catch ex As Exception
'
End Try
' se almeno un errore, mostro log
If bGlobalError Then
MessageBox.Show(Application.Current.MainWindow, sImportMessage, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
End If
End If
End If
End Sub
#End Region ' Methods
#Region "COMMANDS"
@@ -423,42 +511,8 @@ Public Class OnlyProdManagerVM
SetCurrProj(nProjId)
End If
Map.refProjectVM.SetOptimizePanel_Visibility(Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))
' inizializzo nuovo progetto PROD
Dim nProdId As Integer = 0
Dim sProdDir As String = ""
InitNewProjectPROD(m_CurrProj.nProjId, nProdId, sProdDir)
' setto il PType del Prod
DbControllers.m_ProdController.UpdatePType(nProdId, CurrProj.nType)
' setto la Macchina associata al Prod
DbControllers.m_ProdController.UpdateMachine(nProdId, CurrProj.sMachine)
' copio file progetto
Dim sProjPath As String = String.Empty
Dim bOk = False
Dim sProdPath As String = sProdDir & "\" & nProdId.ToString("0000") & ".nge"
If EgtGetCurrFilePath(sProjPath) AndAlso Not String.IsNullOrEmpty(sProjPath) Then
Try
File.Copy(sProjPath, sProdPath)
'Map.refSceneHostVM.MainController.OpenProject(sProdPath)
bOk = True
Catch ex As Exception
EgtOutLog("Impossibile copiare il file")
bOk = False
End Try
End If
If bOk Then
' aggiorno path proj
Map.refOnlyProdManagerVM.UpdateCurrProj()
' imposto currprod
Map.refOnlyProdManagerVM.SetCurrProd(nProdId)
' imposto TempCurrProd
Map.refOnlyProdManagerVM.TempCurrProd = Map.refOnlyProdManagerVM.CurrProd
' setto flag nuovo progetto in prod
Map.refOnlyProdManagerVM.CurrProd.bIsNew = True
Else
' elimino da DB
DbControllers.m_ProdController.DeleteProd(nProdId, True)
End If
InitProd()
Else
MessageBox.Show(EgtMsg(61876))
End If
@@ -781,6 +835,8 @@ Public Class OnlyProdManagerVM
' CheckMe impostata come cancellazione FISICA dal DB...
DbControllers.m_ProjController.DeleteProj(nProjId, False)
End If
' inizializzo nuovo progetto PROD
InitProd()
' carico filtri di ricerca
Map.refProjectVM.BTLStructureVM.LoadFilters()
' gestisco log di importazione
@@ -790,56 +846,6 @@ Public Class OnlyProdManagerVM
LoadingWndHelper.CloseLoadingWnd(ActiveIds.IMPORTBTL)
End Sub
Private Sub ManageImportLog(nProjId As Integer, sProjDir As String)
Dim LogFile As New List(Of String)
Using FileStream As FileStream = New FileStream(Map.refMainWindowVM.MainWindowM.sLogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim StreamReader As New StreamReader(FileStream)
Dim Line As String = StreamReader.ReadLine()
While Not StreamReader.EndOfStream
Line = StreamReader.ReadLine()
LogFile.Add(Line)
End While
StreamReader.Close()
End Using
If LogFile.Count > 0 Then
' recupero ultima occorrenza di import
Dim sLastImport As String = LogFile.LastOrDefault(Function(x) x.Contains("ImportBtl"))
' verifico linee successive
Dim nLastImportIndex As Integer = -1
If Not String.IsNullOrWhiteSpace(sLastImport) Then
nLastImportIndex = LogFile.IndexOf(sLastImport)
End If
Dim sImportMessage As String = sLastImport & Environment.NewLine
Dim sImportLog As New List(Of String)({sLastImport})
If nLastImportIndex > 0 Then
Dim bGlobalError As Boolean = False
' ciclo sulle righe successive
For Index = nLastImportIndex + 1 To LogFile.Count - 1
Dim sLogLine As String = LogFile(Index).Trim()
' verifico se fanno parte dell'import
Dim bStartWithError As Boolean = sLogLine.StartsWith("Error")
Dim bStartWithInfo As Boolean = sLogLine.StartsWith("Info")
If Not bStartWithError And Not bStartWithInfo Then Exit For
If bStartWithError Then
If Not bGlobalError Then bGlobalError = True
sImportMessage &= sLogLine & Environment.NewLine
End If
sImportLog.Add(sLogLine)
Next
' salvo file ImportLog nel progetto
Try
File.WriteAllLines(sProjDir & "\" & nProjId.ToString("0000") & "-ImportLog.txt", sImportLog)
Catch ex As Exception
'
End Try
' se almeno un errore, mostro log
If bGlobalError Then
MessageBox.Show(Application.Current.MainWindow, sImportMessage, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
End If
End If
End If
End Sub
#End Region ' ImportBTL
#Region "UpdateBTL"
@@ -1658,7 +1664,11 @@ Public Class OnlyProdManagerVM
nDuploId = EgtGetNext(nDuploId)
End While
' resetto CurrProd per evitare di leggere valori produzione dal Db di quel progetto
Map.refProdManagerVM.CurrProd = Nothing
If Not IsNothing(Map.refProdManagerVM) Then
Map.refProdManagerVM.CurrProd = Nothing
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
Map.refOnlyProdManagerVM.CurrProd = Nothing
End If
' carico Machgroup che non verrebbero altrimenti importati
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
If Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.Count > 0 Then
@@ -1737,7 +1747,11 @@ Public Class OnlyProdManagerVM
OpenProject(CurrProd) ' Da controllare
End If
' ripristino eventuale CurrProd precedente
Map.refProdManagerVM.CurrProd = CurrProd
If Not IsNothing(Map.refProdManagerVM) Then
Map.refProdManagerVM.CurrProd = CurrProd
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
Map.refOnlyProdManagerVM.CurrProd = CurrProd
End If
WriteMainPrivateProfileString(S_GENERAL, K_LASTNGEXPDIR, Path.GetDirectoryName(ImportDlg.FileName))
LoadingWndHelper.CloseLoadingWnd(ActiveIds.IMPORTPROJECT)
End Sub
@@ -76,6 +76,7 @@
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</TabControl.ItemContainerStyle>
<TabItem Header="NULL"/>
<TabItem Header="PROJ">
<Grid>
<Grid.RowDefinitions>
@@ -421,9 +421,9 @@ Public Class ProjectVM
Map.refMainMenuVM.SetMainMenuIsEnabled(bIsEnabled)
Map.refPartManagerVM.SetPartManagerIsEnabled(bIsEnabled)
Map.refLeftPanelVM.SetLeftPanelIsEnabled(bIsEnabled)
Map.refProjManagerVM.SetProjManagerIsEnabled(bIsEnabled)
Map.refProdManagerVM.SetProdManagerIsEnabled(bIsEnabled)
Map.refTopPanelVM.SetTopPanelIsEnabled(bIsEnabled)
If Not IsNothing(Map.refProjManagerVM) Then Map.refProjManagerVM.SetProjManagerIsEnabled(bIsEnabled)
If Not IsNothing(Map.refProdManagerVM) Then Map.refProdManagerVM.SetProdManagerIsEnabled(bIsEnabled)
If Not IsNothing(Map.refTopPanelVM) Then Map.refTopPanelVM.SetTopPanelIsEnabled(bIsEnabled)
Map.refOptimizePanelVM.SetOptimizePanelIsEnabled(bIsEnabled)
Map.refFeatureManagerVM.SetFeatureManagerIsEnabled(bIsEnabled)
End Sub
@@ -2,6 +2,7 @@
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Imports Org.BouncyCastle.Crypto.Engines
Public Class ProdFileVM
Inherits Core.ProdFileVM
@@ -142,7 +143,11 @@ Public Class ProdFileVM
Select Case VerifyResult
Case MessageBoxResult.Yes
' salvo proj
Map.refProdManagerVM.Save()
If Not IsNothing(Map.refProdManagerVM) Then
Map.refProdManagerVM.Save()
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
Map.refOnlyProdManagerVM.Save()
End If
Case MessageBoxResult.Cancel
Return MessageBoxResult.Cancel
Case Else ' No
@@ -162,14 +167,21 @@ Public Class ProdFileVM
Map.refOnlyProdManagerVM.NotifyPropertyChanged(NameOf(Map.refProdManagerVM.MruFileNames))
End If
DbControllers.m_ProdController.DeleteProd(CurrProject.nProdId, False)
If CurrProject.nProdId = Map.refProjManagerVM.CurrProj.nProdId OrElse CurrProject.nProdId = Map.refOnlyProdManagerVM.CurrProj.nProdId Then
If Not IsNothing(Map.refProjManagerVM) AndAlso CurrProject.nProdId = Map.refProjManagerVM.CurrProj.nProdId Then
' reset prod in path proj
Map.refProjManagerVM.UpdateCurrProj()
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) AndAlso CurrProject.nProdId = Map.refOnlyProdManagerVM.CurrProj.nProdId Then
' reset prod in path proj
Map.refOnlyProdManagerVM.UpdateCurrProj()
End If
Map.refProdManagerVM.CurrProd = Nothing
EgtResetModified()
Return MessageBoxResult.No
If Not IsNothing(Map.refProdManagerVM) Then
Map.refProdManagerVM.CurrProd = Nothing
'ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
' Map.refOnlyProdManagerVM.CurrProd = Nothing
End If
EgtResetModified()
Return MessageBoxResult.No
End If
End Select
Else
EgtResetModified()
@@ -128,7 +128,11 @@ Public Class ProjFileVM
Select Case MessageBox.Show(EgtMsg(61875), "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Yes
' salvo proj
Map.refProjManagerVM.Save()
If Not IsNothing(Map.refProjManagerVM) Then
Map.refProjManagerVM.Save()
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
Map.refOnlyProdManagerVM.Save()
End If
Map.refCALCPanelVM.IsMachineApplied = False
Case MessageBoxResult.Cancel
Return False
@@ -141,12 +145,21 @@ Public Class ProjFileVM
If Directory.Exists(sProjectDirPath) Then
Directory.Delete(sProjectDirPath, True)
End If
Map.refProjManagerVM.m_MruFiles.Remove(CurrProject.sProjPath)
Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
If Not IsNothing(Map.refProjManagerVM) Then
Map.refProjManagerVM.m_MruFiles.Remove(CurrProject.sProjPath)
Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
Map.refOnlyProdManagerVM.m_MruFiles.Remove(CurrProject.sProjPath)
Map.refOnlyProdManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
End If
' CheckMe impostata come cancellazione FISICA dal DB...
DbControllers.m_ProjController.DeleteProj(CurrProject.nProjId, False)
Map.refProjManagerVM.CurrProj = Nothing
' CheckMe impostata come cancellazione FISICA dal DB...
DbControllers.m_ProjController.DeleteProj(CurrProject.nProjId, False)
If Not IsNothing(Map.refProjManagerVM) Then
Map.refProjManagerVM.CurrProj = Nothing
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
Map.refOnlyProdManagerVM.CurrProj = Nothing
End If
EgtResetModified()
Return True
End If
@@ -290,7 +290,7 @@ Public Class MySceneHostVM
Case Pages.VIEW
If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then
If Map.refFreeContourManagerVM.bIsActive AndAlso
( Map.refFreeContourManagerVM.SelType = FreeContourManagerVM.FreeContourTypes.ONEWITHANGLES Or
(Map.refFreeContourManagerVM.SelType = FreeContourManagerVM.FreeContourTypes.ONEWITHANGLES Or
Map.refFreeContourManagerVM.bIsOpeningCurveCompo) Then
' passo entità selezionata
Map.refFreeContourManagerVM.OnMouseSelectedObj(EgtGetFirstSelectedObj(), True)
@@ -572,8 +572,8 @@ Public Class MySceneHostVM
Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = Map.refProjManagerVM.CurrProj.sMachine))
ElseIf Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE Then
Map.refMachinePanelVM.SelectedMachine = If(Not IsNothing(Map.refOnlyProdManagerVM.TempCurrProd),
Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = Map.refOnlyProdManagerVM.CurrProd.sMachine),
Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = Map.refProdManagerVM.TempCurrProd.sMachine))
Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = Map.refOnlyProdManagerVM.TempCurrProd.sMachine),
Map.refMachinePanelVM.MachineList.FirstOrDefault(Function(x) x.Name = Map.refOnlyProdManagerVM.CurrProd.sMachine))
End If
SectionXMaterial.SetType(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
Core.ViewPanelVM.UpdateBWType(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
@@ -592,13 +592,13 @@ Public Class MySceneHostVM
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) AndAlso Not IsNothing(Map.refOnlyProdManagerVM.TempCurrProd) Then
'Map.refFullCompleteManagerVM.CurrProd = Map.refFullCompleteManagerVM.TempCurrProd
CurrProd = Map.refOnlyProdManagerVM.TempCurrProd
End If
'DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, True, Map.refMainWindowVM.MainWindowM.GetKeyNumber())
DbControllers.m_ProdController.LockByProdId(CurrProd.nProdId, True, Map.refMainWindowVM.MainWindowM.GetKeyNumber())
' carico lista macchine e macchina del progetto per il pulsante Reset Macchina del CALCPanel
Map.refCALCPanelVM.LoadMachineList()
End If
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
'DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, True, Map.refMainWindowVM.MainWindowM.GetKeyNumber())
DbControllers.m_ProdController.LockByProdId(CurrProd.nProdId, True, Map.refMainWindowVM.MainWindowM.GetKeyNumber())
' carico lista macchine e macchina del progetto per il pulsante Reset Macchina del CALCPanel
Map.refCALCPanelVM.LoadMachineList()
End If
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.OPENPROJ, 3, EgtMsg(63006), 70, 100) ' Loading graphics
' mostro tutti i pezzi
Map.refShowBeamPanelVM.ShowAll(True)
@@ -703,7 +703,7 @@ Public Class MySceneHostVM
Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer)
If nType = FT.BTL Or nType = FT.BTLX Then
Dim sBTLFlag As String
If Map.refProjManagerVM.nProjType = Core.ConstBeam.BWType.BEAM Then
If Not IsNothing(Map.refProjManagerVM) AndAlso Map.refProjManagerVM.nProjType = Core.ConstBeam.BWType.BEAM OrElse Not IsNothing(Map.refOnlyProdManagerVM) AndAlso Map.refOnlyProdManagerVM.nProjType = Core.ConstBeam.BWType.BEAM Then
sBTLFlag = K_BTLFLAG
Else
sBTLFlag = K_WALLBTLFLAG
@@ -723,7 +723,11 @@ Public Class MySceneHostVM
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
' scrivo in ogni pezzo ProjId
EgtSetInfo(nPartId, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
If Not IsNothing(Map.refProjManagerVM) Then
EgtSetInfo(nPartId, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
EgtSetInfo(nPartId, BTL_PRT_PROJ, Map.refOnlyProdManagerVM.nLoadingProjId)
End If
nPartId = EgtGetNextPart(nPartId)
' scrivo Id negli outline
Dim nPRId As Integer = 1
@@ -742,21 +746,29 @@ Public Class MySceneHostVM
End While
' scrivo info proj e type su layer BtlInfo
Dim nBTLInfoLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
If Not IsNothing(Map.refProjManagerVM) AndAlso Not IsNothing(Map.refProjManagerVM.CurrProj) Then
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
EgtSetInfo(nBTLInfoLayer, BTL_GEN_PROJTYPE, Map.refProjManagerVM.CurrProj.nType)
Else
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) AndAlso Not IsNothing(Map.refOnlyProdManagerVM.CurrProj) Then
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, Map.refOnlyProdManagerVM.nLoadingProjId)
EgtSetInfo(nBTLInfoLayer, BTL_GEN_PROJTYPE, Map.refOnlyProdManagerVM.CurrProd.nType)
End If
' scrivo info proj su layer AsseBase
Dim nAsseBaseLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
If Not IsNothing(Map.refProjManagerVM) AndAlso Not IsNothing(Map.refProjManagerVM.CurrProj) Then
EgtSetInfo(nAsseBaseLayer, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
Else
Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) AndAlso Not IsNothing(Map.refOnlyProdManagerVM.CurrProj) Then
EgtSetInfo(nAsseBaseLayer, BTL_PRT_PROJ, Map.refOnlyProdManagerVM.nLoadingProjId)
End If
Else
Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Map.refProjManagerVM.NewProject()
If Not IsNothing(Map.refProjManagerVM) Then
Map.refProjManagerVM.NewProject()
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) Then
Map.refOnlyProdManagerVM.NewProject()
End If
End If
MainScene.SetStatusNull()
End Sub
@@ -118,7 +118,11 @@ Module LuaExec
EgtLuaSetGlobNumVar("NEST.CORNER", nNestCorner)
EgtLuaSetGlobStringVar("NEST.MATERIAL", PartList(0).sMATERIAL)
EgtLuaSetGlobNumVar("NEST.TIME", nNestTime)
EgtLuaSetGlobNumVar("NEST.PRODID", Map.refProdManagerVM.CurrProd.nProdId)
If Not IsNothing(Map.refProdManagerVM) AndAlso Not IsNothing(Map.refProdManagerVM.CurrProd) Then
EgtLuaSetGlobNumVar("NEST.PRODID", Map.refProdManagerVM.CurrProd.nProdId)
ElseIf Not IsNothing(Map.refOnlyProdManagerVM) AndAlso Not IsNothing(Map.refOnlyProdManagerVM.CurrProd) Then
EgtLuaSetGlobNumVar("NEST.PRODID", Map.refOnlyProdManagerVM.CurrProd.nProdId)
End If
EgtLuaCreateGlobTable("PART")
For PartIndex = 0 To PartList.Count - 1
EgtLuaSetGlobIntVar("PART." & PartList(PartIndex).nPartId.ToString(), PartList(PartIndex).m_nCNT + PartList(PartIndex).m_nADDED - PartList(PartIndex).nINPROD)