Files
OmagCUT/Machine/StatisticsPageUC.xaml.vb
T
Demetrio Cassarino 5145accc39 -aggiornato messggi
2025-07-14 08:41:49 +02:00

114 lines
6.1 KiB
VB.net

Imports EgtUILib
Public Class StatisticsPageUC
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Private Sub StatisticsPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' Imposto i messaggi letti dal file dei messaggi
DayProductionGpBx.Header = EgtMsg(91071) ' Produzione del giorno
DayPartsTxBl.Text = EgtMsg(91074) ' Area Pezzi
DayCutsTxBl.Text = EgtMsg(91075) ' Area Tagli
DayProductionResetBtn.Content = EgtMsg(91078) ' Reset
WeekProductionGpBx.Header = EgtMsg(91072) ' Produzione della settimana
WeekPartsTxBl.Text = EgtMsg(91074) ' Area Pezzi
WeekCutsTxBl.Text = EgtMsg(91075) ' Area Tagli
WeekProductionResetBtn.Content = EgtMsg(91078) ' Reset
ProjectProductionGpBx.Header = EgtMsg(91073) ' Progetto
ProjectPartsTxBl.Text = EgtMsg(91074) ' Area Pezzi
ProjectCutsTxBl.Text = EgtMsg(91079) ' Area da Tagliare
End Sub
Private Sub StatisticsPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
' Unità di misura
Dim dCoeff As Double = GetCoeff()
Dim sUnit As String = GetUnits()
' Leggo il giorno
Dim sDay As String = String.Empty
GetPrivateProfileString(S_STATDATA, K_SD_DAY, "---", sDay, m_MainWindow.GetIniFile())
DayTxBl.Text = sDay
' Leggo il numero della settimana
Dim nWeek As Integer = GetPrivateProfileInt(S_STATDATA, K_SD_WEEK, -1, m_MainWindow.GetIniFile())
WeekTxBl.Text = (nWeek).ToString()
' Leggo area pezzi del giorno
Dim dDayParts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_DAYPARTS, 0, m_MainWindow.GetIniFile())
Dim dDayResetParts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_DAYRESETPARTS, 0, m_MainWindow.GetIniFile())
DayPartsTxBx.Text = DoubleToString( ( dDayParts - dDayResetParts) * dCoeff, 3) & sUnit
' Leggo area tagli del giorno
Dim dDayCuts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_DAYCUTS, 0, m_MainWindow.GetIniFile())
Dim dDayResetCuts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_DAYRESETCUTS, 0, m_MainWindow.GetIniFile())
DayCutsTxBx.Text = DoubleToString( ( dDayCuts - dDayResetCuts) * dCoeff, 3) & sUnit
' Leggo area pezzi della settimana
Dim dWeekParts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_WEEKPARTS, 0, m_MainWindow.GetIniFile())
Dim dWeekResetParts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_WEEKRESETPARTS, 0, m_MainWindow.GetIniFile())
WeekPartsTxBx.Text = DoubleToString( ( dWeekParts - dWeekResetParts) * dCoeff, 3) & sUnit
' Leggo area tagli della settimana
Dim dWeekCuts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_WEEKCUTS, 0, m_MainWindow.GetIniFile())
Dim dWeekResetCuts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_WEEKRESETCUTS, 0, m_MainWindow.GetIniFile())
WeekCutsTxBx.Text = DoubleToString( ( dWeekCuts - dWeekResetCuts) * dCoeff, 3) & sUnit
' Recupero il nome del progetto
Dim sName As String = m_MainWindow.m_CurrentProjectPageUC.GetCurrentProjectName()
ProjectTxBl.Text = sName
' Recupero area pezzi del progetto
Dim dTotArea As Double = m_MainWindow.m_CurrentProjectPageUC.GetTotalArea()
ProjectPartsTxBx.Text = DoubleToString(dTotArea * dCoeff, 3) & sUnit
' Recupero area tagli del progetto
Dim dToProdArea As Double = m_MainWindow.m_CurrentProjectPageUC.GetToProduceArea()
ProjectCutsTxBx.Text = DoubleToString(dToProdArea * dCoeff, 3) & sUnit
End Sub
Private Sub DayProductionResetBtn_Click(sender As Object, e As RoutedEventArgs) Handles DayProductionResetBtn.Click
' Unità di misura
Dim dCoeff As Double = GetCoeff()
Dim sUnit As String = GetUnits()
' Leggo l'attuale area pezzi del giorno e la scrivo nel corrispondente valore di reset
Dim dDayResetParts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_DAYPARTS, 0, m_MainWindow.GetIniFile())
WritePrivateProfileString(S_STATDATA, K_SD_DAYRESETPARTS, dDayResetParts, m_MainWindow.GetIniFile())
' Aggiorno area pezzi del giorno
DayPartsTxBx.Text = DoubleToString( 0 * dCoeff, 3) & sUnit
' Leggo l'attuale area tagli del giorno e la scrivo nel corrispondente valore di reset
Dim dDayResetCuts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_DAYCUTS, 0, m_MainWindow.GetIniFile())
WritePrivateProfileString(S_STATDATA, K_SD_DAYRESETCUTS, dDayResetCuts, m_MainWindow.GetIniFile())
' Aggiorno area tagli del giorno
DayCutsTxBx.Text = DoubleToString( 0 * dCoeff, 3) & sUnit
End Sub
Private Sub WeekProductionResetBtn_Click(sender As Object, e As RoutedEventArgs) Handles WeekProductionResetBtn.Click
' Unità di misura
Dim dCoeff As Double = GetCoeff()
Dim sUnit As String = GetUnits()
' Leggo l'attuale area pezzi della settimana e la scrivo nel corrispondente valore di reset
Dim dWeekResetParts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_WEEKPARTS, 0, m_MainWindow.GetIniFile())
WritePrivateProfileString(S_STATDATA, K_SD_WEEKRESETPARTS, dWeekResetParts, m_MainWindow.GetIniFile())
' Aggiorno area pezzi della settimana
WeekPartsTxBx.Text = DoubleToString( 0 * dCoeff, 3) & sUnit
' Leggo l'attuale area tagli della settimana e la scrivo nel corrispondente valore di reset
Dim dWeekResetCuts As Double = GetPrivateProfileDouble(S_STATDATA, K_SD_WEEKCUTS, 0, m_MainWindow.GetIniFile())
WritePrivateProfileString(S_STATDATA, K_SD_WEEKRESETCUTS, dWeekResetCuts, m_MainWindow.GetIniFile())
' Aggiorno area tagli della settimana
WeekCutsTxBx.Text = DoubleToString( 0 * dCoeff, 3) & sUnit
End Sub
Private Function GetCoeff() As Double
Return If( EgtUiUnitsAreMM(), 1.0 / 1000000.0, 1.0 / (12 * ONEINCH * 12 * ONEINCH))
End Function
Private Function GetUnits() As String
Return If( EgtUiUnitsAreMM(), "", " ft²")
End Function
End Class