8e8d1c2a91
- Correzione viste per travi - Introdotto s/blocco dei duplo - Introdotta traduzione dei messaggi macchina - Migliorata gestione attivazione bottoni - Bloccate colonne in edit durante Calc - Aggiornamento quantita' in prod dopo cambio dimensioni - Impedito Flip e Rot durante Calc - Limitata considerazione pezzi in nesting a quelli ancora da aggiungere - Gestione errori import BTL con messaggio errori
184 lines
6.3 KiB
VB.net
184 lines
6.3 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public MustInherit Class MyMachGroupPanelVM
|
|
Inherits NewMachGroupPanelVM
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Public ReadOnly Property m_MyMachGroupPanelM As MyMachGroupPanelM
|
|
Get
|
|
Return m_MachGroupPanelM
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sTotMachGroups As String
|
|
Get
|
|
Return m_MachGroupVMList.Count()
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sTotVolume As String
|
|
Get
|
|
Dim dMMTotVolume As Double = m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) x.dUnitVolume, Func(Of MachGroupVM, Double)))
|
|
Return If(EgtUiUnitsAreMM(), DoubleToString(dMMTotVolume / 1000000000, 3), DoubleToString(dMMTotVolume * (12 / ONEINCH), 3))
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sTotEstimatedTime As String
|
|
Get
|
|
Return TimeSpan.FromSeconds(m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) x.nCALC_TIME, Func(Of MachGroupVM, Double)))).ToString()
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property dTotTime As String
|
|
Get
|
|
Return m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) If(x.nProduction_State >= ItemState.Produced AndAlso Not IsNothing(x.dtEndTime) AndAlso x.dtEndTime <> DateTime.MinValue, (x.dtEndTime - x.dtStartTime).TotalSeconds(), x.nCALC_TIME), Func(Of MachGroupVM, Double)))
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sTotTime As String
|
|
Get
|
|
Return TimeSpan.FromSeconds(dTotTime).ToString()
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property dRemainingTime As String
|
|
Get
|
|
Return m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) If(x.nProduction_State < ItemState.Produced, x.nCALC_TIME, 0), Func(Of MachGroupVM, Double)))
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sRemainingTime As String
|
|
Get
|
|
Return TimeSpan.FromSeconds(dRemainingTime).ToString()
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(MachGroupPanelM As MachGroupPanelM)
|
|
MyBase.New(MachGroupPanelM)
|
|
' Creo riferimento a questa classe in Map
|
|
CoreMap.SetRefMachGroupPanelVM(Me)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Protected MustOverride Overrides Sub CreateMachGroupVMList()
|
|
|
|
Public Overrides Function InitMachGroupList(Optional bUseDefaults As Boolean = False) As Boolean
|
|
' Svuoto precedente lista di MachGroup
|
|
MachGroupVMList.Clear()
|
|
' aggiorno copie
|
|
MyMachGroupPanelM.UpdateDuplo()
|
|
' verifico se esistono già gruppi di lavorazione o se devo creare il primo
|
|
Dim bOk As Boolean = False
|
|
Dim nId = EgtGetFirstMachGroup()
|
|
If nId <> GDB_ID.NULL Then
|
|
bOk = EgtSetCurrMachGroup(nId)
|
|
End If
|
|
If Not bOk Then Return True
|
|
' carico lista dei gruppi di lavorazione
|
|
m_MachGroupPanelM.MachGroupMList = MyMachGroupPanelM.LoadMyMachGroups(CoreMap.refMachinePanelVM.MachineList.ToList())
|
|
' elimino copie da cancellare
|
|
MyMachGroupPanelM.DeleteDuplo()
|
|
If bOk Then SelectedMachGroup = MachGroupVMList(0)
|
|
EgtZoom(ZM.ALL)
|
|
Return True
|
|
End Function
|
|
|
|
'Public Overrides Sub AddMachGroup()
|
|
' Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(CurrentMachine.sMachineName, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
|
|
' ' e lo seleziono
|
|
' SelectedMachGroup = MachGroupVMList.FirstOrDefault(Function(x) x.MachGroupM Is MyMachGroupM)
|
|
'End Sub
|
|
|
|
Public Overrides Function OnPreSetCurrMachGroup() As Boolean
|
|
EgtSetCurrentContext(CoreMap.refSceneHostVM.MainScene.GetCtx())
|
|
Return True
|
|
End Function
|
|
|
|
Public Overrides Function OnPostSetCurrMachGroup() As Boolean
|
|
' resetto eventuale selezione pezzo
|
|
Dim SelMachGroup As MyMachGroupVM = DirectCast(SelectedMachGroup, MyMachGroupVM)
|
|
SelMachGroup.SelPart = Nothing
|
|
' Imposto vista solo tavola
|
|
EgtSetMachineLook(MCH_LOOK.TAB)
|
|
Core.ViewPanelVM.BWSetView(If(ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
|
|
EgtZoom(ZM.ALL)
|
|
Return True
|
|
End Function
|
|
|
|
' funzione che seleziona primo gruppo
|
|
'Friend Sub SelFirstMachGroup()
|
|
' If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupVMList) AndAlso MachGroupVMList.Count > 0 Then
|
|
' SelectedMachGroup = MachGroupVMList(0)
|
|
' Else
|
|
' SelectedMachGroup = Nothing
|
|
' EgtResetCurrMachGroup()
|
|
' ' nascondo tutti i pezzi
|
|
' Map.refProjectVM.BTLStructureVM.HideAll()
|
|
' End If
|
|
'End Sub
|
|
|
|
' funzione che seleziona ultimo gruppo
|
|
Public Sub SelLastMachGroup()
|
|
If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupVMList) AndAlso MachGroupVMList.Count > 0 Then
|
|
SelectedMachGroup = MachGroupVMList(MachGroupVMList.Count - 1)
|
|
End If
|
|
End Sub
|
|
|
|
Public Function GetLastMachGroup() As MachGroupVM
|
|
If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupVMList) AndAlso MachGroupVMList.Count > 0 Then
|
|
Return MachGroupVMList(MachGroupVMList.Count - 1)
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
' funzione che aggiorna totale tempi a fine calcolo
|
|
Public Sub CalcGlobalTime()
|
|
NotifyPropertyChanged(NameOf(sTotTime))
|
|
NotifyPropertyChanged(NameOf(sRemainingTime))
|
|
End Sub
|
|
|
|
' funzione che aggiorna numero gruppi di lavorazione e volume totale
|
|
Public Sub CalcGlobalUpdate()
|
|
NotifyPropertyChanged(NameOf(sTotMachGroups))
|
|
NotifyPropertyChanged(NameOf(sTotVolume))
|
|
NotifyPropertyChanged(NameOf(sTotTime))
|
|
NotifyPropertyChanged(NameOf(sRemainingTime))
|
|
End Sub
|
|
|
|
Public Shared Sub DuploRemoveProjCalc(nPartDuploId As Integer)
|
|
EgtSetInfo(nPartDuploId, ITG_PROJ_ERR, "")
|
|
EgtSetInfo(nPartDuploId, ITG_PROJ_MSG, "")
|
|
EgtSetInfo(nPartDuploId, ITG_PROJ_ROT, "")
|
|
EgtSetInfo(nPartDuploId, ITG_PROJ_FALL, "")
|
|
EgtSetInfo(nPartDuploId, ITG_PROJ_TIME, "")
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "EVENTS"
|
|
|
|
Protected Overrides Sub OnMachGroupVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
|
|
Select Case e.PropertyName
|
|
Case NameOf(sender.nProduction_State)
|
|
NotifyPropertyChanged(NameOf(sTotTime))
|
|
NotifyPropertyChanged(NameOf(sRemainingTime))
|
|
End Select
|
|
End Sub
|
|
|
|
#End Region ' EVENTS
|
|
|
|
End Class
|