b4e8d68c62
Correzioni e migliorie
333 lines
8.3 KiB
VB.net
333 lines
8.3 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 MyMachGroupM
|
|
Inherits MachGroupM
|
|
|
|
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_dtStartTime As DateTime
|
|
Public Property dtStartTime As DateTime
|
|
Get
|
|
Return m_dtStartTime
|
|
End Get
|
|
Set(value As DateTime)
|
|
m_dtStartTime = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_dtEndTime As DateTime
|
|
Public Property dtEndTime As DateTime
|
|
Get
|
|
Return m_dtEndTime
|
|
End Get
|
|
Set(value As DateTime)
|
|
m_dtEndTime = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_dMatForPart As Double = 0
|
|
Public ReadOnly Property dMatForPart As Double
|
|
Get
|
|
Return m_dMatForPart
|
|
End Get
|
|
End Property
|
|
|
|
Protected m_nProdIndex As Integer = 0
|
|
Public Property nProdIndex As Integer
|
|
Get
|
|
Return m_nProdIndex
|
|
End Get
|
|
Set
|
|
m_nProdIndex = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetMatForPart(dMatForPart As Double)
|
|
m_dMatForPart = dMatForPart
|
|
End Sub
|
|
|
|
Protected m_dTotMat As Double = 0
|
|
Public ReadOnly Property dTotMat As Double
|
|
Get
|
|
Return m_dTotMat
|
|
End Get
|
|
End Property
|
|
Public Sub SetTotMat(TotMat As Double)
|
|
m_dTotMat = TotMat
|
|
End Sub
|
|
|
|
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
|
|
Protected m_PartMList As New List(Of PartM)
|
|
Public Property PartMList As List(Of PartM)
|
|
Get
|
|
Return m_PartMList
|
|
End Get
|
|
Set(value As List(Of PartM))
|
|
m_PartMList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_nCALC_ERR As Integer
|
|
Public Property nCALC_ERR As Integer
|
|
Get
|
|
Return m_nCALC_ERR
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nCALC_ERR = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_nCALC_FALL As Integer
|
|
Public Property nCALC_FALL As Integer
|
|
Get
|
|
Return m_nCALC_FALL
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nCALC_FALL = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_sCALC_MSG As String
|
|
Public Property sCALC_MSG As String
|
|
Get
|
|
Return m_sCALC_MSG
|
|
End Get
|
|
Set(value As String)
|
|
m_sCALC_MSG = value
|
|
End Set
|
|
End Property
|
|
|
|
Public m_nCALC_ROT As Integer
|
|
Public Property nCALC_ROT As Integer
|
|
Get
|
|
Return m_nCALC_ROT
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nCALC_ROT = value
|
|
End Set
|
|
End Property
|
|
|
|
Public m_nCALC_TIME As Integer
|
|
Public Property nCALC_TIME As Integer
|
|
Get
|
|
Return m_nCALC_TIME
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nCALC_TIME = value
|
|
End Set
|
|
End Property
|
|
|
|
Public m_nCALC_GlobalState As CalcStates = CalcStates.NOTCALCULATED
|
|
Public Property nCALC_GlobalState As CalcStates
|
|
Get
|
|
Return m_nCALC_GlobalState
|
|
End Get
|
|
Set(value As CalcStates)
|
|
m_nCALC_GlobalState = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_nCALC_GlobalERR As Integer
|
|
Public Property nCALC_GlobalERR As Integer
|
|
Get
|
|
Return m_nCALC_GlobalERR
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nCALC_GlobalERR = value
|
|
End Set
|
|
End Property
|
|
|
|
Public m_nCALC_State As CalcStates = CalcStates.NOTCALCULATED
|
|
Public Property nCALC_State As CalcStates
|
|
Get
|
|
Return m_nCALC_State
|
|
End Get
|
|
Set(value As CalcStates)
|
|
m_nCALC_State = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_sSupervisorId As String
|
|
Public Property sSupervisorId As String
|
|
Get
|
|
Return m_sSupervisorId
|
|
End Get
|
|
Set(value As String)
|
|
m_sSupervisorId = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_nPriorityIndex As Integer
|
|
Public Property nPriorityIndex As Integer
|
|
Get
|
|
Return m_nPriorityIndex
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nPriorityIndex = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected m_nProductionState As ItemState = 0
|
|
Public ReadOnly Property nProductionState As ItemState
|
|
Get
|
|
Return m_nProductionState
|
|
End Get
|
|
End Property
|
|
Public Sub SetProductionState(nState As ItemState)
|
|
m_nProductionState = nState
|
|
End Sub
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
'Sub New(nId As Integer, sName As String, sMachine As String)
|
|
' MyBase.New(nId, sName, sMachine)
|
|
' 'aggiorno lista pezzi
|
|
' RefreshPartList()
|
|
'End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Public Event PartAdded As EventHandler(Of PartAddedEventArgs)
|
|
Public Event PartRemoved As EventHandler(Of PartAddedEventArgs)
|
|
|
|
Public Sub AddPart(PartM As PartM)
|
|
If IsNothing(PartM) Then Return
|
|
If Not m_PartMList.Contains(PartM) Then
|
|
m_PartMList.Add(PartM)
|
|
RaiseEvent PartAdded(Me, New PartAddedEventArgs(PartM))
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub RemovePart(PartM As PartM)
|
|
If IsNothing(PartM) Then Return
|
|
If m_PartMList.Contains(PartM) AndAlso m_PartMList.Remove(PartM) Then
|
|
RaiseEvent PartRemoved(Me, New PartAddedEventArgs(PartM))
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub RemoveAllParts()
|
|
If IsNothing(m_PartMList) Then Return
|
|
For PartIndex = m_PartMList.Count - 1 To 0 Step -1
|
|
Dim PartM As PartM = m_PartMList(PartIndex)
|
|
If m_PartMList.Remove(PartM) Then
|
|
RaiseEvent PartRemoved(Me, New PartAddedEventArgs(PartM))
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Public Function GetParts() As List(Of PartM)
|
|
Return New List(Of PartM)(m_PartMList)
|
|
End Function
|
|
|
|
Public Shared Sub ReadMachGroupData(NewMachgroup As MyMachGroupM)
|
|
' leggo materiale
|
|
EgtGetInfo(NewMachgroup.Id, MGR_RPT_MATERIAL, NewMachgroup.sMATERIAL)
|
|
' 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(NewMachgroup.Id, ITG_PROD_ERR, nErr)
|
|
EgtGetInfo(NewMachgroup.Id, ITG_PROD_ROT, nRot)
|
|
EgtGetInfo(NewMachgroup.Id, ITG_PROD_MSG, sMsg)
|
|
If Not bCalc Then
|
|
NewMachgroup.m_nCALC_State = CalcStates.NOTCALCULATED
|
|
NewMachgroup.m_nCALC_ERR = 0
|
|
NewMachgroup.m_nCALC_ROT = 0
|
|
NewMachgroup.m_sCALC_MSG = ""
|
|
Else
|
|
NewMachgroup.m_nCALC_ERR = nErr
|
|
NewMachgroup.m_nCALC_ROT = nRot
|
|
NewMachgroup.m_sCALC_MSG = sMsg
|
|
If nErr = 0 Then
|
|
NewMachgroup.nCALC_State = CalcStates.OK
|
|
ElseIf nErr = 17 Then
|
|
NewMachgroup.nCALC_State = CalcStates.WARNING
|
|
ElseIf nErr > 0 Then
|
|
NewMachgroup.nCALC_State = CalcStates.ERROR_
|
|
ElseIf nErr < 0 Then
|
|
NewMachgroup.nCALC_State = CalcStates.INFO
|
|
End If
|
|
End If
|
|
EgtGetInfo(NewMachgroup.Id, ITG_PROD_TIME, NewMachgroup.m_nCALC_TIME)
|
|
|
|
End Sub
|
|
|
|
#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
|
|
|
|
End Class
|