OmagVIEWPlus 2.3a1:

-> aggiornamento automatico della lista "PartList";
-> verifica funzionamento ultima versione.
This commit is contained in:
Nicola Pievani
2021-01-07 14:08:14 +00:00
parent 4ed5b11022
commit 65dee8bf4c
26 changed files with 1794 additions and 265 deletions
+36 -52
View File
@@ -413,7 +413,7 @@ Friend Module CamAuto
End If
Else
' pezzi automatici (recupero la lista di apparenenza del pezzo)
Dim LocalPartList As List(Of Part) = GetPartList(TmpPart.MinRectX)
Dim LocalPartList As List(Of Part) = GetPartialList(TmpPart.MinRectX, PartListMax, PartListMedium, PartListMin)
If LocalPartList.Count = 0 Then
LocalPartList.Add(TmpPart)
Else
@@ -565,20 +565,46 @@ Friend Module CamAuto
End If
Map.refUnloadingAreaVM.ClearOutputMessage()
Map.refUnloadingAreaVM.SetOutputMessage("Ended loading project.")
' aggiorno la lista dei progetti
If Not IsNothing(Map.refUnloadingAreaVM.m_refTablePartWindowVM) Then
Map.refUnloadingAreaVM.m_refTablePartWindowVM.RefreshProject()
End If
Return bOk
End Function
' assegnata la lunghezza del pezzo restiruisce la lista di appartenenza
Private Function GetPartList(MinRectX As Double) As List(Of Part)
Public Function GetPartialList(MinRectX As Double, ByRef LocalPartListMax As List(Of Part), ByRef LocalPartListMedium As List(Of Part), ByRef LocalPartListMin As List(Of Part)) As List(Of Part)
If MinRectX - Map.refUnloadingAreaVM.MaxLength > EPS_SMALL Then
Return PartListMax
Return LocalPartListMax
ElseIf MinRectX - 600 > EPS_SMALL Then
Return PartListMedium
Return LocalPartListMedium
Else
Return PartListMin
Return LocalPartListMin
End If
End Function
' rimuove i pezzi che appartengono allo stesso Layer dello stesso box del pezzo rovinato
Public Function RemuovePartSameLayer(ByRef CurrList As List(Of Part), WastePart As Part, bNewBox As Boolean) As Boolean
Dim IndexPart As Integer = 0
' costruisco la lista degli indici da rimuovere nella lista Medium
Dim RemoveList As New List(Of Part)
For IndexPart = 0 To CurrList.Count - 1
If bNewBox AndAlso CurrList(IndexPart).nLayer = WastePart.nLayer AndAlso CurrList(IndexPart).IdBox = WastePart.IdBox Then
' se appartengono allo stesso layer del box corrente
RemoveList.Add(CurrList(IndexPart))
ElseIf CurrList(IndexPart).IdBox <> WastePart.IdBox Then
' se appartengono ad un box differente
RemoveList.Add(CurrList(IndexPart))
End If
Next
' rimuovo i pezzi che ho calcolato al punto sopra
For Each ItemIndex In RemoveList
CurrList.Remove(ItemIndex)
Next
Return True
End Function
' calcolo il nesting della lista passata
Public Function MyNesting1D(LocalPartList As List(Of Part), ByRef PrecWidthLayer As Double, ByRef LastLayerList As List(Of Part), nLayerIndex As Integer, Optional bStop As Boolean = False) As Boolean
' se la lista da nestare è vuot allora esco siìubito
If LocalPartList.Count < 1 Then Return False
@@ -676,6 +702,7 @@ Friend Module CamAuto
Return True
End Function
' calcolo il nesting tra due liste
Public Function JoinNesting1D(PrecListPart As List(Of Part), CurrListPart As List(Of Part), LastLayerList As List(Of Part), ByRef dDiffY As Double, nCurrLayer As Integer) As Boolean
' se una delle due liste da nestare è vuota allora esco
If PrecListPart.Count < 1 Or CurrListPart.Count < 1 Then Return False
@@ -715,53 +742,6 @@ Friend Module CamAuto
End If
End Function
' riceve in ingresso la lista dei pezzi e la superficie disponibile -> i pezzi non devono essere raggruppati in categorie
Public Sub MyNestingSideBySide(LocalPartList As List(Of Part), ByVal ActualWidthPallet As Double)
Dim nCurrLayer As Integer = 0
Dim dTollerance As Double = Map.refUnloadingAreaVM.MinTollerance
Dim dMaxTollerance As Double = Map.refUnloadingAreaVM.MaxTollerance
Dim dMaxDist As Double = 170
' lista dei pezzi per il Layer corrente
Dim ListPartLayer As New List(Of Part)
' definisco la posizione all'interno del Layer
Dim nCurrPos As Integer = 0
' superficie disponibile di deposito sul pallet
Dim dDiff As Double = ActualWidthPallet - dTollerance
' devo necessariamente impilare i pezzi (non posso porvare ad affiancarli)
Dim dCreateTile As Boolean = False
' costruisco i layer
Dim IndexPart As Integer = 0
While IndexPart < LocalPartList.Count() - 1
' se è il primo pezzo del Layer allora non considero al tolleranza
Dim CurrTollerance As Double = dTollerance
If nCurrPos = 0 Then
dTollerance = 0
End If
' inserisco il pezzo nello spazio rimanete del Layer e calcolo lo spazio disponibile
dDiff = dDiff - LocalPartList(IndexPart).MinRectY - dTollerance
' se il pezzo non sborda
If dDiff >= -EPS_SMALL Then
' defisco la posizione nel Layer
nCurrPos = nCurrPos + 1
' salvo il Layer Occupato dal pezzo
LocalPartList(IndexPart).nLayer = nCurrLayer
' aggiungo il pezzo alla lista dei pezzi inseriti nel Layer
ListPartLayer.Add(LocalPartList(IndexPart))
' passo al pezzo successivo
IndexPart = IndexPart + 1
Else
' passo al Layer successivo
nCurrLayer = nCurrLayer + 1
nCurrPos = 0
' calcolo la disposizione dei pezzi nel Layer corrente in Y
CalcOffsetPartY(ListPartLayer, ActualWidthPallet)
dDiff = ActualWidthPallet
' ripulisco la lista dei pezzi all'interno del Layer
ListPartLayer.Clear()
End If
End While
End Sub
' ricavuta la lista di pezzi che occupano un Layer, e la dimensione Y del Layer precedente determino la nuova disposizione
Public Sub CalcOffsetPartY(ListPartLayer As List(Of Part), ByRef PrecWidthPallet As Double)
' distanza massima di sicurezza da mantenere tra i pezzi
@@ -787,6 +767,8 @@ Friend Module CamAuto
' verifico che la distanza calcolata sia minore del valore massimo
If dSplit > dMaxTollerance Then
dSplit = dMaxTollerance
ElseIf dSplit < 10 Then
dSplit = 10
End If
End If
' determino lo spazio occupato dai pezzi del Layer corrente
@@ -816,6 +798,8 @@ Friend Module CamAuto
ActualY = ActualY + ListPartLayer(IndexPart).MinRectY + dSplit
bCalcOk = True
End If
' assegno la posizione del pezzo all'inerno del Layer
ListPartLayer(IndexPart).nPositionLayer = IndexPart
If Not bCalcOk Then
Map.refUnloadingAreaVM.ClearOutputMessage()
Map.refUnloadingAreaVM.SetOutputMessage("Error in calc offset box.")
-3
View File
@@ -1,3 +0,0 @@
Public Class WarehouseV
End Class
+32
View File
@@ -0,0 +1,32 @@
<EgtWPFLib5:EgtCustomWindow x:Class="InfoWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False" IsClosable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
Height="150" Width="350">
<!--CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"-->
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="1.5*"/>
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Messages}"/>
<ToggleButton Grid.Column="0" Grid.Row="1"
Height="35" Width="100"
Content="Yes" IsChecked="{Binding TryAgain}"/>
<ToggleButton Grid.Column="1" Grid.Row="1"
Height="35" Width="100"
Content="No" IsChecked="{Binding StopTry}"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+11
View File
@@ -0,0 +1,11 @@
Public Class InfoWindowV
Private m_InfoWindowVM As InfoWindowVM
Sub New(Owner As Window, objInfoWindowVM As InfoWindowVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.DataContext = objInfoWindowVM
m_InfoWindowVM = objInfoWindowVM
End Sub
End Class
+53
View File
@@ -0,0 +1,53 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class InfoWindowVM
Inherits VMBase
Friend m_RefInfoWindowV As InfoWindowV
Private m_Title As String = String.Empty
Public ReadOnly Property Title As String
Get
Return m_Title
End Get
End Property
Private m_Messages As String = String.Empty
Public ReadOnly Property Messages As String
Get
Return m_Messages
End Get
End Property
Private m_TryeAgain As Boolean = False
Public Property TryAgain As Boolean
Get
Return m_TryeAgain
End Get
Set(value As Boolean)
m_TryeAgain = value
m_StopTry = Not value
m_RefInfoWindowV.Close()
End Set
End Property
Private m_StopTry As Boolean = False
Public Property StopTry As Boolean
Get
Return m_StopTry
End Get
Set(value As Boolean)
m_StopTry = value
m_TryeAgain = Not value
m_RefInfoWindowV.Close()
End Set
End Property
Sub New(sMessages As String, sTitle As String)
m_Title = sTitle
m_Messages = sMessages
m_RefInfoWindowV = New InfoWindowV(Application.Current.MainWindow, Me)
End Sub
End Class
+2
View File
@@ -239,6 +239,8 @@ Public Class MainWindowVM
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Sub CloseApplication(ByVal param As Object)
' salvo il deisegno del progetto corrente
EgtSaveFile(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & CURR_PROJ_NAME, NGE.BIN)
' Termino il Model
m_MainWindowM.Close()
' chiudo il programma CameraManager
+33 -1
View File
@@ -61,6 +61,7 @@ Public Class Part
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
@@ -73,6 +74,7 @@ Public Class Part
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
@@ -93,6 +95,20 @@ Public Class Part
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
@@ -173,6 +189,7 @@ Public Class Part
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
@@ -185,6 +202,7 @@ Public Class Part
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
@@ -449,6 +467,17 @@ Public Class Part
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
@@ -553,6 +582,9 @@ Public Class Part
' 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
@@ -560,9 +592,9 @@ Public Class Part
' ricavo il magazzino corrente
If ItemWarehouse.Id = CType(nIdWarehouse, Warehouses) Then
For Each ItemBox In ItemWarehouse.Boxes
ItemBox.State = States.LOADING
If ItemBox.Id = LocalPart.IdBox Then
ItemBox.MyListPart.Add(LocalPart)
ItemBox.State = States.LOADING
End If
Next
End If
+2 -2
View File
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.2.11.2")>
<Assembly: AssemblyFileVersion("2.2.11.2")>
<Assembly: AssemblyVersion("2.3.1.1")>
<Assembly: AssemblyFileVersion("2.3.1.1")>
+11 -11
View File
@@ -434,11 +434,11 @@ Public Class MySceneHostVM
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
Dim nId As Integer = EgtGetFirstObjInSelWin()
''usato come test (tutto in una sola funzione)
'Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
'If EgtGetRawPartFromPart(nPartId) = GDB_ID.NULL Then Return
'Dim nStat As Integer = GDB_ST.ON_
'EgtGetStatus(nPartId, nStat)
'usato come test (tutto in una sola funzione)
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
If EgtGetRawPartFromPart(nPartId) = GDB_ID.NULL Then Return
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
'If nStat = GDB_ST.SEL Then
' EgtDeselectObj(nPartId)
'Else
@@ -447,10 +447,10 @@ Public Class MySceneHostVM
While nId <> GDB_ID.NULL
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
nPartId = EgtGetParent(EgtGetParent(nId))
Dim bPartInTable As Boolean = (EgtGetParent(nPartId) = GetRawId())
If EgtGetRawPartFromPart(nPartId) <> GDB_ID.NULL Then
Dim nStat As Integer = GDB_ST.ON_
'Dim nStat As Integer = GDB_ST.ON_
' recupero lo stato del pezzo
EgtGetStatus(nPartId, nStat)
' Se già selezionato
@@ -628,10 +628,10 @@ Public Class MySceneHostVM
m_bDrag = False
m_nIdToSel = GDB_ID.NULL
m_nIdToDesel = GDB_ID.NULL
' Se nessun pezzo selezionato, reset flag posizione selezionati
If EgtGetSelectedObjCount() = 0 Then
m_nPartPos = PART_POS.NONE_TABLE
End If
'' Se nessun pezzo selezionato, reset flag posizione selezionati
'If EgtGetSelectedObjCount() = 0 Then
' m_nPartPos = PART_POS.NONE_TABLE
'End If
EgtDraw()
End Sub
File diff suppressed because it is too large Load Diff
+30 -6
View File
@@ -145,19 +145,27 @@
<DependentUpon>GridBoxesV.xaml</DependentUpon>
</Compile>
<Compile Include="GridBox\GridBoxesVM.vb" />
<Compile Include="GridStorage\WarehouseV.xaml.vb">
<DependentUpon>WarehouseV.xaml</DependentUpon>
<Compile Include="InfoWindow\InfoWindowV.xaml.vb">
<DependentUpon>InfoWindowV.xaml</DependentUpon>
</Compile>
<Compile Include="InfoWindow\InfoWindowVM.vb" />
<Compile Include="MainWindow\Camera.vb" />
<Compile Include="MainWindow\Part.vb" />
<Compile Include="MySceneHost\MySceneHostVM.vb" />
<Compile Include="MySceneHost\SceneWindowVM.vb" />
<Compile Include="NCCommunication\Nc_Debug.vb" />
<Compile Include="NCCommunication\Nc_Parent.vb" />
<Compile Include="NCCommunication\Nc_Siemens.vb" />
<Compile Include="SceneHost\SceneHostV.xaml.vb">
<Compile Include="MySceneHost\SceneHostV.xaml.vb">
<DependentUpon>SceneHostV.xaml</DependentUpon>
</Compile>
<Compile Include="StatusMachine2\StatusMachine2V.xaml.vb">
<DependentUpon>StatusMachine2V.xaml</DependentUpon>
</Compile>
<Compile Include="StatusMachine2\StatusMachine2VM.vb" />
<Compile Include="TablePartWindow\TablePartWindowV.xaml.vb">
<DependentUpon>TablePartWindowV.xaml</DependentUpon>
</Compile>
<Compile Include="TablePartWindow\TablePartWindowVM.vb" />
<Compile Include="UnloadingArea\UnloadingAreaV.xaml.vb">
<DependentUpon>UnloadingAreaV.xaml</DependentUpon>
</Compile>
@@ -173,6 +181,9 @@
<Compile Include="Warehouse\BoxV.xaml.vb">
<DependentUpon>BoxV.xaml</DependentUpon>
</Compile>
<Compile Include="Warehouse\WarehouseV.xaml.vb">
<DependentUpon>WarehouseV.xaml</DependentUpon>
</Compile>
<Compile Include="Warehouse\WarehouseVM.vb" />
</ItemGroup>
<ItemGroup>
@@ -241,7 +252,15 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GridStorage\WarehouseV.xaml">
<Page Include="TablePartWindow\TablePartWindowV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Warehouse\WarehouseV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="InfoWindow\InfoWindowV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -249,10 +268,14 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SceneHost\SceneHostV.xaml">
<Page Include="MySceneHost\SceneHostV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="StatusMachine2\StatusMachine2V.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UnloadingArea\UnloadingAreaV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -312,6 +335,7 @@
<ItemGroup>
<Resource Include="Resources\WhiteArrow.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagVIEWPlus\OmagVIEWPlusR32.exe
+55
View File
@@ -0,0 +1,55 @@
<EgtWPFLib5:EgtCustomWindow x:Class="StatusMachine2V"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False" IsClosable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
Height="200" Width="350">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<UniformGrid Grid.Row="0" Grid.ColumnSpan="2" Columns="2">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding MessagesStatus}"/>
<TextBox Text="{Binding StatusMachine}"
Padding="3"
VerticalAlignment="Center"
Height="25"
Margin="25,0, 25, 0"
IsEnabled="False"/>
</UniformGrid>
<UniformGrid Grid.Row="1" Grid.ColumnSpan="2" Columns="2">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding MessagesIsHang}"/>
<CheckBox Name ="IsHangingName"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding IsHanging}"/>
</UniformGrid>
<UniformGrid Grid.Row="2" Grid.ColumnSpan="2" Columns="2">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding MessagesIsManual}"/>
<CheckBox HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding IsManual}"/>
</UniformGrid>
<ToggleButton Grid.Column="1" Grid.Row="3"
Height="35" Width="100"
Content="Apply" IsChecked="{Binding Apply}"/>
<ToggleButton Grid.Column="0" Grid.Row="3"
Height="35" Width="100"
Content="Cancel" IsChecked="{Binding Cancel}"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+11
View File
@@ -0,0 +1,11 @@
Public Class StatusMachine2V
Private m_StatusMachine2VM As StatusMachine2VM
Sub New(Owner As Window, objStatusMachine2VM As StatusMachine2VM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.DataContext = objStatusMachine2VM
m_StatusMachine2VM = objStatusMachine2VM
End Sub
End Class
+139
View File
@@ -0,0 +1,139 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class StatusMachine2VM
Inherits VMBase
Friend m_RefStusMachine2V As StatusMachine2V
Private m_Title As String = "Status machine 2"
Public ReadOnly Property Title As String
Get
Return m_Title
End Get
End Property
Private m_MessagesIsHang As String = "Part is hanging"
Public ReadOnly Property MessagesIsHang As String
Get
Return m_MessagesIsHang
End Get
End Property
Private m_MessagesStatus As String = "Status machine"
Public ReadOnly Property MessagesStatus As String
Get
Return m_MessagesStatus
End Get
End Property
Private m_MessagesIsManual As String = "Unloaded manual"
Public ReadOnly Property MessagesIsManual As String
Get
Return m_MessagesIsManual
End Get
End Property
Private m_IsHanging As Boolean = False
Public Property IsHanging As Boolean
Get
Return m_IsHanging
End Get
Set(value As Boolean)
m_IsHanging = value
End Set
End Property
Private m_StatusMachine As String = String.Empty
Public Property StatusMachine As String
Get
Return m_StatusMachine
End Get
Set(value As String)
m_StatusMachine = value
NotifyPropertyChanged("StatusMachine")
End Set
End Property
Public Sub SetStatusMachine()
Dim nVal As Integer = 0
If Map.refMainWindowVM.m_CNCommunication.ReadInt("StatusMachine2Read", nVal) Then
m_StatusMachine = nVal.ToString
NotifyPropertyChanged("StatusMachine")
End If
End Sub
Private m_IsManualUnloaded As Boolean = False
Public Property IsManulaUnloaded As Boolean
Get
Return m_IsManualUnloaded
End Get
Set(value As Boolean)
m_IsManualUnloaded = value
NotifyPropertyChanged("IsManulaUnloaded")
End Set
End Property
Private m_Apply As Boolean = False
Public Property Apply As Boolean
Get
Return m_Apply
End Get
Set(value As Boolean)
m_Apply = value
m_Cancel = Not value
If value Then
m_RefStusMachine2V.Close()
Map.refUnloadingAreaVM.StatusMachine2 = False
If Not IsNothing(Map.refMainWindowVM.m_CNCommunication) Then
' definisco lo stato attuale del pezzo
If m_IsManualUnloaded And Not IsNothing(Map.refUnloadingAreaVM.CurrPartTable2) Then
Map.refUnloadingAreaVM.CurrPartTable2.enUnloading = Unloading.MANUAL
Map.refUnloadingAreaVM.CurrPartTable2.enPlace = Place.ON_WASTE_BOX
End If
' definisco lo stato della macchina
If m_IsHanging Then
Map.refMainWindowVM.m_CNCommunication.WriteInt("IsHanging", 1)
Map.refMainWindowVM.m_CNCommunication.WriteInt("StatusMachine2", 1)
Else
Map.refMainWindowVM.m_CNCommunication.WriteInt("IsHanging", 0)
Map.refMainWindowVM.m_CNCommunication.WriteInt("StatusMachine2", 0)
End If
End If
End If
End Set
End Property
Private m_Cancel As Boolean = False
Public Property Cancel As Boolean
Get
Return m_Cancel
End Get
Set(value As Boolean)
m_Cancel = value
m_Apply = Not value
Map.refUnloadingAreaVM.StatusMachine2 = False
If value Then
m_RefStusMachine2V.Close()
End If
End Set
End Property
Sub New()
m_RefStusMachine2V = New StatusMachine2V(Application.Current.MainWindow, Me)
Dim nVal1 As Integer = 0
Dim nVal2 As Integer = 0
If Not IsNothing(Map.refMainWindowVM.m_CNCommunication) Then
If Map.refMainWindowVM.m_CNCommunication.ReadInt("IsHangingRead", nVal1) Then
If nVal1 = 1 Then
m_IsHanging = True
Else
m_IsHanging = False
End If
End If
If Map.refMainWindowVM.m_CNCommunication.ReadInt("StatusMachine2Read", nVal2) Then
m_StatusMachine = nVal2.ToString
End If
End If
End Sub
End Class
+37
View File
@@ -0,0 +1,37 @@
<EgtWPFLib5:EgtCustomWindow x:Class="TablePartWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False" IsClosable="True"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
Height="Auto" Width="850">
<TabControl Name="MyProject" ItemsSource="{Binding ProjetcList}" SelectedItem="{Binding ProjSelected}">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock
Text="{Binding IdProject}" />
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<DataGrid Name="MyParts" ItemsSource="{Binding CurrListPart}" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="IdPart" Binding="{Binding IdPart}" Width="*"/>
<DataGridTextColumn Header="Dim Y" Binding="{Binding MinRectY}" Width="*"/>
<DataGridTextColumn Header="Dim X" Binding="{Binding MinRectX}" Width="*"/>
<DataGridTextColumn Header="Palce" Binding="{Binding enPlace}" Width="*"/>
<DataGridTextColumn Header="Status" Binding="{Binding enStatus}" Width="*"/>
<DataGridTextColumn Header="Unloading" Binding="{Binding enUnloading}" Width="*"/>
<DataGridTextColumn Header="IdBox" Binding="{Binding IdBox}" Width="*"/>
<DataGridTextColumn Header="Warehouse" Binding="{Binding enWarehouse}" Width="*"/>
<DataGridTextColumn Header="Layer" Binding="{Binding nLayer}" Width="*"/>
<DataGridTextColumn Header="Position" Binding="{Binding nPositionLayer}" Width="*"/>
<DataGridTextColumn Header="Offset Y" Binding="{Binding dOffestPartY}" Width="*"/>
</DataGrid.Columns>
</DataGrid>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</EgtWPFLib5:EgtCustomWindow>
+11
View File
@@ -0,0 +1,11 @@
Public Class TablePartWindowV
Private m_TablePartWindowVM As TablePartWindowVM
Sub New(Owner As Window, objTablePartWindowVM As TablePartWindowVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.DataContext = objTablePartWindowVM
m_TablePartWindowVM = objTablePartWindowVM
End Sub
End Class
+111
View File
@@ -0,0 +1,111 @@
Imports EgtUILib
Imports EgtWPFLib5
Imports System.Collections.ObjectModel
Public Class TablePartWindowVM
Inherits VMBase
Friend refTablePartWindowV As TablePartWindowV
Private m_ProjetcList As New ObservableCollection(Of ProjectListParts)
Public Property ProjetcList As ObservableCollection(Of ProjectListParts)
Get
Return m_ProjetcList
End Get
Set(value As ObservableCollection(Of ProjectListParts))
m_ProjetcList = value
End Set
End Property
Private m_ProjSelected As ProjectListParts
Public Property ProjSelected As ProjectListParts
Get
Return m_ProjSelected
End Get
Set(value As ProjectListParts)
m_ProjSelected = value
NotifyPropertyChanged("CurrListPart")
End Set
End Property
Public Sub RefreshProject()
Dim m_CurrentPartList As New ObservableCollection(Of Part)
Dim bAddNewList As Boolean = True
' salvo le liste in funzione del numero di progetto
If Not IsNothing(Map.refUnloadingAreaVM) Then
For Each ItemPart In Map.refUnloadingAreaVM.ListPart
For Each Item In m_ProjetcList
If Item.IdProject = ItemPart.IdProject.ToString Then
bAddNewList = False
Exit For
End If
bAddNewList = True
Next
If bAddNewList Then
m_CurrentPartList.Add(ItemPart)
End If
Next
End If
If m_CurrentPartList.Count > 0 Then
m_ProjetcList.Add(New ProjectListParts(m_CurrentPartList))
NotifyPropertyChanged("CurrentPartList")
' seleziono come progetto quello in fase di scarico
m_ProjSelected = m_ProjetcList.Last
NotifyPropertyChanged("ProjetcList")
NotifyPropertyChanged("ProjSelected")
End If
End Sub
Sub New(IdProj As Integer)
refTablePartWindowV = New TablePartWindowV(Application.Current.MainWindow, Me)
For Each Itemproj In Map.refMainWindowVM.MainWindowM.ProjIndList
Dim m_CurrentPartList As New ObservableCollection(Of Part)
' salvo le liste in funzione del numero del numero di progetto
If Not IsNothing(Map.refUnloadingAreaVM) Then
For Each ItemPart In Map.refUnloadingAreaVM.ListPart
If ItemPart.IdProject = Itemproj.nProjInd Then
m_CurrentPartList.Add(ItemPart)
End If
Next
End If
If m_CurrentPartList.Count > 0 Then
m_ProjetcList.Add(New ProjectListParts(m_CurrentPartList))
NotifyPropertyChanged("CurrentPartList")
m_ProjSelected = m_ProjetcList.Last
End If
Next
NotifyPropertyChanged("ProjetcList")
End Sub
End Class
Public Class ProjectListParts
Inherits VMBase
Private m_CurrListPart As New ObservableCollection(Of Part)
Public Property CurrListPart As ObservableCollection(Of Part)
Get
Return m_CurrListPart
End Get
Set(value As ObservableCollection(Of Part))
m_CurrListPart = value
End Set
End Property
Private m_IdProject As String
Public Property IdProject As String
Get
Return m_IdProject
End Get
Set(value As String)
m_IdProject = value
End Set
End Property
Sub New(obCurrListParts As ObservableCollection(Of Part))
m_CurrListPart = obCurrListParts
If m_CurrListPart.Count > 0 Then
m_IdProject = m_CurrListPart(0).IdProject.ToString
End If
End Sub
End Class
+15 -6
View File
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:OmagVIEWPlus="clr-namespace:OmagVIEWPlus"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<Grid>
<Grid IsEnabled="{Binding EnablePage}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
@@ -54,13 +54,18 @@
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" >
<ToggleButton VerticalAlignment="Top"
Margin="10, 20, 0, 0" Height="35" Width="100"
Content="{Binding ManualUnload}"
IsChecked="{Binding IsChecked_Manual}"/>
<TextBlock Text="{Binding TextReserve}"
Content="{Binding ManualUnload}"
IsChecked="{Binding IsChecked_Manual}"/>
<TextBlock VerticalAlignment="Top"
Text="{Binding TextReserve}"
TextAlignment="Center"
Padding="8"
Margin="10, 20, 0, 0" Height="35" Width="Auto"
Visibility="{Binding VisibilityTextReserve}"/>
<ToggleButton VerticalAlignment="Bottom"
Margin="10, 20, 0, 0" Height="35" Width="100"
Content="{Binding MsgMachine2}"
IsChecked="{Binding StatusMachine2}"/>
</StackPanel>
<!--Tavola-->
@@ -78,10 +83,14 @@
<!--comandi per simulazione test-->
<DockPanel HorizontalAlignment="Right" Height="35" Width="100"
<DockPanel HorizontalAlignment="Right" Height="35" Width="220"
Grid.Row="3" Grid.Column="1">
<ToggleButton Content="Part List" Grid.Row="0"
Height="35" Width="100" Visibility="{Binding ShowTabParts}"
IsChecked="{Binding WindowListPart}"/>
<ToggleButton Content="Machine" Grid.Row="0"
IsChecked="{Binding refScenaIsChecked}"/>
Height="35" Width="100"
IsChecked="{Binding refScenaIsChecked}"/>
</DockPanel>
<!--comandi per simulazione test {Binding ErrorMessages} Visibility="{Binding VisibilityMessages}" -->
+142 -13
View File
@@ -5,6 +5,21 @@ Imports EgtWPFLib5
Public Class UnloadingAreaVM
Inherits VMBase
Friend m_refStatuMachine2VM As StatusMachine2VM
Friend m_refTablePartWindowVM As TablePartWindowVM
' disabilito i comandi della pagina
Private m_EnablePage As Boolean = True
Public Property EnablePage As Boolean
Get
Return m_EnablePage
End Get
Set(value As Boolean)
m_EnablePage = value
NotifyPropertyChanged("EnablePage")
End Set
End Property
' lista dei magazzini disponibii (A, B)
Private m_WarehouseList As New ObservableCollection(Of WarehouseVM)
Public ReadOnly Property WarehouseList As ObservableCollection(Of WarehouseVM)
@@ -53,6 +68,26 @@ Public Class UnloadingAreaVM
End Set
End Property
' apre la finestra per definire lo stato della macchina
Private m_StatusMachine2 As Boolean = False
Public Property StatusMachine2 As Boolean
Get
Return m_StatusMachine2
End Get
Set(value As Boolean)
m_StatusMachine2 = value
If value Then
m_refStatuMachine2VM = New StatusMachine2VM()
m_refStatuMachine2VM.m_RefStusMachine2V.Show()
EnablePage = False
Else
m_refStatuMachine2VM = Nothing
EnablePage = True
End If
NotifyPropertyChanged("StatusMachine2")
End Set
End Property
' messaggio da mostrare a video
Private m_OutputMessage As String
Public Property OutputMessage As String
@@ -132,6 +167,31 @@ Public Class UnloadingAreaVM
End Set
End Property
' permette la visualizzazione del bottone "List Part"
Public ReadOnly Property ShowTabParts As Visibility
Get
Return If(GetMainPrivateProfileInt("General", "ShowTabParts", 0) = 1, Visibility.Visible, Visibility.Hidden)
End Get
End Property
Private m_WindowListPart As Boolean = False
Public Property WindowListPart As Boolean
Get
Return m_WindowListPart
End Get
Set(value As Boolean)
m_WindowListPart = value
If value Then
m_refTablePartWindowVM = New TablePartWindowVM(Map.refMainWindowVM.MainWindowM.nProjInd)
m_refTablePartWindowVM.refTablePartWindowV.Show()
Else
m_refStatuMachine2VM = Nothing
End If
NotifyPropertyChanged("StatusMachine2")
End Set
End Property
#End Region ' PARTS
#Region "OFFSET PALLET/RACK"
@@ -288,7 +348,12 @@ Public Class UnloadingAreaVM
Return "--"
End If
' restituisce la parcentula di pezzi prelevabili (esclusi quelli da scartare)
Return DoubleToString(If(nTotal = 0, 0, nTable / nTotal * 100), 0) & "%"
Dim sMessage As String = nTable.ToString & "/" & nTotal.ToString
If nTotal = 0 Then
sMessage = "0"
End If
'Return DoubleToString(If(nTotal = 0, 0, nTable / nTotal * 100), 0) & "%"
Return sMessage
End Get
End Property
@@ -342,6 +407,14 @@ Public Class UnloadingAreaVM
End Get
End Property
' messaggio sul bottone per la selezione dello stato del manipolatore2
Private m_MsgMachine2 As String = "Machine 2"
Public ReadOnly Property MsgMachine2 As String
Get
Return m_MsgMachine2
End Get
End Property
' visibilità del testo a lato del bottone per la prenotazione
Private m_VisibilityTextReserve As Visibility = Visibility.Collapsed
Public ReadOnly Property VisibilityTextReserve As Visibility
@@ -701,6 +774,25 @@ Public Class UnloadingAreaVM
Return CurrList
End Function
' restituisce il Box assocauto al pezzo indicato
Public Function GetPartBox(CurrPart As Part, CurrWarehouse As WarehouseVM) As Box
Dim CurrBox As Box = Nothing
For Each ItemGridBox In CurrWarehouse.GridBoxList
Dim bFoundBox As Boolean = False
For Each ItemBox In ItemGridBox.CurrBoxList
If ItemBox.Id = CurrPart.IdBox Then
CurrBox = ItemBox
bFoundBox = True
Exit For
End If
Next
If bFoundBox Then
Exit For
End If
Next
Return CurrBox
End Function
' restituisce la lista di tutti i pezzi identificati dalla stessa posizione (di default quelli buoni) di tutti i progetti caricati
Public Function GetAllParts(DefinePlce As Place, Optional DefineStatus As StatusPart = StatusPart.GOOD) As ObservableCollection(Of Part)
Dim CurrList As New ObservableCollection(Of Part)
@@ -784,42 +876,55 @@ Public Class UnloadingAreaVM
Next
Next
' divido i pezzi in due liste (palle/rack) solo quelli con scarico automatico
' divido i pezzi in due liste (pallet/rack) solo quelli con scarico automatico
Dim nPartOnPallet As Integer = 0
Dim nPartOnRack As Integer = 0
Dim RackPartList As New List(Of Part)
Dim PalletPartList As New List(Of Part)
Dim NewPalletPartLisr As New List(Of Part)
Dim dHeightTile As Double = 0
Dim dDistRack As Double = 0
' tutti quelli già sul rullo
' tutti quelli già sul rullo (senza un Box definito)
Dim ListMotorRuller As ObservableCollection(Of Part) = GetParts(m_IdProjTable2.nProjInd, Place.ON_MOTOR_RULLER)
OutLogProcess("OrganaizeWarehouse() -> Pezzi sulla rulliera: " & ListMotorRuller.Count)
For Each ItemPart In ListMotorRuller
If ItemPart.enUnloading = Unloading.AUTOMATIC Then
If ItemPart.enUnloading = Unloading.AUTOMATIC AndAlso ItemPart.IdBox = -1 Then
If ItemPart.MinRectX > m_MaxLength Then
RackPartList.Add(ItemPart)
nPartOnRack = nPartOnRack + 1
dDistRack = ItemPart.Height
Else
PalletPartList.Add(ItemPart)
nPartOnPallet = nPartOnPallet + 1
dHeightTile = ItemPart.Height
If ItemPart.IdBox = -1 Then
PalletPartList.Add(ItemPart)
nPartOnPallet = nPartOnPallet + 1
dHeightTile = ItemPart.Height
Else
NewPalletPartLisr.Add(ItemPart)
nPartOnPallet = nPartOnPallet + 1
dHeightTile = ItemPart.Height
End If
End If
End If
Next
' tutti quelli ancora sul tavolo
' tutti quelli ancora sul tavolo (senza un Box definito)
Dim ListTable As ObservableCollection(Of Part) = GetParts(m_IdProjTable2.nProjInd, Place.ON_TABLE)
OutLogProcess("OrganaizeWarehouse() -> Pezzi sul tavolo: " & ListTable.Count)
For Each ItemPart In ListTable
If ItemPart.enUnloading = Unloading.AUTOMATIC Then
If ItemPart.enUnloading = Unloading.AUTOMATIC AndAlso ItemPart.IdBox = -1 Then
If ItemPart.MinRectX > m_MaxLength Then
RackPartList.Add(ItemPart)
nPartOnRack = nPartOnRack + 1
dDistRack = ItemPart.Height
Else
PalletPartList.Add(ItemPart)
nPartOnPallet = nPartOnPallet + 1
dHeightTile = ItemPart.Height
If ItemPart.IdBox = -1 Then
PalletPartList.Add(ItemPart)
nPartOnPallet = nPartOnPallet + 1
dHeightTile = ItemPart.Height
Else
NewPalletPartLisr.Add(ItemPart)
nPartOnPallet = nPartOnPallet + 1
dHeightTile = ItemPart.Height
End If
End If
End If
Next
@@ -890,7 +995,7 @@ Public Class UnloadingAreaVM
Next
End If
' verifico che il magazzino no sua già stato organizzato
' verifico che il magazzino no sia già stato organizzato
If PalletPartList.Count > 0 Then
If PalletPartList(0).IdBox > -1 Then
OutLogProcess("OrganaizeWarehouse() -> Magazzino pallet già organizzato per progetto: " & m_IdProjTable2.nProjInd.ToString)
@@ -898,6 +1003,24 @@ Public Class UnloadingAreaVM
End If
End If
'' blocco la forzatura ad aprire il magazzino
'Map.refMainWindowVM.m_CNCommunication.m_OpenWarehouse = False
' verifico che i pezzi siano definiti nella sequenza corretta (ovvero in Layer successivi)
Dim LastIndex As Integer = 0
Dim nTestLayer As Integer = 0
If PalletPartList.Count > 0 Then
nTestLayer = PalletPartList(0).nLayer
End If
For Each Item In PalletPartList
If nTestLayer > Item.nLayer Then
ClearOutputMessage()
SetOutputMessage("Error in list part")
Return False
End If
LastIndex = LastIndex + 1
Next
' parto dal primo layer calcolato
Dim nCurrLayer As Integer = 0
' definisco quale Layer deve essere riempito per tutti i pallet
@@ -931,6 +1054,12 @@ Public Class UnloadingAreaVM
' indicizzo il nuovo strato di layer da salvare per i pallet
SetCurrLayer = SetCurrLayer + 1
Next
For Each ItemNewPallet In NewPalletPartLisr
ItemNewPallet.IdBox = ItemNewPallet.IdBox + 1
Next
ClearOutputMessage()
SetOutputMessage("Warehouse confirmed")
OutLogProcess("OrganaizeWarehouse() -> Organizzato magazzino per progetto: " & m_IdProjTable2.nProjInd.ToString)
Return True
End Function
+61 -6
View File
@@ -44,6 +44,39 @@ Public Class Box
End Get
End Property
' dimensione Y dei pezzi che deve ospitare
Private m_DimPartY As Double = 0
Public Property DimPartY As Double
Get
Return m_DimPartY
End Get
Set(value As Double)
m_DimPartY = value
End Set
End Property
' dimensione X dei pezi che deve ospitare
Private m_DimPartX As Double = 0
Public Property DimPartX As Double
Get
Return m_DimPartX
End Get
Set(value As Double)
m_DimPartX = value
End Set
End Property
' definsce se il Box è stato riservato per ospitare un determinato tipo di pezzi
Private m_ReserveBox As Boolean = False
Public Property ReserveBox As Boolean
Get
Return m_ReserveBox
End Get
Set(value As Boolean)
m_ReserveBox = value
End Set
End Property
' elenco dei pezzi che devono essere contenuti nel box
Private m_MyListPart As New List(Of Part)
Public Property MyListPart As List(Of Part)
@@ -55,6 +88,18 @@ Public Class Box
End Set
End Property
' definisce se il Box è modificabile da programma
Private m_IsAvailable As Boolean = True
Public Property IsAvailable As Boolean
Get
Return m_IsAvailable
End Get
Set(value As Boolean)
m_IsAvailable = value
NotifyPropertyChanged("IsAvailable")
End Set
End Property
' comandato dal click in interfaccia
Public Property State_IsChecked As Boolean
Get
@@ -85,6 +130,8 @@ Public Class Box
Select Case m_State
Case States.AVAILABLE
m_BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("LawnGreen"), SolidColorBrush)
Case States.LOADING
m_BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("DarkOrange"), SolidColorBrush)
Case States.FULL
m_BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("Red"), SolidColorBrush)
Case States.NOT_AVAILABLE
@@ -155,6 +202,8 @@ Public Class Box
' valore pecentuale di riempimento del box
Private m_FillPercentage As Integer = 0
Private m_nPartOnBox As Integer = 0
Private m_nPart As Integer = 0
Public ReadOnly Property nFillPercentage As Integer
Get
Dim nPart As Integer = 0
@@ -166,11 +215,13 @@ Public Class Box
If ItemPart.enPlace = Place.ON_BOX Then
nPartOnBox = nPartOnBox + 1
End If
' conto il numero totale di pezzi sani da caricare nel box
If ItemPart.enStatus = StatusPart.GOOD Then
' conto il numero totale di pezzi sani e automatici da caricare nel box
If ItemPart.enStatus = StatusPart.GOOD And ItemPart.enUnloading = Unloading.AUTOMATIC Then
nPart = nPart + 1
End If
Next
m_nPart = nPart
m_nPartOnBox = nPartOnBox
m_FillPercentage = If(nPart > 0, CInt(nPartOnBox / nPart * 100), 0)
End If
' se raggiungo il massimo riempimento prevedibile allora comunico il nuovo stato
@@ -188,15 +239,18 @@ Public Class Box
Public ReadOnly Property FillPercentage As String
Get
Dim Message As String = "--"
Select Case m_State
Case States.FULL
' definisco a video il livello di riempimento dedotto dallo stato FULL
m_FillPercentage = 100
Message = m_FillPercentage.ToString & " %"
'Message = m_FillPercentage.ToString & " %"
Message = m_nPartOnBox.ToString & "/" & m_nPart.ToString
Case States.LOADING
Message = m_FillPercentage.ToString & " %"
Case States.AVAILABLE
Message = m_FillPercentage.ToString & " %"
'Message = m_FillPercentage.ToString & " %"
Message = m_nPartOnBox.ToString & "/" & m_nPart.ToString
'Case States.AVAILABLE
' Message = m_FillPercentage.ToString & " %"
End Select
Return Message
End Get
@@ -276,6 +330,7 @@ Public Class Box
Dim RadAngRack As Double = Map.refUnloadingAreaVM.AngRack * Math.PI / 180
Dim OffsetX = dHeight / Math.Sin(RadAngRack)
OffsetX = nCounter * OffsetX
LocalPart.nPositionLayer = CInt(nCounter)
Return OffsetX
End Function
+2 -1
View File
@@ -7,7 +7,8 @@
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="200">
<Grid>
<ToggleButton Grid.Row="1" Name="MyBox"
<ToggleButton Grid.Row="1" Name="MyBox"
IsEnabled="{Binding IsAvailable}"
Visibility="{Binding VisibilityBtn}"
IsChecked="{Binding State_IsChecked}"
Background="{Binding BackGroundColor}"
-18
View File
@@ -1,21 +1,3 @@
Public Class WarehouseV
End Class
Public Class BoxTemplateSelector
Inherits DataTemplateSelector
Public Overrides Function SelectTemplate(item As Object, container As DependencyObject) As DataTemplate
Dim element As FrameworkElement = TryCast(container, FrameworkElement)
If element IsNot Nothing AndAlso item IsNot Nothing AndAlso TypeOf item Is Box Then
Dim Box As Box = TryCast(item, Box)
If Box.IsPallet Then
Return TryCast(element.FindResource("PalletTemplate"), DataTemplate)
Else
Return TryCast(element.FindResource("RackTemplate"), DataTemplate)
End If
End If
Return MyBase.SelectTemplate(item, container)
End Function
End Class
+38 -1
View File
@@ -324,11 +324,13 @@ Public Class WarehouseVM
' svuota il magazzino corrente da tutti i pezzi depositati sui palet
Public Sub Unloaded()
For Each ItemBox In Boxes
ItemBox.MyListPart.Clear()
ItemBox.IsAvailable = True
'ItemBox.MyListPart.Clear()
' soltanto i box FULL tornano ad essere disponibili
Select Case ItemBox.State
Case States.FULL
ItemBox.State = States.AVAILABLE
ItemBox.MyListPart.Clear()
End Select
' fino a quando non si riconferma la warehouse come disponibile aspetto
SetCurrentWerahouse()
@@ -389,6 +391,7 @@ Public Class WarehouseVM
' definisco il TIPO di Box
Dim bIsPallet As Boolean = IdBox <= 6
Dim enStatus As States = States.NOT_AVAILABLE
' carico lo STATO del Box (di default non è disponibile)
If sItems.Count >= 1 And IsNumeric(sItems(0)) Then
' se il box è in fase di carico lo ridefinisco come non disponibile
@@ -399,6 +402,7 @@ Public Class WarehouseVM
End If
End If
' carico la definizione della sua origine
Dim nOrig As Integer = 0
If sItems.Count >= 2 Then
@@ -409,6 +413,24 @@ Public Class WarehouseVM
EgtOutLog("Error reading file Config.ini [Warehause] -> " & sName & ", wrong CN orig definition")
End If
End If
' carico le dimensioni dei pezzi che devono occupare il pallet
Dim DimX As Double = 0
Dim DimY As Double = 0
If sItems.Count >= 3 Then
' verifico che la scrittura sia corretta: 500 x 300 (oppure) 500 X 300
If sItems(2).Contains("x"c) Or sItems(2).Contains("X"c) Then
sItems(2) = sItems(2).ToLower
Dim sDim As String() = sItems(2).Split("x"c)
' carico le dimensioni dei pezzi
If sDim.Count = 2 Then
If Not (StringToLen(sDim(0), DimX) And StringToLen(sDim(1), DimY)) Then
EgtOutLog("Error reading file Config.ini [Warehause] -> " & sName & ", wrong definition: DimX x DimY ")
End If
End If
End If
End If
' definisco la colonna di appartenenza
Dim enColumnsWarehouse As ColumnsWarehouse = ColumnsWarehouse.THIRD
If IdBox <= 2 Or IdBox = 7 Then
@@ -416,12 +438,22 @@ Public Class WarehouseVM
ElseIf IdBox = 3 Or IdBox = 4 Or IdBox = 8 Then
enColumnsWarehouse = ColumnsWarehouse.SECOND
End If
' aggiungo il Box creato alla lista (solo se appartiene alla configurazione)
Dim CurrBox As New Box(IdBox, If(bIsPallet, ConfigBox.PALLET, ConfigBox.RACK), Me, enStatus, nOrig, enColumnsWarehouse)
' aggiungo eventualmente la definizione dei pezzi da ospitare
If DimX > 0 And DimY > 0 Then
CurrBox.ReserveBox = True
CurrBox.DimPartX = DimX
CurrBox.DimPartY = DimY
Else
CurrBox.ReserveBox = False
End If
CurrBox.NotifyPropertyChanged("")
m_Boxes.Add(CurrBox)
Next
Return True
End Function
@@ -437,14 +469,19 @@ Public Class WarehouseVM
WarehauseWritePrivateProfileString(S_WAREHOUSE, "Column" & Index.ToString & K_STORAGE & m_Id.ToString, If(ItemGridBox.IsPallet, "0", "1"))
Index = Index + 1
Next
' salvo la configurazione dei box
For Index = 0 To m_Boxes.Count - 1
Dim sName As String = K_BOX & m_Id.ToString & m_Boxes(Index).Id.ToString
' converto lo stato nell'indice associato
Dim nState As Integer = CInt(m_Boxes(Index).State)
Dim sInfo As String = nState.ToString & ", G" & m_Boxes(Index).OrigDefCN.ToString
If m_Boxes(Index).ReserveBox Then
sInfo = sInfo & ", " & DoubleToString(m_Boxes(Index).DimPartX, 2) & "x" & DoubleToString(m_Boxes(Index).DimPartY, 2)
End If
WarehauseWritePrivateProfileString(S_WAREHOUSE, sName, sInfo)
Next
Return True
End Function