ce3ff4e3d6
- correzione inizializzazione lavorazioni compatibili con materiale e spessore.
881 lines
35 KiB
VB.net
881 lines
35 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class CurrMachWindowVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
#Region " SAW "
|
|
|
|
Private m_CurrSawingList As New List(Of String)
|
|
Public Property CurrSawingList As List(Of String)
|
|
Get
|
|
Return m_CurrSawingList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_CurrSawingList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelCurrSawing As String = String.Empty
|
|
Public Property SelCurrSawing As String
|
|
Get
|
|
Return m_SelCurrSawing
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_SelCurrSawing Then
|
|
m_SelCurrSawing = value
|
|
End If
|
|
CurrentMachine.sCurrSawing = m_SelCurrSawing
|
|
' salvo la lvorazione corrente
|
|
WritePrivateProfileString(S_MACH_MACH, K_CURRSAWING_OFFICE, m_SelCurrSawing, sMachIniFile)
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetCurrSawing(sCurrOfficeSawing As String)
|
|
m_SelCurrSawing = sCurrOfficeSawing
|
|
CurrentMachine.sCurrSawing = m_SelCurrSawing
|
|
NotifyPropertyChanged("SelCurrSawing")
|
|
End Sub
|
|
|
|
Public ReadOnly Property CurrSawing_Visibility As Visibility
|
|
Get
|
|
If EgtGetHeadId("H1") = GDB_ID.NULL Then
|
|
Return Visibility.Collapsed
|
|
Else
|
|
Return Visibility.Visible
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Saw
|
|
|
|
#Region " AUX MACHINING "
|
|
|
|
Private m_AuxMachTypeList As New List(Of StringIdCmBx)
|
|
Public Property AuxMachTypeList As List(Of StringIdCmBx)
|
|
Get
|
|
Return m_AuxMachTypeList
|
|
End Get
|
|
Set(value As List(Of StringIdCmBx))
|
|
m_AuxMachTypeList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelAuxMachType As StringIdCmBx
|
|
Public Property SelAuxMachType As StringIdCmBx
|
|
Get
|
|
Return m_SelAuxMachType
|
|
End Get
|
|
Set(value As StringIdCmBx)
|
|
If value IsNot m_SelAuxMachType Then
|
|
m_SelAuxMachType = value
|
|
Select Case m_SelAuxMachType.nId
|
|
Case 0
|
|
CurrentMachine.sCurrDrilling = String.Empty
|
|
CurrentMachine.sCurrMilling = String.Empty
|
|
CurrentMachine.sCurrWaterJetting = String.Empty
|
|
CurrDrilling_Visibility = Visibility.Collapsed
|
|
CurrMilling_Visibility = Visibility.Collapsed
|
|
CurrWaterjetting_Visibility = Visibility.Collapsed
|
|
Case 1
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrDrilling) Then
|
|
SelCurrDrilling = CurrentMachine.sCurrDrilling
|
|
End If
|
|
CurrentMachine.sCurrMilling = String.Empty
|
|
CurrentMachine.sCurrWaterJetting = String.Empty
|
|
CurrDrilling_Visibility = Visibility.Visible
|
|
CurrMilling_Visibility = Visibility.Collapsed
|
|
CurrWaterjetting_Visibility = Visibility.Collapsed
|
|
Case 2
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrMilling) Then
|
|
SelCurrMilling = CurrentMachine.sCurrMilling
|
|
End If
|
|
CurrentMachine.sCurrDrilling = String.Empty
|
|
CurrentMachine.sCurrWaterJetting = String.Empty
|
|
CurrDrilling_Visibility = Visibility.Collapsed
|
|
CurrMilling_Visibility = Visibility.Visible
|
|
CurrWaterjetting_Visibility = Visibility.Collapsed
|
|
Case 3
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrDrilling) Then
|
|
SelCurrDrilling = CurrentMachine.sCurrDrilling
|
|
End If
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrMilling) Then
|
|
SelCurrMilling = CurrentMachine.sCurrMilling
|
|
End If
|
|
CurrentMachine.sCurrWaterJetting = String.Empty
|
|
CurrDrilling_Visibility = Visibility.Visible
|
|
CurrMilling_Visibility = Visibility.Visible
|
|
CurrWaterjetting_Visibility = Visibility.Collapsed
|
|
Case 4
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrWaterJetting) Then
|
|
SelCurrWaterjetting = CurrentMachine.sCurrWaterJetting
|
|
End If
|
|
CurrentMachine.sCurrDrilling = String.Empty
|
|
CurrentMachine.sCurrMilling = String.Empty
|
|
CurrDrilling_Visibility = Visibility.Collapsed
|
|
CurrMilling_Visibility = Visibility.Collapsed
|
|
CurrWaterjetting_Visibility = Visibility.Visible
|
|
End Select
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AuxMachType_Visibility As Visibility
|
|
Public Property AuxMachType_Visibility As Visibility
|
|
Get
|
|
Return m_AuxMachType_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AuxMachType_Visibility = value
|
|
NotifyPropertyChanged("AuxiliaryMach_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Aux Machining
|
|
|
|
#Region " DRILLING "
|
|
|
|
Private m_CurrDrillingList As New List(Of String)
|
|
Public Property CurrDrillingList As List(Of String)
|
|
Get
|
|
Return m_CurrDrillingList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_CurrDrillingList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelCurrDrilling As String
|
|
Public Property SelCurrDrilling As String
|
|
Get
|
|
Return m_SelCurrDrilling
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_SelCurrDrilling Then
|
|
m_SelCurrDrilling = value
|
|
CurrentMachine.sCurrDrilling = m_SelCurrDrilling
|
|
' salvo la lvorazione corrente
|
|
WritePrivateProfileString(S_MACH_MACH, K_CURRDRILLING_OFFICE, m_SelCurrDrilling, sMachIniFile)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetCurrDrilling(sCurrOfficeDrilling As String)
|
|
m_SelCurrDrilling = sCurrOfficeDrilling
|
|
CurrentMachine.sCurrDrilling = m_SelCurrDrilling
|
|
NotifyPropertyChanged("SelCurrDrilling")
|
|
End Sub
|
|
|
|
Private m_CurrDrilling_Visibility As Visibility
|
|
Public Property CurrDrilling_Visibility As Visibility
|
|
Get
|
|
Return m_CurrDrilling_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CurrDrilling_Visibility = value
|
|
NotifyPropertyChanged("CurrDrilling_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Drilling
|
|
|
|
#Region " MILLING "
|
|
|
|
Private m_CurrMillingList As New List(Of String)
|
|
Public Property CurrMillingList As List(Of String)
|
|
Get
|
|
Return m_CurrMillingList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_CurrMillingList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelCurrMilling As String
|
|
Public Property SelCurrMilling As String
|
|
Get
|
|
Return m_SelCurrMilling
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_SelCurrMilling Then
|
|
m_SelCurrMilling = value
|
|
CurrentMachine.sCurrMilling = m_SelCurrMilling
|
|
' salvo la lvorazione corrente
|
|
WritePrivateProfileString(S_MACH_MACH, K_CURRMILLING_OFFICE, m_SelCurrMilling, sMachIniFile)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetCurrMilling(sCurrOfficeMilling As String)
|
|
m_SelCurrMilling = sCurrOfficeMilling
|
|
CurrentMachine.sCurrMilling = m_SelCurrMilling
|
|
NotifyPropertyChanged("SelCurrMilling")
|
|
End Sub
|
|
|
|
Private m_CurrMilling_Visibility As Visibility
|
|
Public Property CurrMilling_Visibility As Visibility
|
|
Get
|
|
Return m_CurrMilling_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CurrMilling_Visibility = value
|
|
NotifyPropertyChanged("CurrMilling_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' MILLING
|
|
|
|
#Region " SCASSO "
|
|
|
|
Private m_CurrPocketingList As New List(Of String)
|
|
Public Property CurrPocketingList As List(Of String)
|
|
Get
|
|
Return m_CurrPocketingList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_CurrPocketingList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelCurrPocketing As String
|
|
Public Property SelCurrPocketing As String
|
|
Get
|
|
Return m_SelCurrPocketing
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_SelCurrPocketing Then
|
|
m_SelCurrPocketing = value
|
|
CurrentMachine.sCurrPocketing = m_SelCurrPocketing
|
|
' salvo la lvorazione corrente
|
|
WritePrivateProfileString(S_MACH_MACH, K_CURRPOCKETING_OFFICE, m_SelCurrPocketing, sMachIniFile)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetCurrPocketing(sCurrOfficePocketing As String)
|
|
m_SelCurrPocketing = sCurrOfficePocketing
|
|
CurrentMachine.sCurrPocketing = m_SelCurrPocketing
|
|
NotifyPropertyChanged("SelCurrPocketing")
|
|
End Sub
|
|
|
|
Private m_CurrPocketing_Visibility As Visibility
|
|
Public Property CurrPocketing_Visibility As Visibility
|
|
Get
|
|
Return m_CurrPocketing_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CurrPocketing_Visibility = value
|
|
NotifyPropertyChanged("CurrPocketing_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Scasso
|
|
|
|
#Region " WATERJETTING "
|
|
|
|
Private m_CurrWaterjettingList As New List(Of String)
|
|
Public Property CurrWaterjettingList As List(Of String)
|
|
Get
|
|
Return m_CurrWaterjettingList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_CurrWaterjettingList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelCurrWaterjetting As String
|
|
Public Property SelCurrWaterjetting As String
|
|
Get
|
|
Return m_SelCurrWaterjetting
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_SelCurrWaterjetting Then
|
|
m_SelCurrWaterjetting = value
|
|
CurrentMachine.sCurrWaterJetting = m_SelCurrWaterjetting
|
|
' salvo la lvorazione corrente
|
|
WritePrivateProfileString(S_MACH_MACH, K_CURRWATERJETTING_OFFICE, m_SelCurrWaterjetting, sMachIniFile)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetCurrWaterjetting(sCurrOfficeWaterjetting As String)
|
|
m_SelCurrWaterjetting = sCurrOfficeWaterjetting
|
|
CurrentMachine.sCurrWaterJetting = m_SelCurrWaterjetting
|
|
NotifyPropertyChanged("SelCurrWaterjetting")
|
|
End Sub
|
|
|
|
Private m_CurrWaterjettingQualityList As New List(Of String)
|
|
Public Property CurrWaterjettingQualityList As List(Of String)
|
|
Get
|
|
Return m_CurrWaterjettingQualityList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_CurrWaterjettingQualityList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelCurrWaterjettingQuality As String
|
|
Public Property SelCurrWaterjettingQuality As String
|
|
Get
|
|
Return m_SelCurrWaterjettingQuality
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_SelCurrWaterjettingQuality Then
|
|
m_SelCurrWaterjettingQuality = value
|
|
CurrentMachine.sCurrWaterJettingQuality = m_SelCurrWaterjettingQuality
|
|
' salvo la lvorazione corrente
|
|
WritePrivateProfileString(S_MACH_MACH, K_CURRWATERJETTINGQUALITY_OFFICE, m_SelCurrWaterjettingQuality, sMachIniFile)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetCurrWaterjettingQuality(sCurrOfficeWaterjettingQuality As String)
|
|
m_SelCurrWaterjettingQuality = sCurrOfficeWaterjettingQuality
|
|
CurrentMachine.sCurrWaterJettingQuality = m_SelCurrWaterjettingQuality
|
|
NotifyPropertyChanged("SelCurrWaterjetting")
|
|
End Sub
|
|
|
|
Private m_CurrWaterjetting_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property CurrWaterjetting_Visibility As Visibility
|
|
Get
|
|
Return m_CurrWaterjetting_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CurrWaterjetting_Visibility = value
|
|
NotifyPropertyChanged(NameOf(CurrWaterjetting_Visibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_CurrWaterjettingQuality_Visibility As Visibility
|
|
Public Property CurrWaterjettingQuality_Visibility As Visibility
|
|
Get
|
|
Return m_CurrWaterjettingQuality_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CurrWaterjettingQuality_Visibility = value
|
|
NotifyPropertyChanged(NameOf(CurrWaterjettingQuality_Visibility))
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' WaterJetting
|
|
|
|
Private m_AvailableSawList As New List(Of String)
|
|
Private m_AvailableMillList As New List(Of String)
|
|
Private m_AvailableDrillList As New List(Of String)
|
|
Private m_AvailableWaterjetList As New List(Of String)
|
|
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property TitleMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 9)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property CurrSawingMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 1)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property AuxMachTypeMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 2)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property CurrDrillingMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 3)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property CurrMillingMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 4)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property CurrPocketingMsg As String
|
|
Get
|
|
Return EgtMsg(90550)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property CurrWaterjettingMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 10)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CurrWaterjettingQualityMsg As String
|
|
Get
|
|
Return "Quality"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OkMsg As String
|
|
Get
|
|
Return "Ok"
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ExitMsg As String
|
|
Get
|
|
Return "Exit"
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
InitializeMachiningLists()
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Private Sub InitializeMachiningLists()
|
|
|
|
' Creo liste utensili disponibili da attrezzaggio
|
|
CreateAvailableToolList()
|
|
' Creo lista lavorazioni di lama
|
|
CreateMachiningList(MCH_MY.SAWING, m_AvailableSawList, m_CurrSawingList)
|
|
|
|
' Verifico la configurazione della macchina per creare i combobox
|
|
Select Case CurrentMachine.MountedToolConfig
|
|
Case CurrentMachine.MountedToolConfigs.SAW
|
|
AuxMachType_Visibility = Visibility.Collapsed
|
|
|
|
Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL, CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER, CurrentMachine.MountedToolConfigs.TOOLCHANGER
|
|
' Creo lista lavorazioni foretto e fresa
|
|
If CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
|
|
|
|
' --- DRILL ---
|
|
CreateMachiningList(MCH_MY.DRILLING, m_AvailableDrillList, m_CurrDrillingList)
|
|
' Se la lista è vuota cancello la lavorazione corrente di questo tipo
|
|
If m_CurrDrillingList.Count <= 1 Then
|
|
CurrentMachine.sCurrDrilling = String.Empty
|
|
End If
|
|
|
|
' --- MILL ---
|
|
CreateMachiningList(MCH_MY.MILLING, m_AvailableMillList, m_CurrMillingList)
|
|
' Se la lista è vuota cancello la lavorazione corrente di questo tipo
|
|
If m_CurrMillingList.Count <= 1 Then
|
|
CurrentMachine.sCurrMilling = String.Empty
|
|
End If
|
|
|
|
' --- SCASSO ---
|
|
CreateMachiningList(MCH_MY.POCKETING, m_AvailableMillList, m_CurrPocketingList)
|
|
' Se la lista è vuota cancello la lavorazione corrente di questo tipo
|
|
If m_CurrPocketingList.Count <= 1 Then
|
|
CurrentMachine.sCurrPocketing = String.Empty
|
|
End If
|
|
|
|
' --- WATERJET ---
|
|
CreateMachiningList(MCH_MY.WATERJETTING, m_AvailableWaterjetList, m_CurrWaterjettingList)
|
|
' Se la lista è vuota cancello la lavorazione corrente di questo tipo
|
|
If m_CurrWaterjettingList.Count <= 1 Then
|
|
CurrentMachine.sCurrWaterJetting = String.Empty
|
|
End If
|
|
m_CurrWaterjettingQualityList = New List(Of String)(CurrentMachine.Qualities)
|
|
|
|
ElseIf CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER Or
|
|
CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then
|
|
' --- DRILL ---
|
|
CreateMachiningList(MCH_MY.DRILLING, m_AvailableDrillList, m_CurrDrillingList)
|
|
' Se la lista è vuota cancello la lavorazione corrente di questo tipo
|
|
If m_CurrDrillingList.Count <= 1 Then
|
|
CurrentMachine.sCurrDrilling = String.Empty
|
|
End If
|
|
|
|
' --- MILL ---
|
|
CreateMachiningList(MCH_MY.MILLING, m_AvailableMillList, m_CurrMillingList)
|
|
' Se la lista è vuota cancello la lavorazione corrente di questo tipo
|
|
If m_CurrMillingList.Count <= 1 Then
|
|
CurrentMachine.sCurrMilling = String.Empty
|
|
End If
|
|
|
|
' --- SCASSO ---
|
|
CreateMachiningList(MCH_MY.POCKETING, m_AvailableMillList, m_CurrPocketingList)
|
|
' Se la lista è vuota cancello la lavorazione corrente di questo tipo
|
|
If m_CurrPocketingList.Count <= 1 Then
|
|
CurrentMachine.sCurrPocketing = String.Empty
|
|
End If
|
|
|
|
' --- WATERJET ---
|
|
CreateMachiningList(MCH_MY.WATERJETTING, m_AvailableWaterjetList, m_CurrWaterjettingList)
|
|
' Se la lista è vuota cancello la lavorazione corrente di questo tipo
|
|
If m_CurrWaterjettingList.Count <= 1 Then
|
|
CurrentMachine.sCurrWaterJetting = String.Empty
|
|
End If
|
|
m_CurrWaterjettingQualityList = New List(Of String)(CurrentMachine.Qualities)
|
|
End If
|
|
|
|
' Nascondo la selezione dell'utensile ausiliario -- DA ELIMINARE? --
|
|
AuxMachType_Visibility = Visibility.Hidden
|
|
End Select
|
|
|
|
If m_CurrSawingList.Count > 0 Then
|
|
If CurrentMachine.sCurrSawing <> String.Empty Then
|
|
SetCurrSawing(CurrentMachine.sCurrSawing)
|
|
Else
|
|
Dim sCurrSawing As String = ""
|
|
' GetPrivateProfileString(S_MACH_MACH, K_CURRSAWING, Nothing, sCurrSawing, sMachIniFile)
|
|
GetPrivateProfileString(S_MACH_MACH, K_CURRSAWING_OFFICE, Nothing, sCurrSawing, sMachIniFile)
|
|
'SelCurrSawing = sCurrSawing
|
|
SetCurrSawing(sCurrSawing)
|
|
End If
|
|
Else
|
|
CurrentMachine.sCurrSawing = String.Empty
|
|
End If
|
|
|
|
' rendo visibili le lavorazioni secondarie
|
|
If CurrentMachine.bDrilling And m_CurrDrillingList.Count > 1 Then
|
|
CurrDrilling_Visibility = Visibility.Visible
|
|
If CurrentMachine.sCurrDrilling <> String.Empty Then
|
|
SetCurrDrilling(CurrentMachine.sCurrDrilling)
|
|
Else
|
|
Dim sCurrMachining As String = ""
|
|
GetPrivateProfileString(S_MACH_MACH, K_CURRDRILLING_OFFICE, Nothing, sCurrMachining, sMachIniFile)
|
|
SetCurrDrilling(sCurrMachining)
|
|
End If
|
|
Else
|
|
CurrDrilling_Visibility = Visibility.Collapsed
|
|
End If
|
|
|
|
If CurrentMachine.bMilling And m_CurrMillingList.Count > 1 Then
|
|
CurrMilling_Visibility = Visibility.Visible
|
|
If CurrentMachine.sCurrMilling <> String.Empty Then
|
|
SetCurrMilling(CurrentMachine.sCurrMilling)
|
|
Else
|
|
Dim sCurrMachining As String = ""
|
|
GetPrivateProfileString(S_MACH_MACH, K_CURRMILLING_OFFICE, Nothing, sCurrMachining, sMachIniFile)
|
|
SetCurrMilling(sCurrMachining)
|
|
End If
|
|
Else
|
|
CurrMilling_Visibility = Visibility.Collapsed
|
|
End If
|
|
|
|
If CurrentMachine.bPocketing And CurrPocketingList.Count > 1 Then
|
|
CurrPocketing_Visibility = Visibility.Visible
|
|
If CurrentMachine.sCurrPocketing <> String.Empty Then
|
|
SetCurrPocketing(CurrentMachine.sCurrPocketing)
|
|
Else
|
|
Dim sCurrMachining As String = ""
|
|
GetPrivateProfileString(S_MACH_MACH, K_CURRPOCKETING_OFFICE, Nothing, sCurrMachining, sMachIniFile)
|
|
SetCurrPocketing(sCurrMachining)
|
|
End If
|
|
Else
|
|
CurrPocketing_Visibility = Visibility.Collapsed
|
|
End If
|
|
|
|
If CurrentMachine.bWaterJetting And CurrWaterjettingList.Count > 1 Then
|
|
CurrWaterjetting_Visibility = Visibility.Visible
|
|
' se DB WaterJet abilitato avrò anche la CmBx della Quality solo la CmBx del Waterjetting corrente
|
|
If CurrentMachine.bFromDBWaterJet Then
|
|
If CurrentMachine.sCurrWaterJetting <> String.Empty Then
|
|
SetCurrWaterjetting(CurrentMachine.sCurrWaterJetting)
|
|
Else
|
|
Dim sCurrMachining As String = ""
|
|
GetPrivateProfileString(S_MACH_MACH, K_CURRWATERJETTING_OFFICE, Nothing, sCurrMachining, sMachIniFile)
|
|
SetCurrWaterjetting(sCurrMachining)
|
|
End If
|
|
If CurrentMachine.sCurrWaterJettingQuality <> String.Empty Then
|
|
SetCurrWaterjettingQuality(CurrentMachine.sCurrWaterJettingQuality)
|
|
Else
|
|
Dim sCurrMachining As String = ""
|
|
GetPrivateProfileString(S_MACH_MACH, K_CURRWATERJETTINGQUALITY_OFFICE, Nothing, sCurrMachining, sMachIniFile)
|
|
SetCurrWaterjettingQuality(sCurrMachining)
|
|
End If
|
|
CurrWaterjettingQuality_Visibility = Visibility.Visible
|
|
Else
|
|
CurrWaterjettingQuality_Visibility = Visibility.Collapsed
|
|
End If
|
|
Else
|
|
CurrWaterjettingQuality_Visibility = Visibility.Collapsed
|
|
End If
|
|
|
|
' Con le nuove modifiche questa selezione dovrebbe scompaire definitivamente -- DA ELIMINARE? --
|
|
Dim ShowAuxMAchineCmBx As Boolean = False
|
|
If Not CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAW And ShowAuxMAchineCmBx Then
|
|
If CurrentMachine.bDrilling Then
|
|
m_AuxMachTypeList.Add(New StringIdCmBx(1, EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 6)))
|
|
If CurrentMachine.bMilling Then
|
|
m_AuxMachTypeList.Add(New StringIdCmBx(2, EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 7)))
|
|
If CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER Or
|
|
CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then
|
|
m_AuxMachTypeList.Add(New StringIdCmBx(3, EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 8)))
|
|
End If
|
|
End If
|
|
ElseIf CurrentMachine.bMilling Then
|
|
m_AuxMachTypeList.Add(New StringIdCmBx(2, EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 7)))
|
|
Else
|
|
If CurrentMachine.bWaterJetting Then
|
|
m_AuxMachTypeList.Add(New StringIdCmBx(4, EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 11)))
|
|
End If
|
|
End If
|
|
' Aggiungo nessuna come ultimo elemento della lista
|
|
m_AuxMachTypeList.Add(New StringIdCmBx(0, EgtMsg(MSG_CHOOSEMACHININGPAGEUC + 5)))
|
|
|
|
If CurrentMachine.sCurrDrilling <> String.Empty Then
|
|
If CurrentMachine.sCurrMilling <> String.Empty Then
|
|
SelAuxMachType = StringIdCmBx.FromIdToStringIdCmBx(3, m_AuxMachTypeList)
|
|
Else
|
|
SelAuxMachType = StringIdCmBx.FromIdToStringIdCmBx(1, m_AuxMachTypeList)
|
|
End If
|
|
Else
|
|
If CurrentMachine.sCurrMilling <> String.Empty Then
|
|
SelAuxMachType = StringIdCmBx.FromIdToStringIdCmBx(2, m_AuxMachTypeList)
|
|
Else
|
|
If CurrentMachine.sCurrWaterJetting <> String.Empty Then
|
|
SelAuxMachType = StringIdCmBx.FromIdToStringIdCmBx(4, m_AuxMachTypeList)
|
|
Else
|
|
SelAuxMachType = StringIdCmBx.FromIdToStringIdCmBx(0, m_AuxMachTypeList)
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub CreateAvailableToolList()
|
|
' recupero il gruppo del setup
|
|
Dim nSetUpGroup As Integer = EgtGetCurrSetup()
|
|
' leggo l'attrezzaggio del progetto
|
|
Dim sPosition As String = String.Empty
|
|
Dim IniIndex As Integer = 1
|
|
' recupero stringa di ogni posizione
|
|
While EgtGetInfo(nSetUpGroup, K_POS & IniIndex, sPosition)
|
|
ReadPositionString(IniIndex, sPosition, True)
|
|
IniIndex += 1
|
|
End While
|
|
End Sub
|
|
|
|
' Funzione che dati l'indice della posizione e la sua stringa di attrezzaggio, carica l'attrezzaggio descritto
|
|
Private Sub ReadPositionString(nIndex As Integer, sPosition As String, bOriginal As Boolean)
|
|
Dim sToolList As New List(Of String)
|
|
' la spezzo sui ;
|
|
Dim sItems() As String = sPosition.Split(";".ToCharArray)
|
|
' se ci sono almeno tre elementi sono sicuro che ci sia almeno un'uscita attrezzata
|
|
If sItems.Count >= 3 Then
|
|
' separo le uscite divise dalla ,
|
|
Dim sExitToolAssList() As String = sItems(2).Split(",".ToCharArray)
|
|
sToolList.Clear()
|
|
' creo le liste di uscite e utensili attrezzati ricavati
|
|
For AssIndex = 0 To sExitToolAssList.Count() - 1
|
|
Dim sExitToolAssItem() As String = sExitToolAssList(AssIndex).Split("/".ToCharArray)
|
|
If sExitToolAssItem.Count > 1 Then
|
|
sToolList.Add(sExitToolAssItem(1))
|
|
End If
|
|
Next
|
|
' verifico se gli utensili esistono ancora nel db
|
|
For ToolIndex = sToolList.Count - 1 To 0 Step -1
|
|
Dim sSearchedTool As String = String.Empty
|
|
EgtTdbGetToolFromUUID(sToolList(ToolIndex), sSearchedTool)
|
|
' Se non trovo l'utensile lo elimino; l'attrezzaggio è sbagliato
|
|
If String.IsNullOrWhiteSpace(sSearchedTool) Then
|
|
sToolList.RemoveAt(ToolIndex)
|
|
' Impossibile trovare l'utensile xxx nel DB utensili
|
|
'MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 3) & " " & sSearchedTool & " " & EgtMsg(MSG_SETUPERRORS + 4), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
' Altrimenti lo inserisco nelle liste a seconda del tipo
|
|
Else
|
|
EgtTdbSetCurrTool(sSearchedTool)
|
|
Dim ToolType As Integer = 0
|
|
EgtTdbGetCurrToolParam(MCH_TP.TYPE, ToolType)
|
|
If (ToolType And MCH_TF.DRILLBIT) <> 0 Then
|
|
m_AvailableDrillList.Add(sToolList(ToolIndex))
|
|
ElseIf (ToolType And MCH_TF.SAWBLADE) <> 0 Then
|
|
m_AvailableSawList.Add(sToolList(ToolIndex))
|
|
ElseIf (ToolType And MCH_TF.MILL) <> 0 Then
|
|
m_AvailableMillList.Add(sToolList(ToolIndex))
|
|
ElseIf (ToolType And MCH_TF.WATERJET) <> 0 Then
|
|
m_AvailableWaterjetList.Add(sToolList(ToolIndex))
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CreateMachiningList(MachiningType As Integer, AvailableToolList As List(Of String), MachiningList As List(Of String))
|
|
For ToolIndex = 0 To AvailableToolList.Count - 1
|
|
' Recupero UUID dell'utensile
|
|
Dim sTuuid As String = AvailableToolList(ToolIndex)
|
|
' Cerco tutte le lavorazioni che utilizzano l'utensile corrente e le aggiungo alla lista
|
|
Dim MachiningName As String = String.Empty
|
|
Dim bOk As Boolean = EgtMdbGetFirstMachining(MachiningType, MachiningName)
|
|
While bOk
|
|
EgtMdbSetCurrMachining(MachiningName)
|
|
Dim sMachTuuid As String = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMachTuuid)
|
|
If sMachTuuid = sTuuid AndAlso VerifyMatThickCompatibility() Then
|
|
MachiningList.Add(MachiningName)
|
|
End If
|
|
bOk = EgtMdbGetNextMachining(MachiningType, MachiningName)
|
|
End While
|
|
Next
|
|
' Aggiungo lavorazione nulla
|
|
MachiningList.Add(String.Empty)
|
|
End Sub
|
|
|
|
' Funzione che data la stringa di materiali e spessori della lavorazione, e i dati del grezzo corrente, restituisce se la lavorazione è valida oppure no
|
|
Friend Shared Function VerifyMatThickCompatibility() As Boolean
|
|
If Not IsNothing(EstCalc.GetMaterialName) Then
|
|
Dim SysNotes As String = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.SYSNOTES, SysNotes)
|
|
If SysNotes <> String.Empty Then
|
|
Dim MachiningMaterials() = SysNotes.Split(";".ToCharArray)
|
|
|
|
If CurrentMachine.bWaterJet And CurrentMachine.bFromDBWaterJet Then
|
|
For Each Material As String In MachiningMaterials
|
|
Dim Param() As String = Material.Split(",".ToCharArray)
|
|
If Param.Count() < 2 Then Continue For
|
|
Dim CurrMatId As String = String.Empty
|
|
Dim CurrMatSubId As String = String.Empty
|
|
For Each Mat In CurrentMachine.Materials
|
|
If Mat.sName = EstCalc.GetMaterialName Then
|
|
CurrMatId = Mat.nId.ToString()
|
|
CurrMatSubId = Mat.SubId.ToString()
|
|
Exit For
|
|
End If
|
|
Next
|
|
Dim SubParam() As String = Param(0).Split(".".ToCharArray)
|
|
If Not IsNothing( CurrentMachine.CurrMat) AndAlso SubParam(0) = CurrentMachine.CurrMat.nId.ToString() AndAlso
|
|
SubParam.Count > 1 AndAlso SubParam(1) = CurrentMachine.CurrMat.SubId.ToString() Then
|
|
Dim MatMinH As Double = 0
|
|
StringToDouble(Param(1), MatMinH)
|
|
Dim MatMaxH As Double = 0
|
|
StringToDouble(Param(2), MatMaxH)
|
|
If EstCalc.GetRawHeight > MatMinH - EPS_SMALL And EstCalc.GetRawHeight < MatMaxH + EPS_SMALL Then
|
|
Return True
|
|
End If
|
|
End If
|
|
Next
|
|
Else
|
|
|
|
For Each Material In MachiningMaterials
|
|
Dim Param() As String = Material.Split(",".ToCharArray)
|
|
If Param.Count() < 2 Then Continue For
|
|
Dim CurrMatId As String = String.Empty
|
|
For Each Mat In CurrentMachine.Materials
|
|
If Mat.sName = EstCalc.GetMaterialName Then
|
|
CurrMatId = Mat.nId.ToString()
|
|
Exit For
|
|
End If
|
|
Next
|
|
If Param(0) = CurrMatId Then
|
|
Dim MatMinH As Double = 0
|
|
StringToDouble(Param(1), MatMinH)
|
|
Dim MatMaxH As Double = 0
|
|
StringToDouble(Param(2), MatMaxH)
|
|
If EstCalc.GetRawHeight > MatMinH - EPS_SMALL And EstCalc.GetRawHeight < MatMaxH + EPS_SMALL Then
|
|
Return True
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
End If
|
|
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
Else
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
'Private Function VerifyMatThickCompatibility() As Boolean
|
|
' If Not IsNothing(m_CurrentMachine.CurrMat) Then
|
|
' Dim SysNotes As String = String.Empty
|
|
' EgtMdbGetCurrMachiningParam(MCH_MP.SYSNOTES, SysNotes)
|
|
' If SysNotes <> String.Empty Then
|
|
' Dim MachiningMaterials() = SysNotes.Split(";".ToCharArray)
|
|
' SysNotes = String.Empty
|
|
' If m_CurrentMachine.bWaterJet Then
|
|
' For Each Material As Object In MachiningMaterials
|
|
' Dim Param() As String = Material.Split(",".ToCharArray)
|
|
' Dim SubParam() As String = Param(0).Split(".".ToCharArray)
|
|
' If SubParam(0) = m_CurrentMachine.CurrMat.nId.ToString() AndAlso SubParam.Count > 1 AndAlso SubParam(1) = m_CurrentMachine.CurrMat.SubId.ToString() Then
|
|
' Dim dRawHeight = GetRawHeight()
|
|
' Dim MatMinH As Double = 0
|
|
' StringToDouble(Param(1), MatMinH)
|
|
' Dim MatMaxH As Double = 0
|
|
' StringToDouble(Param(2), MatMaxH)
|
|
' If dRawHeight > MatMinH - EPS_SMALL And dRawHeight < MatMaxH + EPS_SMALL Then
|
|
' Return True
|
|
' End If
|
|
' End If
|
|
' Next
|
|
' Else
|
|
' For Each Material As Object In MachiningMaterials
|
|
' Dim Param() As String = Material.Split(",".ToCharArray)
|
|
' If Param(0) = m_CurrentMachine.CurrMat.nId.ToString() Then
|
|
' Dim dRawHeight = GetRawHeight()
|
|
' Dim MatMinH As Double = 0
|
|
' StringToDouble(Param(1), MatMinH)
|
|
' Dim MatMaxH As Double = 0
|
|
' StringToDouble(Param(2), MatMaxH)
|
|
' If dRawHeight > MatMinH - EPS_SMALL And dRawHeight < MatMaxH + EPS_SMALL Then
|
|
' Return True
|
|
' End If
|
|
' End If
|
|
' Next
|
|
' End If
|
|
|
|
' Return False
|
|
' Else
|
|
' Return False
|
|
' End If
|
|
' Else
|
|
' Return True
|
|
' End If
|
|
'End Function
|
|
|
|
#End Region ' METHODS
|
|
|
|
End Class
|
|
|
|
Public Class StringIdCmBx
|
|
|
|
Private m_nId As Integer
|
|
Private m_sName As String
|
|
|
|
Friend ReadOnly Property nId As Integer
|
|
Get
|
|
Return m_nId
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sName As String
|
|
Get
|
|
Return m_sName
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(Id As Integer, sName As String)
|
|
m_nId = Id
|
|
m_sName = sName
|
|
End Sub
|
|
|
|
Friend Overloads Shared Function FromIdToStringIdCmBx(nId As Integer, List As List(Of StringIdCmBx)) As StringIdCmBx
|
|
For Each Item In List
|
|
If Item.nId = nId Then
|
|
Return Item
|
|
End If
|
|
Next
|
|
Return Nothing
|
|
End Function
|
|
|
|
Friend Overloads Shared Function FromIdToStringIdCmBx(nId As Integer, List As ObservableCollection(Of StringIdCmBx)) As StringIdCmBx
|
|
For Each Item In List
|
|
If Item.nId = nId Then
|
|
Return Item
|
|
End If
|
|
Next
|
|
Return Nothing
|
|
End Function
|
|
|
|
End Class |