Merge commit 'ca0466e60f409f2f5dbe22708a721790b668b54d'

This commit is contained in:
Nicola Pievani
2023-08-03 19:19:27 +02:00
4 changed files with 107 additions and 7 deletions
+11
View File
@@ -11,6 +11,10 @@
'
'----------------------------------------------------------------------------
Imports System.Data
Imports EgtPHOTOLib
Imports EgtWPFLib5
Module ConstIni
Public Const INI_FILE_NAME As String = "OmagPHOTO.ini"
@@ -89,6 +93,13 @@ Module ConstIni
Public Const K_MINLNCOLOR As String = "MinLnColor"
Public Const K_MAJLNCOLOR As String = "MajLnColor"
Public Const S_AUTOCLICK As String = "AutoClick"
Public Const K_CLICKDIR As String = "ClickDir"
Public Const K_STATE As String = "State"
Public Const K_AUTOMATERIAL As String = "Material"
Public Const K_THICKNESS As String = "Thickness"
Public Const K_WAREHAOUSE As String = "WareHouse"
Public Const S_CAMERA As String = "Camera"
Public Const K_CAM_COUNT As String = "Count"
Public Const K_CAM_EXEPATH As String = "ExePath"
+87 -4
View File
@@ -5,6 +5,7 @@ Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtPHOTOLib
Imports System.Windows.Forms.Integration
Public Class MainWindowM
@@ -14,6 +15,12 @@ Public Class MainWindowM
Private m_TimerIsBusy As Boolean = False
Private m_RefreshTimer As New DispatcherTimer
' Per lettura modifica direttorio
Private fsWatch As FileSystemWatcher
Private m_RefreshNewFileClick As New DispatcherTimer
Private m_bNewFileClick As Boolean = False
Private m_sNewFileClickPath As String = String.Empty
Private m_sDataRoot As String = String.Empty
Friend ReadOnly Property sDataRoot As String
Get
@@ -199,11 +206,11 @@ Public Class MainWindowM
Dim sKey As String = String.Empty
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
EgtSetKey(sKey)
Dim bNetHwKey As Boolean = ( GetMainPrivateProfileInt(S_GENERAL, K_NETKEY, 0) = 1)
EgtSetNetHwKey( bNetHwKey)
Dim bNetHwKey As Boolean = (GetMainPrivateProfileInt(S_GENERAL, K_NETKEY, 0) = 1)
EgtSetNetHwKey(bNetHwKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2502, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2502, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2508, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2508, 1, m_nKeyOptions)
' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.PHOTO_BASE)
' Inizializzazione generale di EgtInterface
@@ -301,6 +308,82 @@ Public Class MainWindowM
AddHandler m_RefreshTimer.Tick, AddressOf RefreshTimer_Tick
m_RefreshTimer.Interval = TimeSpan.FromMilliseconds(2000)
m_RefreshTimer.Start()
' sec onfigurato lancio il controllo di uno specifico direttorio per leggere quando scattare una nuova foto
Dim sClidkDir As String = String.Empty
Dim bEnableLineProduction As Boolean = GetMainPrivateProfileString(S_AUTOCLICK, K_CLICKDIR, "", sClidkDir) <> 0
If bEnableLineProduction Then
fsWatch = New FileSystemWatcher(sClidkDir) With {.EnableRaisingEvents = True}
'fsWatch.EnableRaisingEvents = True
AddHandler fsWatch.Created, AddressOf AutoClick
AddHandler fsWatch.Changed, AddressOf AutoClick
AddHandler fsWatch.Renamed, AddressOf AutoClick
m_bNewFileClick = False
AddHandler m_RefreshNewFileClick.Tick, AddressOf AutoClick_Cmd
m_RefreshNewFileClick.Interval = TimeSpan.FromMilliseconds(2000)
m_RefreshNewFileClick.Start()
End If
End Sub
Private Sub AutoClick(ByVal sender As Object, ByVal e As FileSystemEventArgs)
EgtOutLog("File '" & e.FullPath & "' has been created: ready to Click")
m_sNewFileClickPath = e.FullPath
m_bNewFileClick = True
End Sub
Private Sub AutoClick_Cmd()
If Not m_bNewFileClick Then Return
' deseleziono la precedente lastra
If Not IsNothing(EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab) Then
EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab.IsSelected = 0
End If
' verifico se esite una lastra corrente in modifica, quindi chiedo se salvare
Map.refTopCommandBarVM.NewCmd(True)
' apro la pagina per inserire una nuova lastra, se esiste un oggetto di tipo lastra allora procedo
If Not IsNothing(EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab) Then
' Autocompilazione dei campi con i dati dell'ultima lastra salvata
ReadLastInfoAutoClick(EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab)
' scatto la foto
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Photo(Nothing)
' notifico che è stata scattata una foto
Try
File.Delete(m_sNewFileClickPath)
EgtOutLog("File '" & m_sNewFileClickPath & "' has been deleted!")
m_bNewFileClick = False
Catch ex As Exception
EgtOutLog("File '" & m_sNewFileClickPath & "' can't be deleted! " & ex.ToString)
End Try
' se è stata scattata una foto provvedo a salvare l'inserimento
If Not m_bNewFileClick Then
' salvo i dati inseriti ( nel file ini e nel DB )
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Save()
' ricarico la pagina
EgtPHOTOLib.PhotoMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.DETAIL
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Ok_IsEnabled = False
' stampo etichetta
EgtPHOTOLib.PhotoMap.refOptionPanelVM.PrintLabel()
End If
End If
End Sub
Private Sub ReadLastInfoAutoClick(CurrSlab As Slab)
Dim nIndState As Integer = 1
Dim sMaterial As String = ""
Dim dThick As Double = 0
Dim sWarehouse As String = ""
nIndState = GetMainPrivateProfileInt(S_AUTOCLICK, K_STATE, nIndState)
GetMainPrivateProfileString(S_AUTOCLICK, K_AUTOMATERIAL, "", sMaterial)
dThick = GetMainPrivateProfileDouble(S_AUTOCLICK, K_THICKNESS, 1)
GetMainPrivateProfileString(S_AUTOCLICK, K_WAREHAOUSE, "", sWarehouse)
CurrSlab.State = nIndState
For IndexMat As Integer = 0 To EgtPHOTOLib.PhotoMap.refProjectVM.MaterialList.Count - 1
If EgtPHOTOLib.PhotoMap.refProjectVM.MaterialList(IndexMat).Trim = sMaterial.Trim Then
CurrSlab.SetMaterial(EgtPHOTOLib.PhotoMap.refProjectVM.MaterialList(IndexMat))
Exit For
End If
Next
CurrSlab.SetThickness(dThick)
CurrSlab.WarehousePosition = sWarehouse
End Sub
' per la gestione di due OmagPHOTO che accedono allo stesso SQL
+2 -2
View File
@@ -59,5 +59,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.5.2.1")>
<Assembly: AssemblyFileVersion("2.5.2.1")>
<Assembly: AssemblyVersion("2.5.8.1")>
<Assembly: AssemblyFileVersion("2.5.8.1")>
+7 -1
View File
@@ -164,8 +164,14 @@ Public Class TopCommandBarVM
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Save()
bIsSaved = True
End If
Else
bIsSaved = True
End If
If Not bIsSaved Then
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Cancel(Nothing)
Else
EgtPHOTOLib.PhotoMap.refListPageVM.RefreshLisPage()
End If
If Not bIsSaved Then EgtPHOTOLib.PhotoMap.refOptionPanelVM.Cancel(Nothing)
End If
Map.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.NEWSLAB
End Sub