diff --git a/EgtBEAMWALL.Core/BTLModel/BTLFeatureM.vb b/EgtBEAMWALL.Core/BTLModel/BTLFeatureM.vb index 39d83353..008dd91c 100644 --- a/EgtBEAMWALL.Core/BTLModel/BTLFeatureM.vb +++ b/EgtBEAMWALL.Core/BTLModel/BTLFeatureM.vb @@ -258,6 +258,13 @@ Public Class BTLFeatureM EgtGetInfo(nFeatureId, BTL_FTR_DES, NewBTLFeature.m_sDES) EgtGetInfo(nFeatureId, BTL_FTR_PRID, NewBTLFeature.m_nPRID) EgtGetInfo(nFeatureId, BTL_FTR_FRAME, NewBTLFeature.m_frFRAME) + ' leggo parametri della feature + GetBeamPrivateProfileGRPList(CalcBeamPrivateProfileGRP(NewBTLFeature.m_nSelGRP), NewBTLFeature.m_nPRC, NewBTLFeature.m_GRPList) + GetBeamPrivateProfileName(NewBTLFeature.m_nSelGRP, NewBTLFeature.m_nPRC, NewBTLFeature) + ' crea parametri per questa feature da file ini + NewBTLFeature.CreateFeatureParams(NewBTLFeature) + ' leggo parametri delle feature + NewBTLFeature.ReadFeatureParams() ' leggo calc error Dim nErr As Integer = 0 Dim nRot As Integer = 0 @@ -294,13 +301,6 @@ Public Class BTLFeatureM NewBTLFeature.nState = CalcStates.ERROR_ End Select End If - ' leggo parametri della feature - GetBeamPrivateProfileGRPList(CalcBeamPrivateProfileGRP(NewBTLFeature.m_nSelGRP), NewBTLFeature.m_nPRC, NewBTLFeature.m_GRPList) - GetBeamPrivateProfileName(NewBTLFeature.m_nSelGRP, NewBTLFeature.m_nPRC, NewBTLFeature) - ' crea parametri per questa feature da file ini - NewBTLFeature.CreateFeatureParams(NewBTLFeature) - ' leggo parametri delle feature - NewBTLFeature.ReadFeatureParams() Return NewBTLFeature End Function @@ -378,19 +378,19 @@ Public Class BTLFeatureM Dim sReadName As String = Param.sName If IsFreeContour() Then Select Case Param.sName - Case "P05" - sReadName = "DEPTH" - Case "P07" - sReadName = "PCKT" - Case "P13" - sReadName = "CNT_TYPE" - Case "P14" - sReadName = "CNT_DATA" - Case "P15" - sReadName = "CNT_PAR" + Case "P05" + sReadName = "DEPTH" + Case "P07" + sReadName = "PCKT" + Case "P13" + sReadName = "CNT_TYPE" + Case "P14" + sReadName = "CNT_DATA" + Case "P15" + sReadName = "CNT_PAR" End Select End If - if Not EgtGetInfo(m_nFeatureId, sReadName, dParamValue) Then + If Not EgtGetInfo(m_nFeatureId, sReadName, dParamValue) Then dParamValue = 0 End If ' se รจ un parametro P setto il valore letto nel DB @@ -412,6 +412,15 @@ Public Class BTLFeatureM ' Disabilito segnalazione modificato Dim DisableMgr As New DisableModifiedMgr EgtSetInfo(m_nFeatureId, Param.sName, Param.dDefault) + 'se pezzo parent di tipo BTL + If TypeOf m_ParentPart Is BTLPartM AndAlso m_bDO Then + Dim BTLPartM As BTLPartM = DirectCast(m_ParentPart, BTLPartM) + EgtRemoveInfo(BTLPartM.m_nPartId, ITG_PROJ_ERR) + EgtRemoveInfo(BTLPartM.m_nPartId, ITG_PROJ_MSG) + EgtRemoveInfo(BTLPartM.m_nPartId, ITG_PROJ_FALL) + EgtRemoveInfo(BTLPartM.m_nPartId, ITG_PROJ_ROT) + 'EgtDuploSetModified(DirectCast(m_ParentPart, BTLPartM).m_nPartId) + End If ' Ripristino stato segnalazione modifica DisableMgr.ReEnable() bToRecalc = True @@ -549,13 +558,13 @@ Public Class BTLFeatureM End Function ' funzione che restituisce i percorsi associati ai contorni liberi - Public Function GetFreeContourPaths( Byref nCrvId As Integer, ByRef nCrv2Id As Integer) As Boolean + Public Function GetFreeContourPaths(ByRef nCrvId As Integer, ByRef nCrv2Id As Integer) As Boolean ' imposto eventuali percorsi nCrvId = GDB_ID.NULL nCrv2Id = GDB_ID.NULL If IsFreeContour() Then Dim sAuxId As String = "" - If EgtGetInfo( nFeatureId, "AUXID", sAuxId) Then + If EgtGetInfo(nFeatureId, "AUXID", sAuxId) Then Dim sAuxIdSplit() As String = sAuxId.Split(","c) Dim nAuxId As Integer If Integer.TryParse(sAuxIdSplit(0), nAuxId) Then diff --git a/EgtBEAMWALL.Core/CALCPanel/CalcEndEventArgs.vb b/EgtBEAMWALL.Core/CALCPanel/CalcEndEventArgs.vb index ac2ffe24..5d72b3b4 100644 --- a/EgtBEAMWALL.Core/CALCPanel/CalcEndEventArgs.vb +++ b/EgtBEAMWALL.Core/CALCPanel/CalcEndEventArgs.vb @@ -18,7 +18,18 @@ End Set End Property - Sub New(Result As Results) + Public m_CmdType As CmdTypes + Public Property CmdType As CmdTypes + Get + Return m_CmdType + End Get + Private Set(value As CmdTypes) + m_CmdType = value + End Set + End Property + + Sub New(CmdType As CmdTypes, Result As Results) + m_CmdType = CmdType m_End = Result End Sub diff --git a/EgtBEAMWALL.Core/CALCPanel/CalcIntegration.vb b/EgtBEAMWALL.Core/CALCPanel/CalcIntegration.vb index 3506e5c8..a7fcf3eb 100644 --- a/EgtBEAMWALL.Core/CALCPanel/CalcIntegration.vb +++ b/EgtBEAMWALL.Core/CALCPanel/CalcIntegration.vb @@ -13,9 +13,8 @@ Public Module CalcIntegration Public Event Calc_Ended As EventHandler(Of CalcEndEventArgs) Public Event Calc_ProcessResult As EventHandler(Of CalcResultEventArgs) Public Event Calc_ProcessEnd As EventHandler(Of CalcProcessEndEventArgs) - Public Event Calc_EditEnd As EventHandler(Of CalcEditEndEventArgs) - Public Enum CmdType As Integer + Public Enum CmdTypes As Integer GENERATE = 0 MODIFY = 1 SIMULATE = 2 @@ -50,7 +49,7 @@ Public Module CalcIntegration Dim bCancel As Boolean = False callback(0, "Init", bCancel) - If vBar.Count > 0 AndAlso vBar(0).nCmdType = CmdType.SIMULATE Then + If vBar.Count > 0 AndAlso vBar(0).nCmdType = CmdTypes.SIMULATE Then Dim Bar As Bar = vBar(0) ' verifico se il pezzo e' non calcolato If Bar.nProgramPage = ProjectType.PROJ Then @@ -70,7 +69,7 @@ Public Module CalcIntegration Bar.sBarPath = sProjDirPath & "\" & sMachGroupName & ".bwe" End If End If - ElseIf vBar(0).nCmdType <> CmdType.EDIT Then + ElseIf vBar(0).nCmdType <> CmdTypes.EDIT Then ' creo progetti a seconda del tipo For Each Bar In vBar If Bar.nProgramPage = ProjectType.PROJ Then @@ -81,13 +80,14 @@ Public Module CalcIntegration Next End If Dim bIsSimulation As Boolean = False + Dim bIsSimulationVerifyed As Boolean = False Dim bIsEdit As Boolean = False Dim LastFileWriteTime As Date ' se sono in simulazione - If vBar.Count > 0 AndAlso vBar(0).nCmdType = CmdType.SIMULATE Then + If vBar.Count > 0 AndAlso vBar(0).nCmdType = CmdTypes.SIMULATE Then bIsSimulation = True callback(0, "Simulation opened", bCancel) - ElseIf vBar.Count > 0 AndAlso vBar(0).nCmdType = CmdType.EDIT Then + ElseIf vBar.Count > 0 AndAlso vBar(0).nCmdType = CmdTypes.EDIT Then bIsEdit = True Dim sCurrFilePath As String = "" EgtGetCurrFilePath(sCurrFilePath) @@ -159,9 +159,9 @@ Public Module CalcIntegration nActProc += 1 End If Else - If vBar(nCurrBar).nCmdType = CmdType.CHECK OrElse vBar(nCurrBar).nCmdType = CmdType.CHECKGEN Then + If vBar(nCurrBar).nCmdType = CmdTypes.CHECK OrElse vBar(nCurrBar).nCmdType = CmdTypes.CHECKGEN Then RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar)) - ElseIf vBar(nCurrBar).nCmdType = CmdType.GENERATE Then + ElseIf vBar(nCurrBar).nCmdType = CmdTypes.GENERATE Then RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar)) End If bDone = True @@ -174,9 +174,9 @@ Public Module CalcIntegration ' se terminato con successo If vProc(j).Proc.ExitCode = 0 Then ' salvo il risultato - If vBar(vProc(j).nBar).nCmdType = CmdType.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdType.CHECKGEN Then + If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar)) - ElseIf vBar(vProc(j).nBar).nCmdType = CmdType.GENERATE Then + ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar)) End If bDone = True @@ -196,9 +196,9 @@ Public Module CalcIntegration ' altrimenti (errore generico di esecuzione) Else ' salvo il risultato - If vBar(vProc(j).nBar).nCmdType = CmdType.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdType.CHECKGEN Then + If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar)) - ElseIf vBar(vProc(j).nBar).nCmdType = CmdType.GENERATE Then + ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar)) End If bDone = True @@ -228,7 +228,7 @@ Public Module CalcIntegration Proc.StartInfo.FileName = ExePath Proc.StartInfo.Arguments = """" & vBar(0).sBarPath & """ " & """" & vBar(0).nProjType & """ " & - """" & vBar(0).nMachineName & """ " & CmdType.CHECKGEN + """" & vBar(0).nMachineName & """ " & CmdTypes.CHECKGEN Proc.StartInfo.UseShellExecute = False If Proc.Start() Then @@ -243,6 +243,7 @@ Public Module CalcIntegration If Proc.ExitCode = 0 Then ' salvo il risultato RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(0))) + Thread.Sleep(500) End If End If End If @@ -250,7 +251,6 @@ Public Module CalcIntegration callback(0, "Simulation closing", bCancel) ElseIf bIsEdit Then ' ricarico il progetto - 'RaiseEvent Calc_EditEnd(Nothing, New CalcEditEndEventArgs(If(File.GetLastWriteTime(vBar(0).sBarPath) <> LastFileWriteTime, CalcEditEndEventArgs.Results.MODIFIED, CalcEditEndEventArgs.Results.NULL))) Dim Result As CalcEndEventArgs.Results If bAllKO Then Result = CalcEndEventArgs.Results.ERROR_ @@ -259,7 +259,7 @@ Public Module CalcIntegration Else Result = CalcEndEventArgs.Results.OK End If - RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(Result)) + RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.EDIT, Result)) Else ' Dialog con Progress Bar nDoneBar += 1 @@ -271,7 +271,7 @@ Public Module CalcIntegration ' fine callback(1, "", bCancel) ' riabilito interfaccia - RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(CalcEndEventArgs.Results.OK)) + RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.CHECKGEN, CalcEndEventArgs.Results.OK)) Return End If nPgsCurrBar = 0 @@ -316,7 +316,7 @@ Public Module CalcIntegration callback(1, "Done", bCancel) End If ' riabilito interfaccia - RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(If(bAllKO, CalcEndEventArgs.Results.ERROR_, CalcEndEventArgs.Results.OK))) + RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(If(bIsSimulation And Not bIsSimulationVerifyed, CmdTypes.SIMULATE, CmdTypes.CHECKGEN), If(bAllKO, CalcEndEventArgs.Results.ERROR_, CalcEndEventArgs.Results.OK))) End Sub Private Function CreateNewProjectFromPart(nPartId As Integer, sProjDirPath As String) As String diff --git a/EgtBEAMWALL.Core/MachGroupPanel/MyMachGroupVM.vb b/EgtBEAMWALL.Core/MachGroupPanel/MyMachGroupVM.vb index 2a43051a..7400674f 100644 --- a/EgtBEAMWALL.Core/MachGroupPanel/MyMachGroupVM.vb +++ b/EgtBEAMWALL.Core/MachGroupPanel/MyMachGroupVM.vb @@ -551,7 +551,11 @@ Public MustInherit Class MyMachGroupVM MyMachGroupM.nCALC_GlobalERR = nCALC_ERR MyMachGroupM.nCALC_GlobalState = nCALC_State For Each Part In MyMachGroupM.PartMList - If Part.nCALC_GlobalState > MyMachGroupM.nCALC_GlobalState Then + If Part.nCALC_GlobalState = CalcStates.NOTCALCULATED And nCALC_State < CalcStates.ERROR_ Then + MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState + MyMachGroupM.nCALC_GlobalERR = Part.nCALC_GlobalERR + Exit For + ElseIf Part.nCALC_GlobalState > MyMachGroupM.nCALC_GlobalState Then MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState MyMachGroupM.nCALC_GlobalERR = Part.nCALC_GlobalERR End If diff --git a/EgtBEAMWALL.Supervisor/CALCPanel/CALCPanelVM.vb b/EgtBEAMWALL.Supervisor/CALCPanel/CALCPanelVM.vb index 5ef34cd6..372a421c 100644 --- a/EgtBEAMWALL.Supervisor/CALCPanel/CALCPanelVM.vb +++ b/EgtBEAMWALL.Supervisor/CALCPanel/CALCPanelVM.vb @@ -297,11 +297,11 @@ Public Class CALCPanelVM Dim SelMachGroup As MyMachGroupVM = Map.refSupervisorMachGroupPanelVM.SelectedMachGroup Select Case SelMachGroup.nGlobalState Case Core.CalcStates.OK, Core.CalcStates.INFO - Bar.nCmdType = CalcIntegration.CmdType.GENERATE + Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE Case Else Dim sMachGroupFilePath As String = Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe" If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath) - Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN + Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN End Select TempBarList(0) = Bar BarList = TempBarList @@ -335,11 +335,11 @@ Public Class CALCPanelVM .nMachineName = MachineName} Select Case MachGroup.nGlobalState Case Core.CalcStates.OK, Core.CalcStates.INFO - Bar.nCmdType = CalcIntegration.CmdType.GENERATE + Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE Case Else Dim sMachGroupFilePath As String = Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & MachGroup.Name.ToString() & ".ori.bwe" If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath) - Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN + Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN End Select TempBarList(MachGroupIndex) = Bar Next @@ -408,11 +408,11 @@ Public Class CALCPanelVM .nMachineName = MachineName} Select Case CurrMachGroup.nGlobalState Case Core.CalcStates.OK, Core.CalcStates.INFO - Bar.nCmdType = CalcIntegration.CmdType.GENERATE + Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE Case Else Dim sMachGroupFilePath As String = Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & CurrMachGroup.Name.ToString() & ".ori.bwe" If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath) - Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN + Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN End Select TempBarList(PartIndex) = Bar Next @@ -456,7 +456,7 @@ Public Class CALCPanelVM .nProjType = ProjType, .bBarOk = True, .nMachineName = MachineName, - .nCmdType = CalcIntegration.CmdType.SIMULATE} + .nCmdType = CalcIntegration.CmdTypes.SIMULATE} If SelMachGroup.nGlobalState <> Core.CalcStates.OK Then Dim sMachGroupFilePath As String = Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe" If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath) diff --git a/EgtBEAMWALL.Supervisor/Comms/NUMFlexiumComm.vb b/EgtBEAMWALL.Supervisor/Comms/NUMFlexiumComm.vb index 1d70570d..edbf9565 100644 --- a/EgtBEAMWALL.Supervisor/Comms/NUMFlexiumComm.vb +++ b/EgtBEAMWALL.Supervisor/Comms/NUMFlexiumComm.vb @@ -929,6 +929,7 @@ Public Class NUMFlexiumComm End If End Sub + #End Region ' ReadOperatorMessage #End Region ' EVENTS diff --git a/EgtBEAMWALL.Supervisor/MachGroupPanel/MyMachGroupVM.vb b/EgtBEAMWALL.Supervisor/MachGroupPanel/MyMachGroupVM.vb index 7aca9866..d25b153e 100644 --- a/EgtBEAMWALL.Supervisor/MachGroupPanel/MyMachGroupVM.vb +++ b/EgtBEAMWALL.Supervisor/MachGroupPanel/MyMachGroupVM.vb @@ -351,7 +351,7 @@ Public Class MyMachGroupVM EgtSetInfo(nCurrMachGroup, MGR_RPT_BARLEN, dL - dInitialCutOut) Dim BeamMachGroup As MyMachGroupVM = Map.refProjectVM.ProdMachGroupPanelVM.GetLastMachGroup() ' eseguo script creazione grezzo - If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then + If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then BeamMachGroup.DeleteMachGroup() If File.Exists(sLogPath) Then Dim LogFile As String() = File.ReadAllLines(sLogPath) diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLFeatureVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLFeatureVM.vb index c5f62990..586d55c8 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLFeatureVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLFeatureVM.vb @@ -283,9 +283,9 @@ Public Class BTLFeatureVM End Sub Friend Sub ResetCalcFeature() - EgtRemoveInfo(nFeatureId, If(Map.refMainMenuVM.SelPage = Pages.VIEW, ITG_PROJ_ERR, ITG_PROD_ERR)) - EgtRemoveInfo(nFeatureId, If(Map.refMainMenuVM.SelPage = Pages.VIEW, ITG_PROJ_MSG, ITG_PROD_MSG)) - EgtRemoveInfo(nFeatureId, If(Map.refMainMenuVM.SelPage = Pages.VIEW, ITG_PROJ_ROT, ITG_PROD_ROT)) + EgtRemoveInfo(nFeatureId, If(IsNothing(m_BTLPartM), ITG_PROD_ERR, ITG_PROJ_ERR)) + EgtRemoveInfo(nFeatureId, If(IsNothing(m_BTLPartM), ITG_PROD_MSG, ITG_PROJ_MSG)) + EgtRemoveInfo(nFeatureId, If(IsNothing(m_BTLPartM), ITG_PROD_ROT, ITG_PROJ_ROT)) m_BTLFeatureM.nState = CalcStates.NOTCALCULATED m_BTLFeatureM.nCALC_ERR = 0 m_BTLFeatureM.nCALC_ROT = 0 diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLPartVM.vb b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLPartVM.vb index c753335c..55fd08a3 100644 --- a/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLPartVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/BTLViewModel/BTLPartVM.vb @@ -1639,20 +1639,32 @@ Public Class BTLPartVM Friend Sub CalcGlobalUpdate(Optional bFeatureFirst As Boolean = False) m_BTLPartM.nCALC_GlobalERR = nCALC_ERR m_BTLPartM.nGlobalState = nState - For Each Feature In BTLFeatureVMList - If Not Feature.bDO And Not bFeatureFirst Then Continue For - If ((Feature.nState = CalcStates.NOTCALCULATED And nState < CalcStates.ERROR_) Or Not Feature.bDO) And bFeatureFirst Then - m_BTLPartM.nGlobalState = Feature.nState - m_BTLPartM.nCALC_GlobalERR = Feature.nCALC_ERR - Exit For - ElseIf Feature.nState > m_BTLPartM.nGlobalState Then - m_BTLPartM.nGlobalState = Feature.nState - m_BTLPartM.nCALC_GlobalERR = Feature.nCALC_ERR + If nState > CalcStates.NOTCALCULATED Then + For Each Feature In BTLFeatureVMList + If Not Feature.bDO And Not bFeatureFirst Then Continue For + + If ((Feature.nState = CalcStates.NOTCALCULATED And nState < CalcStates.WARNING) Or Not Feature.bDO) And bFeatureFirst Then + m_BTLPartM.nGlobalState = Feature.nState + m_BTLPartM.nCALC_GlobalERR = Feature.nCALC_ERR + EgtRemoveInfo(nPartId, ITG_PROJ_ERR) + Exit For + ElseIf Feature.nState = CalcStates.NOTCALCULATED And nState < CalcStates.WARNING Then + m_BTLPartM.nGlobalState = Feature.nState + m_BTLPartM.nCALC_GlobalERR = Feature.nCALC_ERR + EgtRemoveInfo(nPartId, ITG_PROJ_ERR) + Exit For + ElseIf Feature.nState > m_BTLPartM.nGlobalState Then + m_BTLPartM.nGlobalState = Feature.nState + m_BTLPartM.nCALC_GlobalERR = Feature.nCALC_ERR + End If + If Feature.nCALC_ROT <> 0 Then + m_BTLPartM.m_nCALC_ROT = Feature.nCALC_ROT + End If + Next + If m_BTLPartM.nGlobalState = CalcStates.NOTCALCULATED Then + EgtRemoveInfo(nPartId, ITG_PROJ_ERR) End If - If Feature.nCALC_ROT <> 0 Then - m_BTLPartM.m_nCALC_ROT = Feature.nCALC_ROT - End If - Next + End If NotifyPropertyChanged(NameOf(Calc_BorderBrush)) NotifyPropertyChanged(NameOf(CALC_ROT_Visibility)) NotifyPropertyChanged(NameOf(CALC_ERR_Letter)) diff --git a/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CALCPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CALCPanelVM.vb index a61325d2..a230acf5 100644 --- a/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CALCPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/CALCPanel/CALCPanelVM.vb @@ -134,7 +134,6 @@ Public Class CALCPanelVM Core.CalcIntegration.SetMaxCamInstances(Map.refMainWindowVM.MainWindowM.GetMaxCamInstances()) AddHandler Core.CalcIntegration.Calc_ProcessResult, AddressOf Calc_ProcessResult AddHandler Core.CalcIntegration.Calc_Ended, AddressOf Calc_Ended - AddHandler Core.CalcIntegration.Calc_EditEnd, AddressOf Calc_EditEnd m_Waiting_Timer.Interval = TimeSpan.FromMilliseconds(500) AddHandler m_Waiting_Timer.Tick, AddressOf Waiting_Timer_Tick m_Waiting_Timer.Start() @@ -161,6 +160,8 @@ Public Class CALCPanelVM Map.refMyStatusBarVM.SetOutputMessage("Editor closed") m_ReloadEditedFile = True End If + ' se verify o verifyall, salvo il progetto per conservarne gli stati calcolati + If e.CmdType = CmdTypes.CHECKGEN Then Map.refSceneHostVM.MainController.SaveProject() ' se modalita' assemblato attiva If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Map.refShowBeamPanelVM.ShowBuilding_IsChecked AndAlso Map.refShowBeamPanelVM.bShowAll Then ' lo rimonto @@ -170,12 +171,6 @@ Public Class CALCPanelVM Map.refMyStatusBarVM.ResetStopProgress() End Sub - Private Sub Calc_EditEnd(sender As Object, e As CalcEditEndEventArgs) - If e.m_End = CalcEditEndEventArgs.Results.MODIFIED Then - m_ReloadEditedFile = True - End If - End Sub - Private Sub Waiting_Timer_Tick() If m_ReloadEditedFile Then m_ReloadEditedFile = False @@ -286,9 +281,17 @@ Public Class CALCPanelVM If Bar.nProgramPage = ProjectType.PROJ Then ' aggiorno nuovo pezzo CurrBTLPartVM = GetBTLPartVMFromBTLPartId(Line.nCUTID) + If IsNothing(CurrBTLPartVM) Then + EgtOutLog("Error in CALC ProcessResult. CUTID " & Line.nCUTID & "not found in project(BTLPartVM).") + Continue For + End If Else ' aggiorno nuovo pezzo CurrPartVM = GetPartVMFromPartId(Line.nCUTID) + If IsNothing(CurrPartVM) Then + EgtOutLog("Error in CALC ProcessResult. CUTID " & Line.nCUTID & "not found in project(PartVM).") + Continue For + End If End If End If Else @@ -296,17 +299,33 @@ Public Class CALCPanelVM If Bar.nProgramPage = ProjectType.PROJ Then ' imposto unico pezzo presente CurrBTLPartVM = GetBTLPartVMFromBTLPartId(Bar.nBarId) + If IsNothing(CurrBTLPartVM) Then + EgtOutLog("Error in CALC ProcessResult. CUTID " & Bar.nBarId & "not found in project(BTLPartVM).") + Continue For + End If Else ' riporto errore barra CurrMachgroupVM = GetMachgroupVMFromMachgroupId(Bar.nBarId) + If IsNothing(CurrMachgroupVM) Then + EgtOutLog("Error in CALC ProcessResult. CUTID " & Bar.nBarId & "not found in project(MachGroup).") + Continue For + End If End If End If ' se necessario recupero feature If Line.nTASKID <> 0 Then If Bar.nProgramPage = ProjectType.PROJ Then CurrBTLFeatureVM = GetBTLFeatureVMFromBTLPartId(CurrBTLPartVM, Line.nTASKID) + If IsNothing(CurrBTLFeatureVM) Then + EgtOutLog("Error in CALC ProcessResult. TASKID " & Line.nTASKID & "not found in BTLPartVM " & CurrBTLPartVM.nPartId) + Continue For + End If Else CurrBTLFeatureVM = GetFeatureVMFromPartId(CurrPartVM, Line.nTASKID) + If IsNothing(CurrBTLFeatureVM) Then + EgtOutLog("Error in CALC ProcessResult. TASKID " & Line.nTASKID & "not found in PartVM " & CurrPartVM.nPartId) + Continue For + End If End If Else CurrBTLFeatureVM = Nothing @@ -535,13 +554,13 @@ Public Class CALCPanelVM .nGlobState = Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState} Select Case Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState Case Core.CalcStates.OK, CalcStates.INFO - Bar.nCmdType = CalcIntegration.CmdType.GENERATE + Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE Case Else If Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState = CalcStates.NOTCALCULATED Then Dim sBTLPartFilePath As String = Map.refProjManagerVM.CurrProj.sProjDirPath & "\" & Map.refProjectVM.BTLStructureVM.SelBTLPart.nPDN.ToString() & ".ori.bwe" If File.Exists(sBTLPartFilePath) Then File.Delete(sBTLPartFilePath) End If - Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN + Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN End Select TempBarList(0) = Bar BarList = TempBarList @@ -569,13 +588,13 @@ Public Class CALCPanelVM .nGlobState = SelMachGroup.nGlobalState} Select Case SelMachGroup.nGlobalState Case Core.CalcStates.OK, CalcStates.INFO - Bar.nCmdType = CalcIntegration.CmdType.GENERATE + Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE Case Else If SelMachGroup.nGlobalState = CalcStates.NOTCALCULATED Then Dim sMachGroupFilePath As String = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe" If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath) End If - Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN + Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN End Select TempBarList(0) = Bar BarList = TempBarList @@ -656,13 +675,13 @@ Public Class CALCPanelVM .nGlobState = CurrPart.nGlobalState} Select Case CurrPart.nGlobalState Case Core.CalcStates.OK, CalcStates.INFO - Bar.nCmdType = CalcIntegration.CmdType.GENERATE + Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE Case Else If CurrPart.nGlobalState = CalcStates.NOTCALCULATED Then Dim sBTLPartFilePath As String = Map.refProjManagerVM.CurrProj.sProjDirPath & "\" & CurrPart.nPDN.ToString() & ".ori.bwe" If File.Exists(sBTLPartFilePath) Then File.Delete(sBTLPartFilePath) End If - Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN + Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN End Select TempBarList.Add(Bar) Next @@ -687,13 +706,13 @@ Public Class CALCPanelVM .nGlobState = CurrMachGroup.nGlobalState} Select Case CurrMachGroup.nGlobalState Case Core.CalcStates.OK, CalcStates.INFO - Bar.nCmdType = CalcIntegration.CmdType.GENERATE + Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE Case Else If CurrMachGroup.nGlobalState = CalcStates.NOTCALCULATED Then Dim sMachGroupFilePath As String = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & CurrMachGroup.Name.ToString() & ".ori.bwe" If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath) End If - Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN + Bar.nCmdType = CalcIntegration.CmdTypes.CHECKGEN End Select TempBarList.Add(Bar) Next @@ -799,7 +818,7 @@ Public Class CALCPanelVM .nProjType = ProjType, .bBarOk = True, .nMachineName = Map.refMachinePanelVM.SelectedMachine.Name, - .nCmdType = CalcIntegration.CmdType.SIMULATE, + .nCmdType = CalcIntegration.CmdTypes.SIMULATE, .nGlobState = Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState} If Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState = CalcStates.NOTCALCULATED Then Dim sBTLPartFilePath As String = Map.refProjManagerVM.CurrProj.sProjDirPath & "\" & Map.refProjectVM.BTLStructureVM.SelBTLPart.nPDN.ToString() & ".ori.bwe" @@ -825,7 +844,7 @@ Public Class CALCPanelVM .nProjType = ProjType, .bBarOk = True, .nMachineName = MachineName, - .nCmdType = CalcIntegration.CmdType.SIMULATE, + .nCmdType = CalcIntegration.CmdTypes.SIMULATE, .nGlobState = SelMachGroup.nGlobalState} If SelMachGroup.nGlobalState = CalcStates.NOTCALCULATED Then Dim sMachGroupFilePath As String = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe" @@ -881,7 +900,7 @@ Public Class CALCPanelVM .nProjType = ProjType, .bBarOk = True, .nMachineName = Map.refMachinePanelVM.SelectedMachine.Name, - .nCmdType = CalcIntegration.CmdType.EDIT, + .nCmdType = CalcIntegration.CmdTypes.EDIT, .nGlobState = Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState} TempBarList(0) = Bar BarList = TempBarList diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb index e2ca1ab5..a257a90c 100644 --- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb @@ -266,7 +266,7 @@ Public Class LeftPanelVM EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & dStartOffset) Dim BeamMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.GetLastMachGroup() ' eseguo script creazione grezzo - If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then + If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then BeamMachGroup.DeleteMachGroup() Dim LogFile As String() = File.ReadAllLines(sLogPath) If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then @@ -308,7 +308,7 @@ Public Class LeftPanelVM EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0) Dim WallMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.MachGroupVMList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 1) ' eseguo script creazione grezzo - If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then + If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then ' elimino duplo e gruppo di lavorazione EgtErase(nPartDuploId) WallMachGroup.DeleteMachGroup() @@ -509,7 +509,7 @@ Public Class LeftPanelVM EgtRemoveRawPart(nRawId) nRawId = EgtGetFirstRawPart() End While - If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then + If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then Return False End If EgtSetInfo(nPartDuploId, MGR_PRT_ROT, PartToAdd.nROTATED) diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupVM.vb index cd773124..56d32cd3 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupVM.vb @@ -131,7 +131,7 @@ Public Class MyMachGroupVM BeamWallMachGroup = Map.refMachGroupPanelVM.GetLastMachGroup() ' eseguo script creazione grezzo Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt" - If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then + If Not ExecBeam(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then BeamWallMachGroup.DeleteMachGroup() Dim LogFile As String() = File.ReadAllLines(sLogPath) If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then @@ -192,7 +192,7 @@ Public Class MyMachGroupVM BeamWallMachGroup = Map.refMachGroupPanelVM.GetLastMachGroup() ' eseguo script creazione grezzo Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt" - If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then + If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then BeamWallMachGroup.DeleteMachGroup() Dim LogFile As String() = File.ReadAllLines(sLogPath) If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then @@ -241,7 +241,7 @@ Public Class MyMachGroupVM EgtRemoveRawPart(nRawId) nRawId = EgtGetFirstRawPart() End While - If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then Return False + If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then Return False Return True End Function @@ -324,6 +324,16 @@ Public Class MyMachGroupVM End If End Sub + Friend Sub ResetCalcTotalMachGroup() + ResetCalcMachGroup() + For Each Part In PartVMList + Part.ResetCalcPart() + For Each Feature As BTLFeatureVM In Part.FeatureVMList + Feature.ResetCalcFeature() + Next + Next + End Sub + #End Region ' Machgroup #Region "Parts" diff --git a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb index 9067cdc2..58197e60 100644 --- a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb @@ -367,7 +367,7 @@ Public Class OptimizePanelVM ' mostro risultati Dim sResult As String = "" For Each Section In NestingRunningWndVM.SectionProgressList - If Section.SParamList.Count = 0 Then + If Section.SectionPartList.Count > 0 AndAlso Section.SParamList.Count = 0 Then sResult &= Section.Section.sSectionXMaterial & ": no raw part found in the warehouse!" & Environment.NewLine End If For Each Part In Section.SectionPartList diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb index 2aa0cdeb..d61d9f69 100644 --- a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb @@ -673,10 +673,17 @@ Public Class ProjManagerVM Public Sub ExportProject() If Not ProjFileVM.VerifyProjectModification(CurrProj, ProjectType.PROJ) Then Return If IsNothing(CurrProj) Then Return + ' se assemblato me lo segno e lo smonto + Dim bShowBuilding As Boolean = False + If Map.refShowBeamPanelVM.bShowAll Then + ' verifico se assemblato e lo annullo per salvataggio + bShowBuilding = Map.refShowBeamPanelVM.ShowBuilding_IsChecked + If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(False, False) + End If ' apro finestra di salvataggio progetto Dim ExportDlg As New Microsoft.Win32.SaveFileDialog() With {.DefaultExt = ".ngexp", - .Filter = "ProjectExport (*.ngexp)|*.ngexp", - .FileName = CurrProj.nProjId.ToString("0000") & " - " & CurrProj.sBTLFileName & " - ProjectExport"} + .Filter = "ProjectExport (*.ngexp)|*.ngexp", + .FileName = CurrProj.nProjId.ToString("0000") & " - " & CurrProj.sBTLFileName & " - ProjectExport"} If ExportDlg.ShowDialog() <> True Then Return ' per ogni BTLInfo nel progetto riporto il relativo nome del BTL Dim nBTLInfoProjId As Integer @@ -735,6 +742,7 @@ Public Class ProjManagerVM EgtErase(nImpExpPartId) ' salvo eliminazione info inserite Map.refSceneHostVM.SaveProject() + If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(True, False) End Sub #End Region ' ExportProject @@ -848,6 +856,17 @@ Public Class ProjManagerVM For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLPartVMList EgtSetInfo(BTLPart.nPartId, BTL_PRT_PROJ, nNewProjId) Next + ' cambio indicazione proj in gruppo di assemblaggio + Dim AsseBaseId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE) + While AsseBaseId <> GDB_ID.NULL + Dim nAsseBaseProj As Integer = 0 + EgtGetInfo(AsseBaseId, BTL_PRT_PROJ, nAsseBaseProj) + If nAsseBaseProj = nImportProjId Then + EgtSetInfo(AsseBaseId, BTL_PRT_PROJ, NewProjIdList(nProjIndex)) + Exit While + End If + AsseBaseId = EgtGetNextName(AsseBaseId, ASSEBASE) + End While ' riporto nuovo ProjId nel layer BTLInfo EgtSetInfo(BTLInfoIdList(nProjIndex), BTL_PRT_PROJ, nNewProjId) ' resetto tutti gli stati di CALC @@ -885,8 +904,6 @@ Public Class ProjManagerVM ' elimino da Db DbControllers.m_ProjController.DeleteProj(nNewProjId) End If - '' salvo il progetto PROJ - ' Map.refSceneHostVM.SaveProject() ' aggiorno BTLParts su DB DbControllers.m_ProjController.UpdateBtlParts(nNewProjId, Map.refProjectVM.BTLStructureVM.BTLStructureM.BTLPartMList) ' resetto stato new @@ -921,6 +938,12 @@ Public Class ProjManagerVM DbControllers.m_ProdController.UpdatePType(nProdId, nType) ' setto la Macchina associata al Prod DbControllers.m_ProdController.UpdateMachine(nProdId, sMachine) + ' resetto tutti gli stati di CALC + For Each RawPart As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList + RawPart.ResetCalcTotalMachGroup() + Next + ' salvo il progetto PROD + EgtSaveFile(sProjFromPath(0), NGE.CMPTEXT) ' copio file progetto Dim sProjPath As String = String.Empty Dim sProdPath As String = sProdDir & "\" & nProdId.ToString("0000") & ".nge" @@ -943,8 +966,6 @@ Public Class ProjManagerVM ' elimino da DB DbControllers.m_ProdController.DeleteProd(nProdId) End If - ' salvo il progetto PROD - Map.refSceneHostVM.SaveProject() Dim MyMachGroupList As New List(Of MyMachGroupM) If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then For Each MachGroup In Map.refProjectVM.MachGroupPanelVM.m_MyMachGroupPanelM.MachGroupMList