357 lines
14 KiB
VB.net
357 lines
14 KiB
VB.net
Imports EgtBEAMWALL.Core
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class BTLParamVM
|
|
Inherits VMBase
|
|
|
|
Protected m_BTLParamM As BTLParamM
|
|
Public ReadOnly Property BTLParamM As BTLParamM
|
|
Get
|
|
Return m_BTLParamM
|
|
End Get
|
|
End Property
|
|
|
|
Private m_BTLFeatureM As BTLFeatureM
|
|
|
|
Public ReadOnly Property bIsP As Boolean
|
|
Get
|
|
Return m_BTLParamM.bIsP
|
|
End Get
|
|
End Property
|
|
|
|
Public Property bIsModified As Boolean
|
|
Get
|
|
Return m_BTLParamM.bIsModified
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_BTLParamM.bIsModified = value
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property Custom_Visibility As Visibility
|
|
Get
|
|
If bIsP Then
|
|
Return Visibility.Collapsed
|
|
Else
|
|
Return Visibility.Visible
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
' parametri da struttura
|
|
Public Property sName As String
|
|
Get
|
|
Return m_BTLParamM.sName
|
|
End Get
|
|
Set(value As String)
|
|
m_BTLParamM.sName = value
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property nId As Integer
|
|
Get
|
|
Return m_BTLParamM.nId
|
|
End Get
|
|
End Property
|
|
|
|
Public Property sDescription As String
|
|
Get
|
|
Return m_BTLParamM.sDescription
|
|
End Get
|
|
Set(value As String)
|
|
m_BTLParamM.sDescription = value
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property sMin As String
|
|
Get
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_
|
|
Return DoubleToString(m_BTLParamM.dMin, 3)
|
|
Case BTLParamType.LENGTH
|
|
Return LenToString(m_BTLParamM.dMin, 3)
|
|
Case Else
|
|
Return ""
|
|
End Select
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property dMin As Double
|
|
Get
|
|
Return m_BTLParamM.dMin
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property sMax As String
|
|
Get
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_
|
|
Return DoubleToString(m_BTLParamM.dMax, 3)
|
|
Case BTLParamType.LENGTH
|
|
Return LenToString(m_BTLParamM.dMax, 3)
|
|
Case Else
|
|
Return ""
|
|
End Select
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property dMax As Double
|
|
Get
|
|
Return m_BTLParamM.dMax
|
|
End Get
|
|
End Property
|
|
|
|
' parametri da geometria
|
|
Public Property sValue As String
|
|
Get
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_
|
|
Return DoubleToString(m_BTLParamM.dValue, 3)
|
|
Case BTLParamType.LENGTH
|
|
Return LenToString(m_BTLParamM.dValue, 3)
|
|
Case Else ' stringhe
|
|
Return m_BTLParamM.sValue
|
|
End Select
|
|
Return If(m_BTLParamM.nType = BTLParamType.LENGTH, LenToString(m_BTLParamM.dValue, 3), DoubleToString(m_BTLParamM.dValue, 3))
|
|
End Get
|
|
Set(value As String)
|
|
Dim dNewValue As Double
|
|
' trasformo valori
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_
|
|
StringToDoubleAdv(value, dNewValue, True)
|
|
Case BTLParamType.LENGTH
|
|
StringToLenAdv(value, dNewValue, True)
|
|
Case Else
|
|
' per string non faccio nulla
|
|
End Select
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
|
|
' verifico che sia compreso tra minimo e massimo
|
|
If dNewValue < m_BTLParamM.dMin OrElse dNewValue > m_BTLParamM.dMax Then
|
|
'MessageBox.Show(EgtMsg(61856), EgtMsg(30007))
|
|
If bOnlyProd Then
|
|
EgtBEAMWALL.Core.OnlyProdEgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(61856), EgtMsg(30007))
|
|
Else
|
|
EgtBEAMWALL.Core.EgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(61856), EgtMsg(30007))
|
|
End If
|
|
NotifyPropertyChanged(NameOf(sValue))
|
|
Return
|
|
End If
|
|
' recupero ParentPart
|
|
Dim ParentPart As BTLPartM = TryCast(m_BTLParamM.ParentFeature.ParentPart, BTLPartM)
|
|
' recupero PartId
|
|
Dim nPartId As Integer = ParentPart.nPartId
|
|
' numero di pezzi inseriti nelle barre
|
|
Dim INPROD As Integer = 0
|
|
EgtDuploInRawCount(nPartId, INPROD)
|
|
' recupero pezzi lavorati da Db
|
|
Dim nDoneCnt As Integer = DbControllers.m_ProjController.getCountItemState(ProjectManagerVM.CurrProj.nProjId, nPartId, ItemState.Assigned)
|
|
' controllo se i pezzi sono lavorati se si messaggio di warning altrimenti messaggio informativo
|
|
If nDoneCnt > 0 Then
|
|
'MessageBox.Show("Pezzo " & nPartId & " non modificato in " & INPROD & " barra/e perche' settata/e come da produrre", EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
If bOnlyProd Then
|
|
EgtBEAMWALL.Core.OnlyProdEgtMessageBoxV.Show(Application.Current.MainWindow, "Pezzo " & nPartId & " non modificato in " & INPROD & " barra/e perche' settata/e come da produrre", EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Else
|
|
EgtBEAMWALL.Core.EgtMessageBoxV.Show(Application.Current.MainWindow, "Pezzo " & nPartId & " non modificato in " & INPROD & " barra/e perche' settata/e come da produrre", EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
End If
|
|
ElseIf INPROD > 0 Then
|
|
'MessageBox.Show("Pezzo " & nPartId & " modificato in " & INPROD & " barra/e grezza/e", EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Information)
|
|
If bOnlyProd Then
|
|
EgtBEAMWALL.Core.OnlyProdEgtMessageBoxV.Show(Application.Current.MainWindow, "Pezzo " & nPartId & " modificato in " & INPROD & " barra/e grezza/e", EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Information)
|
|
Else
|
|
EgtBEAMWALL.Core.EgtMessageBoxV.Show(Application.Current.MainWindow, "Pezzo " & nPartId & " modificato in " & INPROD & " barra/e grezza/e", EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Information)
|
|
End If
|
|
End If
|
|
UpdateParamValue(dNewValue, "")
|
|
Case Else
|
|
UpdateParamValue(0, value)
|
|
End Select
|
|
NotifyPropertyChanged(NameOf(bCustom))
|
|
End Set
|
|
End Property
|
|
Public Property dValue As Double
|
|
Get
|
|
Return m_BTLParamM.dValue
|
|
End Get
|
|
Set(value As Double)
|
|
m_BTLParamM.dValue = value
|
|
NotifyPropertyChanged(NameOf(sValue))
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sDefault As String
|
|
Get
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_
|
|
Return DoubleToString(m_BTLParamM.dDefault, 3)
|
|
Case BTLParamType.LENGTH
|
|
Return LenToString(m_BTLParamM.dDefault, 3)
|
|
Case Else
|
|
Return ""
|
|
End Select
|
|
End Get
|
|
Set(value As String)
|
|
Dim dNewValue As Double
|
|
' trasformo valori
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_
|
|
StringToDoubleAdv(value, dNewValue, True)
|
|
Case BTLParamType.LENGTH
|
|
StringToLenAdv(value, dNewValue, True)
|
|
Case Else
|
|
' per string non faccio nulla
|
|
End Select
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
|
|
' verifico che sia compreso tra minimo e massimo
|
|
If dNewValue < m_BTLParamM.dMin OrElse dNewValue > m_BTLParamM.dMax Then
|
|
'MessageBox.Show(EgtMsg(61856), EgtMsg(30007))
|
|
If bOnlyProd Then
|
|
EgtBEAMWALL.Core.OnlyProdEgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(61856), EgtMsg(30007))
|
|
Else
|
|
EgtBEAMWALL.Core.EgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(61856), EgtMsg(30007))
|
|
End If
|
|
NotifyPropertyChanged(NameOf(sDefault))
|
|
Return
|
|
End If
|
|
m_BTLParamM.dDefault = dNewValue
|
|
m_BTLParamM.bIsModified = True
|
|
Case Else
|
|
m_BTLParamM.dDefault = 0
|
|
m_BTLParamM.bIsModified = True
|
|
End Select
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property nType As BTLParamType
|
|
Get
|
|
Return m_BTLParamM.nType
|
|
End Get
|
|
End Property
|
|
|
|
Protected m_sDrawPath As String
|
|
Public ReadOnly Property sDrawPath As String
|
|
Get
|
|
Return Map.refMainWindowVM.MainWindowM.sResourcesRoot & "\Parameters\" & m_BTLFeatureM.sDescGRP & "_" & m_BTLParamM.sName & "_" & m_BTLFeatureM.nSelGRP & ".gif"
|
|
End Get
|
|
End Property
|
|
|
|
Public Property bCustom As Boolean
|
|
Get
|
|
Return m_BTLParamM.bCustom
|
|
End Get
|
|
Set(value As Boolean)
|
|
' Se de-checko il parametro settiamo il suo valore a quello di default
|
|
Dim bFound As Boolean = False
|
|
If Not value Then
|
|
' Cerco il parametro Q direttamente nel file ini
|
|
Dim GRPType As Integer = Me.m_BTLFeatureM.nSelGRP
|
|
Dim PRC As Integer = Me.m_BTLFeatureM.nPRC
|
|
Dim ParamIndex As String = 1
|
|
Dim NewBTLParam As BTLParamM = Nothing
|
|
While BTLIniFile.GetBeamPrivateProfileParam(GRPType, PRC, False, ParamIndex, Nothing, NewBTLParam)
|
|
Dim QBTLParam As BTLParamVM = New BTLParamVM(NewBTLParam)
|
|
If QBTLParam.sName = Me.sName Then
|
|
Me.sValue = QBTLParam.sDefault
|
|
NotifyPropertyChanged(NameOf(sValue))
|
|
m_BTLParamM.bCustom = value
|
|
' setto nel DB che il parametro attuale è custom o meno
|
|
EgtSetInfo(m_BTLFeatureM.nFeatureId, m_BTLParamM.sName & "A", If(value, "1", ""))
|
|
NotifyPropertyChanged(NameOf(bCustom))
|
|
Exit While
|
|
End If
|
|
ParamIndex += 1
|
|
End While
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property sBWType As String
|
|
Get
|
|
Return m_BTLParamM.sBWType
|
|
End Get
|
|
End Property
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(BTLParamM As BTLParamM, BTLFeatureM As BTLFeatureM)
|
|
m_BTLParamM = BTLParamM
|
|
m_BTLFeatureM = BTLFeatureM
|
|
End Sub
|
|
|
|
Sub New(BTLParamM As BTLParamM)
|
|
m_BTLParamM = BTLParamM
|
|
m_BTLFeatureM = Nothing
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
Friend Sub UpdateParamValue(dNewValue As Double, sNewValue As String, Optional bDraw As Boolean = True)
|
|
' verifico se solido attivo
|
|
Dim bShowSolid As Boolean = Map.refShowBeamPanelVM.ShowSolid_IsChecked
|
|
If bShowSolid Then Map.refProjectVM.BTLStructureVM.ShowSolid(GDB_ID.NULL, False, False)
|
|
' Recupero i parametri attuali della feature
|
|
Dim vPar() As Double = Nothing
|
|
Dim sPar As String = String.Empty
|
|
Dim vParQ() As String = Nothing
|
|
m_BTLFeatureM.CalcParamArray(vPar, sPar, vParQ)
|
|
' se P
|
|
If m_BTLParamM.bIsP Then
|
|
' modifico parametro cambiato con value
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
|
|
vPar(m_BTLParamM.nId - 1) = dNewValue
|
|
Case BTLParamType.STRING_
|
|
sPar = sNewValue
|
|
End Select
|
|
Dim bOK As Boolean = m_BTLFeatureM.UpdateParams(m_BTLFeatureM.nSelGRP, m_BTLFeatureM.nPRC, m_BTLFeatureM.nSelSIDE, m_BTLFeatureM.sDES,
|
|
m_BTLFeatureM.nPRID, m_BTLFeatureM.frFRAME, vPar, sPar, vParQ)
|
|
If bOK Then
|
|
Select Case m_BTLParamM.nType
|
|
Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
|
|
m_BTLParamM.dValue = dNewValue
|
|
NotifyPropertyChanged(NameOf(sValue))
|
|
Case BTLParamType.STRING_
|
|
m_BTLParamM.sValue = sNewValue
|
|
NotifyPropertyChanged(NameOf(sValue))
|
|
End Select
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sValue))
|
|
End If
|
|
' se Q
|
|
Else
|
|
For Ind = 0 To vParQ.Length() - 1
|
|
If vParQ(Ind).StartsWith(m_BTLParamM.sName) Then
|
|
vParQ(Ind) = m_BTLParamM.sName & ":" & DoubleToString(dNewValue, 3)
|
|
End If
|
|
Next
|
|
Dim bOK As Boolean = m_BTLFeatureM.UpdateParams(m_BTLFeatureM.nSelGRP, m_BTLFeatureM.nPRC, m_BTLFeatureM.nSelSIDE, m_BTLFeatureM.sDES,
|
|
m_BTLFeatureM.nPRID, m_BTLFeatureM.frFRAME, vPar, sPar, vParQ)
|
|
|
|
If bOK Then
|
|
m_BTLParamM.bCustom = True
|
|
' se sono in ottimizzazione
|
|
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
|
|
' setto nel progetto il fatto che il parametro attuale è custom o meno
|
|
EgtSetInfo(m_BTLFeatureM.nFeatureId, m_BTLParamM.sName & "A", If(bCustom, "1", ""))
|
|
NotifyPropertyChanged(NameOf(bCustom))
|
|
End If
|
|
m_BTLParamM.dValue = dNewValue
|
|
' modifica provvisoria per mancanza aggiornamento su freecontour
|
|
If m_BTLFeatureM.IsFreeContour Then
|
|
EgtSetInfo(m_BTLFeatureM.nFeatureId, sName, dNewValue)
|
|
End If
|
|
NotifyPropertyChanged(NameOf(dValue))
|
|
Else
|
|
NotifyPropertyChanged(NameOf(dValue))
|
|
End If
|
|
End If
|
|
|
|
If bShowSolid Then Map.refProjectVM.BTLStructureVM.ShowSolid(GDB_ID.NULL, True, False)
|
|
If bDraw Then EgtDraw()
|
|
End Sub
|
|
|
|
End Class
|