Modifiche per funzionamento travi

Correzioni e migliorie varie
This commit is contained in:
Emmanuele Sassi
2021-05-10 18:35:08 +02:00
parent 0457bed4ba
commit ee422c8e17
20 changed files with 479 additions and 282 deletions
+11 -4
View File
@@ -274,10 +274,17 @@ Public Class BTLFeatureM
Dim nFall As Integer = 0
Dim sMsg As String = ""
Dim bCalc As Boolean = False
bCalc = EgtGetInfo(NewBTLFeature.nFeatureId, ITG_PROJ_ERR, nErr)
EgtGetInfo(nFeatureId, ITG_PROJ_ROT, nRot)
EgtGetInfo(nFeatureId, ITG_PROJ_FALL, nFall)
EgtGetInfo(nFeatureId, ITG_PROJ_MSG, sMsg)
If IsNothing(ParentPart) Then
bCalc = EgtGetInfo(NewBTLFeature.nFeatureId, ITG_PROD_ERR, nErr)
EgtGetInfo(nFeatureId, ITG_PROD_ROT, nRot)
EgtGetInfo(nFeatureId, ITG_PROD_FALL, nFall)
EgtGetInfo(nFeatureId, ITG_PROD_MSG, sMsg)
Else
bCalc = EgtGetInfo(NewBTLFeature.nFeatureId, ITG_PROJ_ERR, nErr)
EgtGetInfo(nFeatureId, ITG_PROJ_ROT, nRot)
EgtGetInfo(nFeatureId, ITG_PROJ_FALL, nFall)
EgtGetInfo(nFeatureId, ITG_PROJ_MSG, sMsg)
End If
If Not bCalc Then
NewBTLFeature.m_nState = CalcStates.NOTCALCULATED
NewBTLFeature.m_nCALC_ERR = 0
+1
View File
@@ -878,6 +878,7 @@ Public Class BTLPartM
NewBTLPart.m_nState = CalcStates.NOTCALCULATED
End If
End If
EgtGetInfo(nPartId, ITG_PROD_TIME, NewBTLPart.m_nCALC_TIME)
Return NewBTLPart
End Function
+30
View File
@@ -80,6 +80,36 @@ Public Class BeamM
End If
' leggo feature
NewBeamM.m_FeatureMList = LoadBTLFeatures(nPartId)
' leggo calc error
Dim nErr As Integer = 0
Dim nRot As Integer = 0
Dim nFall As Integer = 0
Dim sMsg As String = ""
Dim bCalc As Boolean = False
bCalc = EgtGetInfo(nPartId, ITG_PROD_ERR, nErr)
EgtGetInfo(nPartId, ITG_PROD_ROT, nRot)
EgtGetInfo(nPartId, ITG_PROD_FALL, nFall)
EgtGetInfo(nPartId, ITG_PROD_MSG, sMsg)
If Not bCalc Then
NewBeamM.m_nState = CalcStates.NOTCALCULATED
NewBeamM.m_nCALC_ERR = -1
NewBeamM.m_nCALC_ROT = 0
NewBeamM.m_nCALC_FALL = 0
NewBeamM.m_sCALC_MSG = ""
Else
NewBeamM.m_nCALC_ERR = nErr
NewBeamM.m_nCALC_ROT = nRot
NewBeamM.m_nCALC_FALL = nFall
NewBeamM.m_sCALC_MSG = sMsg
If nErr = 0 Then
NewBeamM.m_nState = CalcStates.OK
ElseIf nErr > 1 Then
NewBeamM.m_nState = CalcStates.ERROR_
ElseIf nErr < 1 Then
NewBeamM.m_nState = CalcStates.NOTCALCULATED
End If
End If
EgtGetInfo(nPartId, ITG_PROD_TIME, NewBeamM.m_nCALC_TIME)
Return NewBeamM
End Function
+1
View File
@@ -242,6 +242,7 @@
Friend Const ITG_PROD_ERR As String = "PROD_ERR"
Friend Const ITG_PROD_MSG As String = "PROD_MSG"
Friend Const ITG_PROD_ROT As String = "PROD_ROT"
Friend Const ITG_PROD_FALL As String = "PROD_FALL"
Friend Const ITG_PROD_TIME As String = "PROD_TIME"
' parametri errori integration
+2 -2
View File
@@ -116,8 +116,8 @@
<Compile Include="Utility\BTLIniFile.vb" />
<Compile Include="Utility\Command.vb" />
<Compile Include="Utility\VMBase.vb" />
<Compile Include="Wall.vb" />
<Compile Include="WallMachGroup.vb" />
<Compile Include="WallM.vb" />
<Compile Include="WallMachGroupM.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
@@ -23,8 +23,6 @@ Public Class MyMachGroupPanelM
NewMyMachGroupPanelM.m_DefaultMachine = ""
' aggiorno copie
UpdateDuplo()
'''' elimino copie da cancellare
'''DeleteDuplo()
' recupero i MachGroup
NewMyMachGroupPanelM.m_MachGroupMList = LoadMyMachGroups(MachineList)
Return NewMyMachGroupPanelM
@@ -52,7 +50,7 @@ Public Class MyMachGroupPanelM
ElseIf UsedMachine.nType = MachineType.BEAM Then
TempList.Add(BeamMachGroupM.CreateBeamMachGroup(nId, sName, sMachine))
ElseIf UsedMachine.nType = MachineType.WALL Then
TempList.Add(New WallMachGroup(nId, sName, sMachine))
TempList.Add(WallMachGroupM.CreateWallMachGroup(nId, sName, sMachine))
End If
nId = EgtGetNextMachGroup(nId)
End While
@@ -81,7 +79,7 @@ Public Class MyMachGroupPanelM
ElseIf UsedMachine.nType = MachineType.BEAM Then
TempList.Add(BeamMachGroupM.CreateBeamMachGroup(nId, sName, sMachine))
ElseIf UsedMachine.nType = MachineType.WALL Then
TempList.Add(New WallMachGroup(nId, sName, sMachine))
TempList.Add(WallMachGroupM.CreateWallMachGroup(nId, sName, sMachine))
End If
End If
nId = EgtGetNextMachGroup(nId)
@@ -103,7 +101,7 @@ Public Class MyMachGroupPanelM
ElseIf nMachineType = MachineType.BEAM Then
MachGroupM = BeamMachGroupM.CreateBeamMachGroup(NewMachGroupID(), sMachName)
ElseIf nMachineType = MachineType.WALL Then
MachGroupM = WallMachGroup.CreateMachGroup(NewMachGroupID(), sMachName)
MachGroupM = WallMachGroupM.CreateWallMachGroup(NewMachGroupID(), sMachName)
End If
If IsNothing(MachGroupM) Then Return Nothing
AddMachGroup(MachGroupM)
-47
View File
@@ -1,47 +0,0 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class Wall
Inherits PartM
Protected m_dPOSY As Double
Public Property dPOSY As Double
Get
Return m_dPOSY
End Get
Set(value As Double)
m_dPOSY = value
End Set
End Property
Protected m_dROT As Double
Public Property dROT As Double
Get
Return m_dROT
End Get
Set(value As Double)
m_dROT = value
End Set
End Property
Protected m_dFLIP As Double
Public Property dFLIP As Double
Get
Return m_dFLIP
End Get
Set(value As Double)
m_dFLIP = value
End Set
End Property
#Region "CONSTRUCTOR"
Sub New(nParentMachGroup As MyMachGroupM, nPartId As Integer)
MyBase.New(nParentMachGroup, nPartId)
End Sub
#End Region ' CONSTRUCTOR
End Class
+112
View File
@@ -0,0 +1,112 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class WallM
Inherits PartM
Protected m_dPOSY As Double
Public Property dPOSY As Double
Get
Return m_dPOSY
End Get
Set(value As Double)
m_dPOSY = value
End Set
End Property
Protected m_dROT As Double
Public Property dROT As Double
Get
Return m_dROT
End Get
Set(value As Double)
m_dROT = value
End Set
End Property
Protected m_dFLIP As Double
Public Property dFLIP As Double
Get
Return m_dFLIP
End Get
Set(value As Double)
m_dFLIP = value
End Set
End Property
#Region "CONSTRUCTOR"
Protected Sub New(nParentMachGroup As MyMachGroupM, nPartId As Integer)
MyBase.New(nParentMachGroup, nPartId)
End Sub
Public Shared Function CreateWall(nParentMachGroup As MyMachGroupM, nPartId As Integer, nRawPartId As Integer) As WallM
Dim NewWallM As New WallM(nParentMachGroup, nPartId)
' leggo info pezzo
EgtGetInfo(nPartId, BTL_PRT_PROJ, NewWallM.m_nProjId)
EgtGetInfo(nPartId, BTL_PRT_PDN, NewWallM.m_nPDN)
EgtGetInfo(nPartId, BTL_PRT_NAM, NewWallM.m_sNAM)
EgtGetInfo(nPartId, BTL_PRT_L, NewWallM.m_dL)
EgtGetInfo(nPartId, BTL_PRT_W, NewWallM.m_dW)
EgtGetInfo(nPartId, BTL_PRT_H, NewWallM.m_dH)
EgtGetInfo(nPartId, BTL_PRT_CNT, NewWallM.m_nCNT)
Dim nTemp As Integer = 0
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
nTemp = 0
End If
NewWallM.SetRotated(nTemp)
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
nTemp = 0
End If
NewWallM.SetInverted(nTemp)
' leggo PosX, PosY, Rot e Flip
Dim sInfo As String = ""
Dim Index = 1
Dim sSplitInfo() As String
Dim bFound As Boolean = False
While EgtGetInfo(NewWallM.m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
If Not String.IsNullOrWhiteSpace(sInfo) Then
sSplitInfo = sInfo.Split(","c)
If sSplitInfo(0) = nPartId Then
bFound = True
Exit While
End If
End If
Index += 1
End While
If bFound Then
StringToDouble(sSplitInfo(1), NewWallM.m_dPOSX)
StringToDouble(sSplitInfo(2), NewWallM.m_dPOSY)
StringToDouble(sSplitInfo(3), NewWallM.m_dROT)
StringToDouble(sSplitInfo(4), NewWallM.m_dFLIP)
End If
' leggo feature
NewWallM.m_FeatureMList = LoadBTLFeatures(nPartId)
Return NewWallM
End Function
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Shared Function LoadBTLFeatures(nPartId As Integer) As List(Of BTLFeatureM)
Dim TempList As New List(Of BTLFeatureM)
Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
While nFeatureId <> GDB_ID.NULL
' verifico che sia una feature
Dim nGRP As Integer
If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
' creo la feature
TempList.Add(BTLFeatureM.CreateBTLFeature(Nothing, nFeatureId))
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
Return TempList
End Function
#End Region ' METHODS
End Class
-45
View File
@@ -1,45 +0,0 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class WallMachGroup
Inherits MyMachGroupM
Protected m_nRawPartId As Integer = GDB_ID.NULL
Public ReadOnly Property nRawPartId As Integer
Get
Return m_nRawPartId
End Get
End Property
Sub New(nId As Integer, sName As String, sMachine As String)
'''MyBase.New(nId, sName, sMachine)
SetMachineType(MachineType.WALL)
m_nRawPartId = EgtGetFirstRawPart()
EgtGetInfo(nId, MGR_RPT_PANELLEN, dL)
EgtGetInfo(nId, MGR_RPT_PANELWIDTH, dW)
EgtGetInfo(nId, MGR_RPT_PANELHEIGHT, dH)
m_dTotMat = dL * dW
For Each Part In PartMList
m_dMatForPart += (Part.dL * Part.dW)
Next
End Sub
Public Overrides Sub RefreshPartList()
m_nRawPartId = EgtGetFirstRawPart()
PartMList.Clear()
Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_nRawPartId)
While nPartId <> GDB_ID.NULL
PartMList.Add(New Wall(Me, nPartId))
nPartId = EgtGetNextPartInRawPart(nPartId)
End While
End Sub
Public Overrides Sub RefreshGroupData()
EgtGetInfo(Id, MGR_RPT_PANELLEN, dL)
EgtGetInfo(Id, MGR_RPT_PANELWIDTH, dW)
EgtGetInfo(Id, MGR_RPT_PANELHEIGHT, dH)
End Sub
End Class
+100
View File
@@ -0,0 +1,100 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class WallMachGroupM
Inherits MyMachGroupM
Protected m_nRawPartId As Integer = GDB_ID.NULL
Public ReadOnly Property nRawPartId As Integer
Get
Return m_nRawPartId
End Get
End Property
#Region "CONSTRUCTORS"
Protected Sub New()
End Sub
Public Shared Function CreateNewWallMachGroup() As MachGroupM
Return New MachGroupM
End Function
Public Shared Function CreateWallMachGroup(nId As Integer, sName As String, sMachine As String) As MachGroupM
Dim NewMachGroupM As New WallMachGroupM
NewMachGroupM.m_Id = nId
NewMachGroupM.m_Name = sName
NewMachGroupM.m_Machine = sMachine
NewMachGroupM.SetMachineType(MachineType.WALL)
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELLEN, NewMachGroupM.m_dL)
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELWIDTH, NewMachGroupM.m_dW)
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELHEIGHT, NewMachGroupM.m_dH)
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
For Each Part In NewMachGroupM.m_PartMList
NewMachGroupM.m_dMatForPart += (Part.dL * Part.dW)
Next
Return NewMachGroupM
End Function
Public Shared Function CreateWallMachGroup(sName As String, sMachine As String) As MachGroupM
Dim NewMachGroupM As New WallMachGroupM
' Creo il nuovo gruppo di lavorazione con i dati ottenuti a seconda del caso in cui mi trovo
NewMachGroupM.m_Id = EgtAddMachGroup(sName, sMachine)
If NewMachGroupM.m_Id = GDB_ID.NULL Then Return Nothing
NewMachGroupM.m_Name = sName
NewMachGroupM.m_Machine = sMachine
NewMachGroupM.SetMachineType(MachineType.WALL)
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELLEN, NewMachGroupM.m_dL)
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELWIDTH, NewMachGroupM.m_dW)
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELHEIGHT, NewMachGroupM.m_dH)
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW
For Each Part In NewMachGroupM.m_PartMList
NewMachGroupM.m_dMatForPart += (Part.dL * Part.dW)
Next
Return NewMachGroupM
End Function
#End Region ' CONSTRUCTORS
Private Shared Function LoadParts(NewWallMachGroupM As WallMachGroupM) As List(Of PartM)
Dim TempList As New List(Of PartM)
Dim nWallId As Integer = EgtGetFirstPartInRawPart(NewWallMachGroupM.m_nRawPartId)
While nWallId <> GDB_ID.NULL
If nWallId <> GDB_ID.NULL Then
Dim NewWall As WallM = WallM.CreateWall(NewWallMachGroupM, nWallId, NewWallMachGroupM.m_nRawPartId)
TempList.Add(NewWall)
End If
nWallId = EgtGetNextPartInRawPart(nWallId)
End While
Return TempList
End Function
Public Overrides Sub RefreshPartList()
' aggiorno lista pezzi
RemoveAllParts()
Dim nRawPartId As Integer = EgtGetFirstRawPart()
If nRawPartId <> GDB_ID.NULL Then
Me.m_nRawPartId = nRawPartId
End If
Dim nWallId As Integer = EgtGetFirstPartInRawPart(m_nRawPartId)
While nWallId <> GDB_ID.NULL
If nWallId <> GDB_ID.NULL Then
Dim NewWall As WallM = WallM.CreateWall(Me, nWallId, m_nRawPartId)
AddPart(NewWall)
End If
nWallId = EgtGetNextPartInRawPart(nWallId)
End While
End Sub
Public Overrides Sub RefreshGroupData()
EgtGetInfo(Id, MGR_RPT_PANELLEN, dL)
EgtGetInfo(Id, MGR_RPT_PANELWIDTH, dW)
EgtGetInfo(Id, MGR_RPT_PANELHEIGHT, dH)
End Sub
End Class
@@ -4,7 +4,7 @@ Imports EgtUILib
Imports EgtWPFLib5
Public Class WallMachGroup
Inherits Core.WallMachGroup
Inherits Core.WallMachGroupM
' definizione comandi
Private m_cmdDeleteMachGroup As ICommand
@@ -4,7 +4,7 @@ Imports EgtUILib
Imports EgtWPFLib5
Public Class Wall
Inherits Core.Wall
Inherits Core.WallM
Public Property sPOSY As String
Get
@@ -84,6 +84,8 @@ Public Class LeftPanelVM
EgtGetMachGroupName(nCurrMachGroup, sCurrMachGroupName)
' creo copia del pezzo
Dim nPartDuploId As Integer = EgtDuploNew(SelPart.nPartId)
' elimino valori calcolo dell'originale
DuploRemoveProjCalc(nPartDuploId)
' lo rendo std
EgtSetMode(nPartDuploId, GDB_MD.STD)
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
@@ -116,21 +118,21 @@ Public Class LeftPanelVM
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELLEN, AddRawPartWndVM.VariableList(0).dValue)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELWIDTH, AddRawPartWndVM.VariableList(1).dValue)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & 10 & "," & 10 & "," & 0 & "," & 0)
'''Dim WallMachGroup As WallMachGroup = DirectCast(Map.refMachGroupPanelVM.MachGroupVMList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 1), WallMachGroup)
'''' eseguo script creazione grezzo
'''If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then
''' WallMachGroup.DeleteMachGroup()
''' Dim LogFile As String() = File.ReadAllLines(sLogPath)
''' If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then
''' MessageBox.Show(LogFile(1), "Error", MessageBoxButton.OK, MessageBoxImage.Error)
''' End If
''' Return
'''End If
''''aggiorno lista pezzi
'''WallMachGroup.RefreshPartList()
'''WallMachGroup.RefreshGroupData()
'''' aggiorno dati ultilizzo barra
'''WallMachGroup.UpdateUsage()
Dim WallMachGroup As WallMachGroupVM = DirectCast(Map.refMachGroupPanelVM.MachGroupVMList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 1), WallMachGroupVM)
' eseguo script creazione grezzo
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then
WallMachGroup.DeleteMachGroup()
Dim LogFile As String() = File.ReadAllLines(sLogPath)
If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then
MessageBox.Show(LogFile(1), "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
Return
End If
'aggiorno lista pezzi
WallMachGroup.m_WallMachGroupM.RefreshPartList()
WallMachGroup.m_WallMachGroupM.RefreshGroupData()
' aggiorno dati ultilizzo barra
WallMachGroup.UpdateUsage()
End If
EgtSetView(VT.ISO_SW, False)
EgtZoom(ZM.ALL)
@@ -150,6 +152,14 @@ Public Class LeftPanelVM
Return True
End Function
Private Sub DuploRemoveProjCalc(nPartDuploId As Integer)
EgtSetInfo(nPartDuploId, ITG_PROJ_ERR, "")
EgtSetInfo(nPartDuploId, ITG_PROJ_MSG, "")
EgtSetInfo(nPartDuploId, ITG_PROJ_ROT, "")
EgtSetInfo(nPartDuploId, ITG_PROJ_FALL, "")
EgtSetInfo(nPartDuploId, ITG_PROJ_TIME, "")
End Sub
'Friend Sub IncrementPartCount(SelPart As BTLPartVM)
' ' incremento i pezzi utilizzati
' SelPart.AddPartToProd()
@@ -178,7 +188,6 @@ Public Class LeftPanelVM
If IsNothing(SelPart) Then Return
Dim SelMachGroup As MachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
If IsNothing(SelMachGroup) Then Return
Dim nCurrMachGroup As Integer = SelMachGroup.Id
' verifico se sono gia' stati messi tutti i pezzi richiesti
If Not VerifyPartCount(SelPart) Then Return
If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
@@ -200,47 +209,16 @@ Public Class LeftPanelVM
' aggiorno dati ultilizzo barra
BeamMachGroup.UpdateUsage()
ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
'''Dim WallMachGroup As WallMachGroup = DirectCast(SelMachGroup, WallMachGroup)
Dim WallMachGroup As WallMachGroup
Dim WallMachGroup As WallMachGroupVM = DirectCast(SelMachGroup, WallMachGroupVM)
' verifico spessore
If SelPart.dH < WallMachGroup.dH - EPS_SMALL OrElse SelPart.dH > WallMachGroup.dH + EPS_SMALL Then
MessageBox.Show("Il pezzo selezionato ha spessore diverso dalla parete selezionata. Impossibile aggiungerlo.", "Errore")
Return
End If
' Posizione di inserimento
Dim dPosX As Double = 10
Dim dPosY As Double = 10
' Se ci sono pezzi già inseriti
If WallMachGroup.PartMList.Count > 0 Then
Dim LastWall As Wall = DirectCast(WallMachGroup.PartMList(WallMachGroup.PartMList.Count - 1), Wall)
' verifico se posso metterlo sopra in Y
Dim NextPosY = LastWall.dPOSY + LastWall.dW + RawPartConfiguration.dWallDist
If WallMachGroup.dW - NextPosY > SelPart.dW + 10 Then
dPosX = LastWall.dPOSX
dPosY = NextPosY
Else
dPosX = 10
For i As Integer = 0 To WallMachGroup.PartMList.Count - 1
Dim CurrWall As Wall = DirectCast(WallMachGroup.PartMList(i), Wall)
Dim NextPosX = CurrWall.dPOSX + CurrWall.dL + RawPartConfiguration.dWallDist
If NextPosX > dPosX Then
dPosX = NextPosX
End If
Next
dPosY = 10
End If
If AddPartToWall(WallMachGroup, SelPart) Then
' aggiorno contatore pezzi usati in Prod
SelPart.RefreshPartInProd()
End If
' scrivo dati in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & WallMachGroup.PartMList.Count + 1, SelPart.nPartId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0)
' eseguo script creazione grezzo
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
EgtRemoveRawPart(nRawId)
nRawId = EgtGetFirstRawPart()
End While
If Not ExecWall(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then Return
'aggiorno lista pezzi
WallMachGroup.RefreshPartList()
' aggiorno dati ultilizzo barra
WallMachGroup.UpdateUsage()
End If
@@ -322,6 +300,48 @@ Public Class LeftPanelVM
Return True
End Function
Friend Function AddPartToWall(WallMachGroup As WallMachGroupVM, PartToAdd As BTLPartVM) As Boolean
' creo copia del pezzo
Dim nPartDuploId As Integer = EgtDuploNew(PartToAdd.nPartId)
' Posizione di inserimento
Dim dPosX As Double = 10
Dim dPosY As Double = 10
' Se ci sono pezzi già inseriti
If WallMachGroup.PartVMList.Count > 0 Then
Dim LastWall As WallVM = DirectCast(WallMachGroup.PartVMList(WallMachGroup.PartVMList.Count - 1), WallVM)
' verifico se posso metterlo sopra in Y
Dim NextPosY = LastWall.m_WallM.dPOSY + LastWall.dW + RawPartConfiguration.dWallDist
If WallMachGroup.dW - NextPosY > PartToAdd.dW + 10 Then
dPosX = LastWall.dPOSX
dPosY = NextPosY
Else
dPosX = 10
For i As Integer = 0 To WallMachGroup.PartVMList.Count - 1
Dim CurrWall As WallVM = DirectCast(WallMachGroup.PartVMList(i), WallVM)
Dim NextPosX = CurrWall.dPOSX + CurrWall.dL + RawPartConfiguration.dWallDist
If NextPosX > dPosX Then
dPosX = NextPosX
End If
Next
dPosY = 10
End If
End If
' scrivo dati in gruppo di lavorazione
EgtSetInfo(WallMachGroup.Id, MGR_RPT_PART & WallMachGroup.PartVMList.Count + 1, nPartDuploId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0)
' eseguo script creazione grezzo
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
EgtRemoveRawPart(nRawId)
nRawId = EgtGetFirstRawPart()
End While
If Not ExecWall(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then Return False
'aggiorno lista pezzi
WallMachGroup.m_WallMachGroupM.RefreshPartList()
' seleziono pezzo aggiunto
If WallMachGroup.PartVMList.Count > 0 Then WallMachGroup.SelPart = WallMachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nPartDuploId)
Return True
End Function
#End Region ' AddToRawPart
#Region "CopyPart"
@@ -59,8 +59,7 @@ Public Class BeamMachGroupVM
End Set
End Property
' definizione comandi
Private m_cmdDeleteMachGroup As ICommand
#Region "CONSTRUCTORS"
Sub New(BeamMachGroupM As BeamMachGroupM)
MyBase.New(BeamMachGroupM)
@@ -69,6 +68,8 @@ Public Class BeamMachGroupVM
CreateBeamVMList()
End Sub
#End Region ' CONSTRUCTORS
#Region "METHODS"
Private Sub CreateBeamVMList()
@@ -202,16 +203,6 @@ Public Class BeamMachGroupVM
#Region "DeleteMachGroup"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property DeleteMachGroup_Command As ICommand
Get
If m_cmdDeleteMachGroup Is Nothing Then
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
End If
Return m_cmdDeleteMachGroup
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Overrides Sub DeleteMachGroup()
' elimino tutte le copie
@@ -29,7 +29,7 @@ Public Class BeamVM
BeamMachGroup.ReDrawBeamMachgroup()
End If
Else
NotifyPropertyChanged("sOffset")
NotifyPropertyChanged(NameOf(sOffset))
End If
End Set
End Property
@@ -66,7 +66,7 @@ Public Class BeamVM
' rimuovo dalla lista pezzi
Dim Index As Integer = ParentMachGroupVM.PartVMList.IndexOf(ParentMachGroupVM.PartVMList.FirstOrDefault(Function(x) x.nPartId = nPartId))
If Index = 0 Then
If ParentMachGroupVM.PartVMList.Count > 0 Then
If ParentMachGroupVM.PartVMList.Count > 1 Then
ParentMachGroupVM.SelPart = ParentMachGroupVM.PartVMList(0)
Else
ParentMachGroupVM.SelPart = Nothing
@@ -36,8 +36,14 @@ Public Class MyMachGroupPanelVM
#Region "METHODS"
Protected Overrides Sub CreateMachGroupVMList()
Dim all As List(Of MachGroupVM) = (From MachGroupM In m_MachGroupPanelM.GetMachGroups()
Select If(DirectCast(MachGroupM, MyMachGroupM).nMachineType = MachineType.BEAM, New BeamMachGroupVM(MachGroupM), New MachGroupVM(MachGroupM))).ToList()
Dim all As New List(Of MachGroupVM)
For Each MachGroupM In m_MachGroupPanelM.GetMachGroups()
If DirectCast(MachGroupM, MyMachGroupM).nMachineType = MachineType.BEAM Then
all.Add(New BeamMachGroupVM(MachGroupM))
Else
all.Add(New WallMachGroupVM(MachGroupM))
End If
Next
For Each MachGroupvM As MachGroupVM In all
AddHandler MachGroupvM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
@@ -93,6 +99,7 @@ Public Class MyMachGroupPanelVM
Public Sub DeleteDuplo()
' reset necessario per poter accedere direttamente al grezzo dalle info pezzo e al MachGroup tramite la gerarchia Db geometrico
EgtResetCurrMachGroup()
Dim bDuploToDeleteFound As Boolean = False
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
Dim bIsToDelete As Boolean = False
@@ -102,6 +109,7 @@ Public Class MyMachGroupPanelVM
EgtDuploCount(nPartId, nDuploCount)
Dim DuploList As New List(Of Integer)
If nDuploCount > 0 AndAlso EgtDuploList(nPartId, DuploList) Then
bDuploToDeleteFound = True
' cancello tutti i pezzi copia nelle barre
For Each nDuploId In DuploList
' recupero grezzo cui appartiene
@@ -125,6 +133,10 @@ Public Class MyMachGroupPanelVM
End If
nPartId = EgtGetNextPart(nPartId)
End While
' se cancellato almeno un pezzo, salvo
If bDuploToDeleteFound Then
Map.refProdManagerVM.Save()
End If
EgtResetCurrMachGroup()
End Sub
@@ -212,7 +224,7 @@ Public Class MyMachGroupPanelVM
Case Core.ConstBeam.MachineType.BEAM
MachGroupVM = New BeamMachGroupVM(e.NewMachGroupM)
Case Core.ConstBeam.MachineType.WALL
'MachGroupVM = New wallMachGroupVM(e.NewMachGroupM)
MachGroupVM = New WallMachGroupVM(e.NewMachGroupM)
Case Core.ConstBeam.MachineType.NULL
Return
End Select
@@ -145,6 +145,9 @@ Public MustInherit Class MyMachGroupVM
End Get
End Property
' definizione comandi
Private m_cmdDeleteMachGroup As ICommand
Sub New(MyMachGroupM As MyMachGroupM)
MyBase.New(MyMachGroupM)
'aggiorno lista pezzi
@@ -159,6 +162,30 @@ Public MustInherit Class MyMachGroupVM
Public MustOverride Sub RefreshGroupData()
Public Sub CalcMachGroupUpdate()
MyMachGroupM.SetState(CalcStates.OK)
For Each Part In PartVMList
If Part.nGlobalState > 0 AndAlso nState = CalcStates.OK Then
MyMachGroupM.SetState(CalcStates.ERROR_)
End If
Next
NotifyPropertyChanged(NameOf(Calc_Background))
End Sub
#Region "COMMANDS"
#Region "DeleteMachGroup"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property DeleteMachGroup_Command As ICommand
Get
If m_cmdDeleteMachGroup Is Nothing Then
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
End If
Return m_cmdDeleteMachGroup
End Get
End Property
Public Overridable Sub DeleteMachGroup()
' elimino tutte le copie
Dim nRawPartId As Integer = EgtGetFirstRawPart()
@@ -173,14 +200,8 @@ Public MustInherit Class MyMachGroupVM
EgtRemoveMachGroup(Me.Id)
End Sub
Public Sub CalcMachGroupUpdate()
MyMachGroupM.SetState(CalcStates.OK)
For Each Part In PartVMList
If Part.nGlobalState > 0 AndAlso nState = CalcStates.OK Then
MyMachGroupM.SetState(CalcStates.ERROR_)
End If
Next
NotifyPropertyChanged(NameOf(Calc_Background))
End Sub
#End Region ' DeleteMachGroup
#End Region ' COMMANDS
End Class
@@ -1,61 +1,68 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class WallMachGroup
Inherits Core.WallMachGroup
Public Class WallMachGroupVM
Inherits MyMachGroupVM
' definizione comandi
Private m_cmdDeleteMachGroup As ICommand
Public ReadOnly Property m_WallMachGroupM As WallMachGroupM
Get
Return m_MachGroupM
End Get
End Property
Sub New(nId As Integer, sName As String, sMachine As String)
MyBase.New(nId, sName, sMachine)
SetMachineType(MachineType.WALL)
m_nRawPartId = EgtGetFirstRawPart()
EgtGetInfo(nId, MGR_RPT_PANELLEN, dL)
EgtGetInfo(nId, MGR_RPT_PANELWIDTH, dW)
EgtGetInfo(nId, MGR_RPT_PANELHEIGHT, dH)
m_dTotMat = dL * dW
For Each Part In PartMList
m_dMatForPart += (Part.dL * Part.dW)
#Region "CONSTRUCTORS"
Sub New(WallMachGroupM As WallMachGroupM)
MyBase.New(WallMachGroupM)
AddHandler m_WallMachGroupM.PartAdded, AddressOf OnWallAdded
AddHandler m_WallMachGroupM.PartRemoved, AddressOf OnWallRemoved
CreateWallVMList()
End Sub
#End Region ' CONSTRUCTORS
#Region "METHODS"
Private Sub CreateWallVMList()
Dim all As List(Of WallVM) = (From WallM In m_WallMachGroupM.GetParts()
Select New WallVM(WallM, Me)).ToList()
For Each WallVM As WallVM In all
AddHandler WallVM.PropertyChanged, AddressOf OnWallVMPropertyChanged
Next
m_PartVMList = New ObservableCollection(Of PartVM)(all)
AddHandler m_PartVMList.CollectionChanged, AddressOf OnWallVMListChanged
End Sub
#End Region ' METHODS
Public Overrides Sub RefreshPartList()
End Sub
Public Overrides Sub RefreshGroupData()
End Sub
Friend Sub UpdateUsage()
m_dTotMat = dL * dW
m_dMatForPart = 0
For Each Part In PartMList
m_dMatForPart += (Part.dL * Part.dW)
m_WallMachGroupM.SetTotMat(dL * dW)
m_WallMachGroupM.SetMatForPart(0)
For Each Part In PartVMList
m_WallMachGroupM.SetMatForPart(m_WallMachGroupM.dMatForPart + (Part.dL * Part.dW))
Next
'''NotifyPropertyChanged("dUsage")
'''NotifyPropertyChanged("dWaste")
NotifyPropertyChanged(NameOf(dUsage))
NotifyPropertyChanged(NameOf(dWaste))
End Sub
Public Overrides Sub RefreshPartList()
m_nRawPartId = EgtGetFirstRawPart()
PartMList.Clear()
Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_nRawPartId)
While nPartId <> GDB_ID.NULL
PartMList.Add(New Wall(Me, nPartId))
nPartId = EgtGetNextPartInRawPart(nPartId)
End While
End Sub
#Region "COMMANDS"
#Region "DeleteMachGroup"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property DeleteMachGroup_Command As ICommand
Get
If m_cmdDeleteMachGroup Is Nothing Then
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
End If
Return m_cmdDeleteMachGroup
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Overrides Sub DeleteMachGroup()
' elimino tutte le copie
@@ -93,4 +100,36 @@ Public Class WallMachGroup
#End Region ' COMMANDS
#Region "EVENTS"
Private Sub OnWallAdded(sender As Object, e As PartAddedEventArgs)
Dim WallVM As WallVM = New WallVM(e.NewPart, Me)
PartVMList.Add(WallVM)
End Sub
Private Sub OnWallRemoved(sender As Object, e As PartAddedEventArgs)
Dim WallVM As WallVM = PartVMList.FirstOrDefault(Function(x) x.PartM Is e.m_NewPart)
If Not IsNothing(WallVM) Then PartVMList.Remove(WallVM)
End Sub
Private Sub OnWallVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
For Each WallVM As WallVM In e.NewItems
AddHandler WallVM.PropertyChanged, AddressOf OnWallVMPropertyChanged
Next
End If
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
For Each WallVM As WallVM In e.OldItems
RemoveHandler WallVM.PropertyChanged, AddressOf OnWallVMPropertyChanged
Next
End If
End Sub
Private Sub OnWallVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
'Select Case e.PropertyName
' Case NameOf(sender.nSelGRP), NameOf(sender.nSelSIDE)
'End Select
End Sub
#End Region
End Class
@@ -1,92 +1,49 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class Wall
Inherits Core.Wall
Public Class WallVM
Inherits PartVM
Public ReadOnly Property m_WallM As WallM
Get
Return m_PartM
End Get
End Property
Public Property sPOSY As String
Get
Return LenToString(m_dPOSY, 3)
Return LenToString(m_WallM.dPOSY, 3)
End Get
Set(value As String)
StringToLen(value, m_dPOSY)
StringToLen(value, m_WallM.dPOSY)
End Set
End Property
Public Property sROT As String
Get
Return LenToString(m_dROT, 3)
Return LenToString(m_WallM.dROT, 3)
End Get
Set(value As String)
StringToLen(value, m_dROT)
StringToLen(value, m_WallM.dROT)
End Set
End Property
Public Property sFLIP As String
Get
Return LenToString(m_dFLIP, 3)
Return LenToString(m_WallM.dFLIP, 3)
End Get
Set(value As String)
StringToLen(value, m_dFLIP)
StringToLen(value, m_WallM.dFLIP)
End Set
End Property
#Region "CONSTRUCTOR"
Sub New(nParentMachGroup As Core.MyMachGroupM, nPartId As Integer)
MyBase.New(nParentMachGroup, nPartId)
' leggo info pezzo
EgtGetInfo(nPartId, BTL_PRT_PROJ, m_nProjId)
EgtGetInfo(nPartId, BTL_PRT_PDN, m_nPDN)
EgtGetInfo(nPartId, BTL_PRT_NAM, m_sNAM)
EgtGetInfo(nPartId, BTL_PRT_L, m_dL)
EgtGetInfo(nPartId, BTL_PRT_W, m_dW)
EgtGetInfo(nPartId, BTL_PRT_H, m_dH)
EgtGetInfo(nPartId, BTL_PRT_CNT, m_nCNT)
Dim nTemp As Integer = 0
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
nTemp = 0
End If
SetRotated(nTemp)
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
nTemp = 0
End If
SetInverted(nTemp)
' leggo PosX, PosY, Rot e Flip
Dim sInfo As String = ""
Dim Index = 1
Dim sSplitInfo() As String
Dim bFound As Boolean = False
While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
If Not String.IsNullOrWhiteSpace(sInfo) Then
sSplitInfo = sInfo.Split(","c)
If sSplitInfo(0) = nPartId Then
bFound = True
Exit While
End If
End If
Index += 1
End While
If bFound Then
StringToDouble(sSplitInfo(1), m_dPOSX)
StringToDouble(sSplitInfo(2), m_dPOSY)
StringToDouble(sSplitInfo(3), m_dROT)
StringToDouble(sSplitInfo(4), m_dFLIP)
End If
' vado sul layer delle feature
Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
While nFeatureId <> GDB_ID.NULL
' verifico che sia una feature
Dim nGRP As Integer
If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
' creo la feature
'''FeatureList.Add(New BTLFeatureVM(Nothing, nFeatureId))
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
Sub New(WallM As WallM, ParentMachGroupVM As WallMachGroupVM)
MyBase.New(WallM, ParentMachGroupVM)
End Sub
#End Region ' CONSTRUCTOR
@@ -178,7 +178,7 @@ Public Class ProdManagerVM
Public Sub Save()
If IsNothing(m_CurrProd) Then Return
Map.refSceneHostVM.SaveProject()
Map.refMainWindowVM.SetTitle(CurrProd.nProdId.ToString("0000") & " - EgtBEAMWALL")
Map.refMainWindowVM.UpdateTitle()
Dim MyMachGroupList As New List(Of MyMachGroupM)
For Each MachGroup In Map.refProjectVM.MachGroupPanelVM.m_MyMachGroupPanelM.MachGroupMList
MyMachGroupList.Add(MachGroup)