From bdc4f56914720f5885a12251eb5d7d0ac7b53c02 Mon Sep 17 00:00:00 2001 From: NicolaP Date: Mon, 30 Aug 2021 15:15:39 +0200 Subject: [PATCH] Gestione di due etichette (con freccia e senza) --- ConstGen.vb | 13 ++++ ConstIni.vb | 1 + MainWindow.xaml.vb | 60 ++++++++++++--- OmagVIEW.vbproj | 3 + OmagVIEWDictionary.xaml | 1 + OptionsPageUC.xaml | 158 +++++++++++++++++++++++++++++----------- OptionsPageUC.xaml.vb | 37 ++++++++++ Resources/Folder.png | Bin 0 -> 1292 bytes 8 files changed, 221 insertions(+), 52 deletions(-) create mode 100644 Resources/Folder.png diff --git a/ConstGen.vb b/ConstGen.vb index 37ffc53..a11e8da 100644 --- a/ConstGen.vb +++ b/ConstGen.vb @@ -73,7 +73,20 @@ Module ConstGen Public Const NAME_PREVIEW As String = "PV" ' Info per stato pezzo Public Const INFO_PARTOK As String = "POK" + + ' Info in pezzo con path di Csv di provenienza + Public Const INFO_CSV_PATH As String = "CsvPath" ' Info in pezzo con suo nome in Csv Public Const INFO_CSV_PART As String = "CsvPart" + ' Info in pezzo con suo ordine in Csv + Public Const INFO_CSV_ORD As String = "CsvOrd" + ' Info in pezzo con sua distinta in Csv + Public Const INFO_CSV_DIST As String = "CsvDist" + ' Info in pezzo con suo materiale in Csv + Public Const INFO_CSV_MAT As String = "CsvMat" + ' Info in pezzo con dimensione X in Csv + Public Const INFO_CSV_V1 As String = "V1" + ' Info in pezzo con dimensione Y in Csv + Public Const INFO_CSV_V2 As String = "V2" End Module diff --git a/ConstIni.vb b/ConstIni.vb index 8425c4e..44e53b4 100644 --- a/ConstIni.vb +++ b/ConstIni.vb @@ -40,6 +40,7 @@ Module ConstIni Public Const S_PRINTER As String = "Printer" Public Const K_TEMPLATE As String = "Template" + Public Const K_TEMPLATE_ARROW As String = "TemplateArrow" Public Const K_DAT As String = "Dat" Public Const K_ZEBRAUTILITIES As String = "ZebraUtilities" diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb index 9de4a5e..7a30bc7 100644 --- a/MainWindow.xaml.vb +++ b/MainWindow.xaml.vb @@ -57,7 +57,9 @@ Class MainWindow ' Lista dei pezzi attivi Private m_vParts As New List(Of Integer) ' percorso file template per stampante - Private m_TemplateFilePrinter As String + Friend m_TemplateFilePrinter As String + ' percorso file template per stampante (disegnod della freccia per indicare il TOP del pezzo) + Friend m_TemplateFileArrowPrinter As String ' percorso direttorio per stampa file ini Private m_DatDirPrinter As String ' percorso eseguibile per stampante zebra @@ -183,7 +185,8 @@ Class MainWindow GetPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", sDefFont, m_sIniFile) EgtSetFont(sNfeDir, sDefFont) ' leggo nome file prn (per stampante zebra) - GetPrivateProfileString(S_PRINTER, K_TEMPLATE, m_sDataRoot & "\Template.prn", m_TemplateFilePrinter, m_sIniFile) + GetPrivateProfileString(S_PRINTER, K_TEMPLATE, m_sDataRoot & "\Label\Default.prn", m_TemplateFilePrinter, m_sIniFile) + GetPrivateProfileString(S_PRINTER, K_TEMPLATE_ARROW, m_sDataRoot & "\Label\DefaultArrow.prn", m_TemplateFileArrowPrinter, m_sIniFile) ' leggo nome del direttorio in cui scrivere il file ini (per stampante zebra) GetPrivateProfileString(S_PRINTER, K_DAT, m_sDataRoot & "\Temp", m_DatDirPrinter, m_sIniFile) ' leggo nome file exe (per stampante zebra) @@ -585,14 +588,20 @@ Class MainWindow Dim sFileDatIni As String = m_DatDirPrinter & "\" & FileName & ".ini" Dim nId As Integer = EgtGetFirstSelectedObj() ' recupero il part - Dim nParentId = EgtGetParent(nId) + Dim nParentId As Integer = nId + Dim bArrow As Boolean = False While nParentId <> GDB_ID.NULL CreateFileData(nParentId, sFileDatIni) - Dim nNextId As Integer = EgtGetNextSelectedObj() - nParentId = EgtGetParent(nNextId) + bArrow = GetTopInfoPart(nParentId) + Dim ProcsPrint As Process() = Process.GetProcessesByName(m_ZebraUtilitiesExe) + If bArrow Then + Process.Start(m_ZebraUtilitiesExe, m_TemplateFileArrowPrinter & " " & sFileDatIni) + Else + Process.Start(m_ZebraUtilitiesExe, m_TemplateFilePrinter & " " & sFileDatIni) + End If + ' passo al pezzo successivo + nParentId = EgtGetNextSelectedObj() End While - Dim ProcsPrint As Process() = Process.GetProcessesByName(m_ZebraUtilitiesExe) - Process.Start(m_ZebraUtilitiesExe, m_TemplateFilePrinter & " " & sFileDatIni) End Sub ' creazione file ini dei dati pezzo per stampa etichetta @@ -601,19 +610,36 @@ Class MainWindow FileText.Add("[Main]") ' Recupero materiale Dim sMaterial As String = String.Empty - EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_PROJMAT, sMaterial) + EgtGetInfo(nPartId, INFO_CSV_MAT, sMaterial) FileText.Add("Var1=$ProjMat$," & sMaterial) ' Recupero path originale di carico Dim sCutPath As String = String.Empty EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_LOADPATH, sCutPath) FileText.Add("Var2=$LoadPath$," & sCutPath) + ' recupero l'ordine del pezzo + Dim sOrd As String = String.Empty + EgtGetInfo(nPartId, INFO_CSV_ORD, sOrd) + FileText.Add("Var3=$CsvOrd$," & sOrd) + ' recupero la distointa del pezzo + Dim sDist As String = String.Empty + EgtGetInfo(nPartId, INFO_CSV_DIST, sDist) + FileText.Add("Var4=$CsvDist$," & sDist) ' recupero il nome della componente Dim sName As String = String.Empty EgtGetInfo(nPartId, INFO_CSV_PART, sName) - FileText.Add("Var3=$CsvPart$," & sName) + FileText.Add("Var5=$CsvPart$," & sName) + ' nome della componente geometrica Dim sCompo As String = String.Empty EgtGetInfo(nPartId, "CMP", sCompo) - FileText.Add("Var4=$CMP$," & sCompo) + FileText.Add("Var6=$CMP$," & sCompo) + ' recupero dimensioni pezzo + Dim sV1 As String = String.Empty + EgtGetInfo(nPartId, INFO_CSV_V1, sV1) + FileText.Add("Var7=$CsvV1$," & sV1) + ' recupero dimensioni pezzo + Dim sV2 As String = String.Empty + EgtGetInfo(nPartId, INFO_CSV_V2, sV2) + FileText.Add("Var8=$CsvV2$," & sV2) Try File.WriteAllLines(sFilePath, FileText) Catch ex As Exception @@ -621,6 +647,20 @@ Class MainWindow End Try End Sub + ' cerco se esiste la definizione del "*TOP*" del pezzo + Private Function GetTopInfoPart(nPartId As Integer) As Boolean + Dim nRegion As Integer = EgtGetFirstNameInGroup(nPartId, NAME_REGION) + If nRegion = GDB_ID.NULL Then Return False + Dim nLayer As Integer = EgtGetFirstInGroup(nRegion) + While nLayer <> GDB_ID.NULL + Dim sMsg As String = String.Empty + EgtTextGetContent(nLayer, sMsg) + If Not String.IsNullOrEmpty(sMsg) AndAlso sMsg = "*TOP*" Then Return True + nLayer = EgtGetNext(nLayer) + End While + Return False + End Function + Private Sub UpdateBtns() ' Per bottoni precedente e successivo progetto UpdatePrevNextBtns() diff --git a/OmagVIEW.vbproj b/OmagVIEW.vbproj index aba0031..776085c 100644 --- a/OmagVIEW.vbproj +++ b/OmagVIEW.vbproj @@ -250,6 +250,9 @@ + + + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagVIEW\OmagVIEWR32.exe diff --git a/OmagVIEWDictionary.xaml b/OmagVIEWDictionary.xaml index 20d2d3c..459626c 100644 --- a/OmagVIEWDictionary.xaml +++ b/OmagVIEWDictionary.xaml @@ -103,6 +103,7 @@ + diff --git a/OptionsPageUC.xaml b/OptionsPageUC.xaml index aa37148..a78da6b 100644 --- a/OptionsPageUC.xaml +++ b/OptionsPageUC.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" FontFamily="{DynamicResource OmagView_Font}" - Height="682.4" Width="511.8" ResizeMode="NoResize" + Height="720.4" Width="511.8" ResizeMode="NoResize" ShowInTaskbar="False" AllowsTransparency="True" WindowStyle="None" Background="Transparent"> @@ -16,27 +16,33 @@ + - + - + - + - + - + + + - - + + - + + @@ -46,7 +52,7 @@ - + @@ -63,7 +69,9 @@ - + + @@ -71,9 +79,9 @@ - + - + @@ -88,32 +96,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -121,9 +106,34 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + @@ -138,7 +148,71 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OptionsPageUC.xaml.vb b/OptionsPageUC.xaml.vb index fbd5dba..708d9a9 100644 --- a/OptionsPageUC.xaml.vb +++ b/OptionsPageUC.xaml.vb @@ -1,4 +1,5 @@ Imports EgtUILib +Imports System.IO Public Class OptionsPageUC @@ -46,6 +47,9 @@ Public Class OptionsPageUC ' Imposto il tema corrente ThemesCmBx.SelectedIndex = m_MainWindow.m_CurrTheme + AddHandler BrowseBtn.Click, AddressOf Me.BrowseBtn_OnClick + AddHandler BrowseArrowBtn.Click, AddressOf Me.BrowseArrowBtn_OnClick + ' Messaggi OptTitle.Text = EgtMsg(MSG_OMAGCUT + 6) ' OPZIONI LanguageGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 1) ' Lingua @@ -53,6 +57,10 @@ Public Class OptionsPageUC UnitsOfMeasureGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 3) ' Unità di misura ViewRotGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 4) ' Rotazione vista ThemesGpBx.Header = EgtMsg(MSG_OPTIONSPAGEUC + 25) ' Tema + LabelGpBx.Header = EgtMsg(92056) ' Etichetta + LabelTxt.Text = m_MainWindow.m_TemplateFilePrinter + LabelArrowGpBx.Header = EgtMsg(92057) ' Etichetta Freccia + LabelArrowTxt.Text = m_MainWindow.m_TemplateFileArrowPrinter End Sub Private Sub LanguageCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles LanguageCmBx.SelectionChanged @@ -91,4 +99,33 @@ Public Class OptionsPageUC End If End Sub + ' distinguo il direttorio di ricerca a seconda del file selezionato + Private Sub BrowseBtn_OnClick() + Browse(m_MainWindow.m_TemplateFilePrinter, K_TEMPLATE) + LabelTxt.Text = m_MainWindow.m_TemplateFilePrinter + End Sub + + Private Sub BrowseArrowBtn_OnClick() + Browse(m_MainWindow.m_TemplateFileArrowPrinter, K_TEMPLATE_ARROW) + LabelArrowTxt.Text = m_MainWindow.m_TemplateFileArrowPrinter + End Sub + + Private Sub Browse(ByRef sFileName As String, sKey As String) + 'recupero il nome del direttorio + Dim CurrDirectory As String = Path.GetDirectoryName(sFileName) + ' Apro la finestra di dialogo aperta direttamente sulla cartella cercata + Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() With { + .InitialDirectory = CurrDirectory + } + OpenFileDialog.Filter = "prn files (*.prn)|*.prn" + If OpenFileDialog.ShowDialog() <> True Then + ' se la risposta è diversa da OK esce + Else + ' carico l'indirizzo del template che voglio aprire + sFileName = OpenFileDialog.FileName + ' salvo il nome del nuovo file template in uso + WritePrivateProfileString(S_PRINTER, sKey, sFileName, m_MainWindow.GetIniFile()) + End If + End Sub + End Class diff --git a/Resources/Folder.png b/Resources/Folder.png new file mode 100644 index 0000000000000000000000000000000000000000..2c1339d04ed24a4dbbe8aeecdde99b279336a84f GIT binary patch literal 1292 zcmV+n1@roeP)H7$(J1j1ltl0mh9(YV}ujem zuqFUiOlCOXF?a-UBv>qtKn_C=$kEBh!a>S=0%Zab7K6v41ZpUTm;|AY>-&TkfIbna zt7?5!0BCvx;;bqhLX2RE@Hheyo)&~0hKM?yI3fa;fJZQZ4Gs-4t{MXgR=Ozzt-#`% z9;kW*Pnzoi!P5m)33!U+&YvP=N)`o-r2Z1I7y`yxB&70U9fBgZPV2q`48P0U0E0)R zZQj!+F)f{W@=tuc>mAjRYMKLegn-3hQ8o~0DNWHif18eIn5&N;W`T(6dX(LzOZ1*S z!!zyeqn$tofD}F8Fu0_QSzI7Lbp_e?JT*Ms#B5m)0B3%n_uLF$sbWRMn5+r}MNuq@ zo1P+Hnna#_gmIKAfu8j+J~T!&Jju;3uJWt3)PY>u2RuTQm0t}vHBB@INWFv(T|kb! z&M1NHl{y8dsF$XlY zPRK4NOCwBER085bO}009nL=@%{=p*CKpCj7`bG5Fn{srt#6AG6riv5AdV}lfKy4xI z5iBBgLlP-2ZiK=^WFSg2C2Z`*Bnj^4LHheHak^Ba1kA5Cjzv`wkqGDj+ThNlyGsf{ zH7mQis)n@yNEQyq`jKYMCRytPR__0r-3M^50sIXfKPV$j2v|t~0000