167 lines
4.1 KiB
VB.net
167 lines
4.1 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports System.Windows.Input
|
|
Imports System.Windows.Media
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public MustInherit Class MyMachGroup
|
|
Inherits MachGroup
|
|
|
|
Protected m_nMachineType As MachineType
|
|
Public ReadOnly Property nMachineType As MachineType
|
|
Get
|
|
Return m_nMachineType
|
|
End Get
|
|
End Property
|
|
Public Sub SetMachineType(nMachineType As MachineType)
|
|
m_nMachineType = nMachineType
|
|
End Sub
|
|
|
|
Protected m_dL As Double
|
|
Public Property dL As Double
|
|
Get
|
|
Return m_dL
|
|
End Get
|
|
Set(value As Double)
|
|
m_dL = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_dW As Double
|
|
Public Property dW As Double
|
|
Get
|
|
Return m_dW
|
|
End Get
|
|
Set(value As Double)
|
|
m_dW = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_dH As Double
|
|
Public Property dH As Double
|
|
Get
|
|
Return m_dH
|
|
End Get
|
|
Set(value As Double)
|
|
m_dH = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_dMatForPart As Double = 0
|
|
Protected m_dTotMat As Double = 0
|
|
Public ReadOnly Property dUsage As Double
|
|
Get
|
|
Return If(m_dMatForPart > 0 AndAlso m_dTotMat > 0, m_dMatForPart / m_dTotMat * 100, 0)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property dWaste As Double
|
|
Get
|
|
Return If(m_dMatForPart > 0 AndAlso m_dTotMat > 0, (m_dTotMat - m_dMatForPart) / m_dTotMat * 100, 0)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sUsage As String
|
|
Get
|
|
Return dUsage & "%"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sWaste As String
|
|
Get
|
|
Return dWaste & "%"
|
|
End Get
|
|
End Property
|
|
|
|
Protected m_sMATERIAL As String
|
|
Public Property sMATERIAL As String
|
|
Get
|
|
Return m_sMATERIAL
|
|
End Get
|
|
Set(value As String)
|
|
m_sMATERIAL = value
|
|
End Set
|
|
End Property
|
|
|
|
' lista dei pezzi che sono nel grezzo
|
|
Private m_PartList As New ObservableCollection(Of Part)
|
|
Public Property PartList As ObservableCollection(Of Part)
|
|
Get
|
|
Return m_PartList
|
|
End Get
|
|
Set(value As ObservableCollection(Of Part))
|
|
m_PartList = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_SelPart As Part
|
|
Public Overridable Property SelPart As Part
|
|
Get
|
|
Return m_SelPart
|
|
End Get
|
|
Set(value As Part)
|
|
m_SelPart = value
|
|
' seleziono pezzo
|
|
EgtDeselectAll()
|
|
If Not IsNothing(value) Then EgtSelectObj(SelPart.nPartId)
|
|
EgtDraw()
|
|
NotifyPropertyChanged("SelPart")
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_nState As CalcStates = -1
|
|
Public ReadOnly Property nState As CalcStates
|
|
Get
|
|
Return m_nState
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Calc_Background As SolidColorBrush
|
|
Get
|
|
If m_nState = 0 Then
|
|
Return Brushes.Green
|
|
ElseIf m_nState < 0 Then
|
|
Return Brushes.LightGray
|
|
ElseIf m_nState > 0 Then
|
|
Return Brushes.Red
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(nId As Integer, sName As String, sMachine As String)
|
|
MyBase.New(nId, sName, sMachine)
|
|
'aggiorno lista pezzi
|
|
RefreshPartList()
|
|
End Sub
|
|
|
|
Public MustOverride Sub RefreshPartList()
|
|
|
|
Public MustOverride Sub RefreshGroupData()
|
|
|
|
Public Overridable Sub DeleteMachGroup()
|
|
' elimino tutte le copie
|
|
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
|
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
|
While nRawPartId <> GDB_ID.NULL
|
|
EgtRemovePartFromRawPart(nBeamId)
|
|
EgtErase(nBeamId)
|
|
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
|
nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
|
|
End While
|
|
' elimino MachGroup
|
|
EgtRemoveMachGroup(Me.Id)
|
|
End Sub
|
|
|
|
Public Sub CalcMachGroupUpdate()
|
|
m_nState = CalcStates.OK
|
|
For Each Part In PartList
|
|
If Part.nGlobalState > 0 AndAlso m_nState = CalcStates.OK Then
|
|
m_nState = CalcStates.ERROR_
|
|
End If
|
|
Next
|
|
NotifyPropertyChanged("Calc_Background")
|
|
End Sub
|
|
|
|
End Class
|