Update demo VB x NKC

This commit is contained in:
Samuele E. Locatelli
2020-03-30 18:27:26 +02:00
parent b286d85fdd
commit fd386e95be
3 changed files with 239 additions and 142 deletions
+41 -58
View File
@@ -9,9 +9,10 @@ Public Class Form1
' 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 codPost As String = "WRK001" ' nome macchina
Dim currNKC As NKC = New NKC(baseIp, baseUrl, codPost)
Dim currentBunk As ProdBunk = Nothing
Dim currentSheets As SheetWorkList = Nothing
Dim risultatoPing As PingReply = Nothing
Dim srvAlive As Boolean = False
Dim srvClock As String = ""
@@ -20,15 +21,15 @@ Public Class Form1
' 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
currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtStart = Nothing
currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd = Nothing
currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtStart = Nothing
currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd = Nothing
currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart = Nothing
currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd = Nothing
' salvo!
currNKC.saveBunk(currentBunk)
currNKC.saveSheets(currentSheets)
updateDataButtons()
@@ -65,50 +66,20 @@ Public Class Form1
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
currentSheets = currNKC.getCurrentSheets
'' chiamata diretta redis + DB
'Dim getFirstBunk = ComLib.prodGetFirstBunk()
' ho un bunk coi suoi pannelli...
If (currentBunk Is Nothing) Then
If (currentSheets 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 = "..."
Label1.Text = $"Trovata lista costituita da {currentSheets.SheetList.Count} pannelli"
' popolo il selettore dei fogli...
cmbSheet.DataSource = currentBunk.SheetList
cmbSheet.DataSource = currentSheets.SheetList
updateDataButtons()
End If
@@ -129,12 +100,12 @@ Public Class Form1
' 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()
txtPrintStart.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtStart.ToString()
txtPrintEnd.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd.ToString()
txtWorkStart.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtStart.ToString()
txtWorkEnd.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd.ToString()
txtUnlStart.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart.ToString()
txtUnlEnd.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd.ToString()
btnPrintStart.Enabled = String.IsNullOrWhiteSpace(txtPrintStart.Text)
@@ -153,7 +124,6 @@ Public Class Form1
' fix buttons
btnLoadBunk.Visible = showButtons
btnNextBunk.Visible = showButtons
btnPrintStart.Visible = showButtons
btnPrintEnd.Visible = showButtons
btnWorkStart.Visible = showButtons
@@ -171,15 +141,28 @@ Public Class Form1
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 SOLO SE è != ""
If (Not String.IsNullOrEmpty(txtPrintStart.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtStart = txtPrintStart.Text
End If
If (Not String.IsNullOrEmpty(txtPrintEnd.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd = txtPrintEnd.Text
End If
If (Not String.IsNullOrEmpty(txtWorkStart.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtStart = txtWorkStart.Text
End If
If (Not String.IsNullOrEmpty(txtWorkEnd.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd = txtWorkEnd.Text
End If
If (Not String.IsNullOrEmpty(txtUnlStart.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart = txtUnlStart.Text
End If
If (Not String.IsNullOrEmpty(txtUnlEnd.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd = txtUnlEnd.Text
End If
' salvo!
currNKC.saveBunk(currentBunk)
currNKC.saveSheets(currentSheets)
updateDataButtons()
End Sub
@@ -222,7 +205,7 @@ Public Class Form1
End Sub
Private Sub btnPersist_Click(sender As Object, e As EventArgs) Handles btnPersist.Click
currNKC.persistedBunk = currentBunk
currNKC.persistedSheetList = currentSheets
End Sub
End Class