137 lines
4.5 KiB
VB.net
137 lines
4.5 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 Core.MyMachGroupVM
|
|
|
|
Public Overrides ReadOnly Property Production_Background As SolidColorBrush
|
|
Get
|
|
If dtEndTime <> DateTime.MinValue Then ' barra finita
|
|
Return Brushes.LightGray
|
|
ElseIf dtStartTime <> DateTime.MinValue Then ' barra iniziata
|
|
Return Brushes.Green
|
|
ElseIf m_bToBeProduced Then ' barra in attesa
|
|
Return Brushes.Yellow
|
|
Else ' barra in coda
|
|
Return Brushes.White
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
' indica se il pezzo deve essere tagliato
|
|
Private m_bToBeProduced As Boolean = False
|
|
Public ReadOnly Property bToBeProduced As Boolean
|
|
Get
|
|
Return m_bToBeProduced
|
|
End Get
|
|
End Property
|
|
|
|
' indica se il pezzo e' gia' stato ricalcolato e quindi pronto a partire
|
|
Private m_bCNReCalculated As Boolean = False
|
|
Public ReadOnly Property bReadyForMachining As Boolean
|
|
Get
|
|
Return m_bToBeProduced AndAlso m_bCNReCalculated
|
|
End Get
|
|
End Property
|
|
|
|
' indica se il pezzo e' stato mandato alla macchina
|
|
Private m_bSentToMachine As Boolean = False
|
|
Public ReadOnly Property bSentToMachine As Boolean
|
|
Get
|
|
Return m_bSentToMachine
|
|
End Get
|
|
End Property
|
|
Friend Sub SetSentToMachine(value As Boolean)
|
|
m_bSentToMachine = value
|
|
End Sub
|
|
|
|
' indica se la macchin e' stata interrotta durante la lavorazione
|
|
Private m_bResetWhileCutting As Boolean = False
|
|
Public ReadOnly Property bResetWhileCutting As Boolean
|
|
Get
|
|
Return m_bResetWhileCutting
|
|
End Get
|
|
End Property
|
|
Friend Sub SetResetWhileCutting(value As Boolean)
|
|
m_bResetWhileCutting = value
|
|
End Sub
|
|
|
|
' definizione comandi
|
|
Private m_cmdProduceMachGroup As ICommand
|
|
|
|
#Region "CONSTRUCTORS"
|
|
|
|
Sub New(MyMachGroupM As MyMachGroupM)
|
|
MyBase.New(MyMachGroupM)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTORS
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub ResetProduce()
|
|
m_bCNReCalculated = False
|
|
m_bToBeProduced = False
|
|
m_bSentToMachine = False
|
|
NotifyPropertyChanged(NameOf(Calc_Background))
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
Public Function CnFilePath() As String
|
|
Return Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & Name & ".cnc"
|
|
End Function
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "ProduceMachGroup"
|
|
|
|
' Returns a command that manage the MainWindow_Unloaded command
|
|
Public ReadOnly Property ProduceMachGroup_Command As ICommand
|
|
Get
|
|
If m_cmdProduceMachGroup Is Nothing Then
|
|
m_cmdProduceMachGroup = New Command(AddressOf ProduceMachGroup)
|
|
End If
|
|
Return m_cmdProduceMachGroup
|
|
End Get
|
|
End Property
|
|
|
|
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
|
Public Sub ProduceMachGroup()
|
|
'' se lavorazione interrotta da reset
|
|
'If bResetWhileCutting Then
|
|
' ' chiedo se riprendere o rimandare i pezzi non fatti all'ottimizzatore
|
|
' If MessageBox.Show("Riprendere lavorazione barra corrente?", "", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
|
|
' ' se ripresa, lancio finestra per definire da dove
|
|
|
|
|
|
' End If
|
|
'End If
|
|
' cerco primo indice di pezzo non in produzione
|
|
Dim NewIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) DirectCast(x, MyMachGroupVM).dtStartTime = DateTime.MinValue AndAlso DirectCast(x, MyMachGroupVM).bToBeProduced = False))
|
|
' segno pezzo da produrre
|
|
m_bToBeProduced = True
|
|
' ricalcolo il CN
|
|
m_bCNReCalculated = True
|
|
|
|
|
|
' sposto MachGroup in lista come ultimo dei pronti da produrre
|
|
Dim OldIndex As Integer = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.IndexOf(Me)
|
|
DbControllers.m_MachGroupController.UpdateOrder(Map.refSupervisorManagerVM.CurrProd.nProdId, Id, NewIndex)
|
|
Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Move(OldIndex, NewIndex)
|
|
|
|
NotifyPropertyChanged(NameOf(nCALC_State))
|
|
NotifyPropertyChanged(NameOf(Calc_Background))
|
|
End Sub
|
|
|
|
#End Region ' ProduceMachGroup
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|