- Migliorie Calc pezzi

- Correzione flip e rot dei duplo
- Cambiata gestione ricalcolo in supervisore
- Aggiunti controlli su comunicazione tra programmi
- Gestione apertura progetto con s/blocco duplo
- Gestione errore ricalcolo in supervisore
- Aggiunti controlli su cicli di comunicazione tra programmi
This commit is contained in:
Emmanuele Sassi
2022-02-03 21:49:05 +01:00
parent 568e98aec8
commit ee558cecd6
16 changed files with 243 additions and 229 deletions
+10
View File
@@ -703,6 +703,16 @@ Public Class BTLPartM
End Set
End Property
Private m_nFeaturesGlobalState As CalcStates
Public Property nFeaturesGlobalState As CalcStates
Get
Return m_nFeaturesGlobalState
End Get
Set(value As CalcStates)
m_nFeaturesGlobalState = value
End Set
End Property
Private m_nCALC_GlobalERR As Integer
Public Property nCALC_GlobalERR As Integer
Get
@@ -162,7 +162,8 @@ Public Module CalcIntegration
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 = CmdTypes.GENERATE Then
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
End If
bDone = True
nCurrBar += 1
@@ -177,7 +178,8 @@ Public Module CalcIntegration
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 = CmdTypes.GENERATE Then
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
End If
bDone = True
vProc(j).nBar = -1
@@ -199,7 +201,8 @@ Public Module CalcIntegration
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 = CmdTypes.GENERATE Then
RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
End If
bDone = True
vProc(j).nBar = -1
@@ -213,6 +213,16 @@ Public Class MyMachGroupM
End Set
End Property
Private m_bCALC_PartsGlobalState As CalcStates
Public Property bCALC_PartsGlobalState As CalcStates
Get
Return m_bCALC_PartsGlobalState
End Get
Set(value As CalcStates)
m_bCALC_PartsGlobalState = value
End Set
End Property
Private m_nCALC_GlobalERR As Integer
Public Property nCALC_GlobalERR As Integer
Get
@@ -270,23 +270,9 @@ Public Class MyMachGroupPanelM
Next
' aggiornamento dei Duplo
EgtDuploUpdate(nPartId)
' recupero flip e rot dell'originale
Dim dRotated As Double = 0
Dim dInverted As Double = 0
Dim dRotAng As Double = 0
Dim dFlipAng As Double = 0
EgtGetInfo(nPartId, BTL_PRT_ROTATED, dRotated)
EgtGetInfo(nPartId, BTL_PRT_INVERTED, dInverted)
' ripristino i valori di ROT e FLIP
For Duploindex = 0 To DuploArray.Length - 1
' recupero box del pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
' faccio flip e rotazione rispetto all'originale che ha sovrascritto posizione del duplo
dRotAng = RotArray(Duploindex) - dRotated
'EgtRotate(DuploArray(Duploindex), b3Part.Center, -Vector3d.Z_AX, dRotAng, GDB_RT.GLOB)
dFlipAng = FlipArray(Duploindex) - dInverted
'EgtRotate(DuploArray(Duploindex), b3Part.Center, Vector3d.X_AX, dFlipAng, GDB_RT.GLOB)
' 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
@@ -235,6 +235,12 @@ Public MustInherit Class MyMachGroupVM
End Set
End Property
Public ReadOnly Property nPartsGlobalState As CalcStates
Get
Return MyMachGroupM.bCALC_PartsGlobalState
End Get
End Property
Public Property nCALC_State As CalcStates
Get
Return MyMachGroupM.nCALC_State
@@ -539,6 +545,8 @@ Public MustInherit Class MyMachGroupVM
Public Overridable Sub CalcGlobalUpdate()
MyMachGroupM.nCALC_GlobalERR = nCALC_ERR
MyMachGroupM.nCALC_GlobalState = nCALC_State
' stato globale dei pezzi
MyMachGroupM.bCALC_PartsGlobalState = CalcStates.NOTCALCULATED
For Each Part In MyMachGroupM.PartMList
If Part.nCALC_GlobalState = CalcStates.NOTCALCULATED And nCALC_State < CalcStates.ERROR_ Then
MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState
@@ -548,6 +556,9 @@ Public MustInherit Class MyMachGroupVM
MyMachGroupM.nCALC_GlobalState = Part.nCALC_GlobalState
MyMachGroupM.nCALC_GlobalERR = Part.nCALC_GlobalERR
End If
If Part.nCALC_GlobalState > MyMachGroupM.bCALC_PartsGlobalState Then
MyMachGroupM.bCALC_PartsGlobalState = Part.nCALC_GlobalState
End If
If Part.nCALC_ROT <> 0 Then
MyMachGroupM.m_nCALC_ROT = Part.nCALC_ROT
End If
@@ -555,6 +566,7 @@ Public MustInherit Class MyMachGroupVM
MyMachGroupM.nCALC_FALL = Part.nCALC_FALL
End If
Next
NotifyPropertyChanged(NameOf(Calc_Background))
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
@@ -69,15 +69,24 @@ Public Class CALCPanelVM
If e.End_ <> CalcEndEventArgs.Results.OK Then
MessageBox.Show("Execution error (all processes are disabled)")
End If
' ciclo sui pezzi
Dim bNotOkFound As Boolean = False
For Each MachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
' se trovo pezzo errato, resetto tutti i successivi
If Not bNotOkFound AndAlso MachGroup.MyMachGroupM.m_nCALC_GlobalState <> CalcStates.OK AndAlso MachGroup.MyMachGroupM.m_nCALC_GlobalState <> CalcStates.INFO Then
bNotOkFound = True
End If
If bNotOkFound Then MachGroup.ResetProduce()
Next
Map.refProjectVM.ManageIsEnabled(True)
Map.refMyStatusBarVM.ResetStopProgress()
End Sub
Private Sub Calc_ProcessEnded(sender As Object, e As CalcProcessEndEventArgs)
Dim nRawid As Integer = e.m_Result.nBarId
If nRawid <= 0 Then Return
Dim Machgroup As MyMachGroupVM = GetMachgroupVMFromMachgroupId(nRawid)
Machgroup.CALCEnd()
'Dim nRawid As Integer = e.m_Result.nBarId
'If nRawid <= 0 Then Return
'Dim Machgroup As MyMachGroupVM = GetMachgroupVMFromMachgroupId(nRawid)
'Machgroup.CALCEnd()
End Sub
Private Shared Sub ProcessResults(Bar As Bar)
@@ -337,8 +346,6 @@ Public Class CALCPanelVM
Case Core.CalcStates.OK, Core.CalcStates.INFO
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.CmdTypes.CHECKGEN
End Select
TempBarList(MachGroupIndex) = Bar
@@ -455,7 +455,7 @@ Public Class LeftPanelVM
If IsNothing(Map.refSupervisorManagerVM.CurrProd) Then Return
If IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList) OrElse Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Count = 0 Then Return
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.nProduction_State <= ItemState.Confirmed) Then Return
If Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.dtStartTime <> DateTime.MinValue) Then Return
If Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.dtStartTime = DateTime.MinValue) Then Return
Dim ToDoList As List(Of MachGroupVM) = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Where(Function(x As MyMachGroupVM) x.nProduction_State <= 1 AndAlso Not x.bResetWhileCutting AndAlso x.dtStartTime = DateTime.MinValue AndAlso Not x.bToBeProduced).ToList()
If Not IsNothing(ToDoList) AndAlso ToDoList.Count > 0 Then
MyMachGroupVM.Produce(ToDoList)
@@ -134,8 +134,13 @@ Public Class MyMachGroupVM
Public Overrides Sub CALCEnd()
' aggiorno stato per lancio in macchina
If MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.OK OrElse MyMachGroupM.m_nCALC_GlobalState = Core.CalcStates.INFO Then
m_bCNReCalculated = True
NotifyPropertyChanged(NameOf(Production_Background))
If m_bToBeProduced AndAlso Not m_bCNReCalculated Then
m_bCNReCalculated = True
NotifyPropertyChanged(NameOf(Production_Background))
End If
Else
ResetProduce()
UpdateProduceIsEnabledForAll()
End If
End Sub
@@ -29,9 +29,15 @@ Public Class ViewerOptimizerComm
Case Core.StatusMapOpType.MachGroupAdd
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Add(MachGroupModification.ItemId, {MachGroupModification.Index, MachGroupModification.Index})
Case Core.StatusMapOpType.MachGroupMod
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList(MachGroupModification.ItemId)(0) = MachGroupModification.Index
If Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.ContainsKey(MachGroupModification.ItemId) Then
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList(MachGroupModification.ItemId)(0) = MachGroupModification.Index
Else
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Add(MachGroupModification.ItemId, {MachGroupModification.Index, 0})
End If
Case Core.StatusMapOpType.MachGroupRem
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Remove(MachGroupModification.ItemId)
If Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.ContainsKey(MachGroupModification.ItemId) Then
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList.Remove(MachGroupModification.ItemId)
End If
Case Core.StatusMapOpType.MachGroupAssignedToSupervisor
Dim MachgroupIndexes As Integer() = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupFullList(MachGroupModification.ItemId)
' se indice di aggiornamento file diverso da indice ultima modifica
@@ -42,18 +48,20 @@ Public Class ViewerOptimizerComm
Map.refProjectVM.SupervisorMachGroupPanelVM.ReloadProjectFile()
Else
Dim ProdMachGroup As MyMachGroupVM = Map.refProjectVM.ProdMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = MachGroupModification.ItemId)
ProdMachGroup.dtStartTime = DateTime.MinValue
ProdMachGroup.dtEndTime = DateTime.MinValue
ProdMachGroup.MyMachGroupM.SetProductionState(Core.ItemState.Assigned)
Dim DBMachGroup As MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(Map.refSupervisorManagerVM.CurrProd.nProdId, ProdMachGroup.Id)
ProdMachGroup.SetProductionIndex(DBMachGroup.ProdIndex)
For Each Part In ProdMachGroup.PartVMList
Part.dtStartTime = DateTime.MinValue
Part.dtEndTime = DateTime.MinValue
Part.nProduction_State = Core.ItemState.Assigned
Next
' lo aggiungo alla lista di MachGroup
Map.refProjectVM.SupervisorMachGroupPanelVM.AddMachGroupToSupervisor(ProdMachGroup)
If Not IsNothing(ProdMachGroup) Then
ProdMachGroup.dtStartTime = DateTime.MinValue
ProdMachGroup.dtEndTime = DateTime.MinValue
ProdMachGroup.MyMachGroupM.SetProductionState(Core.ItemState.Assigned)
Dim DBMachGroup As MachGroupModel = DbControllers.m_MachGroupController.FindByMachGroupId(Map.refSupervisorManagerVM.CurrProd.nProdId, ProdMachGroup.Id)
If Not IsNothing(DBMachGroup) Then ProdMachGroup.SetProductionIndex(DBMachGroup.ProdIndex)
For Each Part In ProdMachGroup.PartVMList
Part.dtStartTime = DateTime.MinValue
Part.dtEndTime = DateTime.MinValue
Part.nProduction_State = Core.ItemState.Assigned
Next
' lo aggiungo alla lista di MachGroup
Map.refProjectVM.SupervisorMachGroupPanelVM.AddMachGroupToSupervisor(ProdMachGroup)
End If
End If
End Select
ElseIf MachGroupModification.ItemType = Core.StatusMapItemType.Comm AndAlso MachGroupModification.Operation = Core.StatusMapOpType.ViewOptimStoped Then
@@ -1277,6 +1277,12 @@ Public Class BTLPartVM
End Set
End Property
Public ReadOnly Property nFeaturesGlobalState As CalcStates
Get
Return m_BTLPartM.nFeaturesGlobalState
End Get
End Property
Public Property nState As CalcStates
Get
Return m_BTLPartM.nState
@@ -1673,6 +1679,7 @@ Public Class BTLPartVM
Friend Sub CalcGlobalUpdate(Optional bFeatureFirst As Boolean = False)
m_BTLPartM.nCALC_GlobalERR = nCALC_ERR
m_BTLPartM.nGlobalState = nState
m_BTLPartM.nFeaturesGlobalState = CalcStates.NOTCALCULATED
If nState > CalcStates.NOTCALCULATED Then
For Each Feature In BTLFeatureVMList
If Not Feature.bDO And Not bFeatureFirst Then Continue For
@@ -1691,6 +1698,9 @@ Public Class BTLPartVM
m_BTLPartM.nGlobalState = Feature.nState
m_BTLPartM.nCALC_GlobalERR = Feature.nCALC_ERR
End If
If Feature.nState > m_BTLPartM.nFeaturesGlobalState Then
m_BTLPartM.nFeaturesGlobalState = Feature.nState
End If
If Feature.nCALC_ROT <> 0 Then
m_BTLPartM.m_nCALC_ROT = Feature.nCALC_ROT
End If
@@ -607,7 +607,7 @@ Public Class CALCPanelVM
Case Core.CalcStates.OK, CalcStates.INFO
Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE
Case Else
If Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState = CalcStates.NOTCALCULATED Then
If Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState = CalcStates.NOTCALCULATED OrElse Map.refProjectVM.BTLStructureVM.SelBTLPart.nFeaturesGlobalState > CalcStates.INFO 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
@@ -641,7 +641,7 @@ Public Class CALCPanelVM
Case Core.CalcStates.OK, CalcStates.INFO
Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE
Case Else
If SelMachGroup.nGlobalState = CalcStates.NOTCALCULATED Then
If SelMachGroup.nGlobalState = CalcStates.NOTCALCULATED OrElse (SelMachGroup.nPartsGlobalState > CalcStates.INFO) Then
Dim sMachGroupFilePath As String = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe"
If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath)
End If
@@ -599,24 +599,7 @@ Public Class MyMachGroupVM
EgtDuploResetLocked(Part.nPartId)
' se da aggiornare, ripristino info del duplo che verrebbero perse
If bDuploToUpdate Then
' recupero flip e rot dell'originale
Dim nOrigPartId As Integer = GDB_ID.NULL
EgtGetInfo(Part.nPartId, GDB_SI_DUPSOU, nOrigPartId)
Dim dRotated As Double = 0
Dim dInverted As Double = 0
Dim dRotAng As Double = 0
Dim dFlipAng As Double = 0
EgtGetInfo(nOrigPartId, BTL_PRT_ROTATED, dRotated)
EgtGetInfo(nOrigPartId, BTL_PRT_INVERTED, dInverted)
' ripristino i valori di ROT e FLIP
' recupero box del pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(Part.nPartId, GDB_BB.STANDARD, b3Part)
' faccio flip e rotazione rispetto all'originale che ha sovrascritto posizione del duplo
dRotAng = DuploRot - dRotated
'EgtRotate(Part.nPartId, b3Part.Center, -Vector3d.Z_AX, dRotAng, GDB_RT.GLOB)
dFlipAng = DuploFlip - dInverted
'EgtRotate(Part.nPartId, b3Part.Center, Vector3d.X_AX, dFlipAng, GDB_RT.GLOB)
EgtSetInfo(Part.nPartId, MGR_PRT_ROT, DuploRot)
EgtSetInfo(Part.nPartId, MGR_PRT_FLIP, DuploFlip)
If nBWType = BWType.WALL Then
@@ -342,71 +342,46 @@ Public Class PartVM
' verifico se bloccare o sbloccare duplo
Dim bLocked As Boolean = True
EgtDuploGetLocked(nPartId, bLocked)
If (PartModel.State <= ItemState.ND And bLocked) Then
If PartModel.State <= ItemState.ND And bLocked Then
' recupero se Duplo da aggiornare
Dim bDuploToUpdate As Boolean = False
EgtGetInfo(nPartId, GDB_SI_DUPTOUPDATE, bDuploToUpdate)
' verifico tipo di progetto
Dim nBtlInfoId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
Dim nBWType As Integer = 0
EgtGetInfo(nBtlInfoId, BTL_GEN_PROJTYPE, nBWType)
Dim bTotIsModified As Boolean = False
' verifico se c'é PRID sugli 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
If EgtExistsInfo(nOutlineId, MGR_FTR_PRID) Then
nOutlineId = EgtGetNext(nOutlineId)
Continue While
Else
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
nPRId += 1
End If
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
bTotIsModified = True
Dim DuploList As New List(Of Integer)
EgtDuploList(nPartId, DuploList)
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
RotArray(Duploindex) = 0
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
FlipArray(Duploindex) = 0
EgtGetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
If FlipArray(Duploindex) <> 0 Then FlipArray(Duploindex) = 180
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
EgtGetInfo(nPartId, MGR_PRT_ROT, DuploRot)
EgtGetInfo(nPartId, MGR_PRT_FLIP, DuploFlip)
If DuploFlip <> 0 Then DuploFlip = 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)
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nGlobPRId As Integer = 1
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
' verifico che sia outline
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
Dim nPRId As Integer = 0
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId)
nPRId = nGlobPRId
nGlobPRId += 1
End If
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
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
QArray(Duploindex)(sKey).Add(QKey, QValue)
QParams(sKey).Add(QKey, QValue)
End If
Next
End If
@@ -414,22 +389,22 @@ Public Class PartVM
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
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
nPRId = 0
Dim nPRId As Integer = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
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
QArray(Duploindex)(sKey).Add(QKey, QValue)
QParams(sKey).Add(QKey, QValue)
End If
Next
End If
@@ -437,43 +412,29 @@ Public Class PartVM
End While
End If
End If
Next
End If
' sblocco Duplo
EgtDuploResetLocked(nPartId)
' recupero flip e rot dell'originale
Dim dRotated As Double = 0
Dim dInverted As Double = 0
Dim dRotAng As Double = 0
Dim dFlipAng As Double = 0
EgtGetInfo(nPartId, BTL_PRT_ROTATED, dRotated)
EgtGetInfo(nPartId, BTL_PRT_INVERTED, dInverted)
' ripristino i valori di ROT e FLIP
For Duploindex = 0 To DuploArray.Length - 1
' recupero box del pezzo
Dim b3Part As New BBox3d
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
' faccio flip e rotazione rispetto all'originale che ha sovrascritto posizione del duplo
dRotAng = RotArray(Duploindex) - dRotated
'EgtRotate(DuploArray(Duploindex), b3Part.Center, -Vector3d.Z_AX, dRotAng)
dFlipAng = FlipArray(Duploindex) - dInverted
'EgtRotate(DuploArray(Duploindex), b3Part.Center, Vector3d.X_AX, dFlipAng)
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_ROT, RotArray(Duploindex))
EgtSetInfo(DuploArray(Duploindex), MGR_PRT_FLIP, FlipArray(Duploindex))
' se da aggiornare, ripristino info del duplo che verrebbero perse
If bDuploToUpdate Then
' 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
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), 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
nPRId = 0
Dim nPRId As Integer = 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)
If QParams.ContainsKey(sKey) Then
For Each QPar In QParams(sKey)
EgtSetInfo(nOutlineId, QPar.Key, QPar.Value)
Next
End If
@@ -482,19 +443,19 @@ Public Class PartVM
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
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
nPRId = 0
Dim nPRId As Integer = 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)
If QParams.ContainsKey(sKey) Then
For Each QPar In QParams(sKey)
EgtSetInfo(nFeatureId, QPar.Key, QPar.Value)
Next
End If
@@ -503,13 +464,13 @@ Public Class PartVM
End While
End If
End If
Next
If bTotIsModified Then
Dim CurrFilePath As String = ""
EgtGetCurrFilePath(CurrFilePath)
EgtSaveFile(CurrFilePath, NGE.CMPTEXT)
End If
ElseIf (PartModel.State > ItemState.ND And Not bLocked) Then
nProduction_State = ItemState.ND
NotifyPropertyChanged(NameOf(Background))
If bDuploToUpdate Then
ResetCalcTotalPart()
End If
ElseIf PartModel.State > ItemState.ND And Not bLocked Then
EgtDuploSetLocked(nPartId)
End If
End If
@@ -112,7 +112,7 @@ Public Class OptimizePanelVM
End Property
Public ReadOnly Property Optimize_Visibility As Visibility
Get
Return If(Map.refMainMenuVM.SelPage = Pages.MACHINING AndAlso
Return If(Map.refMainMenuVM.SelPage = Pages.MACHINING AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso
(Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM OrElse
(Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))), Visibility.Visible, Visibility.Collapsed)
End Get
@@ -31,28 +31,30 @@ Public Class SupervisorComm
' recupero elementi modificati
Dim MachGroupList As List(Of StatusMapModel) = DbControllers.m_StatusMapController.GetFrom(Map.refProjManagerVM.CurrProj.nModificationIndex + 1)
Dim bReloadFile As Boolean = False
For Each MachGroupModification In MachGroupList
If MachGroupModification.ItemType = StatusMapItemType.Part Then
Dim BTLPart As BTLPartVM = CALCPanelVM.GetBTLPartVMFromPartId(MachGroupModification.ItemId)
Select Case MachGroupModification.Operation
Case Core.StatusMapOpType.PartStart
If Not IsNothing(MachGroupList) Then
For Each MachGroupModification In MachGroupList
If MachGroupModification.ItemType = StatusMapItemType.Part Then
Dim BTLPart As BTLPartVM = CALCPanelVM.GetBTLPartVMFromPartId(MachGroupModification.ItemId)
Select Case MachGroupModification.Operation
Case Core.StatusMapOpType.PartStart
' non faccio nulla
Case Core.StatusMapOpType.PartEnd, StatusMapOpType.ResetPartStart, StatusMapOpType.ResetPartEnd
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.nDONE))
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.Background))
End Select
ElseIf MachGroupModification.ItemType = StatusMapItemType.Comm Then
' se arriva richiesta da supervisore di blocco e salvataggio
Select Case MachGroupModification.Operation
Case StatusMapOpType.SupervisorStopRequest
' blocco interfaccia fino a notifica di sblocco
SupervisorCommThread.SetViewerOptimizerBlocked(True)
Case Core.StatusMapOpType.PartEnd, StatusMapOpType.ResetPartStart, StatusMapOpType.ResetPartEnd
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.nDONE))
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.Background))
End Select
ElseIf MachGroupModification.ItemType = StatusMapItemType.Comm Then
' se arriva richiesta da supervisore di blocco e salvataggio
Select Case MachGroupModification.Operation
Case StatusMapOpType.SupervisorStopRequest
' blocco interfaccia fino a notifica di sblocco
SupervisorCommThread.SetViewerOptimizerBlocked(True)
'' chiedo se salvare
Case StatusMapOpType.SupervisorReleaseStop
SupervisorCommThread.SetViewerOptimizerBlocked(False)
End Select
End If
Next
Case StatusMapOpType.SupervisorReleaseStop
SupervisorCommThread.SetViewerOptimizerBlocked(False)
End Select
End If
Next
End If
' aggiorno indice del proj
Map.refProjManagerVM.CurrProj.SetModificationIndex(nModificationIndex)
End If
@@ -75,75 +77,91 @@ Public Class SupervisorComm
If nModificationIndex <> Map.refProdManagerVM.CurrProd.nModificationIndex Then
' recupero elementi modificati
Dim MachGroupList As List(Of StatusMapModel) = DbControllers.m_StatusMapController.GetFrom(Map.refProdManagerVM.CurrProd.nModificationIndex + 1)
Dim bReloadFile As Boolean = False
For Each MachGroupModification In MachGroupList
If Not SupervisorCommThread.bViewerOptimizerBlocked AndAlso MachGroupModification.ItemType = StatusMapItemType.MachGroup Then
Dim MachGroup As MyMachGroupVM = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = MachGroupModification.ItemId)
Select Case MachGroupModification.Operation
Case Core.StatusMapOpType.PartStart
MachGroup.dtStartTime = MachGroupModification.DtEvent
MachGroup.nProduction_State = ItemState.WIP
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
Case Core.StatusMapOpType.PartEnd
MachGroup.dtEndTime = MachGroupModification.DtEvent
MachGroup.nProduction_State = ItemState.Produced
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
Case Core.StatusMapOpType.ResetPartStart
MachGroup.dtStartTime = DateTime.MinValue
MachGroup.nProduction_State = ItemState.Assigned
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
Case Core.StatusMapOpType.ResetPartEnd
MachGroup.dtEndTime = DateTime.MinValue
MachGroup.nProduction_State = ItemState.WIP
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
Case Core.StatusMapOpType.MachGroupRemovedFromSupervisor
MachGroup.ResetSupervisorId()
End Select
ElseIf MachGroupModification.ItemType = StatusMapItemType.Part Then
Dim BTLPart As BTLPartVM = CALCPanelVM.GetBTLPartVMFromPartId(MachGroupModification.ItemId)
Dim Part As PartVM = CALCPanelVM.GetPartVMFromPartId(MachGroupModification.ItemId)
Select Case MachGroupModification.Operation
Case Core.StatusMapOpType.PartStart
Part.dtStartTime = MachGroupModification.DtEvent
Part.nProduction_State = ItemState.WIP
Part.NotifyPropertyChanged(NameOf(Part.Background))
Case Core.StatusMapOpType.PartEnd
Part.dtEndTime = MachGroupModification.DtEvent
Part.nProduction_State = ItemState.Produced
Part.NotifyPropertyChanged(NameOf(Part.Background))
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.nDONE))
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.Background))
Case Core.StatusMapOpType.ResetPartStart
Part.dtStartTime = DateTime.MinValue
Part.nProduction_State = ItemState.Assigned
Part.NotifyPropertyChanged(NameOf(Part.Background))
Case Core.StatusMapOpType.ResetPartEnd
Part.dtEndTime = DateTime.MinValue
Part.nProduction_State = ItemState.WIP
Part.NotifyPropertyChanged(NameOf(Part.Background))
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.nDONE))
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.Background))
End Select
ElseIf MachGroupModification.ItemType = StatusMapItemType.Comm Then
' se arriva richiesta da supervisore di blocco e salvataggio
Select Case MachGroupModification.Operation
Case StatusMapOpType.SupervisorStopRequest
' blocco interfaccia fino a notifica di sblocco
SupervisorCommThread.SetViewerOptimizerBlocked(True)
If Not IsNothing(MachGroupList) Then
Dim bReloadFile As Boolean = False
For Each MachGroupModification In MachGroupList
If Not SupervisorCommThread.bViewerOptimizerBlocked AndAlso MachGroupModification.ItemType = StatusMapItemType.MachGroup Then
Dim MachGroup As MyMachGroupVM = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = MachGroupModification.ItemId)
If Not IsNothing(MachGroup) Then
Select Case MachGroupModification.Operation
Case Core.StatusMapOpType.PartStart
MachGroup.dtStartTime = MachGroupModification.DtEvent
MachGroup.nProduction_State = ItemState.WIP
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
Case Core.StatusMapOpType.PartEnd
MachGroup.dtEndTime = MachGroupModification.DtEvent
MachGroup.nProduction_State = ItemState.Produced
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
Case Core.StatusMapOpType.ResetPartStart
MachGroup.dtStartTime = DateTime.MinValue
MachGroup.nProduction_State = ItemState.Assigned
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
Case Core.StatusMapOpType.ResetPartEnd
MachGroup.dtEndTime = DateTime.MinValue
MachGroup.nProduction_State = ItemState.WIP
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.nProduction_State))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.Background))
Case Core.StatusMapOpType.MachGroupRemovedFromSupervisor
MachGroup.ResetSupervisorId()
End Select
End If
ElseIf MachGroupModification.ItemType = StatusMapItemType.Part Then
Dim BTLPart As BTLPartVM = CALCPanelVM.GetBTLPartVMFromPartId(MachGroupModification.ItemId)
Dim Part As PartVM = CALCPanelVM.GetPartVMFromPartId(MachGroupModification.ItemId)
Select Case MachGroupModification.Operation
Case Core.StatusMapOpType.PartStart
If Not IsNothing(Part) Then
Part.dtStartTime = MachGroupModification.DtEvent
Part.nProduction_State = ItemState.WIP
Part.NotifyPropertyChanged(NameOf(Part.Background))
End If
Case Core.StatusMapOpType.PartEnd
If Not IsNothing(Part) Then
Part.dtEndTime = MachGroupModification.DtEvent
Part.nProduction_State = ItemState.Produced
Part.NotifyPropertyChanged(NameOf(Part.Background))
End If
If Not IsNothing(BTLPart) Then
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.nDONE))
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.Background))
End If
Case Core.StatusMapOpType.ResetPartStart
If Not IsNothing(Part) Then
Part.dtStartTime = DateTime.MinValue
Part.nProduction_State = ItemState.Assigned
Part.NotifyPropertyChanged(NameOf(Part.Background))
End If
Case Core.StatusMapOpType.ResetPartEnd
If Not IsNothing(Part) Then
Part.dtEndTime = DateTime.MinValue
Part.nProduction_State = ItemState.WIP
Part.NotifyPropertyChanged(NameOf(Part.Background))
End If
If Not IsNothing(BTLPart) Then
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.nDONE))
BTLPart.NotifyPropertyChanged(NameOf(BTLPart.Background))
End If
End Select
ElseIf MachGroupModification.ItemType = StatusMapItemType.Comm Then
' se arriva richiesta da supervisore di blocco e salvataggio
Select Case MachGroupModification.Operation
Case StatusMapOpType.SupervisorStopRequest
' blocco interfaccia fino a notifica di sblocco
SupervisorCommThread.SetViewerOptimizerBlocked(True)
'' chiedo se salvare
'Map.refMainWindowVM.m_SupervisorStop = True
Case StatusMapOpType.SupervisorReleaseStop
Dim MachGroupId As Integer = -1
If Not String.IsNullOrWhiteSpace(MachGroupModification.Val) Then Integer.TryParse(MachGroupModification.Val, MachGroupId)
If IsNothing(MachGroupId) Then MachGroupId = -1
SupervisorCommThread.SetViewerOptimizerBlocked(False, MachGroupId)
'Map.refMainWindowVM.m_SupervisorStop = False
End Select
End If
Next
Case StatusMapOpType.SupervisorReleaseStop
Dim MachGroupId As Integer = -1
If Not String.IsNullOrWhiteSpace(MachGroupModification.Val) Then Integer.TryParse(MachGroupModification.Val, MachGroupId)
If IsNothing(MachGroupId) Then MachGroupId = -1
SupervisorCommThread.SetViewerOptimizerBlocked(False, MachGroupId)
'Map.refMainWindowVM.m_SupervisorStop = False
End Select
End If
Next
End If
' aggiorno indice del prod
Map.refProdManagerVM.CurrProd.SetModificationIndex(nModificationIndex)
End If
@@ -356,6 +356,7 @@ Public Class TopPanelVM
Dim SelPart As PartVM = SelMachGroup.SelPart
If IsNothing(SelPart) Then Return
SelPart.DeletePart()
SelMachGroup.UpdateUsage()
SelMachGroup.ResetCalcMachGroup()
End Sub