Files
OmagVIEWPlus/MainWindow/MainWindowM.vb
T
Nicola Pievani 98b6563e57 OmagVIEWPlus 2.2k1:
-> 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.
2020-11-20 19:48:51 +00:00

678 lines
26 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.Threading
Imports System.Math
Imports EgtUILib
Imports EgtWPFLib5
Imports System.Windows.Forms.Integration
Public Class MainWindowM
#Region "FIELDS"
Private m_sDataRoot As String = String.Empty
Friend ReadOnly Property sDataRoot As String
Get
Return m_sDataRoot
End Get
End Property
Private m_sConfigDir As String = String.Empty
Public ReadOnly Property sConfigDir As String
Get
Return m_sConfigDir
End Get
End Property
' direttorio progetto -> conitne il progetto corrente "CurrProj.nge"
Private m_sProjDir As String = String.Empty
Public ReadOnly Property sProjDir As String
Get
Return m_sProjDir
End Get
End Property
' macchina corrente
Private m_sMachinesRoot As String = String.Empty
Public ReadOnly Property sMachinesRoot As String
Get
Return m_sMachinesRoot
End Get
End Property
Private m_sCurrMachine As String = String.Empty
' direttorio degli utensili -> attualmente non eè in uso
Private m_sToolMakersDir As String
Friend ReadOnly Property sToolMakersDir As String
Get
Return m_sToolMakersDir
End Get
End Property
Private m_nDebug As Integer = 0
Private m_objMutex As Mutex
Private m_bFirstInstance As Boolean = False
Friend ReadOnly Property bFirstInstance As Boolean
Get
Return m_bFirstInstance
End Get
End Property
Private m_nInstance As Integer = 0
Friend ReadOnly Property nInstance As Integer
Get
Return m_nInstance
End Get
End Property
Private m_nUserLevel As Integer = 1
Friend ReadOnly Property nUserLevel As Integer
Get
Return m_nUserLevel
End Get
End Property
Private m_nKeyLevel As Integer = 0
Friend ReadOnly Property nKeyLevel As Integer
Get
Return m_nKeyLevel
End Get
End Property
Private m_nKeyOptions As UInteger = 0
Friend ReadOnly Property nKeyOptions As Integer
Get
Return m_nKeyOptions
End Get
End Property
Friend ReadOnly Property sVersion As String
Get
Return My.Application.Info.Version.Major.ToString() & "." &
My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
End Get
End Property
Private m_sTempDir As String
Friend ReadOnly Property sTempDir As String
Get
Return m_sTempDir
End Get
End Property
Private m_sLogFile As String
Friend ReadOnly Property sLogFile As String
Get
Return m_sLogFile
End Get
End Property
Private m_sLogDir As String
Friend ReadOnly Property sLogDir As String
Get
Return m_sLogDir
End Get
End Property
'Lista pezzi attivi
Private m_vParts As New List(Of Integer)
Public ReadOnly Property vParts As List(Of Integer)
Get
Return m_vParts
End Get
End Property
' numero progetto -> assegnato in OmgaCUT
Private m_nProjInd As Integer
Public ReadOnly Property nProjInd As Integer
Get
Return m_nProjInd
End Get
End Property
Public Sub SetProjInd(ProjInd As Integer)
m_nProjInd = ProjInd
End Sub
' Flag di ultimo progetto trasmesso
Private m_bLastProj As Boolean = False
' elenco dei progetti in elaborazione dalla macchina-> utilizzato dalla tavola 2
Private m_ProjIndList As New List(Of Proj)
Public ReadOnly Property ProjIndList As List(Of Proj)
Get
Return m_ProjIndList
End Get
End Property
#End Region ' FIELDS
#Region "CONSTRUCTOR"
Sub New()
InitializeEgtEnvironment()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Sub InitializeEgtEnvironment()
' Impostazione path radice per i dati
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
End If
' Impostazione direttorio di configurazione
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
' Impostazione direttorio per file temporanei
m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
' Impostazione direttorio per backup
m_sLogDir = m_sDataRoot & "\" & LOG_DIR
' Impostazione path Ini file
IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
' impostazioen part WarehouseIniFile
m_WarehouseIniFile = m_sConfigDir & "\" & "Warehouse.ini"
' Impostazione direttorio per le macchine
If GetPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot, m_sIniFile) = 0 Then
m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR
End If
' Impostazione direttorio per toolmakers
If GetMainPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", m_sToolMakersDir) = 0 Then
m_sToolMakersDir = m_sDataRoot & "\" & TOOLMAKERS_DFL_DIR
End If
' Imposto il direttorio per il progetto corrente
If GetPrivateProfileString(S_GENERAL, K_PROJDIR, "", m_sProjDir, m_sIniFile) = 0 Then
m_sProjDir = m_sDataRoot & "\" & S_DATA
End If
' imposto macchina corrente
If GetPrivateProfileString(S_MACH, "CurrMach", "", m_sCurrMachine, m_sIniFile) = 0 Then
m_sCurrMachine = "Omag-Area5"
End If
' Verifico indice di istanza
ManageInstance()
' Imposto tipo di chiave
EgtSetLockType(KEY_TYPE.HW)
' Leggo e imposto chiave di protezione
Dim sLicFileName As String = String.Empty
GetMainPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName
Dim sKey As String = String.Empty
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
EgtSetKey(sKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 19, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 19, 1, m_nKeyOptions)
' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.MAN_MANIP) And GetKeyOption(KEY_OPT.AUTO_MANIP) And GetKeyOption(KEY_OPT.PRODUCTION_LINE)
' Inizializzazione generale di EgtInterface
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
' se 1 allora stampo messaggi di log, altrimenti no
Utility.m_PrintLogProces = GetMainPrivateProfileInt(S_GENERAL, K_LOGPROCES, 0) = 1
m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf &
My.Application.Info.Title.ToString() & " ver. " &
My.Application.Info.Version.Major.ToString() &
"." & My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
EgtInit(m_nDebug, m_sLogFile, sLogMsg)
EgtSetTempDir(m_sTempDir)
EgtSetIniFile(IniFile.m_sIniFile)
' Verifiche
If Not bProd Then
If m_nKeyLevel = -1 Or m_nKeyLevel = -2 Then
MessageBox.Show("Missing Protection Key. Insert Dongle and restart the program", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
Else
MessageBox.Show("Program without licence. Load Licence and restart the program.", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End
End If
' Leggo e imposto livello utilizzatore
m_nUserLevel = Math.Min(m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
' Info su opzioni chiave
EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString() & " " & bProd.ToString())
' Imposto dir di default per libreria Lua e lancio libreria di base
Dim sLuaLibsDir As String = String.Empty
GetPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir, m_sIniFile)
EgtSetLuaLibs(sLuaLibsDir)
Dim sLuaBaseLib As String = String.Empty
GetPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib, m_sIniFile)
EgtLuaRequire(sLuaBaseLib)
End Sub
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex(False, "Global\OmagVIEWPlus", bCreated)
Catch
bCreated = False
End Try
m_bFirstInstance = bCreated
If bCreated Then
' Prima istanza
m_nInstance = 1
' Aggiorno stato istanze attive
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString())
Else
' Leggo il massimo numero di istanze ammesse
Const MAX_INST As Integer = 32
Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
nMaxInst = Max(1, Min(nMaxInst, MAX_INST))
' Cerco il primo indice di istanza libero
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And m_nInstance < MAX_INST
m_nInstance += 1
nMask *= 2
End While
' Se l'indice supera il massimo
If m_nInstance > nMaxInst Then
' porto in primo piano la prima istanza
Dim bFound As Boolean = False
' processi del programma a 32 bit
Dim localProc As Process() = Process.GetProcessesByName("OmagVIEWPlusR32")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, 1)
Exit For
End If
Next
' se non trovati processi a 32 bit provo a 64 bit
If Not bFound Then
localProc = Process.GetProcessesByName("OmagVIEWPlusR64")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, SW.RESTORE)
Exit For
End If
Next
End If
' esco dal programma
End
End If
' Aggiorno stato istanze attive
nTmp += (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End If
End Sub
Friend Function GetKeyOption(nKeyOpt As KEY_OPT) As Boolean
Return ((m_nKeyOptions And nKeyOpt) <> 0)
End Function
Public Function LoadProject() As Boolean
' Reset elenco pezzi e indice progetto
m_vParts.Clear()
m_nProjInd = 0
' Carico il file
If Not EgtOpenFile(m_sProjDir & "\" & CURR_PROJ_NAME) Then Return False
' creo una copia del progetto (direttorio Temp)
EgtSaveFile(m_sTempDir & "\" & CURR_PROJ_NAME, NGE.BIN)
If Not EgtOpenFile(m_sTempDir & "\" & CURR_PROJ_NAME) Then Return False
' Recupero l'indice di progetto
Dim nMarkId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ConstGen.NAME_PROJMARK)
EgtGetInfo(nMarkId, ConstGen.INFO_PROJINDEX, m_nProjInd)
' imposto una nuova macchina di lavoro
Dim nMachGroupId As Integer = EgtGetFirstMachGroup()
EgtSetInfo(nMachGroupId, "Machine", m_sCurrMachine)
' salvo le modifiche nel nuov file
EgtSaveFile(m_sTempDir & "\" & CURR_PROJ_NAME, NGE.BIN)
' verifico che non esista nessun altro progetto con lo stesso indice
Dim bProjExist As Boolean = If(m_ProjIndList.Count() > 0, True, False)
While bProjExist
For Each ItemProj In m_ProjIndList
bProjExist = False
If ItemProj.nProjInd = m_nProjInd Then
' se il progetto esiste incremento il valore di 100
m_nProjInd = m_nProjInd + 100
bProjExist = True
' riverifico da capo tutto l'elenco di progetti
Exit For
End If
Next
End While
' aggiungo il progetto alla lista dei progetti caricati dalla tavola1
m_ProjIndList.Add(New Proj(m_nProjInd))
' Nascondo eventuali info su aree
EgtSetStatus(nMarkId, GDB_ST.OFF)
' Rendo corrente il primo (e unico gruppo di lavoro)
If Not EgtSetCurrMachGroup(nMachGroupId) Then Return False
' Visualizzo solo la tavola della macchina
EgtShowOnlyTable(True)
' ricerco l'ultima fase
Dim nLastPhase = EgtGetPhaseCount()
' Attivo ultima fase di lavorazione
EgtSetCurrPhase(nLastPhase)
' costruisco il bbox con tutti i grezzi dell'ultima fase
Dim b3LastPhase As New BBox3d()
Dim nRawPartID = EgtGetFirstRawPart()
While nRawPartID <> GDB_ID.NULL
If EgtVerifyRawPartPhase(nRawPartID, nLastPhase) Then
Dim b3CurrRawPart As New BBox3d
EgtGetRawPartBBox(nRawPartID, b3CurrRawPart)
b3LastPhase.Add(b3CurrRawPart)
End If
' rimuovo la texture
EgtRemoveTextureData(EgtGetFirstNameInGroup(nRawPartID, NAME_RAW_SOLID))
nRawPartID = EgtGetNextRawPart(nRawPartID)
End While
' definisco il vettore di traslazione tra origine tavola e il punto minimo del bbox generato sopra
Dim vtRawOffset As New Vector3d
Dim ptTable1 As New Point3d
EgtGetTableRef(1, ptTable1)
vtRawOffset.x = ptTable1.x - b3LastPhase.Min().x
' traslo tutti i pezzi dell'ultima fase della quantità appena calcolata
nRawPartID = EgtGetFirstRawPart()
While nRawPartID <> GDB_ID.NULL
If EgtVerifyRawPartPhase(nRawPartID, nLastPhase) Then
EgtMoveRawPart(nRawPartID, vtRawOffset)
End If
nRawPartID = EgtGetNextRawPart(nRawPartID)
End While
' salvo le modifiche nel nuovo file
EgtSaveFile(m_sTempDir & "\" & CURR_PROJ_NAME, NGE.BIN)
' Nascondo lavorazioni
HideAllMachinings()
' Recupero elenco dei pezzi attivi nella fase
MakePartList()
' Nascondo parti ausiliarie per nesting
Dim nRawId = EgtGetFirstRawPart()
Dim nSoId = EgtGetFirstNameInGroup(nRawId, ConstGen.NAME_OUTKERF_REG)
EgtSetStatus(nSoId, GDB_ST.OFF)
Dim nRrId = EgtGetFirstNameInGroup(nRawId, ConstGen.NAME_REF_REG)
EgtSetStatus(nRrId, GDB_ST.OFF)
' Nascondo preview lavorazioni nei pezzi
For Each nPartId As Integer In m_vParts
Dim nPV = EgtGetFirstNameInGroup(nPartId, ConstGen.NAME_PREVIEW)
If nPV <> GDB_ID.NULL Then
EgtSetStatus(nPV, GDB_ST.OFF)
End If
Next
' Assegno colore blu ai pezzi non classificati
Dim nInd As Integer = 0
While nInd < m_vParts.Count()
Dim nPartId As Integer = m_vParts(nInd)
' Se pezzo già classificato, passo al successivo
Dim nOk As Integer = -1
If EgtGetInfo(nPartId, INFO_PARTOK, nOk) Then
nInd += 1
Continue While
End If
' Cerco layer regione
Dim nRegId = EgtGetFirstNameInGroup(nPartId, ConstGen.NAME_REGION)
If nRegId = GDB_ID.NULL Then
m_vParts.RemoveAt(nInd)
Continue While
End If
' Cerco prima regione nel layer
Dim nId = EgtGetFirstInGroup(nRegId)
While nId <> GDB_ID.NULL
If EgtGetType(nId) = GDB_TY.SRF_FRGN Then
EgtSetColor(nId, New Color3d(0, 255, 255, 80)) ' Aqua
EgtSetAlpha(nId, 40)
Exit While
End If
nId = EgtGetNext(nId)
End While
nInd += 1
End While
' Posiziono griglia su grezzo
'Dim p3TableOrig As Point3d
'EgtGetTableRef(1, p3TableOrig)
'EgtSetGridFrame(New Frame3d(New Point3d(p3TableOrig.x, p3TableOrig.y, p3TableOrig.z + b3LastPhase.DimZ)))
'EgtSetGridShow(True, True)
' Imposto lo zoom
EgtZoom(ZM.ALL)
OutLogProcess("LoadProject() -> Caricato il progetto '" & m_sProjDir & "\" & CURR_PROJ_NAME)
Return True
End Function
Public Function GetCameraPhoto() As Boolean
EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
EstCalc.UpdateRawPart()
Dim bOk As Boolean = True
' Se macchina fotografica collegata, faccio una foto
If Map.refMainWindowVM.m_Camera.GetCameraLink() Then
If Not Map.refMainWindowVM.m_Camera.CameraClick() Then
EgtOutLog(EgtMsg(90313))
bOk = True
End If
Else
bOk = False
End If
Return bOk
End Function
Public Function GetRegister() As Boolean
Dim bOk As Boolean = False
' Deseleziono tutto
EgtDeselectAll()
' Se c'è la foto devo sistemare
If GetPhoto() <> GDB_ID.NULL Then
' Salvo il riferimento della texture originale di ogni grezzo
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
Dim nSolidId As Integer = EgtGetFirstNameInGroup(nRawId, NAME_RAW_SOLID)
' Recupero il riferimento originale e lo salvo nelle info
Dim refTxr As New Frame3d
EgtGetTextureFrame(nSolidId, GDB_ID.ROOT, refTxr)
EgtSetInfo(nSolidId, "OriTxrRef", refTxr)
' Passo al successivo
nRawId = EgtGetNextRawPart(nRawId)
End While
' Modifiche sull'unico grezzo della prima fase
Dim nSolId = EgtGetFirstNameInGroup(EgtGetFirstRawPart(), NAME_RAW_SOLID)
' Disabilito la texture sul grezzo
EgtRemoveTextureData(nSolId)
' Sistemo il colore
Dim Col As Color3d
EgtGetCalcColor(nSolId, Col)
Col.A = 20
EgtSetColor(nSolId, Col, True)
' Visualizzo la foto
EstPhoto.ShowPhoto(True)
' Aggiorno visualizzazione
EgtDraw()
bOk = True
End If
Return bOk
End Function
Private Function HideAllMachinings() As Boolean
Dim nId As Integer = EgtGetFirstOperation()
While nId <> GDB_ID.NULL
If EgtGetOperationType(nId) <> MCH_OY.DISP Then
EgtSetOperationStatus(nId, False)
End If
nId = EgtGetNextOperation(nId)
End While
Return True
End Function
Private Function MakePartList() As Boolean
' Ciclo su tutti i grezzi dell'ultima fase
Dim nLastPhase = EgtGetPhaseCount()
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
If EgtVerifyRawPartPhase(nRawId, nLastPhase) Then
' Ciclo su tutti i pezzi del grezzo
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
While nPartId <> GDB_ID.NULL
m_vParts.Add(nPartId)
nPartId = EgtGetNextPartInRawPart(nPartId)
End While
End If
nRawId = EgtGetNextRawPart(nRawId)
End While
Return True
End Function
Friend Sub Close()
' Terminazione generale di EgtInterface
EgtExit()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End Sub
Public Function SavePartStatus() As Boolean
' Gestione file
Try
' Recupero materiale
Dim sMaterial As String = String.Empty
EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, ConstGen.NAME_PROJMARK), ConstGen.INFO_PROJMAT, sMaterial)
' Recupero spessore
Dim nSolidRawId As Integer = EgtGetFirstNameInGroup(EgtGetFirstRawPart(), ConstGen.NAME_RAW_SOLID)
Dim b3RawBox As New BBox3d
EgtGetBBoxGlob(nSolidRawId, GDB_BB.STANDARD, b3RawBox)
Dim dThick As Double = If(b3RawBox.IsEmpty(), 0, b3RawBox.DimZ())
' Recupero path originale di carico
Dim sCutPath As String = String.Empty
EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, ConstGen.NAME_PROJMARK), ConstGen.INFO_LOADPATH, sCutPath)
' Apro i file
Dim RuinedWrt As New IO.StreamWriter(m_sProjDir & "\" & CURR_PROJ_EPL, False)
Dim ProdWrt As New IO.StreamWriter(m_sProjDir & "\" & CURR_PROJ_PPL, False)
' Intestazioni epl
RuinedWrt.WriteLine("[General]")
If String.IsNullOrEmpty(sCutPath) Then
RuinedWrt.WriteLine("Path=*RuinedParts*")
Else
RuinedWrt.WriteLine("Path=" & sCutPath)
End If
' intestazione ppl
ProdWrt.WriteLine("[General]")
If String.IsNullOrEmpty(sCutPath) Then
ProdWrt.WriteLine("Path=*ProducedParts*")
Else
ProdWrt.WriteLine("Path=" & sCutPath)
End If
' Ciclo sui pezzi
Dim nI As Integer = 0
Dim nJ As Integer = 0
' lista dei pezzi rovinati che si trovano sul tavolo
Dim RuinedPart As ObservableCollection(Of Part) = Map.refUnloadingAreaVM.GetParts(Place.ON_TABLE, StatusPart.WASTE)
' lista di tutti i pezzi buoni del progetto
Dim UnloadedPart As New ObservableCollection(Of Part)
' lista di tutti i pezzi buoni sulla rulliera
For Each ItemPart In Map.refUnloadingAreaVM.GetParts(Place.ON_MOTOR_RULLER)
UnloadedPart.Add(ItemPart)
Next
' tutti i pezzi non prelevabili ancora presenti sulla rulliera (dovrebbe essere sempre vuota)
For Each ItemPart In Map.refUnloadingAreaVM.GetParts(Place.ON_MOTOR_RULLER, StatusPart.NOT_LOADED)
UnloadedPart.Add(ItemPart)
Next
' tutti i pezzi non prelevabili tolti dalla rulliera
For Each ItemPart In Map.refUnloadingAreaVM.GetParts(Place.ON_WASTE_BOX, StatusPart.NOT_LOADED)
UnloadedPart.Add(ItemPart)
Next
' tutti i pezzi defpositati nei Box
For Each ItemPart In Map.refUnloadingAreaVM.GetParts(Place.ON_BOX)
UnloadedPart.Add(ItemPart)
Next
' tutti i pezzi prelavati a mano
For Each ItemPart In Map.refUnloadingAreaVM.GetParts(Place.ON_MANUAL_BOX)
UnloadedPart.Add(ItemPart)
Next
For Each ItemPart As Part In RuinedPart
nI = nI + 1
RuinedWrt.WriteLine("[P" & nI.ToString() & "]")
Dim sName As String = String.Empty
EgtGetInfo(ItemPart.IdPart, ConstGen.INFO_CSV_PART, sName)
RuinedWrt.WriteLine("Nam=" & sName)
RuinedWrt.WriteLine("Mat=" & sMaterial)
RuinedWrt.WriteLine("Act=1")
RuinedWrt.WriteLine("Cnt=0")
RuinedWrt.WriteLine("Add=1")
RuinedWrt.WriteLine("ToN=1")
Dim sCompo As String = String.Empty
EgtGetInfo(ItemPart.IdPart, "CMP", sCompo)
RuinedWrt.WriteLine("Rct=" & If(sCompo = "Rettangolo", "1", "0"))
Dim dDimX As Double = 0
EgtGetInfo(ItemPart.IdPart, "V1", dDimX)
RuinedWrt.WriteLine("DX=" & DoubleToString(dDimX, 4))
Dim dDimY As Double = 0
EgtGetInfo(ItemPart.IdPart, "V2", dDimY)
RuinedWrt.WriteLine("DY=" & DoubleToString(dDimY, 4))
RuinedWrt.WriteLine("Th=" & DoubleToString(dThick, 4))
RuinedWrt.WriteLine("OIn=" & nI.ToString())
Next
For Each ItemPart As Part In UnloadedPart
nJ += 1
ProdWrt.WriteLine("[P" & nJ.ToString() & "]")
Dim sName As String = String.Empty
EgtGetInfo(ItemPart.IdPart, ConstGen.INFO_CSV_PART, sName)
ProdWrt.WriteLine("Nam=" & sName)
ProdWrt.WriteLine("Mat=" & sMaterial)
ProdWrt.WriteLine("Act=1")
ProdWrt.WriteLine("Cnt=1")
ProdWrt.WriteLine("Add=0")
ProdWrt.WriteLine("ToN=0")
Dim sCompo As String = String.Empty
EgtGetInfo(ItemPart.IdPart, "CMP", sCompo)
ProdWrt.WriteLine("Rct=" & If(sCompo = "Rettangolo", "1", "0"))
Dim dDimX As Double = 0
EgtGetInfo(ItemPart.IdPart, "V1", dDimX)
ProdWrt.WriteLine("DX=" & DoubleToString(dDimX, 4))
Dim dDimY As Double = 0
EgtGetInfo(ItemPart.IdPart, "V2", dDimY)
ProdWrt.WriteLine("DY=" & DoubleToString(dDimY, 4))
ProdWrt.WriteLine("Th=" & DoubleToString(dThick, 4))
ProdWrt.WriteLine("OIn=" & nJ.ToString())
Next
' Terminatori
RuinedWrt.WriteLine("[END]")
ProdWrt.WriteLine("[END]")
' Chiudo i file
RuinedWrt.Close()
ProdWrt.Close()
Return True
' Errore
Catch ex As Exception
EgtOutLog("Error writing epl file")
Return False
End Try
End Function
#End Region ' METHODS
End Class
Public Class Proj
Private m_nProjInd As Integer = 0
Public ReadOnly Property nProjInd As Integer
Get
Return m_nProjInd
End Get
End Property
Private m_enStatus As StatusProj = StatusProj.WAITING
Public Property enStatus As StatusProj
Get
Return m_enStatus
End Get
Set(value As StatusProj)
m_enStatus = value
End Set
End Property
Sub New(nProjInd As Integer)
m_nProjInd = nProjInd
End Sub
End Class