- Eliminato nome FiveLakes

- agginta gestione ddt
- aggiunta gestione csvout
- possibilita' di aggiungere porte manualmente
- cambiati testi in italiano
- gestito blocco edit su lista porte quando in produzione
- aggiunta eliminazione porte prodotte
- aggiunta funzione che resetta stati su reset macchina
This commit is contained in:
Emmanuele Sassi
2024-10-21 12:12:11 +02:00
parent dc6eaeb324
commit e490597a7b
16 changed files with 267 additions and 65 deletions
@@ -17,6 +17,9 @@ Module ConstIni
Public Const S_GENERAL As String = "General"
Public Const K_BACKUPDIR As String = "BackupDir"
Public Const K_RESOURCESDIR As String = "ResourcesDir"
Public Const K_DDFDIR As String = "DDFDir"
Public Const K_DDTDIR As String = "DDTDir"
Public Const K_CSVOUTPUT As String = "CSVOutput"
Public Const S_CSV As String = "CSV"
Public Const K_DDFNAME As String = "DDFName"
@@ -24,6 +27,7 @@ Module ConstIni
Public Const K_HEIGHT As String = "Height"
Public Const K_WIDTH As String = "Width"
Public Const K_THICKNESS As String = "Thickness"
Public Const K_MANUALADDEDDOORNAME As String = "ManualAddedDoorName"
Public Const S_DEBUG As String = "Debug"
Public Const K_VARIABLELIST As String = "VariableList"
@@ -1,49 +1,64 @@
<Grid x:Class="DoorListPageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.DoorArreda">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal"
IsEnabled="{Binding bExecButton_IsEnabled}">
<Button Content="CSV"
ToolTip="Open CSV file"
ToolTip="Apri file CSV"
Command="{Binding OpenCSV_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"/>
<Button Content="Skip Door"
ToolTip="Skip Door"
<Button Content="Salta Porta"
ToolTip="Blocca Porta selezionata, chenon verrà mandata in produzione"
Command="{Binding SkipDoor_Command}"/>
<Button Content="↑"
ToolTip="Move Up"
ToolTip="Sposta su"
Command="{Binding MoveUp_Command}"/>
<Button Content="↓"
ToolTip="Move Down"
ToolTip="Sposta giù"
Command="{Binding MoveDown_Command}"/>
<Button Content="Delete"
ToolTip="Delete"
<Button Content="Cancella"
ToolTip="Cancella porta selezionata"
Command="{Binding Delete_Command}"/>
<Button Content="Delete All"
ToolTip="Delete All"
<Button Content="Cancella tutto"
ToolTip="Cancella tutte le porte non in produzione"
Command="{Binding DeleteAll_Command}"/>
<Button Content="Produce"
ToolTip="Send to production"
<Button Content="Produci"
ToolTip="Mette in coda di produzione la porta selezionata"
Command="{Binding Produce_Command}"/>
<Button Content="Produce All"
ToolTip="Send all to production"
<Button Content="Produci Tutte"
ToolTip="Mette in coda di produzione tutte le porte"
Command="{Binding ProduceAll_Command}"/>
<Button Content="Reset Production Queue"
ToolTip="Take all the door ready for production back to Verify state"
<Button Content="Reset Coda di Produzione"
ToolTip="Riporta tutte le porte pronte per essere lavorate allo stato Verificate state"
Command="{Binding ResetProductionQueue_Command}"/>
<Button Content="Verify"
ToolTip="Verify all the doors that are in state Not Verified"
<Button Content="Verifica"
ToolTip="Verifica tutte le porte in stato Non Verificata"
Command="{Binding Verify_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"/>
<Button Content="Aggiungi"
ToolTip="Aggiunge una porta alla lista"
Command="{Binding AddDoor_Command}"/>
<Button Content="Salva CSV"
ToolTip="Salva un csv di produzione"
Command="{Binding SaveCSV_Command}"/>
</StackPanel>
<DataGrid Grid.Row="1"
ItemsSource="{Binding DoorList}"
SelectedItem="{Binding SelDoor}"
AutoGenerateColumns="False"
CanUserSortColumns="False">
CanUserDeleteRows="False"
CanUserResizeRows="False"
SelectionMode="Single"
CanUserSortColumns="False"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
BeginningEdit="DoorList_BeginningEdit"
>
<DataGrid.Columns>
<DataGridTextColumn Header=""
Binding="{Binding nId}"
@@ -53,9 +68,24 @@
Binding="{Binding nCSVLine}"
Width="Auto"
IsReadOnly="True"/>
<DataGridTextColumn Header="DDF"
<DataGridTemplateColumn Header="DDF"
Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding sDDFName}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="True"
Text="{Binding sDDFName}"
ItemsSource="{Binding DataContext.DDTList, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<!--<DataGridTextColumn Header="DDF"
Binding="{Binding sDDFName}"
Width="Auto"/>
Width="Auto"/>-->
<DataGridTextColumn Header="Quantity"
Binding="{Binding nQuantity}"
Width="Auto"
@@ -104,5 +134,9 @@
Width="Auto"
IsReadOnly="True"/>
</DataGrid.Columns>
<!--<DataGrid.InputBindings>
<KeyBinding Key="Delete" Command="{Binding Tag.SelectedMachGroup.DeleteMachGroup_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
</DataGrid.InputBindings>-->
</DataGrid>
</Grid>
@@ -1,3 +1,13 @@
Public Class DoorListPageV
' funzione che impedisce di editare le righe che sono gia' in produzione
Private Sub DoorList_BeginningEdit(sender As Object, e As DataGridBeginningEditEventArgs)
If IsNothing(e.Row) Then Return
Dim RowVM As Door = DirectCast(e.Row.DataContext, Door)
' se in produzione impedisco modifica dei parametri
If RowVM.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then
e.Cancel = True
End If
End Sub
End Class
@@ -3,10 +3,13 @@ Imports System.IO
Imports Newtonsoft.Json
Imports System.Windows.Threading
Imports System.Text.RegularExpressions
Imports System.Security.Cryptography
Public Class DoorListPageVM
Inherits VMBase
Private m_ManualAddedDoorName As String = "ManualAddedDoor"
Private m_BackupTimer As New DispatcherTimer
Private m_RefreshGraphicsTimer As New DispatcherTimer
Private m_ExecProcessManager As ExecProcessManager
@@ -27,6 +30,13 @@ Public Class DoorListPageVM
End Set
End Property
Private m_DDTList As New ObservableCollection(Of String)
Public ReadOnly Property DDTList As ObservableCollection(Of String)
Get
Return m_DDTList
End Get
End Property
Private m_bExecButton_IsEnabled As Boolean = True
Public ReadOnly Property bExecButton_IsEnabled As Boolean
Get
@@ -43,7 +53,9 @@ Public Class DoorListPageVM
' Definizione comandi
Private m_cmdOpenCSV As ICommand
Private m_cmdSaveCSV As ICommand
Private m_cmdSkipDoor As ICommand
Private m_cmdAddDoor As ICommand
Private m_cmdMoveUp As ICommand
Private m_cmdMoveDown As ICommand
Private m_cmdDelete As ICommand
@@ -58,6 +70,22 @@ Public Class DoorListPageVM
Sub New()
' imposto riferimento in Map
Map.SetRefDoorListPageVM(Me)
' leggo nome porta manuale
m_ManualAddedDoorName = ""
GetPluginPrivateProfileString(S_CSV, K_MANUALADDEDDOORNAME, "ManualAddedDoor", m_ManualAddedDoorName)
' leggo lista ddt
Dim sDdtDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_DDTDIR, "", sDdtDirPath)
If Not String.IsNullOrWhiteSpace(sDdtDirPath) AndAlso Directory.Exists(sDdtDirPath) Then
Dim FileList As String() = Directory.GetFiles(sDdtDirPath)
Dim DdtFileList As List(Of String) = (From sFile In FileList
Where Path.GetExtension(sFile).ToLower() = ".ddt"
Select Path.GetFileName(sFile)).ToList()
For Each DdtFile In DdtFileList
m_DDTList.Add(DdtFile)
Next
End If
' leggo backup
Dim sBackupDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "BackupDir", "", sBackupDirPath)
Dim sBackupFilePath As String = sBackupDirPath & "\Backup.json"
@@ -180,6 +208,22 @@ Public Class DoorListPageVM
Return NextDoor
End Function
Friend Function NewDoorId() As Integer
Dim nId As Integer = 1
If m_DoorList.Count > 0 Then
Dim nMaxId As Integer = m_DoorList.Max(Of Integer)(Function(x) x.nId)
nId = nMaxId + 1
End If
Return nId
End Function
Friend Sub ResetStateAfterReset()
For Each Door In m_DoorList
If Door.nState > Door.DoorStates.VERIFIED AndAlso Door.nState < Door.DoorStates.PRODUCED Then
Door.SetState(Door.DoorStates.VERIFIED)
End If
Next
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -269,13 +313,7 @@ Public Class DoorListPageVM
End If
End If
For nQuantityIndex = 1 To nQuantity
Dim nId As Integer = 1
If m_DoorList.Count > 0 Then
Dim nMaxId As Integer = m_DoorList.Max(Of Integer)(Function(x) x.nId)
'If nMaxId < 100 Then
nId = nMaxId + 1
'End If
End If
Dim nId As Integer = NewDoorId()
Dim NewDoor As New Door(nId, nLineIndex, Values(nDDFNameIndex), Path.GetFileName(sCSVPath),
1, dWidth, dHeight, dThickness, Headers, Values)
m_DoorList.Add(NewDoor)
@@ -305,10 +343,18 @@ Public Class DoorListPageVM
End If
Dim sDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
Dim sDDTDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "DDTDir", "", sDDTDirPath)
For Each Door In m_DoorList
If Door.nState = Door.DoorStates.LOADED_FROM_CSV Then
Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName
m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sDDFFilePath))
Dim sDDTFilePath As String = sDDTDirPath & "\" & Door.sDDFName
Dim sDDFFilePath As String = sDDFDirPath & "\" & Path.GetDirectoryName(Door.sDDFName) &
Path.GetFileNameWithoutExtension(Door.sDDFName) & "_" & Door.nId & ".ddf"
Dim sWidth As String = DoubleToString(Door.dWidth, 2)
Dim sHeight As String = DoubleToString(Door.dHeight, 2)
Dim sThickness As String = DoubleToString(Door.dThickness, 2)
Dim sArgs As String = sDDTFilePath & ";" & sWidth & ";" & sHeight & ";" & sThickness & ";" & sDDFFilePath
m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sArgs))
End If
Next
If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
@@ -350,6 +396,62 @@ Public Class DoorListPageVM
#End Region ' OpenCSV
#Region "SaveCSV"
Public ReadOnly Property SaveCSV_Command As ICommand
Get
If m_cmdSaveCSV Is Nothing Then
m_cmdSaveCSV = New Command(AddressOf SaveCSV)
End If
Return m_cmdSaveCSV
End Get
End Property
Public Sub SaveCSV()
If IsNothing(m_SelDoor) Then
MessageBox.Show("Nessun file selezionato! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
If m_SelDoor.sCSVName = m_ManualAddedDoorName Then
MessageBox.Show("Selezionata porta creata a mano! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim sCSVOutPath As String = ""
If GetPluginPrivateProfileString(S_GENERAL, K_CSVOUTPUT, "", sCSVOutPath) = 0 Then
MessageBox.Show("Path di salvataggio CSV non impostata! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
If Not Directory.Exists(sCSVOutPath) Then
MessageBox.Show("Path di salvataggio CSV impostata non esiste! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim CSVDoorList As List(Of Door) = (From Door In m_DoorList
Where Door.sCSVName = m_SelDoor.sCSVName).ToList()
sCSVOutPath &= "\" & m_SelDoor.sCSVName
Dim sCSVFileList As New List(Of String)
Dim sHeaderRow As String = ""
For Each Parameter In m_SelDoor.CustomerParameters
sHeaderRow &= Parameter.sHeader & ";"
Next
sHeaderRow.TrimEnd(";"c)
sCSVFileList.Add(sHeaderRow)
For Each Door In CSVDoorList
Dim sDoorRow As String = ""
For Each Parameter In Door.CustomerParameters
sDoorRow &= Parameter.sValue & ";"
Next
sCSVFileList.Add(sDoorRow)
Next
Try
File.WriteAllLines(sCSVOutPath, sCSVFileList)
MessageBox.Show("Csv salvato in " & sCSVOutPath, "Info", MessageBoxButton.OK, MessageBoxImage.Information)
Catch ex As Exception
MessageBox.Show("Creazione file csv fallita!", "Errore", MessageBoxButton.OK, MessageBoxImage.Error)
End Try
End Sub
#End Region ' SkipDoor
#Region "SkipDoor"
Public ReadOnly Property SkipDoor_Command As ICommand
@@ -369,6 +471,24 @@ Public Class DoorListPageVM
#End Region ' SkipDoor
#Region "AddDoor"
Public ReadOnly Property AddDoor_Command As ICommand
Get
If m_cmdAddDoor Is Nothing Then
m_cmdAddDoor = New Command(AddressOf AddDoor)
End If
Return m_cmdAddDoor
End Get
End Property
Public Sub AddDoor()
Dim nId As Integer = NewDoorId()
m_DoorList.Add(New Door(nId, 0, "", m_ManualAddedDoorName, 1, 0, 0, 0, {}, {}))
End Sub
#End Region ' SkipDoor
#Region "MoveUp"
Public ReadOnly Property MoveUp_Command As ICommand
@@ -424,7 +544,7 @@ Public Class DoorListPageVM
End Property
Public Sub Delete()
If IsNothing(SelDoor) OrElse SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
If IsNothing(SelDoor) OrElse (SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.DoorStates.PRODUCED) Then Return
If MessageBox.Show("Are you sure you want to delete the selected door?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
m_DoorList.Remove(SelDoor)
WriteBackup()
@@ -449,7 +569,7 @@ Public Class DoorListPageVM
If MessageBox.Show("Are you sure you want to delete all the doors?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
For nDoorIndex = m_DoorList.Count - 1 To 0 Step -1
Dim Door As Door = m_DoorList(nDoorIndex)
If Door.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Continue For
If Door.nState >= Door.DoorStates.READY_FOR_PRODUCTION AndAlso Door.nState < Door.DoorStates.PRODUCED Then Continue For
m_DoorList.Remove(Door)
Next
WriteBackup()
@@ -470,16 +590,19 @@ Public Class DoorListPageVM
End Property
Public Sub Produce()
If IsNothing(SelDoor) OrElse SelDoor.nState = Door.DoorStates.SKIPPED OrElse
SelDoor.nState = Door.DoorStates.VERIFICATION_FAILED OrElse
SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
ProduceDoor(m_SelDoor)
WriteBackup()
End Sub
Public Sub ProduceDoor(DoorToProduce As Door)
If IsNothing(DoorToProduce) OrElse DoorToProduce.nState = Door.DoorStates.SKIPPED OrElse
DoorToProduce.nState = Door.DoorStates.VERIFICATION_FAILED OrElse
DoorToProduce.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
' la sposto dopo l'ultima da produrre
Dim nNewIndex As Integer = m_DoorList.IndexOf(m_DoorList.FirstOrDefault(Function(x) x.nState < Door.DoorStates.READY_FOR_PRODUCTION))
Dim nOldIndex As Integer = m_DoorList.IndexOf(SelDoor)
Dim SelectedDoor As Door = m_SelDoor
Dim nOldIndex As Integer = m_DoorList.IndexOf(DoorToProduce)
m_DoorList.Move(nOldIndex, nNewIndex)
SelectedDoor.SetState(Door.DoorStates.READY_FOR_PRODUCTION)
WriteBackup()
DoorToProduce.SetState(Door.DoorStates.READY_FOR_PRODUCTION)
End Sub
#End Region ' Produce
@@ -496,7 +619,11 @@ Public Class DoorListPageVM
End Property
Public Sub ProduceAll()
If IsNothing(SelDoor) Then Return
If m_DoorList.Count = 0 Then Return
For nDoorIndex = 0 To m_DoorList.Count - 1
Dim CurrDoor As Door = m_DoorList(nDoorIndex)
ProduceDoor(CurrDoor)
Next
WriteBackup()
End Sub
@@ -507,19 +634,23 @@ Public Class DoorListPageVM
Public ReadOnly Property ResetProductionQueue_Command As ICommand
Get
If m_cmdResetProductionQueue Is Nothing Then
m_cmdResetProductionQueue = New Command(AddressOf ResetProductionQueue)
m_cmdResetProductionQueue = New Command(AddressOf ResetProductionQueueCmd)
End If
Return m_cmdResetProductionQueue
End Get
End Property
Public Sub ResetProductionQueueCmd()
ResetProductionQueue()
WriteBackup()
End Sub
Public Sub ResetProductionQueue()
For Each Door In m_DoorList
If Door.nState = Door.DoorStates.READY_FOR_PRODUCTION Then
Door.SetState(Door.DoorStates.VERIFIED)
End If
Next
WriteBackup()
End Sub
#End Region ' ResetProductionQueue
@@ -550,10 +681,18 @@ Public Class DoorListPageVM
End If
Dim sDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
Dim sDDTDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "DDTDir", "", sDDTDirPath)
For Each Door In m_DoorList
If Door.nState = Door.DoorStates.LOADED_FROM_CSV Or Door.nState = Door.DoorStates.VERIFICATION_FAILED Then
Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName
m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sDDFFilePath))
Dim sDDTFilePath As String = sDDTDirPath & "\" & Door.sDDFName
Dim sDDFFilePath As String = sDDFDirPath & "\" & Path.GetDirectoryName(Door.sDDFName) &
Path.GetFileNameWithoutExtension(Door.sDDFName) & "_" & Door.nId & ".ddf"
Dim sWidth As String = DoubleToString(Door.dWidth, 2)
Dim sHeight As String = DoubleToString(Door.dHeight, 2)
Dim sThickness As String = DoubleToString(Door.dThickness, 2)
Dim sArgs As String = sDDTFilePath & ";" & sWidth & ";" & sHeight & ";" & sThickness & ";" & sDDFFilePath
m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sArgs))
End If
Next
If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
@@ -621,10 +760,10 @@ Public Class Door
End Get
Set(value As String)
' verifico che ci sia il file ddf
Dim sDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
If Not File.Exists(sDDFDirPath & "\" & value) Then
MessageBox.Show("Il nome inserito non corrisponde a nessun file nella cartella dei Ddf (" & sDDFDirPath & ") ", "File non trovato!", MessageBoxButton.OK, MessageBoxImage.Error)
Dim sDDTDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "DDTDir", "", sDDTDirPath)
If Not File.Exists(sDDTDirPath & "\" & value) Then
MessageBox.Show("Il nome inserito non corrisponde a nessun file nella cartella dei Ddt (" & sDDTDirPath & ") ", "File non trovato!", MessageBoxButton.OK, MessageBoxImage.Error)
NotifyPropertyChanged(NameOf(sDDFName))
Else
m_sDDFName = value
@@ -4,8 +4,8 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<RootNamespace>Effector.Plugin.FiveLakes</RootNamespace>
<AssemblyName>Effector.Plugin.FiveLakes</AssemblyName>
<RootNamespace>Effector.Plugin.DoorArreda</RootNamespace>
<AssemblyName>Effector.Plugin.DoorArreda</AssemblyName>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<MyType>Custom</MyType>
+1 -1
View File
@@ -1,7 +1,7 @@
<Grid x:Class="FiveLakesUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
xmlns:local="clr-namespace:Effector.Plugin.DoorArreda"
DataContext="{StaticResource FiveLakesUIVM}">
<TabControl SelectedIndex="{Binding SelPage}">
<TabControl.ItemContainerStyle>
@@ -55,6 +55,7 @@ Public Class FiveLakesUIVM
IniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME)
' Impostazione path resources dir
m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
End Sub
End Class
+15 -1
View File
@@ -1,3 +1,4 @@
Imports System.IO
Imports KeraLua
Public Module Lua_General
@@ -10,6 +11,7 @@ Public Module Lua_General
Friend func_PlgCheckExecProcessAsync As LuaFunction = AddressOf Lua_PlgCheckExecProcessAsync
Friend func_PlgGetNextDoor As LuaFunction = AddressOf Lua_PlgGetNextDoor
Friend func_PlgOpenRestartWnd As LuaFunction = AddressOf Lua_PlgOpenRestartWnd
Friend func_PlgMachineReset As LuaFunction = AddressOf Lua_PlgMachineReset
Private Function Lua_PlgGetNumberFromIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
@@ -107,7 +109,7 @@ Public Module Lua_General
If Not IsNothing(NextDoor) Then
' restituisco il risultato
LuaSetParam(state, NextDoor.nId)
LuaSetParam(state, NextDoor.sDDFName)
LuaSetParam(state, Path.GetFileNameWithoutExtension(NextDoor.sDDFName) & "_" & NextDoor.nId & ".ddf")
Return 2
End If
Return 0
@@ -121,6 +123,17 @@ Public Module Lua_General
Return 0
End Function
Private Function Lua_PlgMachineReset(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nMachineIndex As Integer = 1
LuaGetParam(state, 1, nMachineIndex)
LuaClearStack(state)
Map.refDoorListPageVM.ResetProductionQueue()
Map.refDoorListPageVM.ResetStateAfterReset()
Map.refDoorListPageVM.WriteBackup()
Return 0
End Function
Friend Function LuaInstallGeneral(state As Lua) As Boolean
If IsNothing(state) Then Return False
state.Register("PlgGetNumberFromIni", func_PlgGetNumberFromIni)
@@ -131,6 +144,7 @@ Public Module Lua_General
state.Register("PlgCheckExecProcessAsync", func_PlgCheckExecProcessAsync)
state.Register("PlgGetNextDoor", func_PlgGetNextDoor)
state.Register("PlgOpenRestartWnd", func_PlgOpenRestartWnd)
state.Register("PlgMachineReset", func_PlgMachineReset)
Return True
End Function
@@ -14,7 +14,7 @@
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<RadioButton Content="Door List"
<RadioButton Content="Lista Porte"
Command="{Binding Page_Command}"
CommandParameter="{StaticResource Door_List}"
IsChecked="True"
@@ -24,9 +24,9 @@
Command="{Binding Page_Command}"
CommandParameter="{StaticResource Machine_State}"
Style="{StaticResource {x:Type ToggleButton}}"/>
<RadioButton Grid.Column="2"
<!--<RadioButton Grid.Column="2"
Content="Statistics"
Command="{Binding Page_Command}"
CommandParameter="{StaticResource Statistics}"
Style="{StaticResource {x:Type ToggleButton}}"/>
Style="{StaticResource {x:Type ToggleButton}}"/>-->
</Grid>
@@ -11,10 +11,10 @@ Imports System.Windows
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Effector.Plugin.FiveLakes")>
<Assembly: AssemblyTitle("Effector.Plugin.DoorArreda")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Windows User")>
<Assembly: AssemblyProduct("Effector.Plugin.FiveLakes")>
<Assembly: AssemblyProduct("Effector.Plugin.DoorArreda")>
<Assembly: AssemblyCopyright("Copyright @ Windows User 2024")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
+2 -2
View File
@@ -64,9 +64,9 @@ Namespace My
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Effector.Plugin.FiveLakes.My.MySettings
Friend ReadOnly Property Settings() As Global.Effector.Plugin.DoorArreda.My.MySettings
Get
Return Global.Effector.Plugin.FiveLakes.My.MySettings.Default
Return Global.Effector.Plugin.DoorArreda.My.MySettings.Default
End Get
End Property
End Module
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
xmlns:local="clr-namespace:Effector.Plugin.DoorArreda"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Window.Resources>
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
xmlns:local="clr-namespace:Effector.Plugin.DoorArreda"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
@@ -1,7 +1,7 @@
<ResourceDictionary x:Class="Dictionary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
xmlns:local="clr-namespace:Effector.Plugin.DoorArreda"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
>
@@ -1,7 +1,7 @@
Imports System.IO
Imports System.Threading
Imports MS.Internal
Imports Effector.Plugin.FiveLakes.ThreadData
Imports Effector.Plugin.DoorArreda.ThreadData
Imports System.Windows.Threading
Public Class ExecProcessManager
@@ -1,7 +1,7 @@
Imports System.Globalization
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Converters
Imports Effector.Plugin.FiveLakes.Door
Imports Effector.Plugin.DoorArreda.Door
Public Class JsonDoor