0a352fe1dd
- Implementati indici di passaggio da ottimizzatore a supervisore con 5000 - Correzioni e modifiche comnicazione macchina durante prove
206 lines
9.3 KiB
VB.net
206 lines
9.3 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports EgtBEAMWALL.Core
|
|
|
|
Module WarehouseHelper
|
|
|
|
Public Enum WarehouseTypes As Integer
|
|
BASIC = 1
|
|
MEDIUM = 2
|
|
ADVANCED = 3
|
|
End Enum
|
|
|
|
Public Enum RawPartDefs As Integer
|
|
NULL = 0
|
|
EXPLICIT = 1
|
|
FROMWAREHOUSE = 2
|
|
End Enum
|
|
|
|
' funzione che restituisce il tipo di warehouse
|
|
Public Function GetWarehouseType() As WarehouseType
|
|
Return GetMainPrivateProfileInt(S_GENERAL, K_WAREHOUSE, 1)
|
|
End Function
|
|
|
|
' funzione che restituisce la path dell'ini del warehouse
|
|
Public Function GetWarehouseIniPath() As String
|
|
Dim sWarehouseIniPath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir
|
|
Select Case GetWarehouseType()
|
|
Case WarehouseType.BASIC
|
|
Return sWarehouseIniPath & "\" & WH_BASIC_INI_FILE_NAME
|
|
Case WarehouseType.MEDIUM
|
|
Return sWarehouseIniPath & "\" & WH_MEDIUM_INI_FILE_NAME
|
|
End Select
|
|
Return ""
|
|
End Function
|
|
|
|
' funzione che restituisce l'offset
|
|
Public Function GetOffset(Type As BWType) As Double
|
|
Return GenInterface.GetPrivateProfileDouble(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), WRH_OFFSET, 0, GetWarehouseIniPath())
|
|
End Function
|
|
|
|
#Region "Beam"
|
|
|
|
' funzione che restituisce l'offset iniziale
|
|
Public Function GetStartOffset() As Double
|
|
Return GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, GetWarehouseIniPath())
|
|
End Function
|
|
|
|
#End Region ' Beam
|
|
|
|
#Region "Wall"
|
|
|
|
' funzione che restituisce l'offset
|
|
Public Function GetKerf() As Double
|
|
Return GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, GetWarehouseIniPath())
|
|
End Function
|
|
|
|
#End Region ' Wall
|
|
|
|
' funzione che restituisce le dimensioni correnti
|
|
Public Function GetCurrentDimensions(Type As BWType, ByRef dW As Double, ByRef dL As Double) As Boolean
|
|
If Type = BWType.BEAM Then
|
|
Dim nCurrentL As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_CURRENT & WRH_L, 1, GetWarehouseIniPath())
|
|
If nCurrentL <= 0 Then Return False
|
|
dL = GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_L & nCurrentL, 0, GetWarehouseIniPath())
|
|
Return True
|
|
Else
|
|
Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, GetWarehouseIniPath())
|
|
Dim sPanelDim As String = ""
|
|
Dim sPanelDims() As String
|
|
GenInterface.GetPrivateProfileString(WRH_WALL, WRH_S & nCurrentS, "", sPanelDim, GetWarehouseIniPath())
|
|
If String.IsNullOrWhiteSpace(sPanelDim) Then Return False
|
|
sPanelDims = sPanelDim.Split(","c)
|
|
If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dW) OrElse Not StringToDouble(sPanelDims(1), dL) Then Return False
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
' funzione che restituisce la quantita' generica di grezzi
|
|
Public Function GetQuantity(Type As BWType) As Integer
|
|
Dim nQuantity As Integer = 0
|
|
Integer.TryParse(EgtUILib.GenInterface.GetPrivateProfileDouble(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), WRH_QUANTITY, 0, GetWarehouseIniPath()), nQuantity)
|
|
Return nQuantity
|
|
End Function
|
|
|
|
' funzione che restituisce la quantita' di grezzi per sezione
|
|
Public Function GetDimensionsAndQuantityBySection(Type As BWType, ByRef dW As Double, dH As Double, ByRef dL As Double, Material As String, nQuantity As Integer) As Boolean
|
|
Dim nIndex As Integer = 1
|
|
Dim sSection As String = ""
|
|
While GenInterface.GetPrivateProfileString(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), If(Type = BWType.BEAM, WRH_L, WRH_S) & nIndex, "", sSection, GetWarehouseIniPath()) > 0
|
|
If String.IsNullOrWhiteSpace(sSection) Then Return False
|
|
Dim sSectionValues() As String = sSection.Split(","c)
|
|
Select Case Type
|
|
Case BWType.BEAM
|
|
If dW = sSectionValues(0) AndAlso dH = sSectionValues(1) AndAlso Material = sSectionValues(2) Then
|
|
If Not StringToDouble(sSectionValues(3), dL) Then Return False
|
|
If Not Integer.TryParse(sSectionValues(4), nQuantity) Then Return False
|
|
Return True
|
|
End If
|
|
Case BWType.WALL
|
|
If dH = sSectionValues(0) AndAlso Material = sSectionValues(1) Then
|
|
If Not StringToDouble(sSectionValues(2), dW) Then Return False
|
|
If Not StringToDouble(sSectionValues(3), dL) Then Return False
|
|
If Not Integer.TryParse(sSectionValues(4), nQuantity) Then Return False
|
|
Return True
|
|
End If
|
|
End Select
|
|
nIndex += 1
|
|
End While
|
|
Return False
|
|
End Function
|
|
|
|
|
|
' funzione che restituisce la quantita' di grezzi per sezione
|
|
Public Function GetDimensionsAndQuantityForList(Type As BWType, ByRef SectionList As List(Of SectionProgress)) As Boolean
|
|
Dim nIndex As Integer = 1
|
|
Dim sSection As String = ""
|
|
While GenInterface.GetPrivateProfileString(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), If(Type = BWType.BEAM, WRH_L, WRH_S) & nIndex, "", sSection, GetWarehouseIniPath()) > 0
|
|
If String.IsNullOrWhiteSpace(sSection) Then Continue While
|
|
Dim sSectionValues() As String = sSection.Split(","c)
|
|
Dim dW As Double = 0
|
|
Dim dL As Double = 0
|
|
Dim nQty As Integer = 0
|
|
Dim sSectionData As String = ""
|
|
GetPrivateProfileString(If(Type = BWType.BEAM, S_BEAM_LIST, S_WALL_LIST), sSectionValues(0), "", sSectionData, GetWarehouseIniPath())
|
|
Dim SectionData() As String = sSectionData.Split(","c)
|
|
Select Case Type
|
|
Case BWType.BEAM
|
|
For Each SectionProgress In SectionList
|
|
If SectionProgress.Section.dW = SectionData(0) AndAlso SectionProgress.Section.dH = SectionData(1) AndAlso SectionProgress.Section.sMaterial.Contains(SectionData(2)) Then
|
|
If Not StringToDouble(sSectionValues(1), dL) Then Continue While
|
|
If Not Integer.TryParse(sSectionValues(2), nQty) Then Continue While
|
|
SectionProgress.SParamList.Add(New SParam(SectionProgress.Section, dL, nQty))
|
|
End If
|
|
Next
|
|
Case BWType.WALL
|
|
For Each SectionProgress In SectionList
|
|
If SectionProgress.Section.dH = SectionData(0) AndAlso SectionProgress.Section.sMaterial.Contains(SectionData(1)) Then
|
|
If Not StringToDouble(sSectionValues(1), dW) Then Continue While
|
|
If Not StringToDouble(sSectionValues(2), dL) Then Continue While
|
|
If Not Integer.TryParse(sSectionValues(3), nQty) Then Continue While
|
|
SectionProgress.SParamList.Add(New SParam(SectionProgress.Section, dW, dL, nQty))
|
|
End If
|
|
Next
|
|
End Select
|
|
nIndex += 1
|
|
End While
|
|
Return True
|
|
End Function
|
|
|
|
Public Function GetSectionList() As List(Of SParam)
|
|
Dim Sectionlist As New List(Of SParam)
|
|
Dim nIndex As Integer = 1
|
|
Dim CurrSParam As SParam = WarehouseWndVM.GetSParamFromWarehouse(nIndex)
|
|
While Not IsNothing(CurrSParam)
|
|
Sectionlist.Add(CurrSParam)
|
|
nIndex += 1
|
|
CurrSParam = WarehouseWndVM.GetSParamFromWarehouse(nIndex)
|
|
End While
|
|
Return Sectionlist
|
|
End Function
|
|
|
|
' GetSectionList
|
|
'Public Function GetSectionList(Type As BWType, ByRef dW As Double, ByRef dL As Double, Qty As Integer) As Boolean
|
|
' Dim Sectionlist As List(Of SParam)
|
|
' Dim Index As Integer = 1
|
|
' Dim nIndex As Integer = 1
|
|
' Dim sSection As String = ""
|
|
' While GenInterface.GetPrivateProfileString(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), If(Type = BWType.BEAM, WRH_L, WRH_S) & nIndex, "", sSection, GetWarehouseIniPath()) > 0
|
|
' If String.IsNullOrWhiteSpace(sSection) Then Return False
|
|
' Dim sSectionValues() As String = sSection.Split(","c)
|
|
' Select Case Type
|
|
' Case BWType.BEAM
|
|
' If sSectionValues.Count >= 5 Then
|
|
' Sectionlist.Add(New SectionXMaterial(sSectionValues(0), sSectionValues(1), sSectionValues(3), sSectionValues(2)))
|
|
' End If
|
|
' If dW = sSectionValues(0) AndAlso dH = sSectionValues(1) AndAlso Material = sSectionValues(2) Then
|
|
' If Not StringToDouble(sSectionValues(3), dL) Then Return False
|
|
' If Not Integer.TryParse(sSectionValues(4), nQuantity) Then Return False
|
|
' Return True
|
|
' End If
|
|
' Case BWType.WALL
|
|
' If dH = sSectionValues(1) AndAlso Material = sSectionValues(2) Then
|
|
' If Not StringToDouble(sSectionValues(2), dW) Then Return False
|
|
' If Not StringToDouble(sSectionValues(3), dL) Then Return False
|
|
' If Not Integer.TryParse(sSectionValues(4), nQuantity) Then Return False
|
|
' Return True
|
|
' End If
|
|
' End Select
|
|
' nIndex += 1
|
|
' End While
|
|
'End Function
|
|
|
|
' funzione che restituisce modalita' di definizione del grezzo
|
|
Public Function GetRawPartDef() As Integer
|
|
Return GetMainPrivateProfileInt(S_NEST, K_RAWPARTDEF, 2)
|
|
End Function
|
|
|
|
' funzione che restituisce la validità della sezione
|
|
Public Function IsSectionValid(SectXMat As SectionXMaterial) As Boolean
|
|
Return SectXMat.dH >= 0 Or
|
|
SectXMat.dL >= 0 Or
|
|
SectXMat.dW >= 0
|
|
End Function
|
|
|
|
End Module
|