98b6563e57
-> verificate coordinate di prelievo e deposito (Tab1 e Tab2) -> scatta foto -> gestione di preparazione pallet (nesting 1d) -> gestione mancato vuoto su tavola 1 -> gestione di mancato vuoto tavola 2.
206 lines
11 KiB
VB.net
206 lines
11 KiB
VB.net
Imports EgtWPFLib5
|
|
Imports EgtUILib
|
|
|
|
Module Utility
|
|
|
|
Friend Sub UpdateUI()
|
|
' Costringo ad aggiornare UI
|
|
Dim nDummy As Integer
|
|
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background,
|
|
New Action(Function() nDummy = 0))
|
|
End Sub
|
|
|
|
Friend m_WarehouseIniFile As String = String.Empty
|
|
|
|
Friend m_PrintLogProces As Boolean = True
|
|
|
|
' leggo le informazioni del magazzino
|
|
Friend Function WarehauseGetPrivateProfileString(ByVal IpAppName As String, ByVal IpKeyName As String, ByVal IpDefault As String, ByRef IpString As String) As Integer
|
|
Return EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_WarehouseIniFile)
|
|
End Function
|
|
|
|
' scrivo le infomramzioni dle magazzino
|
|
Friend Function WarehauseWritePrivateProfileString(ByVal IpAppName As String, ByVal IpKeyName As String, ByRef IpString As String) As Boolean
|
|
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_WarehouseIniFile)
|
|
End Function
|
|
|
|
' leggo le informazioni pezzi
|
|
Friend Function PartGetPrivateProfileString(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByVal IpDefault As String, ByRef IpString As String) As Integer
|
|
' genero il file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
Return EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, sFile)
|
|
End Function
|
|
|
|
' leggo le informazioni pezzi
|
|
Friend Function PartGetPrivateProfileBoolean(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef IpBoolean As Boolean) As Boolean
|
|
' genero il file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
Dim IpString As String = String.Empty
|
|
EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "0", IpString, sFile)
|
|
IpBoolean = (IpString = "1")
|
|
Return IpBoolean
|
|
End Function
|
|
|
|
' leggo le informazioni pezzi
|
|
Friend Function PartGetPrivateProfileIntger(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef IpIntger As Integer) As Integer
|
|
' genero il file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
IpIntger = EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, IpIntger, sFile)
|
|
Return IpIntger
|
|
End Function
|
|
|
|
' leggo le informazioni pezzi
|
|
Friend Function PartGetPrivateProfileDouble(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef IpDouble As Double) As Double
|
|
' genero il file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
IpDouble = EgtUILib.GetPrivateProfileDouble(IpAppName, IpKeyName, IpDouble, sFile)
|
|
Return IpDouble
|
|
End Function
|
|
|
|
' leggo le informazioni pezzi
|
|
Friend Function PartGetPrivateProfileVector(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef vtVector As Vector3d) As Integer
|
|
' genero il file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
Dim sValue As String = String.Empty
|
|
EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sValue, sFile)
|
|
Dim sItem As String() = sValue.Split(","c)
|
|
Dim x As Double = 0
|
|
If Not StringToDouble(sItem(0), x) Then Return -1
|
|
Dim y As Double = 0
|
|
If Not StringToDouble(sItem(1), y) Then Return -1
|
|
Dim z As Double = 0
|
|
If Not StringToDouble(sItem(2), z) Then Return -1
|
|
vtVector = New Vector3d(x, y, z)
|
|
Return 0
|
|
End Function
|
|
|
|
' leggo le informazioni pezzi
|
|
Friend Function PartGetPrivateProfilePoint(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef ptPoint As Point3d) As Integer
|
|
' genero il file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
Dim sValue As String = String.Empty
|
|
EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sValue, sFile)
|
|
Dim sItem As String() = sValue.Split(","c)
|
|
Dim x As Double = 0
|
|
If Not StringToDouble(sItem(0), x) Then Return -1
|
|
Dim y As Double = 0
|
|
If Not StringToDouble(sItem(1), y) Then Return -1
|
|
Dim z As Double = 0
|
|
If Not StringToDouble(sItem(2), z) Then Return -1
|
|
ptPoint = New Point3d(x, y, z)
|
|
Return 0
|
|
End Function
|
|
|
|
' scrivo le informazioni pezzi
|
|
Friend Function PartWritePrivateProfileString(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef IpString As String) As Boolean
|
|
' genero il nome del file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
' se non esiste il file allora lo genero
|
|
If Not My.Computer.FileSystem.FileExists(sFile) Then
|
|
' creo il file ini del progetto
|
|
Dim file As System.IO.StreamWriter
|
|
file = My.Computer.FileSystem.OpenTextFileWriter(sFile, False)
|
|
file.WriteLine("; Commento per evitare BOM con UTF-8")
|
|
file.Close()
|
|
End If
|
|
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, sFile)
|
|
End Function
|
|
|
|
' scrivo le informazioni pezzi
|
|
Friend Function PartWritePrivateProfileBoolean(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef IpBoolean As Boolean) As Boolean
|
|
' genero il nome del file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
' se non esiste il file allora lo genero
|
|
If Not My.Computer.FileSystem.FileExists(sFile) Then
|
|
' creo il file ini del progetto
|
|
Dim file As System.IO.StreamWriter
|
|
file = My.Computer.FileSystem.OpenTextFileWriter(sFile, False)
|
|
file.WriteLine("; Commento per evitare BOM con UTF-8")
|
|
file.Close()
|
|
End If
|
|
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, If(IpBoolean, "1", "0"), sFile)
|
|
End Function
|
|
|
|
' scrivo le informazioni pezzi
|
|
Friend Function PartWritePrivateProfileInt(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef IpInteger As Integer) As Boolean
|
|
' genero il nome del file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
' se non esiste il file allora lo genero
|
|
If Not My.Computer.FileSystem.FileExists(sFile) Then
|
|
' creo il file ini del progetto
|
|
Dim file As System.IO.StreamWriter
|
|
file = My.Computer.FileSystem.OpenTextFileWriter(sFile, False)
|
|
file.WriteLine("; Commento per evitare BOM con UTF-8")
|
|
file.Close()
|
|
End If
|
|
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpInteger.ToString, sFile)
|
|
End Function
|
|
|
|
' scrivo le informazioni pezzi
|
|
Friend Function PartWritePrivateProfileDouble(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ByRef IpDouble As Double) As Boolean
|
|
' genero il nome del file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
' se non esiste il file allora lo genero
|
|
If Not My.Computer.FileSystem.FileExists(sFile) Then
|
|
' creo il file ini del progetto
|
|
Dim file As System.IO.StreamWriter
|
|
file = My.Computer.FileSystem.OpenTextFileWriter(sFile, False)
|
|
file.WriteLine("; Commento per evitare BOM con UTF-8")
|
|
file.Close()
|
|
End If
|
|
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, DoubleToString(IpDouble, 5), sFile)
|
|
End Function
|
|
|
|
' scrivo le informazioni pezzi
|
|
Friend Function PartWritePrivateProfileVector(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, vtVector As Vector3d) As Boolean
|
|
' genero il nome del file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
' se non esiste il file allora lo genero
|
|
If Not My.Computer.FileSystem.FileExists(sFile) Then
|
|
' creo il file ini del progetto
|
|
Dim file As System.IO.StreamWriter
|
|
file = My.Computer.FileSystem.OpenTextFileWriter(sFile, False)
|
|
file.WriteLine("; Commento per evitare BOM con UTF-8")
|
|
file.Close()
|
|
End If
|
|
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, VectorToString(vtVector), sFile)
|
|
End Function
|
|
|
|
' scrivo le informazioni pezzi
|
|
Friend Function PartWritePrivateProfilePoint(ByRef IdProj As Integer, ByVal IpAppName As String, ByVal IpKeyName As String, ptPoint As Point3d) As Boolean
|
|
' genero il nome del file in funzione del progetto caricato
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & IdProj.ToString & ".ini"
|
|
' se non esiste il file allora lo genero
|
|
If Not My.Computer.FileSystem.FileExists(sFile) Then
|
|
' creo il file ini del progetto
|
|
Dim file As System.IO.StreamWriter
|
|
file = My.Computer.FileSystem.OpenTextFileWriter(sFile, False)
|
|
file.WriteLine("; Commento per evitare BOM con UTF-8")
|
|
file.Close()
|
|
End If
|
|
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, PointToString(ptPoint), sFile)
|
|
End Function
|
|
|
|
Public Function VectorToString(vtVector As Vector3d) As String
|
|
Dim sVector As String = String.Empty
|
|
sVector = DoubleToString(vtVector.x, 5) & " ," & DoubleToString(vtVector.y, 5) & " ," & DoubleToString(vtVector.z, 5)
|
|
Return sVector
|
|
End Function
|
|
|
|
Public Function PointToString(ptPoint As Point3d) As String
|
|
Dim sPoint As String = String.Empty
|
|
sPoint = ptPoint.x.ToString.Replace(","c, "."c) & " ," & ptPoint.y.ToString.Replace(","c, "."c) & " ," & ptPoint.z.ToString.Replace(","c, "."c)
|
|
Return sPoint
|
|
End Function
|
|
|
|
' scrivo in un file di testo le infomrazioni tutte le info che mi servono per studiare il percorso dei dati
|
|
Friend Sub OutLogProcess(sRow As String)
|
|
Dim file As System.IO.StreamWriter
|
|
' scrivo questo file solo se attvo LogProces = 1 in [General] del file OmagVIEWPlus.ini
|
|
If Not m_PrintLogProces Then Return
|
|
file = My.Computer.FileSystem.OpenTextFileWriter(Map.refMainWindowVM.MainWindowM.sTempDir & "\ProcessLog.txt", True)
|
|
file.WriteLine(sRow)
|
|
file.Close()
|
|
End Sub
|
|
End Module
|