Files
NKC/RedisExample/Form1.vb
T
Samuele E. Locatelli 83dfb79888 Aggiunto dummy project
2019-11-11 13:55:57 +01:00

150 lines
5.3 KiB
VB.net

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 baseUrl As String = "http://seriate.steamware.net:8083/NKC/"
Dim currNKC As NKC = New NKC(baseUrl)
Dim currentBunk As ProdBunk = Nothing
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
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles btnPrintEnd.Click
' completato paint x sheet selezionato
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()
' 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)
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
End Class