Imports System.Net.NetworkInformation Imports NKC_SDK Public Class Form1 ' caricamento del NEXT STACK da redis (come oggetto) ' PROD http : http://seriate.steamware.net:8083/NKC/ ' DEV: https : http://localhost:44388/ Dim baseIp As String = "seriate.steamware.net" Dim baseUrl As String = "http://seriate.steamware.net:8083/NKC/" Dim currNKC As NKC = New NKC(baseIp, baseUrl) Dim currentBunk As ProdBunk = Nothing Dim risultatoPing As PingReply = Nothing Dim srvAlive As Boolean = False Dim srvClock As String = "" Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnReset.Click ' resetto TUTTE le date e salvo il bunk! currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtStart = Nothing currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd = Nothing currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtStart = Nothing currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd = Nothing currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart = Nothing currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd = Nothing ' salvo! currNKC.saveBunk(currentBunk) updateDataButtons() '' invio notifica che c'è una busta da processare 'Dim redKey = $"PROVA:CURR" '' scrivo su REDIS 'memLayer.ML.setRSV(redKey, "ciao " & DateTime.Now.ToString()) ''ComLib.sendMaterials() 'Label1.Text = memLayer.ML.getRSV(redKey) ''Dim x As New Takt ''x = readTakt("PROD", "20190821.1") ''x.StackList(0).PanelsList(0).Printing() ''Dim d = memLayer.ML.connRedis.Configure. ''Dim h = memLayer.ML.connRedis End Sub Private Sub cmbSheet_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbSheet.SelectedIndexChanged ' selezione cambiata su elenco sheet (dal primo all'ultimo a runtime OBBLIGATORIO) updateDataButtons() End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnPrintStart.Click ' iniziato paint x sheet selezionato txtPrintStart.Text = DateTime.Now End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles btnPrintEnd.Click ' completato paint x sheet selezionato txtPrintEnd.Text = DateTime.Now End Sub Private Sub btnNextBunk_Click(sender As Object, e As EventArgs) Handles btnNextBunk.Click ' carico nextBunk Dim bunkId As Integer bunkId = 0 Integer.TryParse(txtCurrBunk.Text, bunkId) '' con com lib diretta... 'Dim nextBunk = ComLib.prodGetNextBunk(bunkId) Dim nextBunk = currNKC.getNextBunk(bunkId) ' mostro risultato... If Not IsNothing(nextBunk) Then lblNextBunk.Text = nextBunk.BunkId Else lblNextBunk.Text = "none" End If End Sub Private Sub btnLoadBunk_Click(sender As Object, e As EventArgs) Handles btnLoadBunk.Click ' recupero BUNK! currentBunk = currNKC.getFirstBunk '' chiamata diretta redis + DB 'Dim getFirstBunk = ComLib.prodGetFirstBunk() ' ho un bunk coi suoi pannelli... If (currentBunk Is Nothing) Then ' non ho un current bunk Label1.Text = "non ho trovato nessun bunk corrente" Else Label1.Text = $"Trovato il bunk {currentBunk.BunkId} costituito da {currentBunk.SheetList.Count} pannelli" ' salvo bunk corrente txtCurrBunk.Text = currentBunk.BunkId ' visualizzo btn nextBunk btnNextBunk.Visible = True lblNextBunk.Visible = True lblNextBunk.Text = "..." ' popolo il selettore dei fogli... cmbSheet.DataSource = currentBunk.SheetList updateDataButtons() End If End Sub Private Sub updateDataButtons() Dim showButtons As Boolean = False ' verifico se il ping è ok... If IsNothing(risultatoPing) Then lblPing.Text = "Effettuare test ping!" Else ' controllo se sia success.. If risultatoPing.Status = IPStatus.Success Then ' ok show showButtons = True ' imposto dateora ed in base ai valori dt del currBunk abilito o meno i buttons... txtPrintStart.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtStart.ToString() txtPrintEnd.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd.ToString() txtWorkStart.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtStart.ToString() txtWorkEnd.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd.ToString() txtUnlStart.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart.ToString() txtUnlEnd.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd.ToString() btnPrintStart.Enabled = String.IsNullOrWhiteSpace(txtPrintStart.Text) btnPrintEnd.Enabled = String.IsNullOrWhiteSpace(txtPrintEnd.Text) btnWorkStart.Enabled = String.IsNullOrWhiteSpace(txtWorkStart.Text) btnWorkEnd.Enabled = String.IsNullOrWhiteSpace(txtWorkEnd.Text) btnUnlStart.Enabled = String.IsNullOrWhiteSpace(txtUnlStart.Text) btnUnlEnd.Enabled = String.IsNullOrWhiteSpace(txtUnlEnd.Text) Else lblPing.Text = "Ping test fallito! " + risultatoPing.Status.ToString() End If End If ' fix buttons btnLoadBunk.Visible = showButtons btnNextBunk.Visible = showButtons btnPrintStart.Visible = showButtons btnPrintEnd.Visible = showButtons btnWorkStart.Visible = showButtons btnWorkEnd.Visible = showButtons btnUnlStart.Visible = showButtons btnUnlEnd.Visible = showButtons End Sub Private Sub btnSaveAll_Click(sender As Object, e As EventArgs) Handles btnSaveAll.Click saveSelection() End Sub Private Sub saveSelection() currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtStart = txtPrintStart.Text currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd = txtPrintEnd.Text currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtStart = txtWorkStart.Text currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd = txtWorkEnd.Text currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart = txtUnlStart.Text currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd = txtUnlEnd.Text ' salvo! currNKC.saveBunk(currentBunk) updateDataButtons() End Sub Private Sub btnWorkStart_Click(sender As Object, e As EventArgs) Handles btnWorkStart.Click txtWorkStart.Text = DateTime.Now End Sub Private Sub btnWorkEnd_Click(sender As Object, e As EventArgs) Handles btnWorkEnd.Click txtWorkEnd.Text = DateTime.Now End Sub Private Sub btnUnlStart_Click(sender As Object, e As EventArgs) Handles btnUnlStart.Click txtUnlStart.Text = DateTime.Now End Sub Private Sub btnUnlEnd_Click(sender As Object, e As EventArgs) Handles btnUnlEnd.Click txtUnlEnd.Text = DateTime.Now End Sub Private Sub btnPing_Click(sender As Object, e As EventArgs) Handles btnPing.Click ' chiamo test ping... risultatoPing = currNKC.testPing lblPing.Text = risultatoPing.Status.ToString() End Sub Private Sub btnAlive_Click(sender As Object, e As EventArgs) Handles btnAlive.Click Dim answ As String = "" If (currNKC.testAlive) Then answ = currNKC.testClock lblAlive.Text = "Server Alive con clock " + answ End If End Sub Private Sub btnPersist_Click(sender As Object, e As EventArgs) Handles btnPersist.Click currNKC.persistedBunk = currentBunk End Sub End Class