- aggiunta caricamento MachGroupPanel su importBtl
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtUILib
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
Imports System.Windows.Threading
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class OnlyProdManagerVM
|
||||
Inherits VMBase
|
||||
@@ -559,10 +559,7 @@ Public Class OnlyProdManagerVM
|
||||
Return False
|
||||
End Try
|
||||
' inizializzo nuovo progetto
|
||||
If InitNewProj(nProjId, sProjDir, nType, sMachine) Then
|
||||
' imposto ProjId di caricamento
|
||||
ProjectManagerVM.nLoadingProjId = nProjId
|
||||
Else
|
||||
If Not InitNewProj(nProjId, sProjDir, nType, sMachine) Then
|
||||
EgtOutLog("Errore! Impossibile creare indice nuovo progetto!")
|
||||
' elimino file Btl copiato
|
||||
Try
|
||||
@@ -572,21 +569,95 @@ Public Class OnlyProdManagerVM
|
||||
End Try
|
||||
Return False
|
||||
End If
|
||||
' importo file
|
||||
If Not Map.refSceneHostVM.MainController.ImportProject(sBtlCopyPath, False) Then
|
||||
EgtOutLog("Errore! Inserimento nel progetto del file BTL fallito!")
|
||||
' elimino file Btl copiato
|
||||
Try
|
||||
File.Delete(sBtlCopyPath)
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Errore! Eliminazione file BTL copiato fallita!")
|
||||
End Try
|
||||
'Map.refShowBeamPanelVM.ShowBuilding_IsChecked = bAssembly
|
||||
' elimino da Db
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(nProjId, False)
|
||||
' verifico tipo di file e recupero flag di importazione
|
||||
Dim nFileType As Integer = EgtGetFileType(sBtlCopyPath)
|
||||
If nFileType <> FT.BTL AndAlso nFileType <> FT.BTLX Then
|
||||
EgtOutLog("Errore! Estensione progetto sconosciuta!")
|
||||
Return False
|
||||
End If
|
||||
Dim sBTLFlag As String
|
||||
If Not IsNothing(Map.refOnlyProdManagerVM) AndAlso Map.refOnlyProdManagerVM.nProjType = Core.ConstBeam.BWType.BEAM Then
|
||||
sBTLFlag = K_BTLFLAG
|
||||
Else
|
||||
sBTLFlag = K_WALLBTLFLAG
|
||||
End If
|
||||
Dim nFlag As Integer = GetMainPrivateProfileInt(S_IMPORT, sBTLFlag, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
|
||||
' importo file
|
||||
If Not EgtNewFile() Then
|
||||
EgtOutLog("Errore! Impossibile creare nuovo progetto!")
|
||||
Return False
|
||||
End If
|
||||
Select Case nFileType
|
||||
Case FT.BTL
|
||||
If Not EgtImportBtl(sBtlCopyPath, nFlag) Then
|
||||
EgtOutLog("Errore! Inserimento nel progetto del file BTL fallito!")
|
||||
' elimino file Btl copiato
|
||||
Try
|
||||
File.Delete(sBtlCopyPath)
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Errore! Eliminazione file BTL copiato fallita!")
|
||||
End Try
|
||||
'Map.refShowBeamPanelVM.ShowBuilding_IsChecked = bAssembly
|
||||
' elimino da Db
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(nProjId, False)
|
||||
Return False
|
||||
End If
|
||||
Case FT.BTLX
|
||||
If Not EgtImportBtlx(sBtlCopyPath, 0) Then
|
||||
EgtOutLog("Errore! Inserimento nel progetto del file BTL fallito!")
|
||||
' elimino file Btl copiato
|
||||
Try
|
||||
File.Delete(sBtlCopyPath)
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Errore! Eliminazione file BTL copiato fallita!")
|
||||
End Try
|
||||
'Map.refShowBeamPanelVM.ShowBuilding_IsChecked = bAssembly
|
||||
' elimino da Db
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(nProjId, False)
|
||||
Return False
|
||||
End If
|
||||
End Select
|
||||
If EgtGetFirstPart() = GDB_ID.NULL Then
|
||||
MessageBox.Show("Imported file is Empty!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
Return False
|
||||
End If
|
||||
' LoadingWndHelper.UpdateLoadingWnd(ActiveIds.IMPORTBTL, 2, EgtMsg(63005), 50, 70) ' Loading parts
|
||||
' aggiungo informazioni su pezzi
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
' scrivo in ogni pezzo ProjId
|
||||
EgtSetInfo(nPartId, BTL_PRT_PROJ, nProjId)
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
' scrivo Id negli outline
|
||||
Dim nPRId As Integer = 1
|
||||
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
|
||||
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
|
||||
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
|
||||
nPRId += 1
|
||||
End If
|
||||
nOutlineId = EgtGetNext(nOutlineId)
|
||||
End While
|
||||
End If
|
||||
End While
|
||||
' scrivo info proj e type su layer BtlInfo
|
||||
Dim nBTLInfoLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, nProjId)
|
||||
EgtSetInfo(nBTLInfoLayer, BTL_GEN_PROJTYPE, nType)
|
||||
' scrivo info proj su layer AsseBase
|
||||
Dim nAsseBaseLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
|
||||
EgtSetInfo(nAsseBaseLayer, BTL_PRT_PROJ, nProjId)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'Dim bFirstPart As Boolean = EgtGetFirstPart() <> GDB_ID.NULL
|
||||
If bOk Then 'OrElse bFirstPart Then
|
||||
'' salvo path di importazione
|
||||
@@ -595,10 +666,10 @@ Public Class OnlyProdManagerVM
|
||||
'bOk = EgtSaveFile(sProjFileName, NGE.CMPTEXT)
|
||||
'SectionXMaterial.SetType(nType)
|
||||
'Core.ViewPanelVM.UpdateBWType(nType)
|
||||
' imposto flag secondo tipo di progetto (travi o pareti)
|
||||
Dim sBTLFlag As String = If(nType = Core.ConstBeam.BWType.BEAM, K_BTLFLAG, K_WALLBTLFLAG)
|
||||
Dim nFlag As Integer = GetMainPrivateProfileInt(S_IMPORT, sBTLFlag, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
|
||||
EgtBeamSetFlag(nFlag)
|
||||
'' imposto flag secondo tipo di progetto (travi o pareti)
|
||||
'Dim sBTLFlag As String = If(nType = Core.ConstBeam.BWType.BEAM, K_BTLFLAG, K_WALLBTLFLAG)
|
||||
'Dim nFlag As Integer = GetMainPrivateProfileInt(S_IMPORT, sBTLFlag, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
|
||||
'EgtBeamSetFlag(nFlag)
|
||||
Else
|
||||
EgtOutLog("Errore nell'importazione BTL")
|
||||
End If
|
||||
@@ -616,10 +687,15 @@ Public Class OnlyProdManagerVM
|
||||
Wall.Rotation(True, Map.refProjectVM.BTLStructureVM.nPROJTYPE, True, 180, False)
|
||||
Next
|
||||
End If
|
||||
' leggo struttura BTL per liste
|
||||
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
|
||||
' calcolo volumi pezzi
|
||||
For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
||||
Part.CalcBTLPartVolume()
|
||||
Next
|
||||
' carico gruppi di lavorazione
|
||||
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
|
||||
|
||||
'Map.refProjectVM.SetOnlyProdOptimizePanel_Visibility(Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))
|
||||
'Map.refPartManagerVM.LockVisibilityUpdate()
|
||||
'LoadingWndHelper.UpdateLoadingWnd(ActiveIds.IMPORTBTL, 3, EgtMsg(63006), 70, 100) ' Loading graphics
|
||||
@@ -647,7 +723,6 @@ Public Class OnlyProdManagerVM
|
||||
Dim bOk = False
|
||||
Try
|
||||
File.Copy(sImportFilePath, sBtlCopyPath, True)
|
||||
bOk = True
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Errore! Impossibile copiare il file BTL!")
|
||||
Return False
|
||||
@@ -663,21 +738,90 @@ Public Class OnlyProdManagerVM
|
||||
End Try
|
||||
Return False
|
||||
End If
|
||||
' importo file
|
||||
If Not Map.refSceneHostVM.MainController.InsertProject(sBtlCopyPath, False) Then
|
||||
EgtOutLog("Errore! Inserimento nel progetto del file BTL fallito!")
|
||||
' elimino file Btl copiato
|
||||
Try
|
||||
File.Delete(sBtlCopyPath)
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Errore! Eliminazione file BTL copiato fallita!")
|
||||
End Try
|
||||
'Map.refShowBeamPanelVM.ShowBuilding_IsChecked = bAssembly
|
||||
' elimino da Db
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(nProjId, False)
|
||||
' verifico tipo di file e recupero flag di importazione
|
||||
Dim nFileType As Integer = EgtGetFileType(sBtlCopyPath)
|
||||
If nFileType <> FT.BTL AndAlso nFileType <> FT.BTLX Then
|
||||
EgtOutLog("Errore! Estensione progetto sconosciuta!")
|
||||
Return False
|
||||
End If
|
||||
Dim sBTLFlag As String
|
||||
If Not IsNothing(Map.refOnlyProdManagerVM) AndAlso Map.refOnlyProdManagerVM.nProjType = Core.ConstBeam.BWType.BEAM Then
|
||||
sBTLFlag = K_BTLFLAG
|
||||
Else
|
||||
sBTLFlag = K_WALLBTLFLAG
|
||||
End If
|
||||
Dim nFlag As Integer = GetMainPrivateProfileInt(S_IMPORT, sBTLFlag, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
|
||||
' importo file
|
||||
Dim nGroupQty As Integer = EgtGetGroupObjs(GDB_ID.ROOT)
|
||||
Dim nLastPartId As Integer = EgtGetLastPart(GDB_ID.ROOT)
|
||||
Select Case nFileType
|
||||
Case FT.BTL
|
||||
If Not EgtImportBtl(sBtlCopyPath, nFlag) Then
|
||||
EgtOutLog("Errore! Inserimento nel progetto del file BTL fallito!")
|
||||
' elimino file Btl copiato
|
||||
Try
|
||||
File.Delete(sBtlCopyPath)
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Errore! Eliminazione file BTL copiato fallita!")
|
||||
End Try
|
||||
'Map.refShowBeamPanelVM.ShowBuilding_IsChecked = bAssembly
|
||||
' elimino da Db
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(nProjId, False)
|
||||
Return False
|
||||
End If
|
||||
Case FT.BTLX
|
||||
If Not EgtImportBtlx(sBtlCopyPath, 0) Then
|
||||
EgtOutLog("Errore! Inserimento nel progetto del file BTL fallito!")
|
||||
' elimino file Btl copiato
|
||||
Try
|
||||
File.Delete(sBtlCopyPath)
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Errore! Eliminazione file BTL copiato fallita!")
|
||||
End Try
|
||||
'Map.refShowBeamPanelVM.ShowBuilding_IsChecked = bAssembly
|
||||
' elimino da Db
|
||||
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
DbControllers.m_ProjController.DeleteProj(nProjId, False)
|
||||
Return False
|
||||
End If
|
||||
End Select
|
||||
' verifico che abbia importato qualcosa
|
||||
If EgtGetGroupObjs(GDB_ID.ROOT) <= nGroupQty Then
|
||||
MessageBox.Show("Imported file is Empty!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
Return False
|
||||
End If
|
||||
'LoadingWndHelper.UpdateLoadingWnd(ActiveIds.IMPORTBTL, 2, EgtMsg(63005), 50, 70) ' Loading parts
|
||||
' aggiungo informazioni su pezzi
|
||||
Dim nPartId As Integer = EgtGetNextPart(nLastPartId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
' scrivo in ogni pezzo ProjId
|
||||
EgtSetInfo(nPartId, BTL_PRT_PROJ, nProjId)
|
||||
' scrivo Id negli outline
|
||||
Dim nPRId As Integer = 1
|
||||
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
|
||||
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
|
||||
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
|
||||
nPRId += 1
|
||||
End If
|
||||
nOutlineId = EgtGetNext(nOutlineId)
|
||||
End While
|
||||
End If
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
' scrivo info proj e type su layer BtlInfo
|
||||
Dim nBTLInfoLayer As Integer = EgtGetLastNameInGroup(GDB_ID.ROOT, BTLINFO)
|
||||
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, nProjId)
|
||||
EgtSetInfo(nBTLInfoLayer, BTL_GEN_PROJTYPE, nType)
|
||||
' scrivo info proj su layer AsseBase
|
||||
Dim nAsseBaseLayer As Integer = EgtGetLastNameInGroup(GDB_ID.ROOT, ASSEBASE)
|
||||
EgtSetInfo(nAsseBaseLayer, BTL_PRT_PROJ, nProjId)
|
||||
' leggo struttura BTL per liste
|
||||
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
|
||||
Dim sProjFileName As String = sProjDir & "\" & nProjId.ToString("0000") & ".nge"
|
||||
Dim bFirstPart As Boolean = EgtGetFirstPart() <> GDB_ID.NULL
|
||||
If bOk Then 'OrElse bFirstPart Then
|
||||
@@ -687,10 +831,6 @@ Public Class OnlyProdManagerVM
|
||||
'bOk = EgtSaveFile(sProjFileName, NGE.CMPTEXT)
|
||||
'SectionXMaterial.SetType(nType)
|
||||
'Core.ViewPanelVM.UpdateBWType(nType)
|
||||
' imposto flag secondo tipo di progetto (travi o pareti)
|
||||
Dim sBTLFlag As String = If(nType = Core.ConstBeam.BWType.BEAM, K_BTLFLAG, K_WALLBTLFLAG)
|
||||
Dim nFlag As Integer = GetMainPrivateProfileInt(S_IMPORT, sBTLFlag, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
|
||||
EgtBeamSetFlag(nFlag)
|
||||
Else
|
||||
EgtOutLog("Errore nell'importazione BTL")
|
||||
End If
|
||||
@@ -700,7 +840,12 @@ Public Class OnlyProdManagerVM
|
||||
DateTime.TryParse(Map.refProjectVM.BTLStructureVM.BTLStructureM.m_sEXPDATE & " " &
|
||||
Map.refProjectVM.BTLStructureVM.BTLStructureM.m_sEXPTIME, ExportDate)
|
||||
DbControllers.m_ProjController.UpdateInfo(nProjId, sBTLFileName, sBTLFileName, Map.refProjectVM.BTLStructureVM.sLISTNAME, ExportDate, ProdFileVM.nType, ProdFileVM.sMachine)
|
||||
SetCurrProj(nProjId)
|
||||
' salvo il progetto
|
||||
Map.refSceneHostVM.SaveProject()
|
||||
' riporto aggiunta proj a prod su Db
|
||||
DbControllers.m_ProdController.AddProj(ProdFileVM.nProdId, nProjId)
|
||||
' resetto stato new del proj
|
||||
DbControllers.m_ProjController.ResetNew(nProjId)
|
||||
' se progetto pareti e vista ruotata
|
||||
If ProdFileVM.nType = BWType.WALL AndAlso (CurrentMachine.ViewDir = VT.ISO_NW OrElse CurrentMachine.ViewDir = VT.ISO_NE) Then
|
||||
' ruoto le pareti di 180 per raddrizzarle rispetto alla vista
|
||||
|
||||
@@ -687,7 +687,7 @@ Public Class MySceneHostVM
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
|
||||
Friend Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
|
||||
Dim bFirstPart As Boolean = EgtGetFirstPart() <> GDB_ID.NULL
|
||||
If bOk OrElse bFirstPart Then
|
||||
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.IMPORTBTL, 2, EgtMsg(63005), 50, 70) ' Loading parts
|
||||
|
||||
Reference in New Issue
Block a user