Compare commits

...

11 Commits

Author SHA1 Message Date
NicolaP 17229ab9bc Migliorata gestione scene e eliminazione Slab 2022-09-28 11:59:11 +02:00
NicolaP 2e0f2eab1b Gestione riconoscimento sfridi da progetto 2022-09-22 17:33:17 +02:00
NicolaP 58c62ebd5c Carico coordinate punti del grezzo (Da verificare) 2022-09-21 18:23:05 +02:00
NicolaP f9fd0f0168 Miglioramento gestione comado AddSpar/RemoveScrap 2022-09-19 12:19:40 +02:00
NicolaP ca0210cf09 Aggiunta gestine notifica di lastra in letttura 2022-09-12 10:22:40 +02:00
NicolaP 622912dec3 Gestione Add/Save/Delete lastra da DB 2022-09-09 17:24:16 +02:00
NicolaP 5ff39c9d1c Gestione personalizzata OmagPHOTO 2022-09-08 19:27:24 +02:00
NicolaP 60a666c1c1 Creazione pagina per gestione campi DB 2022-09-07 18:10:03 +02:00
NicolaP 5b3e73290c Salvataggio in DB dell'iimagine ritagliata 2022-08-29 20:09:46 +02:00
NicolaP 854519b706 Aggiunti riferimenti alla libreria EgtPHOTOLib 2022-08-25 19:28:07 +02:00
NicolaP d8179b47ee Inizio gestione sfridi 2022-08-24 18:58:33 +02:00
17 changed files with 1119 additions and 20 deletions
+7 -3
View File
@@ -133,10 +133,14 @@
</Button>
<Button Name="RemovePartBtn" Grid.ColumnSpan="3" Grid.Row="6"
Style="{DynamicResource OmagCut_YellowTextButton}"/>
<Button Name="RemovePartBtn" Grid.ColumnSpan="2" Grid.Row="6"
Style="{DynamicResource OmagCut_YellowTextButton}"/>
<Grid Grid.Row="7" Grid.ColumnSpan="3">
<Button Name="ScrapsBtn" Grid.Column="3" Grid.Row="6"
Style="{DynamicResource OmagCut_YellowTextButton}"/>
<Grid Grid.Row="7" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="1*"/>
+82 -6
View File
@@ -35,6 +35,7 @@ Public Class MoveRawPartPage
RemovePartBtn.Content = EgtMsg(MSG_MOVERAWPAGEUC + 1) 'Rimuovi
ModifyBtn.Content = EgtMsg(MSG_SPLITPAGEUC + 17) 'Modifica
ResetBtn.Content = EgtMsg(MSG_NESTPAGEUC + 6) 'Reset
ScrapsBtn.Content = "Add Scraps"
End Sub
Private Sub MoveRawPartPage_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded
@@ -57,15 +58,37 @@ Public Class MoveRawPartPage
m_SplitPage.GetEnabledCuts(Cuts)
' Fase precedente
Dim nPrevPhase As Integer = EgtGetCurrPhase()
' Creo nuova fase, eseguo spezzatura grezzi e vi sposto le lavorazioni
Dim vNewRaws As New List(Of Integer)
If Not m_SplitPage.m_bShow Then
' Creo nuova fase, eseguo spezzatura grezzi e vi sposto le lavorazioni
Dim vNewRaws As New List(Of Integer)
SplitRawParts(nPrevPhase, Cuts, vNewRaws)
Else
EgtSetCurrPhase(nPrevPhase + 1)
HideAllMachinings()
End If
m_nCurrPhase = EgtGetCurrPhase()
'---------------------------- SCRAPS ----------------------------
' gestione visualizzazione del comando "Scraps"
Dim ScrapsVisibility As Visibility = Visibility.Collapsed
' verifico se licenza abilitat: m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.SCRAPS)
If GetPrivateProfileInt(S_SCRAPS, K_ENABLESCRAPS, 0, m_MainWindow.GetIniFile()) <> 0 Then
' leggo il direttorio in cui cercare il database delle lastre
Dim PhotDir As String = String.Empty
GetPrivateProfileString(S_SCRAPS, K_PHOTODIR, "", PhotDir, m_MainWindow.GetIniFile())
' verifico che esista il file "OmagPHOTOVb.sqlite" nel direttorio inidicato
If System.IO.File.Exists(PhotDir.Trim & "\OmagPHOTODb.sqlite") Then
ScrapsVisibility = Visibility.Visible
End If
End If
' verifico che siano stati generati dei nuovi grezzi
If vNewRaws.Count = 0 Then
ScrapsVisibility = Visibility.Collapsed
End If
' aggiorno la grafica
ScrapsBtn.Visibility = ScrapsVisibility
'---------------------------- SCRAPS ----------------------------
' Se movimento pezzi finale, sistemazioni per tavolo ausiliario
If m_SplitPage.m_bOnAuxTab Then
m_nAuxTabId = EgtGetTableId(AUX_TAB)
@@ -128,14 +151,14 @@ Public Class MoveRawPartPage
' Distanza iniziale
m_dCurrDist = 0
End If
' Non dovrebbe mai accadere, ma inizializzo con default
' Non dovrebbe mai accadere, ma inizializzo con default
Else
m_vtDir = Vector3d.Y_AX()
m_ptMid = Point3d.ORIG()
m_dOrigDist = 0
m_dCurrDist = 0
End If
' Altrimenti movimento con ventose
' Altrimenti movimento con ventose
Else
m_bRemovedRaw = False
m_bRawWithCups = False
@@ -149,6 +172,9 @@ Public Class MoveRawPartPage
GetMoveInfoInDisposition(nDispId, m_RawMoveDataList)
End If
End If
' aggiorno il messaggio del comando per gestire gli sfridi
VerifyIsNewScrap(m_CurrRawOnVacuum)
' Aggiorno interfaccia per taglio perpendicolare
If m_bByHand Then
UpBtn.Visibility = Windows.Visibility.Visible
@@ -165,7 +191,8 @@ Public Class MoveRawPartPage
BottomLBtn.Visibility = Windows.Visibility.Hidden
BottomRBtn.Visibility = Windows.Visibility.Hidden
ResetBtn.Visibility = Windows.Visibility.Hidden
' altrimenti per movimento con ventose
ScrapsBtn.Visibility = Windows.Visibility.Visible
' altrimenti per movimento con ventose
ElseIf Not m_SplitPage.m_bOnAuxTab Then
UpBtn.Visibility = Windows.Visibility.Visible
LeftBtn.Visibility = Windows.Visibility.Visible
@@ -181,7 +208,8 @@ Public Class MoveRawPartPage
BottomLBtn.Visibility = Windows.Visibility.Hidden
BottomRBtn.Visibility = Windows.Visibility.Hidden
ResetBtn.Visibility = Windows.Visibility.Hidden
' altrimenti per movimento finale dei pezzi
ScrapsBtn.Visibility = Windows.Visibility.Visible
' altrimenti per movimento finale dei pezzi
Else
UpBtn.Visibility = Windows.Visibility.Hidden
LeftBtn.Visibility = Windows.Visibility.Hidden
@@ -197,6 +225,7 @@ Public Class MoveRawPartPage
BottomLBtn.Visibility = Windows.Visibility.Visible
BottomRBtn.Visibility = Windows.Visibility.Visible
ResetBtn.Visibility = Windows.Visibility.Visible
ScrapsBtn.Visibility = Windows.Visibility.Hidden
End If
' Abilitazione bottone modifica
ModifyBtn.IsEnabled = m_SplitPage.m_bShow
@@ -232,6 +261,8 @@ Public Class MoveRawPartPage
If nParentId = nRawGroupId Then
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nId, nStat)
' aggiorno il messaggio del bottone "Scrap" a seconda che il grezzo sia già uno scrap
VerifyIsNewScrap(nId)
' Se il pezzo corrente è selezionato allora lo disattivo -> deposito del pezzo
If nStat = GDB_ST.SEL Then
EgtSetStatus(nId, GDB_ST.ON_)
@@ -347,6 +378,27 @@ Public Class MoveRawPartPage
Return False
End Function
Private Function VerifyIsNewScrap(nMyId As Integer) As Boolean
Dim nVal As Integer = 0
If EgtGetInfo(nMyId, K_ISNEWSCRAPS, nVal) Then
If nVal = 1 Or nVal = 2 Then
' 1 → è stato definito come nuovo grezzo oppure, 2 → è stato definito come nuovo grezzo ed è stato inserito nel DB delle lastre
ScrapsBtn.Content = "Remove Scrap"
ScrapsBtn.IsEnabled = True And Not m_SplitPage.m_bShow
Return True
ElseIf nVal = 3 Then
' non è possibile rimuovere il grezzo in questa fase
ScrapsBtn.Content = "Defined as Scrap"
ScrapsBtn.IsEnabled = False
Return True
End If
End If
' non è un nuovo grezzo
ScrapsBtn.Content = "Add Scrap"
ScrapsBtn.IsEnabled = True And Not m_SplitPage.m_bShow
Return False
End Function
#Region "Move Up/Down/Left/Right"
Private Sub UpBtn_Click(sender As Object, e As RoutedEventArgs) Handles UpBtn.Click
@@ -679,6 +731,29 @@ Public Class MoveRawPartPage
EgtDraw()
End Sub
Private Sub ScrapsBtn_Click(Sender As Object, e As RoutedEventArgs) Handles ScrapsBtn.Click
Dim nRawId As Integer = EgtGetFirstSelectedObj()
While nRawId <> GDB_ID.NULL
' verifico che il grezzo non contenga dei pezzi (altrimenti non risulta selezionabile)
Dim nPartInRaw As Integer = EgtGetFirstPartInRawPart(nRawId)
If nPartInRaw = GDB_ID.NULL Then
If Not VerifyIsNewScrap(nRawId) Then
EgtSetInfo(nRawId, K_ISNEWSCRAPS, "1")
Else
EgtRemoveInfo(nRawId, K_ISNEWSCRAPS)
End If
' aggiorno il contenuto del bottone
VerifyIsNewScrap(nRawId)
Else
' coumico che il grezzo contiene un pezzo e quindi non può essere definito come grezzo
m_CurrProjPage.ClearMessage()
m_CurrProjPage.SetErrorMessage("Part inside raw!")
End If
' passo al grezzo succesivo (NON dovrebbero esserci altri grezzi selezionabili contemporaneamente!)
nRawId = EgtGetNextSelectedObj()
End While
End Sub
Private Sub StepMoveTxBx_EgtClosed(sender As Object, e As EventArgs) Handles StepMoveTxBx.EgtClosed
Dim dStep As Double
If StringToLen(StepMoveTxBx.Text, dStep) Then
@@ -989,6 +1064,7 @@ Public Class MoveRawPartPage
BottomRBtn.IsEnabled = Not m_SplitPage.m_bShow
ResetBtn.IsEnabled = Not m_SplitPage.m_bShow
NextBtn.IsEnabled = Not m_SplitPage.m_bOnAuxTab
ScrapsBtn.IsEnabled = Not m_SplitPage.m_bShow
End Sub
Private Sub MoveRawPartPage_Unloaded(sender As Object, e As EventArgs) Handles Me.Unloaded
+7
View File
@@ -363,6 +363,13 @@ Public Module SplitAuto
vNewRaws.Add(nNewRawId)
nNewRawId = EgtGetNextRawPart(nNewRawId)
End While
Else
' verifico che nella fase precedente è stato definito come sfrido, allora lo riassegno
Dim nVal As Integer = 0
EgtGetInfo(nRawId, K_ISNEWSCRAPS, nVal)
If nVal = 1 Or nVal = 2 Or nVal = 3 Then
EgtSetInfo(nRaw1Id, K_ISNEWSCRAPS, "3")
End If
End If
' Assegno ai nuovi grezzi eventuale texture del grezzo originale
Dim nSolidId = EgtGetFirstNameInGroup(nRawId, NAME_RAW_SOLID)
+9
View File
@@ -216,6 +216,15 @@ Module ConstIni
Public Const K_RAWROTATION As String = "Rotation"
Public Const K_PERPENDICULAR As String = "Perpendicular"
Public Const S_SCRAPS As String = "Scraps"
Public Const K_ENABLESCRAPS As String = "EnableScraps"
Public Const K_PHOTODIR As String = "PhotoDir"
Public Const K_LASTBLOCK As String = "LastBlock"
Public Const K_TEMPLATE As String = "Template"
Public Const K_DAT As String = "Dat"
Public Const K_ZEBRAUTILITIES As String = "ZebraUtilities"
Public Const K_ENABLE_PRINTER As String = "EnablePrinter"
Public Const S_REG As String = "Reg"
Public Const K_REGSTEP As String = "Step"
Public Const K_REGANGSTEP As String = "AngStep"
+3
View File
@@ -233,6 +233,9 @@
Public Const K_MACH_ROTATEVACUUMFOREXTRASTROKEY As String = "RotateVacuumForExtraStrokeY"
Public Const K_MACH_ROTATEVACUUMFOREXTRASTROKEX As String = "RotateVacuumForExtraStrokeX"
Public Const K_ISNEWSCRAPS As String = "IsNewScraps"
Public Const K_DATABASEID As String = "DatabaseID"
Public Const S_MACH_REG As String = "Reg"
Public Const K_MACH_MAX_ROT_ANG As String = "MaxRotAng"
+158 -11
View File
@@ -1,16 +1,48 @@
<ResourceDictionary
x:Class="EgtDictionary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Project="clr-namespace:OmagCUT"
xmlns:ControlExtensions="clr-namespace:OmagCUT.ControlExtensions">
<ResourceDictionary x:Class="EgtDictionary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Project="clr-namespace:OmagCUT"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtPHOTOLib="clr-namespace:EgtPHOTOLib;assembly=EgtPHOTOLib"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:ControlExtensions="clr-namespace:OmagCUT.ControlExtensions">
<!--Template che permette di andare a capo-->
<EgtWPFLib5:StatusBarVM x:Key="StatusBarVM"/>
<EgtWPFLib5:ShowPanelVM x:Key="ShowPanelVM"/>
<EgtWPFLib5:ViewPanelVM x:Key="ViewPanelVM"/>
<EgtWPFLib5:InstrumentPanelVM x:Key="InstrumentPanelVM"/>
<EgtPHOTOLib:ProjectSlabVM x:Key="ProjectSlabVM"/>
<EgtPHOTOLib:OptionPanelSlabVM x:Key="OptionPanelSlabVM"/>
<EgtPHOTOLib:ListPageSlabVM x:Key="ListPageSlabVM"/>
<EgtPHOTOLib:DetailPageSlabVM x:Key="DetailPageSlabVM"/>
<EgtPHOTOLib:SearchPanelSlabVM x:Key="SearchPanelSlabVM"/>
<EgtPHOTOLib:MyInstrumentPanelSlabVM x:Key="MyInstrumentPanelSlabVM"/>
<!--Colori predefiniti-->
<SolidColorBrush x:Key="Omag_Blue" Color="#FF095CA8" />
<SolidColorBrush x:Key="Omag_Yellow" Color="#FFFFCE5B" />
<SolidColorBrush x:Key="Omag_Red" Color="Red" />
<SolidColorBrush x:Key="Omag_Green" Color="LawnGreen" />
<SolidColorBrush x:Key="Omag_VeryLightGray" Color="#FFF2F2F2" />
<SolidColorBrush x:Key="Omag_LightGray" Color="LightGray" />
<SolidColorBrush x:Key="Omag_Gray" Color="#FF9E9E9E" />
<SolidColorBrush x:Key="Omag_DarkGray" Color="#FF444444" />
<SolidColorBrush x:Key="Omag_White" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="Omag_Black" Color="#FF000000" />
<SolidColorBrush x:Key="EgaltechBlue1" Color="#FF095CA8" />
<SolidColorBrush x:Key="EgaltechWhite" Color="#FFFFFFFF" />
<!--Template che permette di andare a capo-->
<DataTemplate x:Key="Button_DataTemplate_Wrap">
<TextBlock TextWrapping="Wrap" Text="{Binding}"/>
</DataTemplate>
<!--ButtonBase-->
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- Button Style -->
<Style TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle">
<Setter.Value>
@@ -71,7 +103,44 @@
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________ -->
<!--Template che permette di andare a capo-->
<DataTemplate x:Key="WrapButton_DataTemplate">
<TextBlock TextWrapping="WrapWithOverflow" Text="{Binding}"/>
</DataTemplate>
<Style x:Key="ToolBar_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="30"/>
</Style>
<Style x:Key="ToolBar_TextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="80"/>
</Style>
<Style x:Key="OptionPanel_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="60"/>
<Setter Property="Width" Value="60"/>
</Style>
<Style x:Key="OptionPanel_TextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
</Style>
<Style x:Key="OptionPanel_TextWrapButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="ContentTemplate" Value="{StaticResource WrapButton_DataTemplate}" />
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
<Setter Property="Height" Value="45"/>
</Style>
<Style x:Key="OptionPanel_NestingButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="60"/>
<Setter Property="Width" Value="60"/>
</Style>
<Style x:Key="CompoWindow_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="40"/>
</Style>
<Style x:Key="EgtWPFLib5_InputButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="60"/>
</Style>
<!-- ______________________________________________________________________________________________________________________ -->
<!--Template che permette di andare a capo-->
<DataTemplate x:Key="CheckBox_DataTemplate_Wrap">
@@ -375,7 +444,59 @@
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________ -->
<Style x:Key="ToolBar_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="30"/>
</Style>
<Style x:Key="ToolBar_TextToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="70"/>
</Style>
<Style x:Key="OptionPanel_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="30"/>
</Style>
<Style x:Key="OptionPanel_NestingToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="60"/>
<Setter Property="Width" Value="60"/>
</Style>
<Style x:Key="CompoWindow_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="40"/>
</Style>
<Style x:Key="CompoWindow_WrapToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="ContentTemplate" Value="{StaticResource WrapButton_DataTemplate}" />
<Setter Property="TextBlock.TextAlignment" Value="Center" />
<Setter Property="Height" Value="40"/>
</Style>
<Style x:Key="Option_ColorButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFB8C3CD"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="OpacityMask" Value="#33FF0000"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="Background" Value="Transparent"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#FFF4F4F4"/>
<Setter Property="BorderBrush" Value="#FFADB2B5"/>
<Setter Property="TextElement.Foreground" Value="#FF838383"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- ______________________________________________________________________________________________________________________ -->
<!--TreeViewBase-->
<!--Style e colori della freccia di espansione, necessari per modificare il ContainerItemStyle perchè contiene riferimenti ad essi-->
@@ -431,6 +552,32 @@
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________ -->
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- EgtCustomWindow -->
<Style TargetType="{x:Type EgtWPFLib5:EgtCustomWindow}" BasedOn="{StaticResource {x:Type EgtWPFLib5:EgtCustomWindow}}">
<Setter Property="TitleBarHeight" Value="32"/>
<Setter Property="TitleBarBrush" Value="{StaticResource Omag_LightGray}"/>
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- EgtFloatingPanel -->
<Style x:Key="ToolBar_EgtFloatingPanel" TargetType="{x:Type EgtFloating:EgtFloatingPanel}" BasedOn="{StaticResource {x:Type EgtFloating:EgtFloatingPanel}}">
<Setter Property="Background" Value="{StaticResource Omag_Gray}"/>
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
</Style>
<Style x:Key="Option_EgtFloatingPanel" TargetType="{x:Type EgtFloating:EgtFloatingPanel}" BasedOn="{StaticResource {x:Type EgtFloating:EgtFloatingPanel}}">
<Setter Property="IsToolBar" Value="False"/>
<Setter Property="TitleBarOrientation" Value="Vertical"/>
<Setter Property="Background" Value="{StaticResource Omag_Gray}"/>
<Setter Property="BorderBrush" Value="{StaticResource Omag_Gray}"/>
</Style>
<!-- ______________________________________________________________________________________________________________________ -->
</ResourceDictionary>
+59
View File
@@ -2,6 +2,7 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib
Imports EgtPHOTOLib
Imports System.ComponentModel
Imports System.Threading
Imports System.Windows.Threading
@@ -498,6 +499,64 @@ Class MainWindow
AddHandler m_ProdLineTimer.Tick, AddressOf OnProdLine
' Imposto riferimento a funzione delle textbox che disattiva scene in libreria
EgtWPFLib.EgtTextBox.m_refScenesIsEnabled = AddressOf IsEnabledScenes
' --------------------------------- SLAB DB -------------------------------------------------------
If GetPrivateProfileInt(S_SCRAPS, K_ENABLESCRAPS, 0, GetIniFile()) <> 0 Then
' leggo il direttorio in cui cercare il database delle lastre
Dim PhotDir As String = String.Empty
GetPrivateProfileString(S_SCRAPS, K_PHOTODIR, "", PhotDir, GetIniFile())
' verifico che esista il file "OmagPHOTOVb.sqlite" nel direttorio inidicato
If System.IO.File.Exists(PhotDir.Trim & "\" & DB_FILENAME) Then
If Not ManageDb.ConnectToDb(PhotDir.Trim & "\" & DB_FILENAME) Then
EgtOutLog("Error connecting to DB: " & PhotDir.Trim & "\" & DB_FILENAME)
' coumico che il grezzo contiene un pezzo e quindi non può essere definito come grezzo
m_CurrentProjectPageUC.ClearMessage()
m_CurrentProjectPageUC.SetErrorMessage("Denied connection SlabDB")
Else
' Impostazione direttorio per backup
Dim BackUpDir As String = m_sDataRoot & "\BackUp"
Directory.CreateDirectory(BackUpDir)
EgtPHOTOLib.MainData.SetConfigDir(m_sConfigDir)
EgtPHOTOLib.MainData.SetKeyLevel(m_nKeyLevel)
EgtPHOTOLib.MainData.SetKeyOptions(CInt(m_nKeyOptions))
EgtPHOTOLib.MainData.SetPhotoDir(PhotDir)
EgtPHOTOLib.MainData.SetBackUpDir(BackUpDir)
EgtPHOTOLib.MainData.SetIsOMagCUT(True)
Dim sLastBlock As String = String.Empty
GetPrivateProfileString(S_SCRAPS, K_LASTBLOCK, "", sLastBlock, GetIniFile())
If Not String.IsNullOrEmpty(sLastBlock) Then
EgtPHOTOLib.MainData.SetLastBlock(sLastBlock)
End If
If GetPrivateProfileInt(S_SCRAPS, K_ENABLE_PRINTER, 0, GetIniFile()) = 1 Then
' leggo nome file prn (per stampante zebra)
Dim m_TemplateFilePrinter As String = String.Empty
GetPrivateProfileString(S_SCRAPS, K_TEMPLATE, m_sDataRoot & "\Label\Default.prn", m_TemplateFilePrinter, GetIniFile())
' leggo nome del direttorio in cui scrivere il file ini (per stampante zebra) -- solo se si desidera scrivere il file in un direttorio diverso
Dim m_DatFilePrinter As String = String.Empty
GetPrivateProfileString(S_SCRAPS, K_DAT, m_sDataRoot & "\Temp", m_DatFilePrinter, GetIniFile())
' leggo nome file exe (per stampante zebra)
Dim m_ZebraUtilitiesExe As String = String.Empty
GetPrivateProfileString(S_SCRAPS, K_ZEBRAUTILITIES, System.AppDomain.CurrentDomain.BaseDirectory & "ZebraPrinterUtilitiesR32.exe", m_ZebraUtilitiesExe, GetIniFile())
EgtPHOTOLib.MainData.SetTemplateFilePrinter(m_TemplateFilePrinter)
EgtPHOTOLib.MainData.SetDataFilePrinter(m_DatFilePrinter)
EgtPHOTOLib.MainData.SetZebraPrinterExe(m_ZebraUtilitiesExe)
EgtPHOTOLib.MainData.SetPrinterVisibility(True)
Else
EgtPHOTOLib.MainData.SetPrinterVisibility(False)
End If
' è permessa una sola istanza alla volta del programma OmagCUT -> "(1)" : "(" & nIstance.ToString & ")"
EgtPHOTOLib.MainData.SetUser(Environment.MachineName & "\" & Environment.UserName & " (1)")
Dim sIdKey As String = String.Empty
EgtGetKeyInfo(sIdKey)
EgtPHOTOLib.MainData.SetKey(sIdKey)
End If
End If
End If
' --------------------------------- SLAB DB -------------------------------------------------------
End Sub
Private Sub ManageSingleIstance()
+34
View File
@@ -115,6 +115,9 @@
<Reference Include="AxInterop.FXLib">
<HintPath>..\..\EgtProg\OmagCUT\AxInterop.FXLib.dll</HintPath>
</Reference>
<Reference Include="EgtPHOTOLib">
<HintPath>..\..\EgtProg\Dll32\EgtPHOTOLib.dll</HintPath>
</Reference>
<Reference Include="EgtUILib, Version=2.3.4.5, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\EgtProg\DllD32\EgtUILib.dll</HintPath>
@@ -143,6 +146,10 @@
</Reference>
<Reference Include="PresentationFramework.Aero" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\EgtProg\Dll32\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
@@ -210,6 +217,15 @@
<Compile Include="Machine\WaterJetPageUC.xaml.vb">
<DependentUpon>WaterJetPageUC.xaml</DependentUpon>
</Compile>
<Compile Include="Project\AddToDataBaseUC.xaml.vb">
<DependentUpon>AddToDataBaseUC.xaml</DependentUpon>
</Compile>
<Compile Include="Project\OmagPhotoWD.xaml.vb">
<DependentUpon>OmagPhotoWD.xaml</DependentUpon>
</Compile>
<Compile Include="Project\ScrapsWD.xaml.vb">
<DependentUpon>ScrapsWD.xaml</DependentUpon>
</Compile>
<Compile Include="Project\StartLauncheWD.xaml.vb">
<DependentUpon>StartLauncheWD.xaml</DependentUpon>
</Compile>
@@ -460,6 +476,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Project\AddToDataBaseUC.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Project\OmagPhotoWD.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Project\ScrapsWD.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Project\StartLauncheWD.xaml">
</Page>
<Page Include="Project\CicloStartWD.xaml">
@@ -1262,6 +1290,12 @@
<ItemGroup>
<Resource Include="Resources\NewIcons\START-WJ.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ImportPageListBoxImages\4.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ImportPageListBoxImages\5.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagCUT\OmagCUTR32.exe
+95
View File
@@ -0,0 +1,95 @@
<UserControl x:Class="AddToDataBaseUC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
mc:Ignorable="d"
d:DesignHeight="853.3" d:DesignWidth="1280">
<Border Style="{DynamicResource OmagCut_Border}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="2.5*"/>
<ColumnDefinition Width="0.25*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
</Grid.RowDefinitions>
<!--Nome BLOCCO-->
<TextBlock Name="BlockTxBl" Grid.Column="1" Grid.Row="1" Text="Name block"
Style="{DynamicResource OmagCut_ToolsDBTextBlock}"/>
<EgtWPFLib:EgtTextBox Name="BlockTxBx" Grid.Column="3" Grid.Row="1"
Style="{DynamicResource OmagCut_KeyboardTextBox}"/>
<!--Numero ID-->
<TextBlock Name="NbrIdTxBl" Grid.Column="1" Grid.Row="3" Text="ID"
Style="{DynamicResource OmagCut_ToolsDBTextBlock}"/>
<EgtWPFLib:EgtTextBox Name="NbrIdTxBx" Grid.Column="3" Grid.Row="3"
Style="{DynamicResource OmagCut_KeyboardTextBox}"/>
<!--STATE-->
<TextBlock Name="StateTxBl" Grid.Column="1" Grid.Row="5" Text="State"
Style="{DynamicResource OmagCut_ToolsDBTextBlock}"/>
<ComboBox Name="StateCmBx" Grid.Column="3" Grid.Row="5" Style="{StaticResource OmagCut_LeftComboBoxInBorder}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" Style="{StaticResource OmagCut_LowerCaseCharacterTextBlock}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!--PROJECT-->
<TextBlock Name="ProjectNameTxBl" Grid.Column="1" Grid.Row="7" Text="Project"
Style="{DynamicResource OmagCut_ToolsDBTextBlock}"/>
<EgtWPFLib:EgtTextBox Name="ProjectTxBx" Grid.Column="3" Grid.Row="7"
Style="{DynamicResource OmagCut_KeyboardTextBox}"/>
<!--MATERIAL-->
<TextBlock Name="MatTxBl" Grid.Column="1" Grid.Row="9" Text="Mat"
Style="{DynamicResource OmagCut_ToolsDBTextBlock}"/>
<EgtWPFLib:EgtTextBox Name="MatTxBx" Grid.Column="3" Grid.Row="9"
Style="{DynamicResource OmagCut_KeyboardTextBox}" IsEnabled="False"/>
<!--THICKNESS-->
<TextBlock Name="ThicknessTxBl" Grid.Column="1" Grid.Row="11" Text="Thickness"
Style="{DynamicResource OmagCut_ToolsDBTextBlock}"/>
<EgtWPFLib:EgtTextBox Name="ThicknessTxBx" Grid.Column="3" Grid.Row="11"
Style="{DynamicResource OmagCut_CalculatorTextBox}"/>
<!--WAREHOUSE-->
<TextBlock Name="WarehouseTxBl" Grid.Column="1" Grid.Row="13" Text="Warehouse position"
Style="{DynamicResource OmagCut_ToolsDBTextBlock}"/>
<EgtWPFLib:EgtTextBox Name="WarehouseTxBx" Grid.Column="3" Grid.Row="13"
Style="{DynamicResource OmagCut_KeyboardTextBox}"/>
<!--CANCEL-->
<Button Name="CacelBtn" Grid.Column="1" Grid.Row="15" Content="Delete"
Style="{DynamicResource OmagCut_YellowTextButton}"/>
<!--ADD-->
<Button Name="AddBtn" Grid.Column="3" Grid.Row="15" Content="Add"
Style="{DynamicResource OmagCut_YellowTextButton}"/>
<!--PRINT-->
<Button Name="PrintBtn" Grid.Column="1" Grid.Row="17" Content="Print"
Style="{DynamicResource OmagCut_YellowTextButton}"/>
</Grid>
</Border>
</UserControl>
+121
View File
@@ -0,0 +1,121 @@
Imports EgtUILib
Imports EgtPHOTOLib
Imports System.IO
Public Class AddToDataBaseUC
Private m_OmagPhotoWD As OmagPhotoWD
#Region "PROPERTY"
Private Sub BlockTxBx_EgtClosed(sender As Object, e As EventArgs) Handles BlockTxBx.EgtClosed
' assegno il dato alla classe inizializzata nella libreria
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.sNameBlock = BlockTxBx.Text
' devo riasseganre il valore dell'indice
NbrIdTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.sNbrID
EnableButtons()
End Sub
Private Sub NbrIdTxBx_EgtClosed(sender As Object, e As EventArgs) Handles NbrIdTxBx.EgtClosed
' assegno il dato alla classe inizializzata nella libreria
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.sNbrID = NbrIdTxBx.Text
EnableButtons()
End Sub
Private Sub StateCmBx_Changed() Handles StateCmBx.SelectionChanged
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.State = StateCmBx.SelectedIndex
EnableButtons()
End Sub
Private Sub ProjectTxBx_EgtClosed(sender As Object, e As EventArgs) Handles ProjectTxBx.EgtClosed
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.ProjectAssignedTo = ProjectTxBx.Text
EnableButtons()
End Sub
Private Sub ThicknessTxBx_EgtClosed(sender As Object, e As EventArgs) Handles ThicknessTxBx.EgtClosed
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.Thickness = ThicknessTxBx.Text
EnableButtons()
End Sub
Private Sub WarehouseTxBx_EgtClosed(sender As Object, e As EventArgs) Handles WarehouseTxBx.EgtClosed
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.WarehousePosition = WarehouseTxBl.Text
EnableButtons()
End Sub
#End Region ' Property
Sub New(LocalOmagPhotoWD As OmagPhotoWD)
' La chiamata è richiesta dalla finestra di progettazione.
InitializeComponent()
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
m_OmagPhotoWD = LocalOmagPhotoWD
End Sub
' dopo la crezione della pagina imposto lo stato dei pulsanti
Private Sub PostLoaded() Handles Me.Loaded
If EgtPHOTOLib.MainData.bEnableTextId Then
BlockTxBx.Visibility = Visibility.Collapsed
BlockTxBl.Visibility = Visibility.Collapsed
Else
NbrIdTxBx.IsEnabled = False
End If
PrintBtn.IsEnabled = EgtPHOTOLib.MainData.bEnablePrinter
EnableButtons()
End Sub
#Region "COMMAND"
Private Sub CancelBtn_Click() Handles CacelBtn.Click
' se è stata inserita nel DB allora devo rimuoverla ed esco dalla pagina
EgtPHOTOLib.refOptionPanelVM.Delete()
' notifico che il grezzo è stato rimosso
OmagPhotoWD.m_IsDeleted = True
' notifico che il grezzo non è stato aggiunto al DB delle lastre
OmagPhotoWD.m_IsAdded = False
' elimino l'identificativo usato nel database del grezzo appena inserito
OmagPhotoWD.m_sDtBsId = ""
' esco dalla pagina
m_OmagPhotoWD.Close()
End Sub
Private Sub AddBtn_Click() Handles AddBtn.Click
' se non sono validi i campi allora attendo
If Not EgtPHOTOLib.PhotoMap.refOptionPanelVM.Ok_IsEnabled Then Return
' modalità di funzionamento della libreria: ProjectSlabVM.ProjectModeOpt.NEWSLAB
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Save()
' notifico che il grezzo è stato aggiunto al DB delle lastre
OmagPhotoWD.m_IsAdded = True
' salvo l'identificativo usato nel database del grezzo appena inserito
OmagPhotoWD.m_sDtBsId = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.Id
' salvo il nome del blocco che è stato utilizzato
If Not EgtPHOTOLib.MainData.bEnableTextId Then
WritePrivateProfileString(S_SCRAPS, K_LASTBLOCK, EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.sNameBlock, m_OmagPhotoWD.m_MainWindow.GetIniFile())
End If
' aggiorno il testo del messaggio "Add" → "Save"
AddBtn.Content = "Save"
' notifico che da ora la lastra inserita è in modalità di modifica (non salvo la lastra come nuova, ma la sovrascrivo come in modifica)
EgtPHOTOLib.PhotoMap.refProjectVM.SetSelProjectMode(ProjectSlabVM.ProjectModeOpt.DETAIL)
EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab.SetOrigValues()
' notifico che la lastra è in modifica da questo programma
EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab.IsSelected = EgtPHOTOLib.MainData.nKey
EgtPHOTOLib.PhotoMap.refOptionPanelVM.IsSelected()
End Sub
Private Sub PrintBtn_Click() Handles PrintBtn.Click
EgtPHOTOLib.PhotoMap.refOptionPanelVM.PrintLabel()
End Sub
#End Region ' Command
#Region "METHODS"
Private Sub EnableButtons()
AddBtn.IsEnabled = EgtPHOTOLib.PhotoMap.refOptionPanelVM.Ok_IsEnabled
' se la stampante non è abilitata allora non permetto assolutamente di abilitare il comando
If EgtPHOTOLib.MainData.bEnablePrinter Then
PrintBtn.IsEnabled = EgtPHOTOLib.PhotoMap.refOptionPanelVM.Ok_IsEnabled
End If
End Sub
#End Region ' Methods
End Class
+40
View File
@@ -0,0 +1,40 @@
<Window x:Class="OmagPhotoWD"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:OmagCUT="clr-namespace:OmagCUT"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtPHOTOLib="clr-namespace:EgtPHOTOLib;assembly=EgtPHOTOLib"
FontFamily="{DynamicResource OmagCut_Font}"
Title="OmagPHOTO" Height="700" Width="1250" WindowStyle="None" ResizeMode="NoResize" ShowInTaskbar="False" >
<Border Style="{DynamicResource OmagCut_Border}">
<Grid Name="OptionSLabGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.25*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="0.25*"/>
</Grid.RowDefinitions>
<!-- nel codice mi occupo di riempire la griglia con gli UserControl -->
<Button Name="ExitBtn" Grid.Column="2" Grid.Row="3"
Style="{DynamicResource OmagCut_GradientBlueIconButton}" IsCancel="True">
<Image Source="{DynamicResource XImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<DockPanel Grid.Column="1" Grid.Row="1" Visibility="Hidden">
<!--StatusBar-->
<EgtWPFLib5:StatusBarV DataContext="{StaticResource StatusBarVM}" DockPanel.Dock="Bottom"/>
</DockPanel>
</Grid>
</Border>
</Window>
+171
View File
@@ -0,0 +1,171 @@
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtPHOTOLib
Imports System.IO
Public Class OmagPhotoWD
' Riferimento alla MainWindow
Friend m_MainWindow As MainWindow
Private m_AddToDataBaseUC As AddToDataBaseUC
Private m_StateList As New List(Of EgtWPFLib5.IdNameStruct)
' il contorno dell sfrido è definito a partire dai punti che rappresentano i vertici dello stesso
Private m_ContornScrap As New List(Of Point3d)
' se lo stato della lastra è "2" significa che è già stata inserita nel DB (non devo generare una nuova foto!)
Private m_nState As Integer = 1
' salvo il nome del file *.jpg
Private m_sFileImage As String = String.Empty
' definsce se il slavataggio è andato a buon fine (questa variabile deve esistere anche dopo la chiusura della finestra!)
Public Shared m_IsAdded As Boolean = False
Public Shared m_sDtBsId As String = ""
Public Shared m_bSlabIsSelected As Boolean = False
' definisce se il grezzo è stato eliminato dal DB
Public Shared m_IsDeleted As Boolean = False
Public Sub New(sImage As String, ContornScrap As List(Of Point3d), MnWindow As MainWindow, nState As Integer, DatabaseID As String)
InitializeComponent()
' salvo il riferimento della finestra principale
m_MainWindow = MnWindow
' leggo lo stato dello sfrido per decidere quale modalità di apertuta usare
m_nState = nState
'--------------- CARCICO lastra esistente ---------------
If m_nState = 2 Then
m_bSlabIsSelected = False
' ricerco l'elemento già inserito nel DB
For Each Item As Slab In EgtPHOTOLib.refProjectVM.SlabList
Dim CurrId As String = Item.GetCurrentID.Trim
If Item.GetCurrentID.Trim = DatabaseID.Trim Then
EgtPHOTOLib.refProjectVM.SelSlab = Item
m_bSlabIsSelected = True
Exit For
End If
Next
' se non trovo nessun elemento nel db allora esco
If IsNothing(EgtPHOTOLib.refProjectVM.SelSlab) Then
EgtOutLog("ID is not found in database: " & DatabaseID)
m_bSlabIsSelected = False
Return
End If
' procedo alla visualizzazione della pagina
EgtPHOTOLib.PhotoMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.DETAIL
' carico la lista degli stati letta dalla libreria
For Each Item As EgtWPFLib5.IdNameStruct In EgtPHOTOLib.PhotoMap.refOptionPanelVM.StateList
m_StateList.Add(Item)
Next
' notifico che la lastra è in modifica da questo programma
EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab.IsSelected = EgtPHOTOLib.MainData.nKey
EgtPHOTOLib.PhotoMap.refOptionPanelVM.IsSelected()
' posiziono la finestra
Me.Top = 15
Me.Left = 15
Return
End If
'--------------- DEFINSCO nuova lastra esistente ---------------
' imposto come prima pagina sempre la lista (per inizializzare gli elementi della libreria) → ACCELERARE il processo di creazione di questo oggetto!
EgtPHOTOLib.PhotoMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.NEWSLAB
' imposto il percoso della foto appena generato
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.ImagePath = sImage
' carico la foto come texture
EgtPHOTOLib.PhotoMap.refOptionPanelVM.PostPhoto(sImage, "")
' carico l'elenco dei materiali (non serve...)
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SetMaterialFromDB()
' definisco la lista degli stati
For Each Item As EgtWPFLib5.IdNameStruct In EgtPHOTOLib.PhotoMap.refOptionPanelVM.StateList
m_StateList.Add(Item)
Next
' imposto i dati lastra
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.Thickness = m_MainWindow.m_CurrentProjectPageUC.m_dRawHeight
' carico la lista degli stati letta dalla libreria
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelState = EgtPHOTOLib.PhotoMap.refOptionPanelVM.StateList(0)
' ricorco il materiale corrente nell'elenco dei materiali presenti nel DB (se non presente nell'elenco?)
For Each MaterialItem As String In EgtPHOTOLib.PhotoMap.refOptionPanelVM.MaterialList
If MaterialItem.ToLower = m_MainWindow.m_CurrentMachine.CurrMat.sName.ToLower Then
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.Material = MaterialItem
Exit For
End If
Next
' salvo in locale i punti che arrivano dal progetto
m_ContornScrap = ContornScrap
' avvio la finestra di modifica
Dim m_refImagePrevieV As New EgtPHOTOLib.ImagePreviewV()
' modifico l'immagine e salvo
m_refImagePrevieV.SetContourScraps(m_ContornScrap)
m_refImagePrevieV.Show()
m_refImagePrevieV.SaveImage()
m_refImagePrevieV.Close()
m_bSlabIsSelected = True
' posiziono la finestra
Me.Top = 15
Me.Left = 15
End Sub
' posizionamento degli UserControl all'interno della griglia
Private Sub OmagPhotoWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' definisco nella pagina la posizione dello UserControl e inizializzo le liste
m_AddToDataBaseUC = New AddToDataBaseUC(Me)
m_AddToDataBaseUC.SetValue(Grid.ColumnProperty, 0)
m_AddToDataBaseUC.SetValue(Grid.RowProperty, 1)
m_AddToDataBaseUC.SetValue(Grid.RowSpanProperty, 2)
Me.OptionSLabGrid.Children.Add(m_AddToDataBaseUC)
m_AddToDataBaseUC.StateCmBx.ItemsSource = m_StateList
' recupero la scena dalla libreria e la carico nel finestra
Dim MyScene As New EgtPHOTOLib.SceneHostSlabV(EgtPHOTOLib.PhotoMap.refSceneHostVM)
MyScene.SetValue(Grid.ColumnProperty, 1)
MyScene.SetValue(Grid.ColumnSpanProperty, 2)
MyScene.SetValue(Grid.RowProperty, 1)
Me.OptionSLabGrid.Children.Add(MyScene)
End Sub
' carcio i dati della lastra
Private Sub PostLoaded() Handles Me.Loaded
If Not m_bSlabIsSelected Then
Return
End If
' carico i campi con i dati letti da database
If m_nState = 2 Then
' provo ad eseguire la separazione dei campi
m_sDtBsId = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.Id
m_AddToDataBaseUC.BlockTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.sNameBlock
m_AddToDataBaseUC.NbrIdTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.sNbrID
m_AddToDataBaseUC.StateCmBx.SelectedIndex = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.State
m_AddToDataBaseUC.MatTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.Material
m_AddToDataBaseUC.ThicknessTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.Thickness
m_AddToDataBaseUC.ProjectTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.ProjectAssignedTo
' aggiorno il testo del messaggio "Add" → "Save"
m_AddToDataBaseUC.AddBtn.Content = "Save"
Return
End If
' inizializzo i campi
'm_AddToDataBaseUC.IdTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.Id
m_AddToDataBaseUC.BlockTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.sNameBlock
m_AddToDataBaseUC.NbrIdTxBx.Text = EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.sNbrID
m_AddToDataBaseUC.StateCmBx.SelectedIndex = 0
m_AddToDataBaseUC.MatTxBx.Text = m_MainWindow.m_CurrentMachine.CurrMat.sName
m_AddToDataBaseUC.ThicknessTxBx.Text = LenToString(m_MainWindow.m_CurrentProjectPageUC.m_dRawHeight, 4)
m_AddToDataBaseUC.ProjectTxBx.Text = m_MainWindow.m_CurrentProjectPageUC.GetCurrentProjectName()
' rendo in primo piano la finestra
Me.Activate()
End Sub
Private Sub ExitBtn_Click() Handles ExitBtn.Click
' se esista una lastra corrente, notifico che deve essere deselezionata
If Not IsNothing(EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab) Then
EgtPHOTOLib.PhotoMap.refOptionPanelVM.SelSlab.IsSelected = 0
EgtPHOTOLib.PhotoMap.refOptionPanelVM.IsSelected()
End If
Me.Close()
End Sub
End Class
+97
View File
@@ -492,6 +492,20 @@ Public Class ProjectMgrUC
End If
'------------------- FINE Avvio il Ciclo-Start-------------------------
' ------------------ INIZIO gestione SCRAPS ---------------------------
Dim NewScrapsList As New List(Of Scrap)
' procedo all'aggiornamento della lista degli sfridi
UpDateScrapList(NewScrapsList)
' se esiste almeno uno sfrido da inserire come nuovo grezzo
If NewScrapsList.Count > 0 Then
' apro la finestra con l'elenco degli sfridi
Dim MyScrapsWD As New ScrapsWD(m_MainWindow, Me, NewScrapsList)
MyScrapsWD.ShowDialog()
End If
' ------------------ FINE gestione SCRAPS -----------------------------
' Altrimenti linea di produzione
Else
' Verifico non sia già stato trasmesso
@@ -663,6 +677,32 @@ Public Class ProjectMgrUC
#End If
End Sub
' aggiorno la lista dei grezzi/sfridi
Public Sub UpDateScrapList(ByRef NewScrapsList As List(Of Scrap))
If IsNothing(NewScrapsList) Then
NewScrapsList = New List(Of Scrap)
Else
NewScrapsList.Clear()
End If
' procedo all'aggiornamento della lista degli sfridi
Dim CurrRawId As Integer = EgtGetFirstRawPart()
Dim IsNewScraps As Integer = 0
Dim nCountScrap As Integer = 1
While CurrRawId <> GDB_ID.NULL
If EgtGetInfo(CurrRawId, K_ISNEWSCRAPS, IsNewScraps) Then
If IsNewScraps = 1 Or IsNewScraps = 2 Then
' deve essere aggiunto nel DB delle lastre come nuovo grezzo (l'indice è utilizzato per definire il nome della lastra)
NewScrapsList.Add(New Scrap(CurrRawId, "Scrap_" & nCountScrap.ToString, IsNewScraps))
nCountScrap += 1
' è già stato aggiunto al DB delle lastre come nuovo grezzo
Else
' non è stato definito come nuovo grezzo
End If
End If
CurrRawId = EgtGetNextRawPart(CurrRawId)
End While
End Sub
' ------------------------------------------------ GENERA COMANDI CNC MOVIMENTO ------------------------------------------------
Private Sub ExecuteCommandCNC(ptMid As Point3d, dAngC As Double, dAngB As Double)
@@ -936,3 +976,60 @@ Public Class ProjectMgrUC
End Sub
End Class
Public Class Scrap
Private m_iPictureID As Integer
Private m_sName As String
Private m_IdRaw As Integer
Private m_nState As Integer
Public Property PictureID() As Integer
Get
Return m_iPictureID
End Get
Set(value As Integer)
m_iPictureID = value
End Set
End Property
Public Property Name() As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Public ReadOnly Property IdRaw() As Integer
Get
Return m_IdRaw
End Get
End Property
Public ReadOnly Property nState As Integer
Get
Return m_nState
End Get
End Property
Public ReadOnly Property PictureString() As String
Get
Return "/Resources/ImportPageListBoxImages/" + PictureID.ToString() + ".png"
End Get
End Property
Sub New(IdScrap As Integer, NameScrap As String, State As Integer)
m_IdRaw = IdScrap
m_sName = NameScrap
m_nState = State
' immagine del grezzo
If m_nState = 2 Then
m_iPictureID = 5
Else
m_iPictureID = 4
End If
End Sub
End Class
+50
View File
@@ -0,0 +1,50 @@
<Window x:Class="ScrapsWD"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
FontFamily="{DynamicResource OmagCut_Font}"
Title="Scraps" Height="482.6" Width="226.6" WindowStyle="None" ResizeMode="NoResize" ShowInTaskbar="False" AllowsTransparency="True" Background="Transparent">
<Border Style="{DynamicResource OmagCut_Border}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.5*"/>
</Grid.RowDefinitions>
<Label Name="TitleTxBl" Grid.Column="1" Grid.Row="1" Foreground="White" FontSize="20" VerticalAlignment="Center"/>
<ListBox Name="ScrapsListBox" Grid.Column="1" Grid.Row="2" ItemTemplate="{DynamicResource DataTemplateItem}"
ItemsSource="{Binding ItemList, NotifyOnSourceUpdated=True}"/>
<Grid Grid.Column="1" Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.1*"/>
</Grid.ColumnDefinitions>
<Button Name="OkBtn" Grid.Column="1" Style="{DynamicResource OmagCut_GradientBlueIconButton}" >
<Image Source="{DynamicResource VImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<Button Name="ExitBtn" Grid.Column="3" Style="{DynamicResource OmagCut_GradientBlueIconButton}" IsCancel="True">
<Image Source="{DynamicResource XImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
</Grid>
</Grid>
</Border>
</Window>
+186
View File
@@ -0,0 +1,186 @@
Imports EgtUILib
Imports EgtPHOTOLib
Imports System.IO
Public Class ScrapsWD
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Private m_refProjectMgrUC As ProjectMgrUC
Private m_ScrapList As New List(Of Scrap)
Private m_CurrScrapId As Integer = GDB_ID.NULL
Private m_CurrScrapState As Integer = 2
Private m_sDatabaseId As String = ""
Private Sub Initalized()
' resetto eventuali errori mostrati nella pagina
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
' inserisco il titolo della pagina aperta
TitleTxBl.Content = "Scraps List"
ScrapsListBox.ItemsSource = m_ScrapList
' definzione posizione finetra
Me.Left = 25
Me.Top = 25
End Sub
Public Sub New(Owner As Window, LocalProjectMgrUC As ProjectMgrUC, MyScrapList As List(Of Scrap))
Me.Owner = Owner
InitializeComponent()
m_ScrapList = MyScrapList
m_refProjectMgrUC = LocalProjectMgrUC
Initalized()
End Sub
' visualizzo la fase del pezzo selezionato
Private Sub ScrapListBox_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs) Handles ScrapsListBox.PreviewMouseUp
Dim vItems As Scrap = ScrapsListBox.SelectedItems(0)
' elimino l'utimo selzione
EgtResetMark(m_CurrScrapId)
EgtDeselectObj(m_CurrScrapId)
' ricerco il grezzo associato a questo Id
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
If nRawId = vItems.IdRaw Then
m_CurrScrapId = nRawId
m_CurrScrapState = vItems.nState
If m_CurrScrapState = 2 Then
EgtGetInfo(nRawId, K_DATABASEID, m_sDatabaseId)
Else
m_sDatabaseId = String.Empty
End If
Dim nCurrRawPhase As Integer = 0
' recupero la fase del grezzo corrente
EgtGetInfo(nRawId, "Ph", nCurrRawPhase)
If nCurrRawPhase <> 0 Then
' evidenzio lo sfrido selezionato all'interno della fase
EgtSetCurrPhase(nCurrRawPhase)
EgtSetMark(m_CurrScrapId)
EgtSelectObj(m_CurrScrapId)
EgtDraw()
Return
End If
End If
nRawId = EgtGetNextRawPart(nRawId)
End While
End Sub
Private Sub OkBtn_Click() Handles OkBtn.Click
If m_CurrScrapId = GDB_ID.NULL Then Return
' creo una copia dell'immagine attuale (fotocamera 1)
Dim sImage As String = String.Empty
Dim sInfo As String = String.Empty
GetPrivateProfileString(S_CAMERA, K_CAM_IMAGE, "", sImage, m_MainWindow.GetIniFile())
GetPrivateProfileString(S_CAMERA, K_CAM_INFO, "", sInfo, m_MainWindow.GetIniFile())
' recupero dalla libreria il percoso del database
Dim sPhotoDir As String = String.Empty
EgtPHOTOLib.GetPhotoDir(sPhotoDir)
' recupero l'ora corrente
Dim sDate As String = Date.Now.ToString
sDate = sDate.Replace("/", "_")
sDate = sDate.Replace(" ", "_")
sDate = sDate.Replace(":", "_")
Dim sNewPath As String = sPhotoDir & "\Scrap_" & sDate
Try
File.Copy(sImage, sNewPath & ".jpg", False)
File.Copy(sInfo, sNewPath & ".txt", False)
Catch ex As Exception
EgtOutLog(ex.Message.ToString)
End Try
' se non esiste la classe StatusBar allora provo ad inizializzarla...
If IsNothing(EgtWPFLib5.LibMap.refStatusBarVM) Then
Dim objStatusBarVM As New EgtWPFLib5.StatusBarVM
End If
' salvo il contesto corrente del programma
Dim nCurrentContetxt As Integer = EgtGetCurrentContext()
' costruisco l'elenco ordinato dei punti che reppresentano il contorno del grezzo da salvare
Dim ContornScrapList As New List(Of Point3d)
Dim RefId As New Frame3d
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(m_CurrScrapId, "RawSolid")
EgtGetTextureFrame(nRawSolidId, nRawSolidId, RefId)
Dim nCurveCompoId As Integer = EgtGetFirstNameInGroup(m_CurrScrapId, "RawOutline")
Dim dStart As Double = 0
Dim dEnd As Double = 0
EgtCurveDomain(nCurveCompoId, dStart, dEnd)
Dim ptCurrPoint As Point3d
For dU As Integer = dStart To dEnd - 1
EgtAtParamPoint(nCurveCompoId, dU, m_CurrScrapId, ptCurrPoint)
ptCurrPoint.z = 0
ptCurrPoint.ToLoc(RefId)
ContornScrapList.Add(ptCurrPoint)
Next
MainData.SetPreviousContext(nCurrentContetxt)
'If Not IsNothing(MainData.ContextSTONELib) Or MainData.ContextSTONELib <> 0 Then
'If MainData.ContextSTONELib <> 0 Then
' EgtSetCurrentContext(MainData.ContextSTONELib)
'End If
' inizializzo PojectSlabV pechè si occupa di inizializzare le pagine Detail e Option
Dim MyProjectSlab As New EgtPHOTOLib.ProjectSlabV
' ACCELERARE il processo di creazione di questo oggetto!
MyProjectSlab.DataContext = New EgtPHOTOLib.ProjectSlabVM
' per ogni creazione della nuova pagina viene creata una nuova scena, ma non viene eliminata
Dim refProjectVMSceneContext As Integer = EgtGetCurrentContext()
' apro la finestra OmagPHOTO (passo il nome del file come copia dell'originale)
If ContornScrapList.Count > 2 Then
Dim MyOmagPhotoWD As New OmagPhotoWD(sNewPath & ".jpg", ContornScrapList, m_MainWindow, m_CurrScrapState, m_sDatabaseId)
OmagPhotoWD.m_IsAdded = False
OmagPhotoWD.m_sDtBsId = String.Empty
OmagPhotoWD.m_IsDeleted = False
MyOmagPhotoWD.ShowDialog()
Else
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
m_MainWindow.m_CurrentProjectPageUC.SetErrorMessage("Error loading contour scrap")
End If
' ripristino il contesto corrente dell'immagine
EgtSetCurrentContext(EgtPHOTOLib.MainData.PreviousContext)
' se l'inserimento è andatoa buon fine allora procedo a notificarlo
If OmagPhotoWD.m_IsAdded AndAlso Not String.IsNullOrEmpty(OmagPhotoWD.m_sDtBsId) Then
EgtSetInfo(m_CurrScrapId, K_ISNEWSCRAPS, 2)
EgtSetInfo(m_CurrScrapId, K_DATABASEID, OmagPhotoWD.m_sDtBsId)
Else
' se è stato eliminato dal DB allora aggiorno la lista dei grezzi
If OmagPhotoWD.m_IsDeleted Then
EgtSetInfo(m_CurrScrapId, K_ISNEWSCRAPS, 1)
EgtRemoveInfo(m_CurrScrapId, K_DATABASEID)
End If
Try
File.Delete(sNewPath & ".jpg")
File.Delete(sNewPath & ".txt")
Catch ex As Exception
EgtOutLog(ex.Message.ToString)
End Try
End If
'----------------INIZIO ELIMINAZIONE contesti generati da OmagPHOTOLib per la visualizzazione delle Texture
EgtDeleteContext(EgtPHOTOLib.MainData.ContextSTONELib)
EgtDeleteContext(refProjectVMSceneContext)
'---------------- FINE ELIMINAZIONE contesti
' aggiorno la lista degli scrap
m_refProjectMgrUC.UpDateScrapList(m_ScrapList)
ScrapsListBox.ItemsSource = m_ScrapList
ScrapsListBox.Items.Refresh()
End Sub
Private Sub ExitBtn_Click() Handles ExitBtn.Click
' resetto eventuali errori mostrati nella pagina
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
' deseleziono l'oggetto corrente
EgtResetMark(m_CurrScrapId)
EgtDeselectObj(m_CurrScrapId)
' reimposto la fase iniziale
EgtSetCurrPhase(1)
EgtDraw()
Me.Close()
End Sub
End Class
Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB