187 lines
4.6 KiB
VB.net
187 lines
4.6 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports System.Windows.Input
|
|
Imports System.Windows.Media
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public MustInherit Class MyMachGroupVM
|
|
Inherits MachGroupVM
|
|
|
|
Public ReadOnly Property MyMachGroupM As MyMachGroupM
|
|
Get
|
|
Return m_MachGroupM
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property nMachineType As MachineType
|
|
Get
|
|
Return MyMachGroupM.nMachineType
|
|
End Get
|
|
End Property
|
|
|
|
Public Property dL As Double
|
|
Get
|
|
Return MyMachGroupM.dL
|
|
End Get
|
|
Set(value As Double)
|
|
MyMachGroupM.dL = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dW As Double
|
|
Get
|
|
Return MyMachGroupM.dW
|
|
End Get
|
|
Set(value As Double)
|
|
MyMachGroupM.dW = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dH As Double
|
|
Get
|
|
Return MyMachGroupM.dH
|
|
End Get
|
|
Set(value As Double)
|
|
MyMachGroupM.dH = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dtStartTime As DateTime
|
|
Get
|
|
Return MyMachGroupM.dtStartTime
|
|
End Get
|
|
Set(value As DateTime)
|
|
MyMachGroupM.dtStartTime = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dtEndTime As DateTime
|
|
Get
|
|
Return MyMachGroupM.dtEndTime
|
|
End Get
|
|
Set(value As DateTime)
|
|
MyMachGroupM.dtEndTime = value
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property dUsage As Double
|
|
Get
|
|
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, MyMachGroupM.dMatForPart / MyMachGroupM.dTotMat * 100, 0)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property dWaste As Double
|
|
Get
|
|
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, (MyMachGroupM.dTotMat - MyMachGroupM.dMatForPart) / MyMachGroupM.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
|
|
|
|
Public Property sMATERIAL As String
|
|
Get
|
|
Return MyMachGroupM.sMATERIAL
|
|
End Get
|
|
Set(value As String)
|
|
MyMachGroupM.sMATERIAL = value
|
|
End Set
|
|
End Property
|
|
|
|
' lista dei pezzi che sono nel grezzo
|
|
Protected m_PartVMList As New ObservableCollection(Of PartVM)
|
|
Public Property PartVMList As ObservableCollection(Of PartVM)
|
|
Get
|
|
Return m_PartVMList
|
|
End Get
|
|
Set(value As ObservableCollection(Of PartVM))
|
|
m_PartVMList = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_SelPart As PartVM
|
|
Public Overridable Property SelPart As PartVM
|
|
Get
|
|
Return m_SelPart
|
|
End Get
|
|
Set(value As PartVM)
|
|
m_SelPart = value
|
|
' seleziono pezzo
|
|
EgtDeselectAll()
|
|
If Not IsNothing(value) Then EgtSelectObj(SelPart.nPartId)
|
|
EgtDraw()
|
|
NotifyPropertyChanged(NameOf(SelPart))
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property nState As CalcStates
|
|
Get
|
|
Return MyMachGroupM.nState
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Calc_Background As SolidColorBrush
|
|
Get
|
|
If nState = 0 Then
|
|
Return Brushes.Green
|
|
ElseIf nState < 0 Then
|
|
Return Brushes.LightGray
|
|
ElseIf nState > 0 Then
|
|
Return Brushes.Red
|
|
Else
|
|
Return Brushes.Red
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(MyMachGroupM As MyMachGroupM)
|
|
MyBase.New(MyMachGroupM)
|
|
'aggiorno lista pezzi
|
|
RefreshPartList()
|
|
End Sub
|
|
|
|
#Region "METHODS"
|
|
|
|
#End Region ' METHODS
|
|
|
|
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()
|
|
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 Class
|