104 lines
3.8 KiB
VB.net
104 lines
3.8 KiB
VB.net
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.m_nType = 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
|
|
ReadMachGroupData(NewMachGroupM)
|
|
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.m_nType = 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
|
|
ReadMachGroupData(NewMachGroupM)
|
|
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)
|
|
EgtGetInfo(Id, MGR_RPT_MATERIAL, sMATERIAL)
|
|
End Sub
|
|
|
|
End Class
|