65dee8bf4c
-> aggiornamento automatico della lista "PartList"; -> verifica funzionamento ultima versione.
627 lines
25 KiB
VB.net
627 lines
25 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports System.IO
|
|
|
|
Public Class Part
|
|
Inherits VMBase
|
|
|
|
#Region "PROPERTIES"
|
|
|
|
' posizione tavola rispetto ad origine macchina
|
|
Private m_ptTable1 As New Point3d
|
|
Public ReadOnly Property ptTable1 As Point3d
|
|
Get
|
|
Return m_ptTable1
|
|
End Get
|
|
End Property
|
|
|
|
' Dimensioni minime del rettangolo che circonda il pezzo
|
|
Private m_MinRectY As Double
|
|
Public Property MinRectY As Double
|
|
Get
|
|
Return m_MinRectY
|
|
End Get
|
|
Set(value As Double)
|
|
m_MinRectY = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MinRectX As Double
|
|
Public Property MinRectX As Double
|
|
Get
|
|
Return m_MinRectX
|
|
End Get
|
|
Set(value As Double)
|
|
m_MinRectX = value
|
|
End Set
|
|
End Property
|
|
|
|
' numerazione del progetto
|
|
Private m_IdProject As Integer
|
|
Public ReadOnly Property IdProject As Integer
|
|
Get
|
|
Return m_IdProject
|
|
End Get
|
|
End Property
|
|
|
|
' Id gruppo: identificativo del pezzo
|
|
Private m_IdPart As Integer
|
|
Public ReadOnly Property IdPart As Integer
|
|
Get
|
|
Return m_IdPart
|
|
End Get
|
|
End Property
|
|
|
|
' Id del box che accohlierà il pezzo
|
|
Private m_IdBox As Integer = -1
|
|
Public Property IdBox As Integer
|
|
Get
|
|
Return m_IdBox
|
|
End Get
|
|
Set(value As Integer)
|
|
m_IdBox = value
|
|
PartWritePrivateProfileString(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "IdBox", m_IdBox.ToString)
|
|
NotifyPropertyChanged("IdBox")
|
|
End Set
|
|
End Property
|
|
|
|
' Id Warehouse dei box
|
|
Private m_enWarehouse As Warehouses = 0
|
|
Public Property enWarehouse As Warehouses
|
|
Get
|
|
Return m_enWarehouse
|
|
End Get
|
|
Set(value As Warehouses)
|
|
m_enWarehouse = value
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "IdWarehouse", CInt(m_enWarehouse))
|
|
NotifyPropertyChanged("enWarehouse")
|
|
End Set
|
|
End Property
|
|
|
|
' definsce se il pezzo è l'ultimo del progetto
|
|
Private m_IsLast As Boolean
|
|
Public ReadOnly Property IsLast As Boolean
|
|
Get
|
|
Return m_IsLast
|
|
End Get
|
|
End Property
|
|
|
|
' indica il livello da occupare nel pallet (partendo da 0)
|
|
Private m_nLayer As Integer = 0
|
|
Public Property nLayer As Integer
|
|
Get
|
|
Return m_nLayer
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nLayer = value
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "IdLayer", CInt(m_nLayer))
|
|
NotifyPropertyChanged("nLayer")
|
|
End Set
|
|
End Property
|
|
|
|
' indica la posizione occupata all'interno del Layer
|
|
Private m_nPositionLayer As Integer = 1
|
|
Public Property nPositionLayer As Integer
|
|
Get
|
|
Return m_nPositionLayer
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nPositionLayer = value
|
|
'PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "PositionInLayer", CInt(m_nPositionLayer))
|
|
NotifyPropertyChanged("nPositionLayer")
|
|
End Set
|
|
End Property
|
|
|
|
' se pezzo inserito nell'elenco dei pezzi da scaricare dopo il Nesting
|
|
Private m_bInsert As Boolean = False
|
|
Public Property bInsert As Boolean
|
|
Get
|
|
Return m_bInsert
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bInsert = value
|
|
End Set
|
|
End Property
|
|
|
|
' offsetY rispetto allo zero del pallet
|
|
Private m_OffsetPartY As Double = 0
|
|
Public Property dOffestPartY As Double
|
|
Get
|
|
Return m_OffsetPartY
|
|
End Get
|
|
Set(value As Double)
|
|
m_OffsetPartY = value
|
|
PartWritePrivateProfileDouble(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "OffsetY", m_OffsetPartY)
|
|
End Set
|
|
End Property
|
|
|
|
' coordinate del pezzo ripsetto alla tavola
|
|
Private m_CenterPartTable As New Point3d
|
|
Public ReadOnly Property CeneterPartTable As Point3d
|
|
Get
|
|
Return m_CenterPartTable
|
|
End Get
|
|
End Property
|
|
|
|
' posizione angolare del pezzo
|
|
Private m_DegAngOnTable As Double = 0
|
|
Public ReadOnly Property DegAngOnTable As Double
|
|
Get
|
|
Return m_MoveTable1.m_dAngRotDeg
|
|
End Get
|
|
End Property
|
|
|
|
' altezza del pezzo
|
|
Private m_Height As Double
|
|
Public ReadOnly Property Height As Double
|
|
Get
|
|
Return m_Height
|
|
End Get
|
|
End Property
|
|
|
|
' salvo localmente le informazioni relative all'pezzo sulla tavola 1
|
|
Private m_MoveTable1 As New RawMoveData
|
|
Public ReadOnly Property MoveTable1 As RawMoveData
|
|
Get
|
|
Return m_MoveTable1
|
|
End Get
|
|
End Property
|
|
|
|
' salvo localmente le informazioni relative all'pezzo sulla tavola 2
|
|
Private m_MoveTable2 As New RawMoveData
|
|
Public ReadOnly Property MoveTable2 As RawMoveData
|
|
Get
|
|
Return m_MoveTable2
|
|
End Get
|
|
End Property
|
|
|
|
|
|
#End Region ' PROPERIES
|
|
|
|
#Region "STATES"
|
|
|
|
' inidica la posizione attuale del pezzo-> di default ON_TABLE
|
|
Private m_enPlace As Place
|
|
Public Property enPlace As Place
|
|
Get
|
|
Return m_enPlace
|
|
End Get
|
|
Set(value As Place)
|
|
m_enPlace = value
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, ConstIni.K_PLACE, CInt(m_enPlace))
|
|
NotifyPropertyChanged("enPlace")
|
|
End Set
|
|
End Property
|
|
|
|
' indica lo stato attuale del pezzo-> di default GOOD
|
|
Private m_enStatus As StatusPart
|
|
Public Property enStatus As StatusPart
|
|
Get
|
|
Return m_enStatus
|
|
End Get
|
|
Set(value As StatusPart)
|
|
m_enStatus = value
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, ConstIni.K_STATUS, CInt(m_enStatus))
|
|
NotifyPropertyChanged("enStatus")
|
|
End Set
|
|
End Property
|
|
|
|
' indica il tipo di scarico previsto per il pezzo
|
|
Private m_enUnloading As Unloading
|
|
Public Property enUnloading As Unloading
|
|
Get
|
|
Return m_enUnloading
|
|
End Get
|
|
Set(value As Unloading)
|
|
m_enUnloading = value
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, ConstIni.K_UNLOADING, CInt(m_enUnloading))
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' STATES
|
|
|
|
#Region "CONSTUCTOR"
|
|
|
|
Sub New(nIdPart As Integer, nProjId As Integer)
|
|
SetIdPart(nIdPart)
|
|
SetIdProject(nProjId)
|
|
' -> MyUpdateVacuumsForUnloading: tavolo
|
|
m_enPlace = Place.ON_TABLE
|
|
m_enStatus = StatusPart.GOOD
|
|
m_enUnloading = Unloading.AUTOMATIC
|
|
m_IsLast = False
|
|
End Sub
|
|
|
|
#End Region 'CONSTUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
' verifico che l'id del progetto sia un intero
|
|
Public Sub SetIdProject(nIdProject As Integer)
|
|
If IsNumeric(nIdProject) Then
|
|
m_IdProject = nIdProject
|
|
End If
|
|
End Sub
|
|
|
|
' verifico che l'id del pezzo sia un un numero
|
|
Public Sub SetIdPart(nIdPart As Integer)
|
|
If IsNumeric(nIdPart) Then
|
|
m_IdPart = nIdPart
|
|
End If
|
|
End Sub
|
|
|
|
' verifico che l'Id del box sia un numero
|
|
Public Sub SetIdBox(nIdBox As Integer)
|
|
If IsNumeric(nIdBox) Then
|
|
m_IdBox = nIdBox
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub SetWareHouse(IdWarehouse As Integer)
|
|
If IsNumeric(IdWarehouse) Then
|
|
m_enWarehouse = CType(IdWarehouse, Warehouses)
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub SetIsLast(bIsLast As Boolean)
|
|
m_IsLast = bIsLast
|
|
End Sub
|
|
|
|
Public Sub SetLayer(IdLayer As Integer)
|
|
If IsNumeric(IdLayer) Then
|
|
m_nLayer = IdLayer
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub SetOffsetY(dOffsetY As Double)
|
|
m_OffsetPartY = dOffsetY
|
|
End Sub
|
|
|
|
' cordinate del centro del pezzo rispetto alla tavola
|
|
Public Sub SetCenterPartTable(ptCenter As Point3d)
|
|
' salvo le coordinate di riferimento della tavola
|
|
m_CenterPartTable = GetPointInTableRef(ptCenter, m_ptTable1)
|
|
End Sub
|
|
|
|
Public Sub SetHeight(dHeight As Double)
|
|
m_Height = dHeight
|
|
End Sub
|
|
|
|
' coordinate del centro del rettangolo rispetto alla tavola
|
|
Public Function GetPointOnTable1(ptCenter As Point3d) As Point3d
|
|
Dim ptResult As New Point3d()
|
|
ptResult.x = ptCenter.x - m_ptTable1.x
|
|
ptResult.y = ptCenter.y - m_ptTable1.y
|
|
ptResult.z = ptCenter.z - m_ptTable1.z
|
|
Return ptResult
|
|
End Function
|
|
|
|
' salvo le info del pezzo sulla tavola 1
|
|
Public Sub SetInfoTable1(RawData As RawMoveData, dDimz As Double)
|
|
m_MoveTable1 = RawData
|
|
SetHeight(dDimz)
|
|
End Sub
|
|
|
|
' salvo le info del pezzo sulla tavola 2
|
|
Public Sub SetInfoTable2(RawData As RawMoveData)
|
|
m_MoveTable2 = RawData
|
|
End Sub
|
|
|
|
' restituisce la poszione della testa
|
|
Public Function GetUnloadingPosTable1() As Point3d
|
|
Dim ptResult As Point3d
|
|
ptResult.x = GetPointOnTable1(m_MoveTable1.m_ptCenMinRect).x + m_MoveTable1.m_vtDelta.x
|
|
ptResult.y = GetPointOnTable1(m_MoveTable1.m_ptCenMinRect).y + m_MoveTable1.m_vtDelta.y
|
|
ptResult.z = m_Height
|
|
Return ptResult
|
|
End Function
|
|
|
|
' quando calcolo le posizioni delle ventose devo recuperare queste info
|
|
Public Function GetloadingPosStrip(ByRef dAngC As Double) As Point3d
|
|
Dim ptUnLoad As New Point3d
|
|
Dim C_Ang As Double = 0
|
|
If m_MoveTable1.m_bCupsSecondSel Then
|
|
' controruoto e mi porto in posizione posizione di scarico
|
|
C_Ang = -m_MoveTable1.m_dAngRotDeg - 90
|
|
m_MoveTable1.m_vtDelta.Rotate(Vector3d.Z_AX, -m_MoveTable1.m_dAngRotDeg - 90)
|
|
' verifico che le vetose siano sopra alla tavola
|
|
If m_MoveTable1.m_vtDelta.y > 0 Then
|
|
m_MoveTable1.m_vtDelta.Rotate(Vector3d.Z_AX, 180)
|
|
dAngC = 180 + dAngC
|
|
End If
|
|
Else
|
|
' ruoto gli offset per allinearmi al tappeto di scarico
|
|
C_Ang = -m_MoveTable1.m_dAngRotDeg
|
|
m_MoveTable1.m_vtDelta.Rotate(Vector3d.Z_AX, -m_MoveTable1.m_dAngRotDeg)
|
|
If m_MoveTable1.m_vtDelta.x > 0 Then
|
|
m_MoveTable1.m_vtDelta.Rotate(Vector3d.Z_AX, 180)
|
|
dAngC = 180 + dAngC
|
|
End If
|
|
End If
|
|
|
|
Dim vtResult As Vector3d = m_MoveTable1.m_vtDelta - m_MoveTable1.m_vtRect
|
|
|
|
' se la distanza x è minore della larghezza della ventosa correggo
|
|
If Not m_MoveTable1.m_bCupsSecondSel And vtResult.x + Map.refUnloadingAreaVM.VacuumDimX / 2 > 0 Then
|
|
ptUnLoad.x = -Map.refUnloadingAreaVM.VacuumDimX / 2
|
|
Else
|
|
ptUnLoad.x = vtResult.x
|
|
End If
|
|
' se la distanza y è minore della lunghezza della ventosa allo ra correggo
|
|
'If vtResult.y + Map.refUnloadingAreaVM.VacuumDimY / 2 > 0 Then
|
|
' ptUnLoad.y = -Map.refUnloadingAreaVM.VacuumDimY / 2
|
|
'Else
|
|
ptUnLoad.y = vtResult.y
|
|
'End If
|
|
ptUnLoad.z = m_Height
|
|
Return ptUnLoad
|
|
End Function
|
|
|
|
' restuisce la poszione di prelievo dalla rulliera
|
|
Public Function GetLoadingPosRuller() As Point3d
|
|
Dim ptLoad As New Point3d
|
|
' assegno come punto di riferimento l'angolo in alto a sinistra del pezzo
|
|
Dim vtRectTopLeft As New Vector3d(-m_MoveTable2.m_vtRect.x, m_MoveTable2.m_vtRect.y, 0)
|
|
Dim vtResult As Vector3d = m_MoveTable2.m_vtDelta - vtRectTopLeft
|
|
ptLoad.x = vtResult.x
|
|
ptLoad.y = vtResult.y
|
|
ptLoad.z = m_Height
|
|
Return ptLoad
|
|
End Function
|
|
|
|
' restituisce la posizione di deposito sul pallet (riceve l'offset attuale del pellet in funzione dei pezzi già caricati)
|
|
Public Function GetUnloadingPosBox(vtCurrOffset As Vector3d, Optional ByVal bRotate As Boolean = False) As Point3d
|
|
Dim ptUnload As New Point3d
|
|
Dim vtCurrDelta As Vector3d = m_MoveTable2.m_vtDelta
|
|
' se sto per scaricare nei pallet dispari allora girare la testa
|
|
If bRotate Then
|
|
vtCurrDelta.Rotate(Vector3d.Z_AX, 180)
|
|
End If
|
|
'correggo il vettore Delta a causa di un pivot dell'asse di rotazione
|
|
Dim vtResult As Vector3d = vtCurrDelta + vtCurrOffset
|
|
ptUnload.x = vtResult.x
|
|
ptUnload.y = vtResult.y
|
|
ptUnload.z = vtCurrOffset.z
|
|
Return ptUnload
|
|
End Function
|
|
|
|
' restituisce la posizione di deposito sul pallet (riceve l'offset attuale del pellet in funzione dei pezzi già caricati)
|
|
Public Function GetUnloadingPosRack(vtCurrOffset As Vector3d) As Point3d
|
|
Dim ptUnload As New Point3d
|
|
Dim OffsetX As Double = vtCurrOffset.z
|
|
vtCurrOffset.z = m_Height
|
|
Dim vtResult As Vector3d = vtCurrOffset
|
|
vtResult.Rotate(Vector3d.Z_AX, +90)
|
|
vtResult.Rotate(Vector3d.Y_AX, Map.refUnloadingAreaVM.AngRack)
|
|
ptUnload.x = OffsetX + vtResult.x
|
|
ptUnload.y = vtResult.y
|
|
ptUnload.z = vtResult.z
|
|
Return ptUnload
|
|
End Function
|
|
|
|
' restituisce se la ventosa deve essere attivata
|
|
Public Function GetVacuumLoadingStatus(sVacuum As String, Optional sTable As String = "Table1") As Integer
|
|
If sTable = "Table1" Then
|
|
If m_MoveTable1.m_sCups.Contains(sVacuum) Then
|
|
Return 1
|
|
End If
|
|
Else
|
|
If m_MoveTable2.m_sCups.Contains(sVacuum) Then
|
|
Return 1
|
|
End If
|
|
End If
|
|
Return 0
|
|
End Function
|
|
|
|
Public Function SavePart(nIdexPart As Integer) As Boolean
|
|
' scrivo l'elenco dei part presenti nel file
|
|
'PartWritePrivateProfileString(m_IdProject, "PartList", "IdPart" & nIdexPart.ToString, m_IdPart.ToString)
|
|
' stato della piastrella
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, ConstIni.K_STATUS, CInt(m_enStatus))
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, ConstIni.K_PLACE, CInt(m_enPlace))
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, ConstIni.K_UNLOADING, CInt(m_enUnloading))
|
|
' IdWarehouse
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "IdWarehouse", CInt(m_enWarehouse))
|
|
' IdBox
|
|
PartWritePrivateProfileInt(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "IdBox", m_IdBox)
|
|
' altezza della piastrella
|
|
PartWritePrivateProfileDouble(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "Height", m_Height)
|
|
' posizione della tavola
|
|
PartWritePrivateProfilePoint(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "Table1ref", m_ptTable1)
|
|
' posizione centro pezzo sulla tavola
|
|
PartWritePrivateProfilePoint(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "CenterPartTable1", m_CenterPartTable)
|
|
' info Table 1
|
|
For nIndex = 1 To 2
|
|
Dim objRawMoveData As New RawMoveData
|
|
If nIndex = 1 Then
|
|
objRawMoveData = m_MoveTable1
|
|
Else
|
|
objRawMoveData = m_MoveTable2
|
|
End If
|
|
' CenterMinRect
|
|
PartWritePrivateProfilePoint(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "CenterMinRect" & nIndex.ToString, objRawMoveData.m_ptCenMinRect)
|
|
' RotAngDeg
|
|
PartWritePrivateProfileDouble(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "RotAngDeg" & nIndex.ToString, objRawMoveData.m_dAngRotDeg)
|
|
' Delta
|
|
PartWritePrivateProfileVector(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "Delta" & nIndex.ToString, objRawMoveData.m_vtDelta)
|
|
' Cups
|
|
PartWritePrivateProfileString(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "Cups" & nIndex.ToString, objRawMoveData.m_sCups)
|
|
' Rect
|
|
PartWritePrivateProfileVector(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "Rect" & nIndex.ToString, objRawMoveData.m_vtRect)
|
|
' DirX
|
|
PartWritePrivateProfileVector(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "DirX" & nIndex.ToString, objRawMoveData.m_vtDirX)
|
|
' OrtoDirX
|
|
PartWritePrivateProfileVector(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "OrtoDirX" & nIndex.ToString, objRawMoveData.m_vtOrtoDirX)
|
|
' RawAngRotDeg
|
|
PartWritePrivateProfileDouble(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "RawAngRotDeg" & nIndex.ToString, objRawMoveData.m_dRawAngRotDeg)
|
|
' RawMove
|
|
PartWritePrivateProfileVector(m_IdProject, ConstIni.S_PART & m_IdPart.ToString, "RawMove" & nIndex.ToString, objRawMoveData.m_vtRawMove)
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
Shared Function GetListOfPart() As Boolean
|
|
' recupero l'elenco dei file da caricare dal file Warehouese.ini
|
|
Dim sVal As String = String.Empty
|
|
WarehauseGetPrivateProfileString("Warehouse", "IdProj", "", sVal)
|
|
If String.IsNullOrEmpty(sVal) Then
|
|
Return False
|
|
End If
|
|
' provo a caricare il disegno del progetto corrente (in fase di scarico)
|
|
If EgtOpenFile(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & CURR_PROJ_NAME) Then
|
|
' imposto la macchina di lavoro
|
|
EgtSetCurrMachGroup(EgtGetFirstMachGroup())
|
|
' Attivo ultima fase di lavorazione
|
|
EgtSetCurrPhase(EgtGetPhaseCount())
|
|
' Nascondo lavorazioni
|
|
HideAllMachinings()
|
|
End If
|
|
|
|
|
|
' separo l'elenco di progetti
|
|
Dim sItemIdProj As String() = sVal.Split(","c)
|
|
For Each ItemId In sItemIdProj
|
|
' costruisco il nome del file
|
|
Dim sFile As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\PartList" & ItemId.Trim & ".ini"
|
|
' verifico che esista il file
|
|
If Not My.Computer.FileSystem.FileExists(sFile) Then
|
|
Continue For
|
|
End If
|
|
' converto l'Id del progetto in un intero
|
|
Dim nIdProj As Integer
|
|
If Not IsNumeric(ItemId) Then
|
|
Continue For
|
|
End If
|
|
nIdProj = CInt(ItemId)
|
|
Dim objProj As New Proj(nIdProj)
|
|
objProj.enStatus = StatusProj.LOADING
|
|
If Map.refMainWindowVM.MainWindowM.nProjInd < 1 Then
|
|
Map.refMainWindowVM.MainWindowM.SetProjInd(nIdProj)
|
|
Map.refUnloadingAreaVM.IdProjTable2 = objProj
|
|
End If
|
|
Map.refMainWindowVM.MainWindowM.ProjIndList.Add(objProj)
|
|
' recupero l'elenco dei pezzi contenuti nel progetto
|
|
Dim sParts As String = String.Empty
|
|
Dim sValue As String = String.Empty
|
|
Dim nInd As Integer = 1
|
|
While PartGetPrivateProfileString(nIdProj, "PartList", "IdPart" & nInd.ToString, "0", sValue) > 1
|
|
If nInd = 1 Then
|
|
sParts = sValue
|
|
Else
|
|
sParts = sParts & "," & sValue
|
|
End If
|
|
nInd = nInd + 1
|
|
End While
|
|
Dim sItemIdPart As String() = sParts.Split(","c)
|
|
Dim bIsWorking As Boolean = False
|
|
' leggo le info per ogni part del progetto
|
|
For Each ItemPart In sItemIdPart
|
|
' converto l'Id del Part in un intero
|
|
Dim nIdPart As Integer
|
|
If Not IsNumeric(ItemPart) Then
|
|
Continue For
|
|
End If
|
|
nIdPart = CInt(ItemPart)
|
|
Dim sIpAppName As String = "Part" & Trim(ItemPart)
|
|
' inizio la lettura dei dati della piastrella
|
|
Dim LocalPart As New Part(nIdPart, nIdProj)
|
|
' stato della piastrella
|
|
Dim nValue As Integer = 0
|
|
LocalPart.enStatus = CType(PartGetPrivateProfileIntger(nIdProj, ConstIni.S_PART & nIdPart.ToString, ConstIni.K_STATUS, nValue), StatusPart)
|
|
LocalPart.enPlace = CType(PartGetPrivateProfileIntger(nIdProj, ConstIni.S_PART & nIdPart.ToString, ConstIni.K_PLACE, nValue), Place)
|
|
LocalPart.enUnloading = CType(PartGetPrivateProfileIntger(nIdProj, ConstIni.S_PART & nIdPart.ToString, ConstIni.K_UNLOADING, nValue), Unloading)
|
|
' posizione della tavola
|
|
PartGetPrivateProfilePoint(nIdProj, ConstIni.S_PART & nIdPart.ToString, "Table1ref", LocalPart.m_ptTable1)
|
|
' posizione del pezzo sulla tavola
|
|
PartGetPrivateProfilePoint(nIdProj, ConstIni.S_PART & nIdPart.ToString, "CenterPartTable1", LocalPart.m_CenterPartTable)
|
|
' IdWarehouse
|
|
Dim nIdWarehouse As Integer = 0
|
|
LocalPart.SetWareHouse(PartGetPrivateProfileIntger(nIdProj, ConstIni.S_PART & nIdPart.ToString, "IdWarehouse", nIdWarehouse))
|
|
' IdBox
|
|
Dim nIdBox As Integer = -1
|
|
LocalPart.SetIdBox(PartGetPrivateProfileIntger(nIdProj, ConstIni.S_PART & nIdPart.ToString, "IdBox", nIdBox))
|
|
' altezza della piastrella
|
|
Dim dHeight As Double = 0
|
|
LocalPart.SetHeight(PartGetPrivateProfileDouble(nIdProj, ConstIni.S_PART & nIdPart.ToString, "Height", dHeight))
|
|
' IsLast
|
|
Dim bIsLats As Boolean = sItemIdPart(nInd - 2) = ItemPart
|
|
LocalPart.SetIsLast(bIsLats)
|
|
' nLayer
|
|
Dim nIdLayer As Integer = 0
|
|
LocalPart.SetLayer(PartGetPrivateProfileIntger(nIdProj, ConstIni.S_PART & nIdPart.ToString, "IdLayer", nIdLayer))
|
|
' OffsetPartY
|
|
Dim dOffsetY As Double = 0
|
|
LocalPart.SetOffsetY(PartGetPrivateProfileDouble(nIdProj, ConstIni.S_PART & nIdPart.ToString, "OffsetY", dOffsetY))
|
|
|
|
' info Table 1
|
|
For nIndex As Integer = 1 To 2
|
|
Dim objRawMoveData As New RawMoveData
|
|
If nIndex = 1 Then
|
|
objRawMoveData = LocalPart.m_MoveTable1
|
|
Else
|
|
objRawMoveData = LocalPart.m_MoveTable2
|
|
End If
|
|
' RawMove
|
|
PartGetPrivateProfileVector(nIdProj, ConstIni.S_PART & nIdPart.ToString, "RawMove" & nIndex.ToString, objRawMoveData.m_vtRawMove)
|
|
' Delta
|
|
PartGetPrivateProfileVector(nIdProj, ConstIni.S_PART & nIdPart.ToString, "Delta" & nIndex.ToString, objRawMoveData.m_vtDelta)
|
|
' Rect
|
|
PartGetPrivateProfileVector(nIdProj, ConstIni.S_PART & nIdPart.ToString, "Rect" & nIndex.ToString, objRawMoveData.m_vtRect)
|
|
LocalPart.MinRectX = objRawMoveData.m_vtRect.x * 2
|
|
LocalPart.MinRectY = objRawMoveData.m_vtRect.y * 2
|
|
' DirX
|
|
PartGetPrivateProfileVector(nIdProj, ConstIni.S_PART & nIdPart.ToString, "DirX" & nIndex.ToString, objRawMoveData.m_vtDirX)
|
|
' OrtoDirX
|
|
PartGetPrivateProfileVector(nIdProj, ConstIni.S_PART & nIdPart.ToString, "OrtoDirX" & nIndex.ToString, objRawMoveData.m_vtOrtoDirX)
|
|
' CenterMinRect
|
|
PartGetPrivateProfilePoint(nIdProj, ConstIni.S_PART & nIdPart.ToString, "CenterMinRect" & nIndex.ToString, objRawMoveData.m_ptCenMinRect)
|
|
' Cups
|
|
PartGetPrivateProfileString(nIdProj, ConstIni.S_PART & nIdPart.ToString, "Cups" & nIndex.ToString, "", objRawMoveData.m_sCups)
|
|
' RotAngDeg
|
|
PartGetPrivateProfileDouble(nIdProj, ConstIni.S_PART & nIdPart.ToString, "RotAngDeg" & nIndex.ToString, objRawMoveData.m_dAngRotDeg)
|
|
' RawAngRotDeg
|
|
PartGetPrivateProfileDouble(nIdProj, ConstIni.S_PART & nIdPart.ToString, "RawAngRotDeg" & nIndex.ToString, objRawMoveData.m_dRawAngRotDeg)
|
|
Next
|
|
If LocalPart.enPlace = Place.ON_MOTOR_RULLER Then
|
|
EgtSetStatus(LocalPart.IdPart, GDB_ST.OFF)
|
|
End If
|
|
Map.refUnloadingAreaVM.ListPart.Add(LocalPart)
|
|
|
|
' terminata la costruzione della lista dei pezzi, genero la lista per i box del progetto corrente
|
|
For Each ItemWarehouse In Map.refUnloadingAreaVM.WarehouseList
|
|
' ricavo il magazzino corrente
|
|
If ItemWarehouse.Id = CType(nIdWarehouse, Warehouses) Then
|
|
For Each ItemBox In ItemWarehouse.Boxes
|
|
If ItemBox.Id = LocalPart.IdBox Then
|
|
ItemBox.MyListPart.Add(LocalPart)
|
|
ItemBox.State = States.LOADING
|
|
End If
|
|
Next
|
|
End If
|
|
Next
|
|
' verifico se almeno un pezzo del progetto è stato depositato nel magazzino
|
|
If LocalPart.enPlace <> Place.ON_MOTOR_RULLER AndAlso LocalPart.enPlace <> Place.ON_TABLE Then
|
|
bIsWorking = True
|
|
End If
|
|
Next
|
|
If bIsWorking Then
|
|
objProj.enStatus = StatusProj.WORKING
|
|
Else
|
|
objProj.enStatus = StatusProj.LOADING
|
|
End If
|
|
Next
|
|
' se esiste attivo il magazzino del primo progetto caricato
|
|
If Map.refUnloadingAreaVM.ListPart.Count > 0 Then
|
|
Dim CurrWarehouse As WarehouseVM = Map.refUnloadingAreaVM.GetWarehouse(Map.refUnloadingAreaVM.ListPart(0).enWarehouse)
|
|
If Not IsNothing(CurrWarehouse) Then Map.refUnloadingAreaVM.SetActiveWarehouse(CurrWarehouse.Id)
|
|
'CurrWarehouse.SetState(States.AVAILABLE)
|
|
'CurrWarehouse.NotifyPropertyChanged("IsEnabled")
|
|
End If
|
|
OutLogProcess("GetListOfPart() -> Recuperato i progetti: PartList" & sVal & ".ini")
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' METHODS
|
|
|
|
End Class
|